netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] cxgb4: fix dump collection when firmware crashed
@ 2018-01-26 11:35 Rahul Lakkireddy
  2018-01-26 11:35 ` [PATCH net-next 1/3] cxgb4: reset FW_OK flag on firmware crash Rahul Lakkireddy
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Rahul Lakkireddy @ 2018-01-26 11:35 UTC (permalink / raw)
  To: netdev; +Cc: davem, ganeshgr, nirranjan, indranil, Rahul Lakkireddy

Patch 1 resets FW_OK flag, if firmware reports error.

Patch 2 fixes incorrect condition for using firmware LDST commands.

Patch 3 fixes dump collection logic to use backdoor register
access to collect dumps when firmware is crashed.

Thanks,
Rahul

Rahul Lakkireddy (3):
  cxgb4: reset FW_OK flag on firmware crash
  cxgb4: fix incorrect condition for using firmware LDST commands
  cxgb4: use backdoor access to collect dumps when firmware crashed

 drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c | 51 +++++++++++++++++++-------
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c     |  6 ++-
 2 files changed, 42 insertions(+), 15 deletions(-)

-- 
2.14.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 1/3] cxgb4: reset FW_OK flag on firmware crash
  2018-01-26 11:35 [PATCH net-next 0/3] cxgb4: fix dump collection when firmware crashed Rahul Lakkireddy
@ 2018-01-26 11:35 ` Rahul Lakkireddy
  2018-01-26 11:35 ` [PATCH net-next 2/3] cxgb4: fix incorrect condition for using firmware LDST commands Rahul Lakkireddy
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Rahul Lakkireddy @ 2018-01-26 11:35 UTC (permalink / raw)
  To: netdev; +Cc: davem, ganeshgr, nirranjan, indranil, Rahul Lakkireddy

If firmware reports error, reset FW_OK flag.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index af27d2b0f79f..be795d0b0b7e 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -195,9 +195,11 @@ static void t4_report_fw_error(struct adapter *adap)
 	u32 pcie_fw;
 
 	pcie_fw = t4_read_reg(adap, PCIE_FW_A);
-	if (pcie_fw & PCIE_FW_ERR_F)
+	if (pcie_fw & PCIE_FW_ERR_F) {
 		dev_err(adap->pdev_dev, "Firmware reports adapter error: %s\n",
 			reason[PCIE_FW_EVAL_G(pcie_fw)]);
+		adap->flags &= ~FW_OK;
+	}
 }
 
 /*
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/3] cxgb4: fix incorrect condition for using firmware LDST commands
  2018-01-26 11:35 [PATCH net-next 0/3] cxgb4: fix dump collection when firmware crashed Rahul Lakkireddy
  2018-01-26 11:35 ` [PATCH net-next 1/3] cxgb4: reset FW_OK flag on firmware crash Rahul Lakkireddy
