DPDK patches and discussions
 help / color / mirror / Atom feed
From: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
To: dev@dpdk.org
Cc: Kishore Padmanabha <kishore.padmanabha@broadcom.com>,
	Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Subject: [PATCH 4/4] net/bnxt: fix ULP context list deadlock
Date: Tue, 16 Nov 2021 18:34:37 +0530	[thread overview]
Message-ID: <20211116130437.2022-5-venkatkumar.duvvuru@broadcom.com> (raw)
In-Reply-To: <20211116130437.2022-1-venkatkumar.duvvuru@broadcom.com>

From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>

The ulp context list was not updated when high availability
feature was deinitialized. This caused the ulp context list
to acquire the lock when it is not supposed to causing the
deadlock. The fix is to correctly clear the list.

Fixes: 3184b1ef666a ("net/bnxt: add HA support in ULP")
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Michael Baucom <michael.baucom@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c   | 7 ++++---
 drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c | 8 ++++----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
index b1b8679aa6..1ee21fceef 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
@@ -1546,9 +1546,6 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 	BNXT_TF_DBG(DEBUG, "BNXT Port:%d ULP port deinit\n",
 		    bp->eth_dev->data->port_id);
 
-	/* Free the ulp context in the context entry list */
-	bnxt_ulp_cntxt_list_del(bp->ulp_ctx);
-
 	/* Get the session details  */
 	pci_dev = RTE_DEV_TO_PCI(bp->eth_dev->device);
 	pci_addr = &pci_dev->addr;
@@ -1587,6 +1584,9 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 		}
 	}
 
+	/* Free the ulp context in the context entry list */
+	bnxt_ulp_cntxt_list_del(bp->ulp_ctx);
+
 	/* clean up the session */
 	ulp_session_deinit(session);
 
@@ -2062,6 +2062,7 @@ bnxt_ulp_cntxt_entry_acquire(void *arg)
 		TAILQ_FOREACH(entry, &ulp_cntx_list, next)
 			if (entry->ulp_ctx->cfg_data == arg)
 				return entry->ulp_ctx;
+		rte_spinlock_unlock(&bnxt_ulp_ctxt_lock);
 	}
 	return NULL;
 }
diff --git a/drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c
index 1325986aba..0030a487f5 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c
@@ -26,7 +26,7 @@
 #define ULP_HA_IF_TBL_IDX 10
 #define ULP_HA_CLIENT_CNT_IF_TBL_IDX 9
 
-static void ulp_ha_mgr_timer_cancel(void);
+static void ulp_ha_mgr_timer_cancel(struct bnxt_ulp_context *ulp_ctx);
 static int32_t ulp_ha_mgr_timer_start(void *arg);
 static void ulp_ha_mgr_timer_cb(void *arg);
 static int32_t ulp_ha_mgr_app_type_set(struct bnxt_ulp_context *ulp_ctx,
@@ -311,9 +311,9 @@ ulp_ha_mgr_timer_start(void *arg)
 }
 
 static void
-ulp_ha_mgr_timer_cancel(void)
+ulp_ha_mgr_timer_cancel(struct bnxt_ulp_context *ulp_ctx)
 {
-	rte_eal_alarm_cancel(ulp_ha_mgr_timer_cb, (void *)NULL);
+	rte_eal_alarm_cancel(ulp_ha_mgr_timer_cb, ulp_ctx->cfg_data);
 }
 
 int32_t
@@ -351,7 +351,7 @@ ulp_ha_mgr_deinit(struct bnxt_ulp_context *ulp_ctx)
 {
 	struct bnxt_ulp_ha_mgr_info *ha_info;
 
-	ulp_ha_mgr_timer_cancel();
+	ulp_ha_mgr_timer_cancel(ulp_ctx);
 
 	ha_info = bnxt_ulp_cntxt_ptr2_ha_info_get(ulp_ctx);
 	if (ha_info == NULL) {
-- 
2.17.1


  parent reply	other threads:[~2021-11-16 13:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16 13:04 [PATCH 0/4] fixes to TruFlow Venkat Duvvuru
2021-11-16 13:04 ` [PATCH 1/4] net/bnxt: remove settings to support multiple session Venkat Duvvuru
2021-11-16 13:04 ` [PATCH 2/4] net/bnxt: fix sram resource free block list Venkat Duvvuru
2021-11-16 13:04 ` [PATCH 3/4] net/bnxt: fix multi adapter support Venkat Duvvuru
2021-11-16 13:04 ` Venkat Duvvuru [this message]
2021-11-17  4:01 ` [PATCH 0/4] fixes to TruFlow Ajit Khaparde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211116130437.2022-5-venkatkumar.duvvuru@broadcom.com \
    --to=venkatkumar.duvvuru@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=kishore.padmanabha@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).