DPDK patches and discussions
 help / color / mirror / Atom feed
From: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
To: dev@dpdk.org
Cc: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Subject: [dpdk-dev] [PATCH 14/14] net/bnxt: add support for testpmd co-existence
Date: Wed,  1 Sep 2021 19:54:33 +0530	[thread overview]
Message-ID: <20210901142433.8444-15-venkatkumar.duvvuru@broadcom.com> (raw)
In-Reply-To: <20210901142433.8444-1-venkatkumar.duvvuru@broadcom.com>

Currently, testpmd support in ULP is enabled only during compilation
time. This patch adds support for testpmd during runtime using
devarg "testpmd".

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
---
 drivers/net/bnxt/bnxt.h                 |  3 ++
 drivers/net/bnxt/bnxt_ethdev.c          | 56 +++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c      |  5 +++
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c |  4 +-
 4 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 494a1eff37..c9adc66fda 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -722,6 +722,9 @@ struct bnxt {
 	((bp)->flags2 & BNXT_FLAGS2_PTP_TIMESYNC_ENABLED)
 #define	BNXT_ACCUM_STATS_EN(bp)			\
 	((bp)->flags2 & BNXT_FLAGS2_ACCUM_STATS_EN)
+#define	BNXT_FLAGS2_TESTPMD_EN			BIT(3)
+#define	BNXT_TESTPMD_EN(bp)			\
+	((bp)->flags2 & BNXT_FLAGS2_TESTPMD_EN)
 
 	uint16_t		chip_num;
 #define CHIP_NUM_58818		0xd818
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index de34a2f0bb..20c5b12b53 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -98,6 +98,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
 #define BNXT_DEVARG_REP_FC_R2F  "rep-fc-r2f"
 #define BNXT_DEVARG_REP_FC_F2R  "rep-fc-f2r"
 #define BNXT_DEVARG_APP_ID	"app-id"
+#define	BNXT_DEVARG_TESTPMD	"testpmd"
 
 static const char *const bnxt_dev_args[] = {
 	BNXT_DEVARG_REPRESENTOR,
@@ -111,9 +112,17 @@ static const char *const bnxt_dev_args[] = {
 	BNXT_DEVARG_REP_FC_R2F,
 	BNXT_DEVARG_REP_FC_F2R,
 	BNXT_DEVARG_APP_ID,
+	BNXT_DEVARG_TESTPMD,
 	NULL
 };
 
+/*
+ * testpmd == false to disable
+ * testpmd == true to enable
+ */
+#define	BNXT_DEVARG_TESTPMD_INVALID(truflow)		((testpmd) > 1)
+
+
 /*
  * accum-stats == false to disable flow counter accumulation
  * accum-stats == true to enable flow counter accumulation
@@ -5853,6 +5862,44 @@ bnxt_parse_devarg_rep_fc_f2r(__rte_unused const char *key,
 	return 0;
 }
 
+static int
+bnxt_parse_devarg_testpmd(__rte_unused const char *key,
+			  const char *value, void *opaque_arg)
+{
+	struct bnxt *bp = opaque_arg;
+	unsigned long testpmd;
+	char *end = NULL;
+
+	if (!value || !opaque_arg) {
+		PMD_DRV_LOG(ERR,
+			    "Invalid parameter passed to testpmd devargs.\n");
+		return -EINVAL;
+	}
+
+	testpmd = strtoul(value, &end, 10);
+	if (end == NULL || *end != '\0' ||
+	    (testpmd == ULONG_MAX && errno == ERANGE)) {
+		PMD_DRV_LOG(ERR,
+			    "Invalid parameter passed to testpmd devargs.\n");
+		return -EINVAL;
+	}
+
+	if (BNXT_DEVARG_TESTPMD_INVALID(testpmd)) {
+		PMD_DRV_LOG(ERR,
+			    "Invalid value passed to testpmd devargs.\n");
+		return -EINVAL;
+	}
+
+	if (testpmd) {
+		bp->flags2 |= BNXT_FLAGS2_TESTPMD_EN;
+		PMD_DRV_LOG(INFO, "Host-based testpmd feature enabled.\n");
+	} else {
+		bp->flags2 &= ~BNXT_FLAGS2_TESTPMD_EN;
+		PMD_DRV_LOG(INFO, "Host-based testpmd feature disabled.\n");
+	}
+
+	return 0;
+}
 static int
 bnxt_parse_dev_args(struct bnxt *bp, struct rte_devargs *devargs)
 {
@@ -5890,6 +5937,15 @@ bnxt_parse_dev_args(struct bnxt *bp, struct rte_devargs *devargs)
 	if (ret)
 		goto err;
 
+	/*
+	 * Handler for "testpmd" devarg.
+	 * Invoked as for ex: "-a 0000:00:0d.0,testpmd=1"
+	 */
+	ret = rte_kvargs_process(kvlist, BNXT_DEVARG_TESTPMD,
+				 bnxt_parse_devarg_testpmd, bp);
+	if (ret)
+		goto err;
+
 err:
 	/*
 	 * Handler for "app-id" devarg.
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
index 3b86410fb1..2ad662fb17 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
@@ -844,6 +844,11 @@ ulp_ctx_init(struct bnxt *bp,
 		goto error_deinit;
 	}
 
+	if (BNXT_TESTPMD_EN(bp)) {
+		ulp_data->ulp_flags &= ~BNXT_ULP_VF_REP_ENABLED;
+		BNXT_TF_DBG(ERR, "Enabled Testpmd forward mode\n");
+	}
+
 	/*
 	 * Shared session must be created before first regular session but after
 	 * the ulp_ctx is valid.
diff --git a/drivers/net/bnxt/tf_ulp/ulp_def_rules.c b/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
index d8336d164e..827fe30acd 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
@@ -526,8 +526,10 @@ bnxt_ulp_create_df_rules(struct bnxt *bp)
 	rc = ulp_default_flow_db_cfa_action_get(bp->ulp_ctx,
 						info->def_port_flow_id,
 						&bp->tx_cfa_action);
-	if (rc)
+
+	if (rc || BNXT_TESTPMD_EN(bp))
 		bp->tx_cfa_action = 0;
+
 	info->valid = true;
 	return 0;
 }
-- 
2.17.1


  parent reply	other threads:[~2021-09-01 14:26 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01 14:24 [dpdk-dev] [PATCH 00/14] enhancements to host based flow table management Venkat Duvvuru
2021-09-01 14:24 ` [dpdk-dev] [PATCH 01/14] net/bnxt: tf core index table updates Venkat Duvvuru
2021-09-01 14:24 ` [dpdk-dev] [PATCH 02/14] net/bnxt: enable dpool allocator Venkat Duvvuru
2021-09-01 14:24 ` [dpdk-dev] [PATCH 03/14] net/bnxt: add flow meter drop counter support Venkat Duvvuru
2021-09-01 14:24 ` [dpdk-dev] [PATCH 04/14] net/bnxt: add Thor SRAM mgr model Venkat Duvvuru
2021-09-01 14:24 ` [dpdk-dev] [PATCH 05/14] net/bnxt: add flow templates support for Thor Venkat Duvvuru
2021-09-01 14:24 ` [dpdk-dev] [PATCH 06/14] net/bnxt: add support for tunnel offloads Venkat Duvvuru
2021-09-01 14:24 ` [dpdk-dev] [PATCH 07/14] net/bnxt: add support for dynamic encap action Venkat Duvvuru
2021-09-01 14:24 ` [dpdk-dev] [PATCH 08/14] net/bnxt: add wild card TCAM byte order for Thor Venkat Duvvuru
2021-09-01 14:24 ` [dpdk-dev] [PATCH 09/14] net/bnxt: add flow templates " Venkat Duvvuru
2021-09-01 14:24 ` [dpdk-dev] [PATCH 10/14] net/bnxt: tf core SRAM Manager Venkat Duvvuru
2021-09-01 14:24 ` [dpdk-dev] [PATCH 11/14] net/bnxt: dynamically allocate space for EM defrag function Venkat Duvvuru
2021-09-01 14:24 ` [dpdk-dev] [PATCH 12/14] net/bnxt: sram manager shared session Venkat Duvvuru
2021-09-01 14:24 ` [dpdk-dev] [PATCH 13/14] net/bnxt: add enhancements to TF ULP Venkat Duvvuru
2021-09-01 14:24 ` Venkat Duvvuru [this message]
2021-09-08  5:06 ` [dpdk-dev] [PATCH v2 00/13] enhancements to host based flow table management Venkat Duvvuru
2021-09-08  5:06   ` [dpdk-dev] [PATCH v2 01/13] net/bnxt: tf core index table updates Venkat Duvvuru
2021-09-08  5:06   ` [dpdk-dev] [PATCH v2 02/13] net/bnxt: enable dpool allocator Venkat Duvvuru
2021-09-08  5:06   ` [dpdk-dev] [PATCH v2 03/13] net/bnxt: add flow meter drop counter support Venkat Duvvuru
2021-09-08  5:06   ` [dpdk-dev] [PATCH v2 04/13] net/bnxt: add Thor SRAM mgr model Venkat Duvvuru
2021-09-08  5:06   ` [dpdk-dev] [PATCH v2 05/13] net/bnxt: add flow templates support for Thor Venkat Duvvuru
2021-09-08  5:06   ` [dpdk-dev] [PATCH v2 06/13] net/bnxt: add support for tunnel offloads Venkat Duvvuru
2021-09-08  5:06   ` [dpdk-dev] [PATCH v2 07/13] net/bnxt: add support for dynamic encap action Venkat Duvvuru
2021-09-08  5:06   ` [dpdk-dev] [PATCH v2 08/13] net/bnxt: add wild card TCAM byte order for Thor Venkat Duvvuru
2021-09-08  5:06   ` [dpdk-dev] [PATCH v2 09/13] net/bnxt: add flow templates " Venkat Duvvuru
2021-09-08  5:06   ` [dpdk-dev] [PATCH v2 10/13] net/bnxt: tf core SRAM Manager Venkat Duvvuru
2021-09-08  5:06   ` [dpdk-dev] [PATCH v2 11/13] net/bnxt: dynamically allocate space for EM defrag function Venkat Duvvuru
2021-09-08  5:06   ` [dpdk-dev] [PATCH v2 12/13] net/bnxt: sram manager shared session Venkat Duvvuru
2021-09-08  5:06   ` [dpdk-dev] [PATCH v2 13/13] net/bnxt: add enhancements to TF ULP Venkat Duvvuru
2021-09-11 15:30   ` [dpdk-dev] [PATCH v3 00/13] enhancements to host based flow table management Venkat Duvvuru
2021-09-11 15:30     ` [dpdk-dev] [PATCH v3 01/13] net/bnxt: tf core index table updates Venkat Duvvuru
2021-09-16 13:47       ` Ferruh Yigit
2021-09-16 15:51         ` Ajit Khaparde
2021-09-11 15:30     ` [dpdk-dev] [PATCH v3 02/13] net/bnxt: enable dpool allocator Venkat Duvvuru
2021-09-11 15:30     ` [dpdk-dev] [PATCH v3 03/13] net/bnxt: add flow meter drop counter support Venkat Duvvuru
2021-09-11 15:30     ` [dpdk-dev] [PATCH v3 04/13] net/bnxt: add Thor SRAM mgr model Venkat Duvvuru
2021-09-16 13:49       ` Ferruh Yigit
2021-09-16 14:01         ` Bruce Richardson
2021-09-16 14:04           ` Thomas Monjalon
2021-09-16 16:29         ` Venkat Duvvuru
2021-09-16 16:30           ` Ferruh Yigit
2021-09-11 15:30     ` [dpdk-dev] [PATCH v3 05/13] net/bnxt: add flow templates support for Thor Venkat Duvvuru
2021-09-11 15:30     ` [dpdk-dev] [PATCH v3 06/13] net/bnxt: add support for tunnel offloads Venkat Duvvuru
2021-09-11 15:30     ` [dpdk-dev] [PATCH v3 07/13] net/bnxt: add support for dynamic encap action Venkat Duvvuru
2021-09-11 15:30     ` [dpdk-dev] [PATCH v3 08/13] net/bnxt: add wild card TCAM byte order for Thor Venkat Duvvuru
2021-09-11 15:30     ` [dpdk-dev] [PATCH v3 09/13] net/bnxt: add flow templates " Venkat Duvvuru
2021-09-11 15:30     ` [dpdk-dev] [PATCH v3 10/13] net/bnxt: tf core SRAM Manager Venkat Duvvuru
2021-09-11 15:30     ` [dpdk-dev] [PATCH v3 11/13] net/bnxt: dynamically allocate space for EM defrag function Venkat Duvvuru
2021-09-16 13:53       ` Ferruh Yigit
2021-09-11 15:30     ` [dpdk-dev] [PATCH v3 12/13] net/bnxt: sram manager shared session Venkat Duvvuru
2021-09-11 15:30     ` [dpdk-dev] [PATCH v3 13/13] net/bnxt: add enhancements to TF ULP Venkat Duvvuru
2021-09-16 14:06       ` Ferruh Yigit
2021-09-16  3:25     ` [dpdk-dev] [PATCH v3 00/13] enhancements to host based flow table management Ajit Khaparde
2021-09-16 13:26     ` Ferruh Yigit
2021-09-16 14:17       ` Brandon Lo
2021-09-16 16:18       ` Ajit Khaparde
2021-09-20  7:42   ` [dpdk-dev] [PATCH v4 " Venkat Duvvuru
2021-09-20  7:42     ` [dpdk-dev] [PATCH v4 01/13] net/bnxt: updates to TF core index table Venkat Duvvuru
2021-09-20  7:42     ` [dpdk-dev] [PATCH v4 02/13] net/bnxt: enable dpool allocator Venkat Duvvuru
2021-09-20  7:42     ` [dpdk-dev] [PATCH v4 03/13] net/bnxt: add flow meter drop counter support Venkat Duvvuru
2021-09-20  7:42     ` [dpdk-dev] [PATCH v4 04/13] net/bnxt: add SRAM manager model Venkat Duvvuru
2021-09-20  7:42     ` [dpdk-dev] [PATCH v4 05/13] net/bnxt: add flow template support for Thor Venkat Duvvuru
2021-09-20  7:42     ` [dpdk-dev] [PATCH v4 06/13] net/bnxt: add support for tunnel offload API Venkat Duvvuru
2021-09-28 12:43       ` Ferruh Yigit
2021-09-28 15:46         ` Thomas Monjalon
2021-09-28 15:57           ` Ferruh Yigit
2021-09-28 21:32         ` Ajit Khaparde
2021-09-29  8:20           ` Thomas Monjalon
2021-09-29  9:44             ` Ferruh Yigit
2021-09-29 16:44               ` Ajit Khaparde
2021-09-20  7:42     ` [dpdk-dev] [PATCH v4 07/13] net/bnxt: add support for dynamic encap action Venkat Duvvuru
2021-09-20  7:42     ` [dpdk-dev] [PATCH v4 08/13] net/bnxt: add wild card TCAM byte order for Thor Venkat Duvvuru
2021-09-20  7:42     ` [dpdk-dev] [PATCH v4 09/13] net/bnxt: add flow templates " Venkat Duvvuru
2021-09-20  7:42     ` [dpdk-dev] [PATCH v4 10/13] net/bnxt: change log level to debug Venkat Duvvuru
2021-09-20  7:42     ` [dpdk-dev] [PATCH v4 11/13] net/bnxt: dynamically allocate space for EM defrag function Venkat Duvvuru
2021-09-20  7:42     ` [dpdk-dev] [PATCH v4 12/13] net/bnxt: add SRAM manager shared session Venkat Duvvuru
2021-09-20  7:42     ` [dpdk-dev] [PATCH v4 13/13] net/bnxt: add enhancements to TF ULP Venkat Duvvuru
2021-09-21  4:50     ` [dpdk-dev] [PATCH v4 00/13] enhancements to host based flow table management Ajit Khaparde
2021-09-22 17:36       ` Ferruh Yigit
2021-09-22 20:21         ` Ajit Khaparde
2021-09-23  7:19           ` Ferruh Yigit
2021-09-25 14:24             ` [dpdk-dev] [PATCH] net/bnxt: remove code to initialize SRAM slice node Ajit Khaparde
2021-09-27 10:25               ` Ferruh Yigit

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=20210901142433.8444-15-venkatkumar.duvvuru@broadcom.com \
    --to=venkatkumar.duvvuru@broadcom.com \
    --cc=dev@dpdk.org \
    /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).