DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/4] fixes to TruFlow
@ 2021-11-16 13:04 Venkat Duvvuru
  2021-11-16 13:04 ` [PATCH 1/4] net/bnxt: remove settings to support multiple session Venkat Duvvuru
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Venkat Duvvuru @ 2021-11-16 13:04 UTC (permalink / raw)
  To: dev; +Cc: Venkat Duvvuru

This patch set adds fixes to Truflow feature.

Jay Ding (1):
  net/bnxt: remove settings to support multiple session

Kishore Padmanabha (3):
  net/bnxt: fix sram resource free block list
  net/bnxt: fix multi adapter support
  net/bnxt: fix ULP context list deadlock

 drivers/net/bnxt/tf_core/tf_device.c     |  3 -
 drivers/net/bnxt/tf_core/tf_device_p4.c  | 24 +++++--
 drivers/net/bnxt/tf_core/tf_device_p58.c | 24 +++++--
 drivers/net/bnxt/tf_core/tf_global_cfg.c | 82 +++++++++++++-----------
 drivers/net/bnxt/tf_core/tf_global_cfg.h |  2 +-
 drivers/net/bnxt/tf_core/tf_if_tbl.c     | 61 ++++++++++++++----
 drivers/net/bnxt/tf_core/tf_session.c    | 76 ++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_session.h    | 69 +++++++++++++++++++-
 drivers/net/bnxt/tf_core/tf_sram_mgr.c   | 16 +++--
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c       | 19 +++---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h       |  2 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c     | 12 ++--
 drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c     | 24 +++----
 13 files changed, 317 insertions(+), 97 deletions(-)

-- 
2.17.1


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

* [PATCH 1/4] net/bnxt: remove settings to support multiple session
  2021-11-16 13:04 [PATCH 0/4] fixes to TruFlow Venkat Duvvuru
@ 2021-11-16 13:04 ` Venkat Duvvuru
  2021-11-16 13:04 ` [PATCH 2/4] net/bnxt: fix sram resource free block list Venkat Duvvuru
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Venkat Duvvuru @ 2021-11-16 13:04 UTC (permalink / raw)
  To: dev; +Cc: Jay Ding, Venkat Duvvuru

From: Jay Ding <jay.ding@broadcom.com>

Move wc_tcam_slices_per_row and database structure of
global_cfg and if_tbl to session structure to support
multiple TruFlow sessions with different card type under single
dpdk application instance.

Signed-off-by: Jay Ding <jay.ding@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Farah Smith <farah.smith@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
---
 drivers/net/bnxt/tf_core/tf_device.c     |  3 -
 drivers/net/bnxt/tf_core/tf_device_p4.c  | 24 ++++++--
 drivers/net/bnxt/tf_core/tf_device_p58.c | 24 ++++++--
 drivers/net/bnxt/tf_core/tf_global_cfg.c | 75 +++++++++++++++++------
 drivers/net/bnxt/tf_core/tf_if_tbl.c     | 61 +++++++++++++++----
 drivers/net/bnxt/tf_core/tf_session.c    | 76 ++++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_session.h    | 69 ++++++++++++++++++++-
 7 files changed, 291 insertions(+), 41 deletions(-)

diff --git a/drivers/net/bnxt/tf_core/tf_device.c b/drivers/net/bnxt/tf_core/tf_device.c
index 4c416270b6..a35d22841c 100644
--- a/drivers/net/bnxt/tf_core/tf_device.c
+++ b/drivers/net/bnxt/tf_core/tf_device.c
@@ -16,9 +16,6 @@
 
 struct tf;
 
-/* Number of slices per row for WC TCAM */
-uint16_t g_wc_num_slices_per_row = TF_WC_TCAM_1_SLICE_PER_ROW;
-
 /* Forward declarations */
 static int tf_dev_unbind_p4(struct tf *tfp);
 static int tf_dev_unbind_p58(struct tf *tfp);
diff --git a/drivers/net/bnxt/tf_core/tf_device_p4.c b/drivers/net/bnxt/tf_core/tf_device_p4.c
index a6a59b8a07..aa55587ba8 100644
--- a/drivers/net/bnxt/tf_core/tf_device_p4.c
+++ b/drivers/net/bnxt/tf_core/tf_device_p4.c
@@ -239,14 +239,22 @@ tf_dev_p4_get_resource_str(struct tf *tfp __rte_unused,
  *   - (-EINVAL) on failure.
  */
 static int
-tf_dev_p4_set_tcam_slice_info(struct tf *tfp __rte_unused,
+tf_dev_p4_set_tcam_slice_info(struct tf *tfp,
 			      enum tf_wc_num_slice num_slices_per_row)
 {
+	int rc;
+	struct tf_session *tfs;
+
+	/* Retrieve the session information */
+	rc = tf_session_get_session_internal(tfp, &tfs);
+	if (rc)
+		return rc;
+
 	switch (num_slices_per_row) {
 	case TF_WC_TCAM_1_SLICE_PER_ROW:
 	case TF_WC_TCAM_2_SLICE_PER_ROW:
 	case TF_WC_TCAM_4_SLICE_PER_ROW:
-		g_wc_num_slices_per_row = num_slices_per_row;
+		tfs->wc_num_slices_per_row = num_slices_per_row;
 	break;
 	default:
 		return -EINVAL;
@@ -276,16 +284,24 @@ tf_dev_p4_set_tcam_slice_info(struct tf *tfp __rte_unused,
  *   - (-EINVAL) on failure.
  */
 static int
-tf_dev_p4_get_tcam_slice_info(struct tf *tfp __rte_unused,
+tf_dev_p4_get_tcam_slice_info(struct tf *tfp,
 			      enum tf_tcam_tbl_type type,
 			      uint16_t key_sz,
 			      uint16_t *num_slices_per_row)
 {
+	int rc;
+	struct tf_session *tfs;
+
+	/* Retrieve the session information */
+	rc = tf_session_get_session_internal(tfp, &tfs);
+	if (rc)
+		return rc;
+
 /* Single slice support */
 #define CFA_P4_WC_TCAM_SLICE_SIZE     12
 
 	if (type == TF_TCAM_TBL_TYPE_WC_TCAM) {
-		*num_slices_per_row = g_wc_num_slices_per_row;
+		*num_slices_per_row = tfs->wc_num_slices_per_row;
 		if (key_sz > *num_slices_per_row * CFA_P4_WC_TCAM_SLICE_SIZE)
 			return -ENOTSUP;
 	} else { /* for other type of tcam */
diff --git a/drivers/net/bnxt/tf_core/tf_device_p58.c b/drivers/net/bnxt/tf_core/tf_device_p58.c
index 30c0af7eef..987ad2a564 100644
--- a/drivers/net/bnxt/tf_core/tf_device_p58.c
+++ b/drivers/net/bnxt/tf_core/tf_device_p58.c
@@ -350,14 +350,22 @@ tf_dev_p58_get_resource_str(struct tf *tfp __rte_unused,
  *   - (-EINVAL) on failure.
  */
 static int
-tf_dev_p58_set_tcam_slice_info(struct tf *tfp __rte_unused,
+tf_dev_p58_set_tcam_slice_info(struct tf *tfp,
 			       enum tf_wc_num_slice num_slices_per_row)
 {
+	int rc;
+	struct tf_session *tfs;
+
+	/* Retrieve the session information */
+	rc = tf_session_get_session_internal(tfp, &tfs);
+	if (rc)
+		return rc;
+
 	switch (num_slices_per_row) {
 	case TF_WC_TCAM_1_SLICE_PER_ROW:
 	case TF_WC_TCAM_2_SLICE_PER_ROW:
 	case TF_WC_TCAM_4_SLICE_PER_ROW:
-		g_wc_num_slices_per_row = num_slices_per_row;
+		tfs->wc_num_slices_per_row = num_slices_per_row;
 	break;
 	default:
 		return -EINVAL;
@@ -387,14 +395,22 @@ tf_dev_p58_set_tcam_slice_info(struct tf *tfp __rte_unused,
  *   - (-EINVAL) on failure.
  */
 static int
-tf_dev_p58_get_tcam_slice_info(struct tf *tfp __rte_unused,
+tf_dev_p58_get_tcam_slice_info(struct tf *tfp,
 			       enum tf_tcam_tbl_type type,
 			       uint16_t key_sz,
 			       uint16_t *num_slices_per_row)
 {
+	int rc;
+	struct tf_session *tfs;
+
+	/* Retrieve the session information */
+	rc = tf_session_get_session_internal(tfp, &tfs);
+	if (rc)
+		return rc;
+
 #define CFA_P58_WC_TCAM_SLICE_SIZE     24
 	if (type == TF_TCAM_TBL_TYPE_WC_TCAM) {
-		*num_slices_per_row = g_wc_num_slices_per_row;
+		*num_slices_per_row = tfs->wc_num_slices_per_row;
 		if (key_sz > *num_slices_per_row * CFA_P58_WC_TCAM_SLICE_SIZE)
 			return -ENOTSUP;
 	} else { /* for other type of tcam */
diff --git a/drivers/net/bnxt/tf_core/tf_global_cfg.c b/drivers/net/bnxt/tf_core/tf_global_cfg.c
index f420452684..98a42b2fe6 100644
--- a/drivers/net/bnxt/tf_core/tf_global_cfg.c
+++ b/drivers/net/bnxt/tf_core/tf_global_cfg.c
@@ -12,10 +12,13 @@
 #include "tfp.h"
 
 struct tf;
+
 /**
- * Global Cfg DBs.
+ * Global cfg database
  */
-static void *global_cfg_db[TF_DIR_MAX];
+struct tf_global_cfg_db {
+	struct tf_global_cfg_cfg *global_cfg_db[TF_DIR_MAX];
+};
 
 /**
  * Init flag, set on bind and cleared on unbind
@@ -72,40 +75,62 @@ tf_global_cfg_get_hcapi_type(struct tf_global_cfg_get_hcapi_parms *parms)
 }
 
 int
-tf_global_cfg_bind(struct tf *tfp __rte_unused,
+tf_global_cfg_bind(struct tf *tfp,
 		   struct tf_global_cfg_cfg_parms *parms)
 {
+	struct tfp_calloc_parms cparms;
+	struct tf_global_cfg_db *global_cfg_db;
+
 	TF_CHECK_PARMS2(tfp, parms);
 
 	if (init) {
-		TFP_DRV_LOG(ERR,
-			    "Global Cfg DB already initialized\n");
+		TFP_DRV_LOG(ERR, "Global Cfg DB already initialized\n");
 		return -EINVAL;
 	}
 
-	global_cfg_db[TF_DIR_RX] = parms->cfg;
-	global_cfg_db[TF_DIR_TX] = parms->cfg;
+	cparms.nitems = 1;
+	cparms.size = sizeof(struct tf_global_cfg_db);
+	cparms.alignment = 0;
+	if (tfp_calloc(&cparms) != 0) {
+		TFP_DRV_LOG(ERR, "global_rm_db alloc error %s\n",
+			    strerror(ENOMEM));
+		return -ENOMEM;
+	}
+
+	global_cfg_db = cparms.mem_va;
+	global_cfg_db->global_cfg_db[TF_DIR_RX] = parms->cfg;
+	global_cfg_db->global_cfg_db[TF_DIR_TX] = parms->cfg;
+
+	tf_session_set_global_db(tfp, (void *)global_cfg_db);
 
 	init = 1;
 
-	TFP_DRV_LOG(INFO,
-		    "Global Cfg - initialized\n");
+	TFP_DRV_LOG(INFO, "Global Cfg - initialized\n");
 
 	return 0;
 }
 
 int
-tf_global_cfg_unbind(struct tf *tfp __rte_unused)
+tf_global_cfg_unbind(struct tf *tfp)
 {
+	int rc;
+	struct tf_global_cfg_db *global_cfg_db_ptr;
+
+	TF_CHECK_PARMS1(tfp);
+
 	/* Bail if nothing has been initialized */
 	if (!init) {
-		TFP_DRV_LOG(INFO,
-			    "No Global Cfg DBs created\n");
+		TFP_DRV_LOG(INFO, "No Global Cfg DBs created\n");
 		return 0;
 	}
 
-	global_cfg_db[TF_DIR_RX] = NULL;
-	global_cfg_db[TF_DIR_TX] = NULL;
+	rc = tf_session_get_global_db(tfp, (void **)&global_cfg_db_ptr);
+	if (rc) {
+		TFP_DRV_LOG(INFO, "global_cfg_db is not initialized\n");
+		return 0;
+	}
+
+	tfp_free((void *)global_cfg_db_ptr);
 	init = 0;
 
 	return 0;
@@ -117,19 +142,25 @@ tf_global_cfg_set(struct tf *tfp,
 {
 	int rc;
 	struct tf_global_cfg_get_hcapi_parms hparms;
+	struct tf_global_cfg_db *global_cfg_db_ptr;
 	uint16_t hcapi_type;
 
 	TF_CHECK_PARMS3(tfp, parms, parms->config);
 
 	if (!init) {
-		TFP_DRV_LOG(ERR,
-			    "%s: No Global Cfg DBs created\n",
+		TFP_DRV_LOG(ERR, "%s: No Global Cfg DBs created\n",
 			    tf_dir_2_str(parms->dir));
 		return -EINVAL;
 	}
 
+	rc = tf_session_get_global_db(tfp, (void **)&global_cfg_db_ptr);
+	if (rc) {
+		TFP_DRV_LOG(INFO, "No global cfg DBs initialized\n");
+		return 0;
+	}
+
 	/* Convert TF type to HCAPI type */
-	hparms.global_cfg_db = global_cfg_db[parms->dir];
+	hparms.global_cfg_db = global_cfg_db_ptr->global_cfg_db[parms->dir];
 	hparms.db_index = parms->type;
 	hparms.hcapi_type = &hcapi_type;
 	rc = tf_global_cfg_get_hcapi_type(&hparms);
@@ -161,6 +192,7 @@ tf_global_cfg_get(struct tf *tfp,
 {
 	int rc;
 	struct tf_global_cfg_get_hcapi_parms hparms;
+	struct tf_global_cfg_db *global_cfg_db_ptr;
 	uint16_t hcapi_type;
 
 	TF_CHECK_PARMS3(tfp, parms, parms->config);
@@ -172,7 +204,14 @@ tf_global_cfg_get(struct tf *tfp,
 		return -EINVAL;
 	}
 
-	hparms.global_cfg_db = global_cfg_db[parms->dir];
+	rc = tf_session_get_global_db(tfp, (void **)&global_cfg_db_ptr);
+	if (rc) {
+		TFP_DRV_LOG(INFO, "No Global cfg DBs initialized\n");
+		return 0;
+	}
+
+	/* Convert TF type to HCAPI type */
+	hparms.global_cfg_db = global_cfg_db_ptr->global_cfg_db[parms->dir];
 	hparms.db_index = parms->type;
 	hparms.hcapi_type = &hcapi_type;
 	rc = tf_global_cfg_get_hcapi_type(&hparms);
diff --git a/drivers/net/bnxt/tf_core/tf_if_tbl.c b/drivers/net/bnxt/tf_core/tf_if_tbl.c
index 762dac0473..e667d6fa6d 100644
--- a/drivers/net/bnxt/tf_core/tf_if_tbl.c
+++ b/drivers/net/bnxt/tf_core/tf_if_tbl.c
@@ -15,10 +15,11 @@
 struct tf;
 
 /**
- * IF Table DBs.
- * TODO: Store this data in session db
+ * IF Table database
  */
-static void *if_tbl_db[TF_DIR_MAX];
+struct tf_if_tbl_db {
+	struct tf_if_tbl_cfg *if_tbl_cfg_db[TF_DIR_MAX];
+};
 
 /**
  * Init flag, set on bind and cleared on unbind
@@ -57,13 +58,27 @@ tf_if_tbl_get_hcapi_type(struct tf_if_tbl_get_hcapi_parms *parms)
 }
 
 int
-tf_if_tbl_bind(struct tf *tfp __rte_unused,
+tf_if_tbl_bind(struct tf *tfp,
 	       struct tf_if_tbl_cfg_parms *parms)
 {
+	struct tfp_calloc_parms cparms;
+	struct tf_if_tbl_db *if_tbl_db;
+
 	TF_CHECK_PARMS2(tfp, parms);
 
-	if_tbl_db[TF_DIR_RX] = parms->cfg;
-	if_tbl_db[TF_DIR_TX] = parms->cfg;
+	cparms.nitems = 1;
+	cparms.size = sizeof(struct tf_if_tbl_db);
+	cparms.alignment = 0;
+	if (tfp_calloc(&cparms) != 0) {
+		TFP_DRV_LOG(ERR, "if_tbl_rm_db alloc error %s\n",
+			    strerror(ENOMEM));
+		return -ENOMEM;
+	}
+
+	if_tbl_db = cparms.mem_va;
+	if_tbl_db->if_tbl_cfg_db[TF_DIR_RX] = parms->cfg;
+	if_tbl_db->if_tbl_cfg_db[TF_DIR_TX] = parms->cfg;
+	tf_session_set_if_tbl_db(tfp, (void *)if_tbl_db);
 
 	init = 1;
 
@@ -74,8 +89,11 @@ tf_if_tbl_bind(struct tf *tfp __rte_unused,
 }
 
 int
-tf_if_tbl_unbind(struct tf *tfp __rte_unused)
+tf_if_tbl_unbind(struct tf *tfp)
 {
+	int rc;
+	struct tf_if_tbl_db *if_tbl_db_ptr;
+
 	/* Bail if nothing has been initialized */
 	if (!init) {
 		TFP_DRV_LOG(INFO,
@@ -83,8 +101,15 @@ tf_if_tbl_unbind(struct tf *tfp __rte_unused)
 		return 0;
 	}
 
-	if_tbl_db[TF_DIR_RX] = NULL;
-	if_tbl_db[TF_DIR_TX] = NULL;
+	TF_CHECK_PARMS1(tfp);
+
+	rc = tf_session_get_if_tbl_db(tfp, (void **)&if_tbl_db_ptr);
+	if (rc) {
+		TFP_DRV_LOG(INFO, "No IF Table DBs initialized\n");
+		return 0;
+	}
+
+	tfp_free((void *)if_tbl_db_ptr);
 	init = 0;
 
 	return 0;
@@ -95,6 +120,7 @@ tf_if_tbl_set(struct tf *tfp,
 	      struct tf_if_tbl_set_parms *parms)
 {
 	int rc;
+	struct tf_if_tbl_db *if_tbl_db_ptr;
 	struct tf_if_tbl_get_hcapi_parms hparms;
 
 	TF_CHECK_PARMS3(tfp, parms, parms->data);
@@ -106,8 +132,14 @@ tf_if_tbl_set(struct tf *tfp,
 		return -EINVAL;
 	}
 
+	rc = tf_session_get_if_tbl_db(tfp, (void **)&if_tbl_db_ptr);
+	if (rc) {
+		TFP_DRV_LOG(INFO, "No IF Table DBs initialized\n");
+		return 0;
+	}
+
 	/* Convert TF type to HCAPI type */
-	hparms.tbl_db = if_tbl_db[parms->dir];
+	hparms.tbl_db = if_tbl_db_ptr->if_tbl_cfg_db[parms->dir];
 	hparms.db_index = parms->type;
 	hparms.hcapi_type = &parms->hcapi_type;
 	rc = tf_if_tbl_get_hcapi_type(&hparms);
@@ -131,6 +163,7 @@ tf_if_tbl_get(struct tf *tfp,
 	      struct tf_if_tbl_get_parms *parms)
 {
 	int rc = 0;
+	struct tf_if_tbl_db *if_tbl_db_ptr;
 	struct tf_if_tbl_get_hcapi_parms hparms;
 
 	TF_CHECK_PARMS3(tfp, parms, parms->data);
@@ -142,8 +175,14 @@ tf_if_tbl_get(struct tf *tfp,
 		return -EINVAL;
 	}
 
+	rc = tf_session_get_if_tbl_db(tfp, (void **)&if_tbl_db_ptr);
+	if (rc) {
+		TFP_DRV_LOG(INFO, "No IF Table DBs initialized\n");
+		return 0;
+	}
+
 	/* Convert TF type to HCAPI type */
-	hparms.tbl_db = if_tbl_db[parms->dir];
+	hparms.tbl_db = if_tbl_db_ptr->if_tbl_cfg_db[parms->dir];
 	hparms.db_index = parms->type;
 	hparms.hcapi_type = &parms->hcapi_type;
 	rc = tf_if_tbl_get_hcapi_type(&hparms);
diff --git a/drivers/net/bnxt/tf_core/tf_session.c b/drivers/net/bnxt/tf_core/tf_session.c
index 3e6664e9f2..9f849a0a76 100644
--- a/drivers/net/bnxt/tf_core/tf_session.c
+++ b/drivers/net/bnxt/tf_core/tf_session.c
@@ -1069,3 +1069,79 @@ tf_session_set_sram_db(struct tf *tfp,
 }
 
 #endif /* TF_TCAM_SHARED */
+
+int
+tf_session_get_global_db(struct tf *tfp,
+			 void **global_handle)
+{
+	struct tf_session *tfs = NULL;
+	int rc = 0;
+
+	*global_handle = NULL;
+
+	if (tfp == NULL)
+		return (-EINVAL);
+
+	rc = tf_session_get_session_internal(tfp, &tfs);
+	if (rc)
+		return rc;
+
+	*global_handle = tfs->global_db_handle;
+	return rc;
+}
+
+int
+tf_session_set_global_db(struct tf *tfp,
+			 void *global_handle)
+{
+	struct tf_session *tfs = NULL;
+	int rc = 0;
+
+	if (tfp == NULL)
+		return (-EINVAL);
+
+	rc = tf_session_get_session_internal(tfp, &tfs);
+	if (rc)
+		return rc;
+
+	tfs->global_db_handle = global_handle;
+	return rc;
+}
+
+int
+tf_session_get_if_tbl_db(struct tf *tfp,
+			 void **if_tbl_handle)
+{
+	struct tf_session *tfs = NULL;
+	int rc = 0;
+
+	*if_tbl_handle = NULL;
+
+	if (tfp == NULL)
+		return (-EINVAL);
+
+	rc = tf_session_get_session_internal(tfp, &tfs);
+	if (rc)
+		return rc;
+
+	*if_tbl_handle = tfs->if_tbl_db_handle;
+	return rc;
+}
+
+int
+tf_session_set_if_tbl_db(struct tf *tfp,
+			 void *if_tbl_handle)
+{
+	struct tf_session *tfs = NULL;
+	int rc = 0;
+
+	if (tfp == NULL)
+		return (-EINVAL);
+
+	rc = tf_session_get_session_internal(tfp, &tfs);
+	if (rc)
+		return rc;
+
+	tfs->if_tbl_db_handle = if_tbl_handle;
+	return rc;
+}
diff --git a/drivers/net/bnxt/tf_core/tf_session.h b/drivers/net/bnxt/tf_core/tf_session.h
index c1d7f70060..19a96c28b1 100644
--- a/drivers/net/bnxt/tf_core/tf_session.h
+++ b/drivers/net/bnxt/tf_core/tf_session.h
@@ -13,7 +13,6 @@
 #include "tf_core.h"
 #include "tf_device.h"
 #include "tf_rm.h"
-#include "tf_tbl.h"
 #include "tf_resources.h"
 #include "stack.h"
 #include "ll.h"
@@ -166,10 +165,26 @@ struct tf_session {
 	 */
 	void *tcam_shared_db_handle;
 #endif /* TF_TCAM_SHARED */
+
 	/**
 	 * SRAM db reference for the session
 	 */
 	void *sram_handle;
+
+	/**
+	 * if table db reference for the session
+	 */
+	void *if_tbl_db_handle;
+
+	/**
+	 * global db reference for the session
+	 */
+	void *global_db_handle;
+
+	/**
+	 * Number of slices per row for WC TCAM
+	 */
+	uint16_t wc_num_slices_per_row;
 };
 
 /**
@@ -666,4 +681,56 @@ int
 tf_session_get_sram_db(struct tf *tfp,
 		       void **sram_handle);
 
+/**
+ * Set the pointer to the global cfg database
+ *
+ * [in] session, pointer to the session
+ *
+ * Returns:
+ *   - (0) if successful.
+ *   - (-EINVAL) on failure.
+ */
+int
+tf_session_set_global_db(struct tf *tfp,
+			 void *global_handle);
+
+/**
+ * Get the pointer to the global cfg database
+ *
+ * [in] session, pointer to the session
+ *
+ * Returns:
+ *   - (0) if successful.
+ *   - (-EINVAL) on failure.
+ */
+int
+tf_session_get_global_db(struct tf *tfp,
+			 void **global_handle);
+
+/**
+ * Set the pointer to the if table cfg database
+ *
+ * [in] session, pointer to the session
+ *
+ * Returns:
+ *   - (0) if successful.
+ *   - (-EINVAL) on failure.
+ */
+int
+tf_session_set_if_tbl_db(struct tf *tfp,
+			 void *if_tbl_handle);
+
+/**
+ * Get the pointer to the if table cfg database
+ *
+ * [in] session, pointer to the session
+ *
+ * Returns:
+ *   - (0) if successful.
+ *   - (-EINVAL) on failure.
+ */
+int
+tf_session_get_if_tbl_db(struct tf *tfp,
+			 void **if_tbl_handle);
+
 #endif /* _TF_SESSION_H_ */
-- 
2.17.1


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

* [PATCH 2/4] net/bnxt: fix sram resource free block list
  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 ` Venkat Duvvuru
  2021-11-16 13:04 ` [PATCH 3/4] net/bnxt: fix multi adapter support Venkat Duvvuru
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Venkat Duvvuru @ 2021-11-16 13:04 UTC (permalink / raw)
  To: dev; +Cc: Kishore Padmanabha, Venkat Duvvuru

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

The sram resource free did not reset the next block to be used
when the block is not empty. This caused the flows not be created
when max flows limit is reached and you delete one flow and try to
add a new flow. The fix calls the update of the next free block
even when block is not empty.

Fixes: 37ff91c158a3 ("net/bnxt: add SRAM manager model")
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_core/tf_sram_mgr.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bnxt/tf_core/tf_sram_mgr.c b/drivers/net/bnxt/tf_core/tf_sram_mgr.c
index a248ef2ce8..acb3372486 100644
--- a/drivers/net/bnxt/tf_core/tf_sram_mgr.c
+++ b/drivers/net/bnxt/tf_core/tf_sram_mgr.c
@@ -794,17 +794,19 @@ tf_sram_mgr_free(void *sram_handle,
 			TFP_DRV_LOG(ERR, "Free block_id(%d) failed error(%s)\n",
 				    block_id, strerror(-rc));
 		}
-		/* Free local entry regardless
-		 */
+		/* Free local entry regardless */
 		tf_sram_free_block(slice_list, block);
 
-		/* Find the next non-full block in the list
-		 */
-		tf_sram_find_first_not_full_block(slice_list,
-					     parms->slice_size,
-					     &slice_list->first_not_full_block);
+		/* Clear the not full block to set it again */
+		slice_list->first_not_full_block = NULL;
 	}
+	if (slice_list->first_not_full_block)
+		return rc;
 
+	/* set the non full block so it can be used in next alloc */
+	tf_sram_find_first_not_full_block(slice_list,
+					  parms->slice_size,
+					  &slice_list->first_not_full_block);
 	return rc;
 }
 
-- 
2.17.1


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

* [PATCH 3/4] net/bnxt: fix multi adapter support
  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 ` Venkat Duvvuru
  2021-11-16 13:04 ` [PATCH 4/4] net/bnxt: fix ULP context list deadlock Venkat Duvvuru
  2021-11-17  4:01 ` [PATCH 0/4] fixes to TruFlow Ajit Khaparde
  4 siblings, 0 replies; 6+ messages in thread
