Patch set 95432 v3

[v3] net/bnxt: shared TCAM region support

Submitter
Ajit Khaparde
Applied on
dpdk-next-net-brcm (175af25734f295874e31b33ccd0879e69fd152a9)
Date submitted
July 6, 2021, 10:39 p.m.

Test Results Apply Error

Checking patch drivers/net/bnxt/tf_core/meson.build...
error: drivers/net/bnxt/tf_core/meson.build: does not exist in index
Checking patch drivers/net/bnxt/tf_core/tf_core.h...
Hunk #2 succeeded at 53 (offset -23 lines).
error: while searching for:
	TF_MODULE_TYPE_MAX
};


/**
 * Identifier resource types
 */

error: patch failed: drivers/net/bnxt/tf_core/tf_core.h:198
Hunk #4 succeeded at 267 (offset -47 lines).
Hunk #5 succeeded at 320 (offset -47 lines).
Hunk #6 succeeded at 876 (offset -206 lines).
Checking patch drivers/net/bnxt/tf_core/tf_device.c...
error: while searching for:
#include "tfp.h"
#include "tf_em.h"
#include "tf_rm.h"

struct tf;


error: patch failed: drivers/net/bnxt/tf_core/tf_device.c:9
Hunk #2 succeeded at 46 (offset -49 lines).
error: while searching for:
		tcam_cfg.cfg = tf_tcam_p4;
		tcam_cfg.shadow_copy = shadow_copy;
		tcam_cfg.resources = resources;
		rc = tf_tcam_bind(tfp, &tcam_cfg);
		if (rc) {
			TFP_DRV_LOG(ERR,
				    "TCAM initialization failure\n");

error: patch failed: drivers/net/bnxt/tf_core/tf_device.c:142
error: while searching for:
		return -ENOMEM;
	}

	/*
	 * IF_TBL
	 */
	if_tbl_cfg.num_elements = TF_IF_TBL_TYPE_MAX;
	if_tbl_cfg.cfg = tf_if_tbl_p4;
	if_tbl_cfg.shadow_copy = shadow_copy;
	rc = tf_if_tbl_bind(tfp, &if_tbl_cfg);
	if (rc) {
		TFP_DRV_LOG(ERR,
			    "IF Table initialization failure\n");
		goto fail;
	}

	/*
	 * GLOBAL_CFG
	 */
	global_cfg.num_elements = TF_GLOBAL_CFG_TYPE_MAX;
	global_cfg.cfg = tf_global_cfg_p4;
	rc = tf_global_cfg_bind(tfp, &global_cfg);
	if (rc) {
		TFP_DRV_LOG(ERR,
			    "Global Cfg initialization failure\n");
		goto fail;
	}

	/* Final function initialization */
	dev_handle->ops = &tf_dev_ops_p4;


error: patch failed: drivers/net/bnxt/tf_core/tf_device.c:203
error: while searching for:
	 * In case of residuals TCAMs are cleaned up first as to
	 * invalidate the pipeline in a clean manner.
	 */
	rc = tf_tcam_unbind(tfp);
	if (rc) {
		TFP_DRV_LOG(INFO,
			    "Device unbind failed, TCAM\n");

error: patch failed: drivers/net/bnxt/tf_core/tf_device.c:265
error: while searching for:
		tcam_cfg.cfg = tf_tcam_p58;
		tcam_cfg.shadow_copy = shadow_copy;
		tcam_cfg.resources = resources;
		rc = tf_tcam_bind(tfp, &tcam_cfg);
		if (rc) {
			TFP_DRV_LOG(ERR,
				    "TCAM initialization failure\n");

error: patch failed: drivers/net/bnxt/tf_core/tf_device.c:407
error: while searching for:
	 * In case of residuals TCAMs are cleaned up first as to
	 * invalidate the pipeline in a clean manner.
	 */
	rc = tf_tcam_unbind(tfp);
	if (rc) {
		TFP_DRV_LOG(INFO,
			    "Device unbind failed, TCAM\n");

error: patch failed: drivers/net/bnxt/tf_core/tf_device.c:517
Checking patch drivers/net/bnxt/tf_core/tf_device.h...
error: while searching for:
				       uint16_t resource_id,
				       const char **resource_str);


	/**
	 * Retrieves the WC TCAM slice information that the device
	 * supports.

error: patch failed: drivers/net/bnxt/tf_core/tf_device.h:136
Checking patch drivers/net/bnxt/tf_core/tf_device_p4.c...
Hunk #2 succeeded at 88 (offset -52 lines).
error: while searching for:
	.tf_dev_get_tbl = tf_tbl_get,
	.tf_dev_get_bulk_tbl = tf_tbl_bulk_get,
	.tf_dev_get_tbl_resc_info = tf_tbl_get_resc_info,
	.tf_dev_alloc_tcam = tf_tcam_alloc,
	.tf_dev_free_tcam = tf_tcam_free,
	.tf_dev_alloc_search_tcam = tf_tcam_alloc_search,
	.tf_dev_set_tcam = tf_tcam_set,
	.tf_dev_get_tcam = NULL,
	.tf_dev_get_tcam_resc_info = tf_tcam_get_resc_info,
	.tf_dev_insert_int_em_entry = tf_em_insert_int_entry,
	.tf_dev_delete_int_em_entry = tf_em_delete_int_entry,

error: patch failed: drivers/net/bnxt/tf_core/tf_device_p4.c:263
Checking patch drivers/net/bnxt/tf_core/tf_device_p58.c...
error: drivers/net/bnxt/tf_core/tf_device_p58.c: does not exist in index
Checking patch drivers/net/bnxt/tf_core/tf_identifier.c...
error: while searching for:
			db_rc[i] = tf_rm_create_db(tfp, &db_cfg);
		if (db_rc[i]) {
			TFP_DRV_LOG(INFO,
				    "%s: Identifier DB creation failed\n",
				    tf_dir_2_str(i));
		}


error: patch failed: drivers/net/bnxt/tf_core/tf_identifier.c:76
Checking patch drivers/net/bnxt/tf_core/tf_tbl.c...
error: while searching for:
			db_rc[d] = tf_rm_create_db(tfp, &db_cfg);
		if (db_rc[d]) {
			TFP_DRV_LOG(ERR,
				    "%s: Table DB creation failed\n",
				    tf_dir_2_str(d));

		}

error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:85
error: while searching for:
	}
	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;


	/* check if reserved resource for WC is multiple of num_slices */
	for (d = 0; d < TF_DIR_MAX; d++) {
		ainfo.rm_db = tbl_db->tbl_db[d];

error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:656
error: while searching for:
		}
	}



	return 0;
}

