Add the cmd_err and opaque_0 and opaque_1 fields to HWRM error
messages.  These allow better debugging of some classes of HWRM
errors.

Signed-off-by: Stephen Hurd <stephen.h...@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khapa...@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c           | 19 ++++++++++++++++--
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 36 ++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index bea855e..b6fff91 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -137,7 +137,7 @@ static int bnxt_hwrm_send_message_locked(struct bnxt *bp, 
void *msg,
        }
 
        if (i >= HWRM_CMD_TIMEOUT) {
-               RTE_LOG(ERR, PMD, "Error sending msg %x\n",
+               RTE_LOG(ERR, PMD, "Error sending msg 0x%04x\n",
                        req->req_type);
                goto err_ret;
        }
@@ -174,7 +174,22 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void 
*msg, uint32_t msg_len)
                } \
                if (resp->error_code) { \
                        rc = rte_le_to_cpu_16(resp->error_code); \
-                       RTE_LOG(ERR, PMD, "%s error %d\n", __func__, rc); \
+                       if (resp->resp_len >= 16) { \
+                               struct hwrm_err_output *tmp_hwrm_err_op = \
+                                                       (void *)resp; \
+                               RTE_LOG(ERR, PMD, \
+                                       "%s error %d:%d:%08x:%04x\n", \
+                                       __func__, \
+                                       rc, tmp_hwrm_err_op->cmd_err, \
+                                       rte_le_to_cpu_32(\
+                                               tmp_hwrm_err_op->opaque_0), \
+                                       rte_le_to_cpu_16(\
+                                               tmp_hwrm_err_op->opaque_1)); \
+                       } \
+                       else { \
+                               RTE_LOG(ERR, PMD, \
+                                       "%s error %d\n", __func__, rc); \
+                       } \
                        return rc; \
                } \
        }
diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h 
b/drivers/net/bnxt/hsi_struct_def_dpdk.h
index 987ff53..84c53d7 100644
--- a/drivers/net/bnxt/hsi_struct_def_dpdk.h
+++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h
@@ -8569,6 +8569,42 @@ struct hwrm_stat_ctx_clr_stats_output {
         */
 } __attribute__((packed));
 
+struct hwrm_err_output {
+       uint16_t error_code;
+       /*
+        * Pass/Fail or error type Note: receiver to verify the in
+        * parameters, and fail the call with an error when appropriate
+        */
+       uint16_t req_type;
+       /* This field returns the type of original request. */
+       uint16_t seq_id;
+       /* This field provides original sequence number of the command. */
+       uint16_t resp_len;
+       /*
+        * This field is the length of the response in bytes. The last
+        * byte of the response is a valid flag that will read as '1'
+        * when the command has been completely written to memory.
+        */
+       uint32_t opaque_0;
+       /* debug info for this error response. */
+       uint16_t opaque_1;
+       /* debug info for this error response. */
+       uint8_t cmd_err;
+       /*
+        * In the case of an error response, command specific error code
+        * is returned in this field.
+        */
+       uint8_t valid;
+       /*
+        * This field is used in Output records to indicate that the
+        * output is completely written to RAM. This field should be
+        * read as '1' to indicate that the output has been completely
+        * written. When writing a command completion or response to an
+        * internal processor, the order of writes has to be such that
+        * this field is written last.
+        */
+} __attribute__((packed));
+
 /* Port Tx Statistics Formats  (408 bytes) */
 struct tx_port_stats {
        uint64_t tx_64b_frames;
-- 
2.10.1 (Apple Git-78)

Reply via email to