From: Venkat Duvvuru @ 2021-11-16 13:04 UTC (permalink / raw)
  To: dev; +Cc: Kishore Padmanabha, Venkat Duvvuru

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

1. removed the global flag for tf global config initialization.

2. Modified the truflow context lock to be a global lock instead
of per context lock.

3. The ulp context list is modified to check on the ulp configiuration
data so alarm handlers can operate on the correct ulp context.

These changes help in support of multiple network cards using
single dpdk application.

Fixes: d75b55121bcd ("net/bnxt: add context list for timers")

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Michael Baucom <michael.baucom@broadcom.com>
---
 drivers/net/bnxt/tf_core/tf_device_p4.c  |  2 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c |  4 +--
 drivers/net/bnxt/tf_core/tf_global_cfg.c | 35 ------------------------
 drivers/net/bnxt/tf_core/tf_global_cfg.h |  2 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c       | 12 ++++----
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h       |  2 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c     | 12 ++++----
 drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c     | 16 +++++------
 8 files changed, 26 insertions(+), 59 deletions(-)

diff --git a/drivers/net/bnxt/tf_core/tf_device_p4.c b/drivers/net/bnxt/tf_core/tf_device_p4.c
index aa55587ba8..b8b3dcbb3f 100644
--- a/drivers/net/bnxt/tf_core/tf_device_p4.c
+++ b/drivers/net/bnxt/tf_core/tf_device_p4.c
@@ -243,7 +243,7 @@ tf_dev_p4_set_tcam_slice_info(struct tf *tfp,
 			      enum tf_wc_num_slice num_slices_per_row)
 {
 	int rc;
-	struct tf_session *tfs;
+	struct tf_session *tfs = NULL;
 
 	/* Retrieve the session information */
 	rc = tf_session_get_session_internal(tfp, &tfs);
diff --git a/drivers/net/bnxt/tf_core/tf_device_p58.c b/drivers/net/bnxt/tf_core/tf_device_p58.c
index 987ad2a564..8179287e46 100644
--- a/drivers/net/bnxt/tf_core/tf_device_p58.c
+++ b/drivers/net/bnxt/tf_core/tf_device_p58.c
@@ -354,7 +354,7 @@ tf_dev_p58_set_tcam_slice_info(struct tf *tfp,
 			       enum tf_wc_num_slice num_slices_per_row)
 {
 	int rc;
-	struct tf_session *tfs;
+	struct tf_session *tfs = NULL;
 
 	/* Retrieve the session information */
 	rc = tf_session_get_session_internal(tfp, &tfs);
@@ -401,7 +401,7 @@ tf_dev_p58_get_tcam_slice_info(struct tf *tfp,
 			       uint16_t *num_slices_per_row)
 {
 	int rc;
-	struct tf_session *tfs;
+	struct tf_session *tfs = NULL;
 
 	/* Retrieve the session information */
 	rc = tf_session_get_session_internal(tfp, &tfs);
diff --git a/drivers/net/bnxt/tf_core/tf_global_cfg.c b/drivers/net/bnxt/tf_core/tf_global_cfg.c
index 98a42b2fe6..d83e7db315 100644
--- a/drivers/net/bnxt/tf_core/tf_global_cfg.c
+++ b/drivers/net/bnxt/tf_core/tf_global_cfg.c
@@ -20,11 +20,6 @@ struct tf_global_cfg_db {
 	struct tf_global_cfg_cfg *global_cfg_db[TF_DIR_MAX];
 };
 
-/**
- * Init flag, set on bind and cleared on unbind
- */
-static uint8_t init;
-
 /**
  * Get HCAPI type parameters for a single element
  */
@@ -83,11 +78,6 @@ tf_global_cfg_bind(struct tf *tfp,
 
 	TF_CHECK_PARMS2(tfp, parms);
 
-	if (init) {
-		TFP_DRV_LOG(ERR, "Global Cfg DB already initialized\n");
-		return -EINVAL;
-	}
-
 	cparms.nitems = 1;
 	cparms.size = sizeof(struct tf_global_cfg_db);
 	cparms.alignment = 0;
@@ -100,13 +90,9 @@ tf_global_cfg_bind(struct tf *tfp,
 	global_cfg_db = cparms.mem_va;
 	global_cfg_db->global_cfg_db[TF_DIR_RX] = parms->cfg;
 	global_cfg_db->global_cfg_db[TF_DIR_TX] = parms->cfg;
-
 	tf_session_set_global_db(tfp, (void *)global_cfg_db);
 
-	init = 1;
-
 	TFP_DRV_LOG(INFO, "Global Cfg - initialized\n");
-
 	return 0;
 }
 
@@ -118,12 +104,6 @@ tf_global_cfg_unbind(struct tf *tfp)
 
 	TF_CHECK_PARMS1(tfp);
 
-	/* Bail if nothing has been initialized */
-	if (!init) {
-		TFP_DRV_LOG(INFO, "No Global Cfg DBs created\n");
-		return 0;
-	}
-
 	rc = tf_session_get_global_db(tfp, (void **)&global_cfg_db_ptr);
 	if (rc) {
 		TFP_DRV_LOG(INFO, "global_cfg_db is not initialized\n");
@@ -131,8 +111,6 @@ tf_global_cfg_unbind(struct tf *tfp)
 	}
 
 	tfp_free((void *)global_cfg_db_ptr);
-	init = 0;
-
 	return 0;
 }
 
@@ -147,12 +125,6 @@ tf_global_cfg_set(struct tf *tfp,
 
 	TF_CHECK_PARMS3(tfp, parms, parms->config);
 
-	if (!init) {
-		TFP_DRV_LOG(ERR, "%s: No Global Cfg DBs created\n",
-			    tf_dir_2_str(parms->dir));
-		return -EINVAL;
-	}
-
 	rc = tf_session_get_global_db(tfp, (void **)&global_cfg_db_ptr);
 	if (rc) {
 		TFP_DRV_LOG(INFO, "No global cfg DBs initialized\n");
@@ -197,13 +169,6 @@ tf_global_cfg_get(struct tf *tfp,
 
 	TF_CHECK_PARMS3(tfp, parms, parms->config);
 
-	if (!init) {
-		TFP_DRV_LOG(ERR,
-			    "%s: No Global Cfg DBs created\n",
-			    tf_dir_2_str(parms->dir));
-		return -EINVAL;
-	}
-
 	rc = tf_session_get_global_db(tfp, (void **)&global_cfg_db_ptr);
 	if (rc) {
 		TFP_DRV_LOG(INFO, "No Global cfg DBs initialized\n");
diff --git a/drivers/net/bnxt/tf_core/tf_global_cfg.h b/drivers/net/bnxt/tf_core/tf_global_cfg.h
index 3522bcc07e..c14e5e9109 100644
--- a/drivers/net/bnxt/tf_core/tf_global_cfg.h
+++ b/drivers/net/bnxt/tf_core/tf_global_cfg.h
@@ -93,7 +93,7 @@ struct tf_global_cfg_cfg_parms {
  *
  * Returns
  *   - (0) if successful.
- *   - (-EINVAL) on failure.
+ *   - (-ENOMEM) on failure.
  */
 int
 tf_global_cfg_bind(struct tf *tfp,
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
index fd211bbc3f..b1b8679aa6 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
@@ -35,6 +35,7 @@ STAILQ_HEAD(, bnxt_ulp_session_state) bnxt_ulp_session_list =
 static pthread_mutex_t bnxt_ulp_global_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 /* Spin lock to protect context global list */
+uint32_t bnxt_ulp_ctxt_lock_created;
 rte_spinlock_t bnxt_ulp_ctxt_lock;
 TAILQ_HEAD(cntx_list_entry_list, ulp_context_list_entry);
 static struct cntx_list_entry_list ulp_cntx_list =
@@ -2010,9 +2011,10 @@ bnxt_ulp_cntxt_ha_enabled(struct bnxt_ulp_context *ulp_ctx)
 static int32_t
 bnxt_ulp_cntxt_list_init(void)
 {
-	/* Create the cntxt spin lock */
-	rte_spinlock_init(&bnxt_ulp_ctxt_lock);
-
+	/* Create the cntxt spin lock only once*/
+	if (!bnxt_ulp_ctxt_lock_created)
+		rte_spinlock_init(&bnxt_ulp_ctxt_lock);
+	bnxt_ulp_ctxt_lock_created = 1;
 	return 0;
 }
 
@@ -2051,14 +2053,14 @@ bnxt_ulp_cntxt_list_del(struct bnxt_ulp_context *ulp_ctx)
 }
 
 struct bnxt_ulp_context *
-bnxt_ulp_cntxt_entry_acquire(void)
+bnxt_ulp_cntxt_entry_acquire(void *arg)
 {
 	struct ulp_context_list_entry	*entry;
 
 	/* take a lock and get the first ulp context available */
 	if (rte_spinlock_trylock(&bnxt_ulp_ctxt_lock)) {
 		TAILQ_FOREACH(entry, &ulp_cntx_list, next)
-			if (entry->ulp_ctx)
+			if (entry->ulp_ctx->cfg_data == arg)
 				return entry->ulp_ctx;
 	}
 	return NULL;
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
index 17c6898196..05a98b14e6 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
@@ -307,7 +307,7 @@ bool
 bnxt_ulp_cntxt_ha_enabled(struct bnxt_ulp_context *ulp_ctx);
 
 struct bnxt_ulp_context *
-bnxt_ulp_cntxt_entry_acquire(void);
+bnxt_ulp_cntxt_entry_acquire(void *arg);
 
 void
 bnxt_ulp_cntxt_entry_release(void);
diff --git a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c
index 92243083b5..85c9cbb7f2 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c
@@ -203,7 +203,7 @@ ulp_fc_mgr_thread_start(struct bnxt_ulp_context *ctxt)
 
 	if (ulp_fc_info && !(ulp_fc_info->flags & ULP_FLAG_FC_THREAD)) {
 		rte_eal_alarm_set(US_PER_S * ULP_FC_TIMER,
-				  ulp_fc_mgr_alarm_cb, NULL);
+				  ulp_fc_mgr_alarm_cb, (void *)ctxt->cfg_data);
 		ulp_fc_info->flags |= ULP_FLAG_FC_THREAD;
 	}
 
@@ -225,7 +225,7 @@ void ulp_fc_mgr_thread_cancel(struct bnxt_ulp_context *ctxt)
 		return;
 
 	ulp_fc_info->flags &= ~ULP_FLAG_FC_THREAD;
-	rte_eal_alarm_cancel(ulp_fc_mgr_alarm_cb, NULL);
+	rte_eal_alarm_cancel(ulp_fc_mgr_alarm_cb, ctxt->cfg_data);
 }
 
 /*
@@ -434,7 +434,7 @@ static int ulp_get_single_flow_stat(struct bnxt_ulp_context *ctxt,
  */
 
 void
-ulp_fc_mgr_alarm_cb(void *arg __rte_unused)
+ulp_fc_mgr_alarm_cb(void *arg)
 {
 	int rc = 0;
 	unsigned int j;
@@ -445,11 +445,11 @@ ulp_fc_mgr_alarm_cb(void *arg __rte_unused)
 	struct tf *tfp;
 	uint32_t dev_id, hw_cntr_id = 0, num_entries = 0;
 
-	ctxt = bnxt_ulp_cntxt_entry_acquire();
+	ctxt = bnxt_ulp_cntxt_entry_acquire(arg);
 	if (ctxt == NULL) {
 		BNXT_TF_DBG(INFO, "could not get the ulp context lock\n");
 		rte_eal_alarm_set(US_PER_S * ULP_FC_TIMER,
-				  ulp_fc_mgr_alarm_cb, NULL);
+				  ulp_fc_mgr_alarm_cb, arg);
 		return;
 	}
 
@@ -534,7 +534,7 @@ ulp_fc_mgr_alarm_cb(void *arg __rte_unused)
 out:
 	bnxt_ulp_cntxt_entry_release();
 	rte_eal_alarm_set(US_PER_S * ULP_FC_TIMER,
-			  ulp_fc_mgr_alarm_cb, NULL);
+			  ulp_fc_mgr_alarm_cb, arg);
 }
 
 /*
diff --git a/drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c
index 5f5b5d639e..1325986aba 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c
@@ -27,7 +27,7 @@
 #define ULP_HA_CLIENT_CNT_IF_TBL_IDX 9
 
 static void ulp_ha_mgr_timer_cancel(void);
-static int32_t ulp_ha_mgr_timer_start(void);
+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,
 				enum ulp_ha_mgr_app_type app_type);
@@ -151,7 +151,7 @@ ulp_ha_mgr_app_type_set(struct bnxt_ulp_context *ulp_ctx,
 }
 
 static void
-ulp_ha_mgr_timer_cb(void *arg __rte_unused)
+ulp_ha_mgr_timer_cb(void *arg)
 {
 	struct tf_move_tcam_shared_entries_parms mparms = { 0 };
 	struct tf_clear_tcam_shared_entries_parms cparms = { 0 };
@@ -163,9 +163,9 @@ ulp_ha_mgr_timer_cb(void *arg __rte_unused)
 	struct tf *tfp;
 	int32_t rc;
 
-	ulp_ctx = bnxt_ulp_cntxt_entry_acquire();
+	ulp_ctx = bnxt_ulp_cntxt_entry_acquire(arg);
 	if (ulp_ctx == NULL) {
-		ulp_ha_mgr_timer_start();
+		ulp_ha_mgr_timer_start(arg);
 		return;
 	}
 
@@ -299,14 +299,14 @@ ulp_ha_mgr_timer_cb(void *arg __rte_unused)
 	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 cb_restart:
 	bnxt_ulp_cntxt_entry_release();
-	ulp_ha_mgr_timer_start();
+	ulp_ha_mgr_timer_start(arg);
 }
 
 static int32_t
-ulp_ha_mgr_timer_start(void)
+ulp_ha_mgr_timer_start(void *arg)
 {
 	rte_eal_alarm_set(US_PER_S * ULP_HA_TIMER_SEC,
-			  ulp_ha_mgr_timer_cb, NULL);
+			  ulp_ha_mgr_timer_cb, arg);
 	return 0;
 }
 
@@ -333,7 +333,7 @@ ulp_ha_mgr_init(struct bnxt_ulp_context *ulp_ctx)
 		PMD_DRV_LOG(ERR, "Failed to initialize ha mutex\n");
 		goto cleanup;
 	}
-	rc = ulp_ha_mgr_timer_start();
+	rc = ulp_ha_mgr_timer_start(ulp_ctx->cfg_data);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Unable to start timer CB.\n");
 		goto cleanup;
-- 
2.17.1


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

* [PATCH 4/4] net/bnxt: fix ULP context list deadlock
  2021-11-16 13:04 [PATCH 0/4] fixes to TruFlow Venkat Duvvuru
                   ` (2 preceding siblings ...)
  2021-11-16 13:04 ` [PATCH 3/4] net/bnxt: fix multi adapter support Venkat Duvvuru
@ 2021-11-16 13:04 ` Venkat Duvvuru
  2021-11-17  4:01 ` [PATCH 0/4] fixes to TruFlow Ajit Khaparde
  4 siblings, 0 replies; 6+ messages in thread
From: Venkat Duvvuru @ 2021-11-16 13:04 UTC (permalink / raw)
  To: dev; +Cc: Kishore Padmanabha, Venkat Duvvuru

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


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

* Re: [PATCH 0/4] fixes to TruFlow
  2021-11-16 13:04 [PATCH 0/4] fixes to TruFlow Venkat Duvvuru
                   ` (3 preceding siblings ...)
  2021-11-16 13:04 ` [PATCH 4/4] net/bnxt: fix ULP context list deadlock Venkat Duvvuru
@ 2021-11-17  4:01 ` Ajit Khaparde
  4 siblings, 0 replies; 6+ messages in thread
From: Ajit Khaparde @ 2021-11-17  4:01 UTC (permalink / raw)
  To: Venkat Duvvuru; +Cc: dpdk-dev, Ferruh Yigit

On Tue, Nov 16, 2021 at 5:04 AM Venkat Duvvuru
<venkatkumar.duvvuru@broadcom.com> wrote:
>
> This patch set adds fixes to Truflow feature.
Patchset applied to dpdk-next-net-brcm.
Fixed typo in commit log on patch 3 during merge.

Thanks

>
> Jay Ding (1):
>   net/bnxt: remove settings to support multiple session
>
> Kishore Padmanabha (3):
>   net/bnxt: fix sram resource free block list
>   net/bnxt: fix multi adapter support
>   net/bnxt: fix ULP context list deadlock
>
>  drivers/net/bnxt/tf_core/tf_device.c     |  3 -
>  drivers/net/bnxt/tf_core/tf_device_p4.c  | 24 +++++--
>  drivers/net/bnxt/tf_core/tf_device_p58.c | 24 +++++--
>  drivers/net/bnxt/tf_core/tf_global_cfg.c | 82 +++++++++++++-----------
>  drivers/net/bnxt/tf_core/tf_global_cfg.h |  2 +-
>  drivers/net/bnxt/tf_core/tf_if_tbl.c     | 61 ++++++++++++++----
>  drivers/net/bnxt/tf_core/tf_session.c    | 76 ++++++++++++++++++++++
>  drivers/net/bnxt/tf_core/tf_session.h    | 69 +++++++++++++++++++-
>  drivers/net/bnxt/tf_core/tf_sram_mgr.c   | 16 +++--
>  drivers/net/bnxt/tf_ulp/bnxt_ulp.c       | 19 +++---
>  drivers/net/bnxt/tf_ulp/bnxt_ulp.h       |  2 +-
>  drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c     | 12 ++--
>  drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c     | 24 +++----
>  13 files changed, 317 insertions(+), 97 deletions(-)
>
> --
> 2.17.1
>

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

end of thread, other threads:[~2021-11-17  4:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 4/4] net/bnxt: fix ULP context list deadlock Venkat Duvvuru
2021-11-17  4:01 ` [PATCH 0/4] fixes to TruFlow Ajit Khaparde

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).