error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:693
Checking patch drivers/net/bnxt/tf_core/tf_tcam.c...
error: while searching for:
			db_rc[d] = tf_rm_create_db(tfp, &db_cfg);
		if (db_rc[d]) {
			TFP_DRV_LOG(INFO,
				    "%s: TCAM DB creation failed\n",
				    tf_dir_2_str(d));
		}
	}

error: patch failed: drivers/net/bnxt/tf_core/tf_tcam.c:115
error: while searching for:

	/* check if reserved resource for WC is multiple of num_slices */
	for (d = 0; d < TF_DIR_MAX; d++) {
		memset(&info, 0, sizeof(info));
		ainfo.rm_db = tcam_db->tcam_db[d];
		ainfo.subtype = TF_TCAM_TBL_TYPE_WC_TCAM;

error: patch failed: drivers/net/bnxt/tf_core/tf_tcam.c:126
Checking patch drivers/net/bnxt/tf_core/tf_tcam_shared.c...
Checking patch drivers/net/bnxt/tf_core/tf_tcam_shared.h...
Checking patch drivers/net/bnxt/tf_core/tf_util.c...
Applying patch drivers/net/bnxt/tf_core/tf_core.h with 1 reject...
Hunk #1 applied cleanly.
Hunk #2 applied cleanly.
Rejected hunk #3.
Hunk #4 applied cleanly.
Hunk #5 applied cleanly.
Hunk #6 applied cleanly.
Applying patch drivers/net/bnxt/tf_core/tf_device.c with 6 rejects...
Rejected hunk #1.
Hunk #2 applied cleanly.
Rejected hunk #3.
Rejected hunk #4.
Rejected hunk #5.
Rejected hunk #6.
Rejected hunk #7.
Applying patch drivers/net/bnxt/tf_core/tf_device.h with 1 reject...
Hunk #1 applied cleanly.
Rejected hunk #2.
Applying patch drivers/net/bnxt/tf_core/tf_device_p4.c with 1 reject...
Hunk #1 applied cleanly.
Hunk #2 applied cleanly.
Rejected hunk #3.
Applying patch drivers/net/bnxt/tf_core/tf_identifier.c with 1 reject...
Rejected hunk #1.
Applying patch drivers/net/bnxt/tf_core/tf_tbl.c with 3 rejects...
Rejected hunk #1.
Rejected hunk #2.
Rejected hunk #3.
Applying patch drivers/net/bnxt/tf_core/tf_tcam.c with 2 rejects...
Rejected hunk #1.
Rejected hunk #2.
Applied patch drivers/net/bnxt/tf_core/tf_tcam_shared.c cleanly.
Applied patch drivers/net/bnxt/tf_core/tf_tcam_shared.h cleanly.
Applied patch drivers/net/bnxt/tf_core/tf_util.c cleanly.
diff a/drivers/net/bnxt/tf_core/tf_core.h b/drivers/net/bnxt/tf_core/tf_core.h	(rejected hunks)
@@ -198,7 +196,6 @@ enum tf_module_type {
 	TF_MODULE_TYPE_MAX
 };
 
-
 /**
  * Identifier resource types
  */
diff a/drivers/net/bnxt/tf_core/tf_device.c b/drivers/net/bnxt/tf_core/tf_device.c	(rejected hunks)
@@ -9,6 +9,9 @@
 #include "tfp.h"
 #include "tf_em.h"
 #include "tf_rm.h"
+#ifdef TF_TCAM_SHARED
+#include "tf_tcam_shared.h"
+#endif /* TF_TCAM_SHARED */
 
 struct tf;
 
@@ -142,7 +151,11 @@ tf_dev_bind_p4(struct tf *tfp,
 		tcam_cfg.cfg = tf_tcam_p4;
 		tcam_cfg.shadow_copy = shadow_copy;
 		tcam_cfg.resources = resources;
+#ifdef TF_TCAM_SHARED
+		rc = tf_tcam_shared_bind(tfp, &tcam_cfg);
+#else /* !TF_TCAM_SHARED */
 		rc = tf_tcam_bind(tfp, &tcam_cfg);
+#endif
 		if (rc) {
 			TFP_DRV_LOG(ERR,
 				    "TCAM initialization failure\n");
@@ -203,31 +216,32 @@ tf_dev_bind_p4(struct tf *tfp,
 		return -ENOMEM;
 	}
 
-	/*
-	 * IF_TBL
-	 */
-	if_tbl_cfg.num_elements = TF_IF_TBL_TYPE_MAX;
-	if_tbl_cfg.cfg = tf_if_tbl_p4;
-	if_tbl_cfg.shadow_copy = shadow_copy;
-	rc = tf_if_tbl_bind(tfp, &if_tbl_cfg);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "IF Table initialization failure\n");
-		goto fail;
-	}
+	if (!tf_session_is_shared_session(tfs)) {
+		/*
+		 * IF_TBL
+		 */
+		if_tbl_cfg.num_elements = TF_IF_TBL_TYPE_MAX;
+		if_tbl_cfg.cfg = tf_if_tbl_p4;
+		if_tbl_cfg.shadow_copy = shadow_copy;
+		rc = tf_if_tbl_bind(tfp, &if_tbl_cfg);
+		if (rc) {
+			TFP_DRV_LOG(ERR,
+				    "IF Table initialization failure\n");
+			goto fail;
+		}
 
-	/*
-	 * GLOBAL_CFG
-	 */
-	global_cfg.num_elements = TF_GLOBAL_CFG_TYPE_MAX;
-	global_cfg.cfg = tf_global_cfg_p4;
-	rc = tf_global_cfg_bind(tfp, &global_cfg);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Global Cfg initialization failure\n");
-		goto fail;
+		/*
+		 * GLOBAL_CFG
+		 */
+		global_cfg.num_elements = TF_GLOBAL_CFG_TYPE_MAX;
+		global_cfg.cfg = tf_global_cfg_p4;
+		rc = tf_global_cfg_bind(tfp, &global_cfg);
+		if (rc) {
+			TFP_DRV_LOG(ERR,
+				    "Global Cfg initialization failure\n");
+			goto fail;
+		}
 	}
-
 	/* Final function initialization */
 	dev_handle->ops = &tf_dev_ops_p4;
 
@@ -265,7 +279,11 @@ tf_dev_unbind_p4(struct tf *tfp)
 	 * In case of residuals TCAMs are cleaned up first as to
 	 * invalidate the pipeline in a clean manner.
 	 */
+#ifdef TF_TCAM_SHARED
+	rc = tf_tcam_shared_unbind(tfp);
+#else /* !TF_TCAM_SHARED */
 	rc = tf_tcam_unbind(tfp);
+#endif /* TF_TCAM_SHARED */
 	if (rc) {
 		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, TCAM\n");
@@ -407,7 +425,11 @@ tf_dev_bind_p58(struct tf *tfp,
 		tcam_cfg.cfg = tf_tcam_p58;
 		tcam_cfg.shadow_copy = shadow_copy;
 		tcam_cfg.resources = resources;
+#ifdef TF_TCAM_SHARED
+		rc = tf_tcam_shared_bind(tfp, &tcam_cfg);
+#else /* !TF_TCAM_SHARED */
 		rc = tf_tcam_bind(tfp, &tcam_cfg);
+#endif
 		if (rc) {
 			TFP_DRV_LOG(ERR,
 				    "TCAM initialization failure\n");
@@ -517,7 +539,11 @@ tf_dev_unbind_p58(struct tf *tfp)
 	 * In case of residuals TCAMs are cleaned up first as to
 	 * invalidate the pipeline in a clean manner.
 	 */
+#ifdef TF_TCAM_SHARED
+	rc = tf_tcam_shared_unbind(tfp);
+#else /* !TF_TCAM_SHARED */
 	rc = tf_tcam_unbind(tfp);
+#endif /* TF_TCAM_SHARED */
 	if (rc) {
 		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, TCAM\n");
diff a/drivers/net/bnxt/tf_core/tf_device.h b/drivers/net/bnxt/tf_core/tf_device.h	(rejected hunks)
@@ -136,7 +139,6 @@ struct tf_dev_ops {
 				       uint16_t resource_id,
 				       const char **resource_str);
 
-
 	/**
 	 * Retrieves the WC TCAM slice information that the device
 	 * supports.
diff a/drivers/net/bnxt/tf_core/tf_device_p4.c b/drivers/net/bnxt/tf_core/tf_device_p4.c	(rejected hunks)
@@ -263,11 +267,18 @@ const struct tf_dev_ops tf_dev_ops_p4 = {
 	.tf_dev_get_tbl = tf_tbl_get,
 	.tf_dev_get_bulk_tbl = tf_tbl_bulk_get,
 	.tf_dev_get_tbl_resc_info = tf_tbl_get_resc_info,
+#ifdef TF_TCAM_SHARED
+	.tf_dev_alloc_tcam = tf_tcam_shared_alloc,
+	.tf_dev_free_tcam = tf_tcam_shared_free,
+	.tf_dev_set_tcam = tf_tcam_shared_set,
+	.tf_dev_get_tcam = tf_tcam_shared_get,
+#else /* !TF_TCAM_SHARED */
 	.tf_dev_alloc_tcam = tf_tcam_alloc,
 	.tf_dev_free_tcam = tf_tcam_free,
-	.tf_dev_alloc_search_tcam = tf_tcam_alloc_search,
 	.tf_dev_set_tcam = tf_tcam_set,
-	.tf_dev_get_tcam = NULL,
+	.tf_dev_get_tcam = tf_tcam_get,
+#endif
+	.tf_dev_alloc_search_tcam = tf_tcam_alloc_search,
 	.tf_dev_get_tcam_resc_info = tf_tcam_get_resc_info,
 	.tf_dev_insert_int_em_entry = tf_em_insert_int_entry,
 	.tf_dev_delete_int_em_entry = tf_em_delete_int_entry,
diff a/drivers/net/bnxt/tf_core/tf_identifier.c b/drivers/net/bnxt/tf_core/tf_identifier.c	(rejected hunks)
@@ -76,7 +76,7 @@ tf_ident_bind(struct tf *tfp,
 			db_rc[i] = tf_rm_create_db(tfp, &db_cfg);
 		if (db_rc[i]) {
 			TFP_DRV_LOG(INFO,
-				    "%s: Identifier DB creation failed\n",
+				    "%s: No Identifier DB required\n",
 				    tf_dir_2_str(i));
 		}
 
diff a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c	(rejected hunks)
@@ -85,7 +85,7 @@ tf_tbl_bind(struct tf *tfp,
 			db_rc[d] = tf_rm_create_db(tfp, &db_cfg);
 		if (db_rc[d]) {
 			TFP_DRV_LOG(ERR,
-				    "%s: Table DB creation failed\n",
+				    "%s: No Table DB creation required\n",
 				    tf_dir_2_str(d));
 
 		}
@@ -656,7 +656,6 @@ tf_tbl_get_resc_info(struct tf *tfp,
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
 
-
 	/* check if reserved resource for WC is multiple of num_slices */
 	for (d = 0; d < TF_DIR_MAX; d++) {
 		ainfo.rm_db = tbl_db->tbl_db[d];
@@ -693,7 +692,5 @@ tf_tbl_get_resc_info(struct tf *tfp,
 		}
 	}
 
-
-
 	return 0;
 }
diff a/drivers/net/bnxt/tf_core/tf_tcam.c b/drivers/net/bnxt/tf_core/tf_tcam.c	(rejected hunks)
@@ -115,7 +115,7 @@ tf_tcam_bind(struct tf *tfp,
 			db_rc[d] = tf_rm_create_db(tfp, &db_cfg);
 		if (db_rc[d]) {
 			TFP_DRV_LOG(INFO,
-				    "%s: TCAM DB creation failed\n",
+				    "%s: no TCAM DB required\n",
 				    tf_dir_2_str(d));
 		}
 	}
@@ -126,6 +126,9 @@ tf_tcam_bind(struct tf *tfp,
 
 	/* check if reserved resource for WC is multiple of num_slices */
 	for (d = 0; d < TF_DIR_MAX; d++) {
+		if (!tcam_db->tcam_db[d])
+			continue;
+
 		memset(&info, 0, sizeof(info));
 		ainfo.rm_db = tcam_db->tcam_db[d];
 		ainfo.subtype = TF_TCAM_TBL_TYPE_WC_TCAM;