diff options
author | Iwona Winiarska <iwona.winiarska@intel.com> | 2021-12-09 01:30:16 +0300 |
---|---|---|
committer | Iwona Winiarska <iwona.winiarska@intel.com> | 2021-12-15 14:10:54 +0300 |
commit | d4457cf3ab689cd9b1848a9e96fd1a8a60b743e5 (patch) | |
tree | 27bc98b3d237ac9350b72fc8f409946b68d859f9 /drivers/peci | |
parent | b4fb3e2e3e4b4666ad3f05817e387c11688f6632 (diff) | |
download | linux-d4457cf3ab689cd9b1848a9e96fd1a8a60b743e5.tar.xz |
peci: mctp: Add packet dump
Currently, there is no way to view PECI over MCTP transmit or receive
data. To simplify peci-mctp debugging, let's add debug level logging for
tx and rx packets.
Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
Change-Id: Ia746ae72f37c06e9a2647b4568e9aa6c5be76f76
Diffstat (limited to 'drivers/peci')
-rw-r--r-- | drivers/peci/busses/peci-mctp.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/peci/busses/peci-mctp.c b/drivers/peci/busses/peci-mctp.c index ac22e4e40049..e2d7c4dcc4e5 100644 --- a/drivers/peci/busses/peci-mctp.c +++ b/drivers/peci/busses/peci-mctp.c @@ -8,6 +8,8 @@ #include <linux/platform_device.h> #define PCIE_SET_DATA_LEN(x, val) ((x)->len_lo |= (val)) +#define PCIE_GET_DATA_LEN(x) ((x)->len_lo) +#define PCIE_GET_PAD_LEN(x) (((x)->tag >> 4) & 0x3) #define PCIE_SET_TARGET_ID(x, val) ((x)->target |= (swab16(val))) #define PCIE_PKT_ALIGN(x) ALIGN(x, sizeof(u32)) #define PCIE_GET_REQUESTER_ID(x) (swab16((x)->requester)) @@ -182,6 +184,8 @@ mctp_peci_send_receive(struct peci_adapter *adapter, struct node_cfg *cpu, u8 tag = priv->tag; struct mctp_pcie_packet *tx_packet, *rx_packet; unsigned long current_time, end_time; + struct pcie_transport_hdr *pcie_hdr; + u32 payload_len, rx_packet_size; int ret; tx_packet = aspeed_mctp_packet_alloc(GFP_KERNEL); @@ -192,6 +196,8 @@ mctp_peci_send_receive(struct peci_adapter *adapter, struct node_cfg *cpu, aspeed_mctp_flush_rx_queue(priv->peci_client); + print_hex_dump_bytes("TX : ", DUMP_PREFIX_NONE, &tx_packet->data, tx_packet->size); + ret = aspeed_mctp_send_packet(priv->peci_client, tx_packet); if (ret) { dev_dbg_ratelimited(priv->dev, "failed to send mctp packet: %d\n", ret); @@ -220,6 +226,11 @@ retry: goto retry; } + pcie_hdr = (struct pcie_transport_hdr *)rx_packet; + payload_len = PCIE_GET_DATA_LEN(pcie_hdr) * sizeof(u32) - PCIE_GET_PAD_LEN(pcie_hdr); + rx_packet_size = payload_len + PCIE_VDM_HDR_SIZE; + print_hex_dump_bytes("RX : ", DUMP_PREFIX_NONE, &rx_packet->data, rx_packet_size); + return rx_packet; } |