[13/17] net/bnxt: add more checks for fw reset

Message ID 20191024074432.30705-14-somnath.kotur@broadcom.com (mailing list archive)
State Accepted, archived
Delegated to: Ajit Khaparde
Headers
Series bnxt patchset with bug fixes |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Somnath Kotur Oct. 24, 2019, 7:44 a.m. UTC
  From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Added check for fw reset or fw errors in few more routines.
While processing the events, if it is fw fatal or non-fatal
event, there is no need to process the remaining events as
driver triggers recovery mechanism.

Also added a check for fw reset or fatal error in bnxt_disable_int()
to avoid bar access in case of fatal error.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_irq.c | 8 ++++++++
 drivers/net/bnxt/bnxt_rxr.c | 3 +++
 2 files changed, 11 insertions(+)
  

Patch

diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c
index 4feb637..846325e 100644
--- a/drivers/net/bnxt/bnxt_irq.c
+++ b/drivers/net/bnxt/bnxt_irq.c
@@ -37,6 +37,11 @@  void bnxt_int_handler(void *param)
 			return;
 		}
 
+		if (is_bnxt_in_error(bp)) {
+			pthread_mutex_unlock(&bp->def_cp_lock);
+			return;
+		}
+
 		cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
 		cmp = &cpr->cp_desc_ring[cons];
 
@@ -104,6 +109,9 @@  void bnxt_disable_int(struct bnxt *bp)
 	if (BNXT_NUM_ASYNC_CPR(bp) == 0)
 		return;
 
+	if (is_bnxt_in_error(bp))
+		return;
+
 	if (!cpr || !cpr->cp_db.doorbell)
 		return;
 
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 03dae57..ee1444c 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -639,6 +639,9 @@  uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			evt =
 			bnxt_event_hwrm_resp_handler(rxq->bp,
 						     (struct cmpl_base *)rxcmp);
+			/* If the async event is Fatal error, return */
+			if (unlikely(is_bnxt_in_error(rxq->bp)))
+				goto done;
 		}
 
 		raw_cons = NEXT_RAW_CMP(raw_cons);