bnxt_en: Add support for a new ethtool dump flag 3
authorVasuthevan Maheswaran <vasuthevan.maheswaran@broadcom.com>
Mon, 10 Mar 2025 18:31:23 +0000 (11:31 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 18 Mar 2025 09:25:21 +0000 (10:25 +0100)
When doing a live coredump with ethtool -w, the context data cached
in the NIC is not dumped by the FW by default.  The reason is that
retrieving this cached context data with traffic running may cause
problems.  Add a new dump flag 3 to allow the option to include this
cached context data which may be useful in some debug scenarios.

Reviewed-by: Hongguang Gao <hongguang.gao@broadcom.com>
Reviewed-by: Selvin Xavier <selvin.xavier@broadcom.com>
Reviewed-by: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>
Signed-off-by: Vasuthevan Maheswaran <vasuthevan.maheswaran@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20250310183129.3154117-2-michael.chan@broadcom.com
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.c
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

index e85b5ce94f5879cbcffbfc6fa8c910dd596fe249..e93ba0e4f0878848f2234ed944ec9a6897f31a5c 100644 (file)
@@ -2697,6 +2697,7 @@ struct bnxt {
 #define BNXT_DUMP_LIVE         0
 #define BNXT_DUMP_CRASH                1
 #define BNXT_DUMP_DRIVER       2
+#define BNXT_DUMP_LIVE_WITH_CTX_L1_CACHE       3
 
        struct bpf_prog         *xdp_prog;
 
index 7236d8e548ab5d1974c3f56fc0b3837f20e95741..5576e7cf8463176c6350f3cf30d210dbd2a1b79c 100644 (file)
@@ -159,8 +159,8 @@ static int bnxt_hwrm_dbg_coredump_list(struct bnxt *bp,
        return rc;
 }
 
-static int bnxt_hwrm_dbg_coredump_initiate(struct bnxt *bp, u16 component_id,
-                                          u16 segment_id)
+static int bnxt_hwrm_dbg_coredump_initiate(struct bnxt *bp, u16 dump_type,
+                                          u16 component_id, u16 segment_id)
 {
        struct hwrm_dbg_coredump_initiate_input *req;
        int rc;
@@ -172,6 +172,8 @@ static int bnxt_hwrm_dbg_coredump_initiate(struct bnxt *bp, u16 component_id,
        hwrm_req_timeout(bp, req, bp->hwrm_cmd_max_timeout);
        req->component_id = cpu_to_le16(component_id);
        req->segment_id = cpu_to_le16(segment_id);
+       if (dump_type == BNXT_DUMP_LIVE_WITH_CTX_L1_CACHE)
+               req->seg_flags = DBG_COREDUMP_INITIATE_REQ_SEG_FLAGS_COLLECT_CTX_L1_CACHE;
 
        return hwrm_req_send(bp, req);
 }
@@ -450,7 +452,8 @@ static int __bnxt_get_coredump(struct bnxt *bp, u16 dump_type, void *buf,
 
                start = jiffies;
 
-               rc = bnxt_hwrm_dbg_coredump_initiate(bp, comp_id, seg_id);
+               rc = bnxt_hwrm_dbg_coredump_initiate(bp, dump_type, comp_id,
+                                                    seg_id);
                if (rc) {
                        netdev_err(bp->dev,
                                   "Failed to initiate coredump for seg = %d\n",
index 9c582083951448faa0691af038c21c9518bbe767..e031340bdce2725b12b56122c48becb651b2de58 100644 (file)
@@ -5077,8 +5077,9 @@ static int bnxt_set_dump(struct net_device *dev, struct ethtool_dump *dump)
 {
        struct bnxt *bp = netdev_priv(dev);
 
-       if (dump->flag > BNXT_DUMP_DRIVER) {
-               netdev_info(dev, "Supports only Live(0), Crash(1), Driver(2) dumps.\n");
+       if (dump->flag > BNXT_DUMP_LIVE_WITH_CTX_L1_CACHE) {
+               netdev_info(dev,
+                           "Supports only Live(0), Crash(1), Driver(2), Live with cached context(3) dumps.\n");
                return -EINVAL;
        }