@ 2018-01-26 11:35 ` Rahul Lakkireddy
  2018-01-26 11:35 ` [PATCH net-next 3/3] cxgb4: use backdoor access to collect dumps when firmware crashed Rahul Lakkireddy
  2018-01-26 16:02 ` [PATCH net-next 0/3] cxgb4: fix dump collection " David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Rahul Lakkireddy @ 2018-01-26 11:35 UTC (permalink / raw)
  To: netdev; +Cc: davem, ganeshgr, nirranjan, indranil, Rahul Lakkireddy

Only contact firmware if it's alive _AND_ if use_bd (use backdoor
access) is not set when issuing FW_LDST_CMD.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index be795d0b0b7e..047609ef0515 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -5090,7 +5090,7 @@ int t4_read_rss(struct adapter *adapter, u16 *map)
 
 static unsigned int t4_use_ldst(struct adapter *adap)
 {
-	return (adap->flags & FW_OK) || !adap->use_bd;
+	return (adap->flags & FW_OK) && !adap->use_bd;
 }
 
 /**
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 3/3] cxgb4: use backdoor access to collect dumps when firmware crashed
  2018-01-26 11:35 [PATCH net-next 0/3] cxgb4: fix dump collection when firmware crashed Rahul Lakkireddy
  2018-01-26 11:35 ` [PATCH net-next 1/3] cxgb4: reset FW_OK flag on firmware crash Rahul Lakkireddy
  2018-01-26 11:35 ` [PATCH net-next 2/3] cxgb4: fix incorrect condition for using firmware LDST commands Rahul Lakkireddy
@ 2018-01-26 11:35 ` Rahul Lakkireddy
  2018-01-26 16:02 ` [PATCH net-next 0/3] cxgb4: fix dump collection " David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Rahul Lakkireddy @ 2018-01-26 11:35 UTC (permalink / raw)
  To: netdev; +Cc: davem, ganeshgr, nirranjan, indranil, Rahul Lakkireddy

Fallback to backdoor register access to collect dumps if firmware
is crashed.  Fixes TID, SGE Queue Context, and MPS TCAM dump collection.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c | 51 +++++++++++++++++++-------
 1 file changed, 38 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
index 8b95117c2923..557fd8bfd54e 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
@@ -1567,6 +1567,12 @@ int cudbg_collect_tid(struct cudbg_init *pdbg_init,
 	tid1->ver_hdr.size = sizeof(struct cudbg_tid_info_region_rev1) -
 			     sizeof(struct cudbg_ver_hdr);
 
+	/* If firmware is not attached/alive, use backdoor register
+	 * access to collect dump.
+	 */
+	if (!is_fw_attached(pdbg_init))
+		goto fill_tid;
+
 #define FW_PARAM_PFVF_A(param) \
 	(FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_PFVF) | \
 	 FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_PFVF_##param) | \
@@ -1604,6 +1610,9 @@ int cudbg_collect_tid(struct cudbg_init *pdbg_init,
 		tid->nhpftids = val[1] - val[0] + 1;
 	}
 
+#undef FW_PARAM_PFVF_A
+
+fill_tid:
 	tid->ntids = padap->tids.ntids;
 	tid->nstids = padap->tids.nstids;
 	tid->stid_base = padap->tids.stid_base;
@@ -1623,8 +1632,6 @@ int cudbg_collect_tid(struct cudbg_init *pdbg_init,
 	tid->ip_users = t4_read_reg(padap, LE_DB_ACT_CNT_IPV4_A);
 	tid->ipv6_users = t4_read_reg(padap, LE_DB_ACT_CNT_IPV6_A);
 
-#undef FW_PARAM_PFVF_A
-
 	return cudbg_write_and_release_buff(pdbg_init, &temp_buff, dbg_buff);
 }
 
@@ -1866,11 +1873,18 @@ int cudbg_collect_dump_context(struct cudbg_init *pdbg_init,
 		max_ctx_size = region_info[i].end - region_info[i].start + 1;
 		max_ctx_qid = max_ctx_size / SGE_CTXT_SIZE;
 
-		t4_sge_ctxt_flush(padap, padap->mbox, i);
-		rc = t4_memory_rw(padap, MEMWIN_NIC, mem_type[i],
-				  region_info[i].start, max_ctx_size,
-				  (__be32 *)ctx_buf, 1);
-		if (rc) {
+		/* If firmware is not attached/alive, use backdoor register
+		 * access to collect dump.
+		 */
+		if (is_fw_attached(pdbg_init)) {
+			t4_sge_ctxt_flush(padap, padap->mbox, i);
+
+			rc = t4_memory_rw(padap, MEMWIN_NIC, mem_type[i],
+					  region_info[i].start, max_ctx_size,
+					  (__be32 *)ctx_buf, 1);
+		}
+
+		if (rc || !is_fw_attached(pdbg_init)) {
 			max_ctx_qid = CUDBG_LOWMEM_MAX_CTXT_QIDS;
 			cudbg_get_sge_ctxt_fw(pdbg_init, max_ctx_qid, i,
 					      &buff);
@@ -1946,9 +1960,10 @@ static void cudbg_mps_rpl_backdoor(struct adapter *padap,
 	mps_rplc->rplc31_0 = htonl(t4_read_reg(padap, MPS_VF_RPLCT_MAP0_A));
 }
 
-static int cudbg_collect_tcam_index(struct adapter *padap,
+static int cudbg_collect_tcam_index(struct cudbg_init *pdbg_init,
 				    struct cudbg_mps_tcam *tcam, u32 idx)
 {
+	struct adapter *padap = pdbg_init->adap;
 	u64 tcamy, tcamx, val;
 	u32 ctl, data2;
 	int rc = 0;
@@ -2033,12 +2048,22 @@ static int cudbg_collect_tcam_index(struct adapter *padap,
 			htons(FW_LDST_CMD_FID_V(FW_LDST_MPS_RPLC) |
 			      FW_LDST_CMD_IDX_V(idx));
 
-		rc = t4_wr_mbox(padap, padap->mbox, &ldst_cmd, sizeof(ldst_cmd),
-				&ldst_cmd);
-		if (rc)
+		/* If firmware is not attached/alive, use backdoor register
+		 * access to collect dump.
+		 */
+		if (is_fw_attached(pdbg_init))
+			rc = t4_wr_mbox(padap, padap->mbox, &ldst_cmd,
+					sizeof(ldst_cmd), &ldst_cmd);
+
+		if (rc || !is_fw_attached(pdbg_init)) {
 			cudbg_mps_rpl_backdoor(padap, &mps_rplc);
-		else
+			/* Ignore error since we collected directly from
+			 * reading registers.
+			 */
+			rc = 0;
+		} else {
 			mps_rplc = ldst_cmd.u.mps.rplc;
+		}
 
 		tcam->rplc[0] = ntohl(mps_rplc.rplc31_0);
 		tcam->rplc[1] = ntohl(mps_rplc.rplc63_32);
@@ -2075,7 +2100,7 @@ int cudbg_collect_mps_tcam(struct cudbg_init *pdbg_init,
 
 	tcam = (struct cudbg_mps_tcam *)temp_buff.data;
 	for (i = 0; i < n; i++) {
-		rc = cudbg_collect_tcam_index(padap, tcam, i);
+		rc = cudbg_collect_tcam_index(pdbg_init, tcam, i);
 		if (rc) {
 			cudbg_err->sys_err = rc;
 			cudbg_put_buff(pdbg_init, &temp_buff);
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 0/3] cxgb4: fix dump collection when firmware crashed
  2018-01-26 11:35 [PATCH net-next 0/3] cxgb4: fix dump collection when firmware crashed Rahul Lakkireddy
                   ` (2 preceding siblings ...)
  2018-01-26 11:35 ` [PATCH net-next 3/3] cxgb4: use backdoor access to collect dumps when firmware crashed Rahul Lakkireddy
@ 2018-01-26 16:02 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2018-01-26 16:02 UTC (permalink / raw)
  To: rahul.lakkireddy; +Cc: netdev, ganeshgr, nirranjan, indranil

From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Date: Fri, 26 Jan 2018 17:05:53 +0530

> Patch 1 resets FW_OK flag, if firmware reports error.
> 
> Patch 2 fixes incorrect condition for using firmware LDST commands.
> 
> Patch 3 fixes dump collection logic to use backdoor register
> access to collect dumps when firmware is crashed.

Series applied, thank you.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-26 16:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-26 11:35 [PATCH net-next 0/3] cxgb4: fix dump collection when firmware crashed Rahul Lakkireddy
2018-01-26 11:35 ` [PATCH net-next 1/3] cxgb4: reset FW_OK flag on firmware crash Rahul Lakkireddy
2018-01-26 11:35 ` [PATCH net-next 2/3] cxgb4: fix incorrect condition for using firmware LDST commands Rahul Lakkireddy
2018-01-26 11:35 ` [PATCH net-next 3/3] cxgb4: use backdoor access to collect dumps when firmware crashed Rahul Lakkireddy
2018-01-26 16:02 ` [PATCH net-next 0/3] cxgb4: fix dump collection " David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).