DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Long Wu <long.wu@corigine.com>,
	Peng Zhang <peng.zhang@corigine.com>,
	Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH 5/6] net/nfp: add CPP service enable option
Date: Wed, 19 Jun 2024 11:06:54 +0800	[thread overview]
Message-ID: <20240619030655.3216268-6-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20240619030655.3216268-1-chaoyong.he@corigine.com>

From: Long Wu <long.wu@corigine.com>

The CPP service is not necessary for NFP PMD,
so add an option as the switch of it.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 doc/guides/nics/nfp.rst          |  9 +++++++++
 drivers/net/nfp/nfp_ethdev.c     | 21 ++++++++++++++++-----
 drivers/net/nfp/nfp_net_common.h |  3 +++
 3 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/doc/guides/nics/nfp.rst b/doc/guides/nics/nfp.rst
index 22692bedc0..ed9548de0b 100644
--- a/doc/guides/nics/nfp.rst
+++ b/doc/guides/nics/nfp.rst
@@ -246,6 +246,15 @@ NFP devargs
       firmware option, only the first one will cause the firmware reload
       and the second one will be ignored.
 
+- ``cpp_service_enable`` (default **0**)
+
+   The NFP PF PMD supports enable CPP service. For example, user let a PF with
+   PCI ID 0000:af:00.0 enable CPP service by:
+
+   .. code-block:: console
+
+      -a af:00.0,cpp_service_enable=1 -- -i
+
 Metadata Format
 ---------------
 
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 76bbaf1f50..696a301650 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -34,6 +34,7 @@
 
 #define NFP_PF_DRIVER_NAME net_nfp_pf
 #define NFP_PF_FORCE_RELOAD_FW   "force_reload_fw"
+#define NFP_CPP_SERVICE_ENABLE   "cpp_service_enable"
 
 struct nfp_net_init {
 	/** Sequential physical port number, only valid for CoreNIC firmware */
@@ -121,6 +122,11 @@ nfp_devargs_parse(struct nfp_devargs *nfp_devargs_param,
 	if (ret != 0)
 		goto exit;
 
+	ret = nfp_devarg_parse_bool_para(kvlist, NFP_CPP_SERVICE_ENABLE,
+			&nfp_devargs_param->cpp_service_enable);
+	if (ret != 0)
+		goto exit;
+
 exit:
 	rte_kvargs_free(kvlist);
 
@@ -641,7 +647,8 @@ nfp_pf_uninit(struct nfp_net_hw_priv *hw_priv)
 {
 	struct nfp_pf_dev *pf_dev = hw_priv->pf_dev;
 
-	nfp_disable_cpp_service(pf_dev);
+	if (pf_dev->devargs.cpp_service_enable)
+		nfp_disable_cpp_service(pf_dev);
 	nfp_cpp_area_release_free(pf_dev->mac_stats_area);
 	nfp_cpp_area_release_free(pf_dev->qc_area);
 	free(pf_dev->sym_tbl);
@@ -1993,9 +2000,11 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
 	}
 
 	/* Register the CPP bridge service here for primary use */
-	ret = nfp_enable_cpp_service(pf_dev);
-	if (ret != 0)
-		PMD_INIT_LOG(INFO, "Enable cpp service failed.");
+	if (pf_dev->devargs.cpp_service_enable) {
+		ret = nfp_enable_cpp_service(pf_dev);
+		if (ret != 0)
+			PMD_INIT_LOG(INFO, "Enable cpp service failed.");
+	}
 
 	return 0;
 
@@ -2302,4 +2311,6 @@ static struct rte_pci_driver rte_nfp_net_pf_pmd = {
 RTE_PMD_REGISTER_PCI(NFP_PF_DRIVER_NAME, rte_nfp_net_pf_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(NFP_PF_DRIVER_NAME, pci_id_nfp_pf_net_map);
 RTE_PMD_REGISTER_KMOD_DEP(NFP_PF_DRIVER_NAME, "* igb_uio | uio_pci_generic | vfio");
-RTE_PMD_REGISTER_PARAM_STRING(NFP_PF_DRIVER_NAME, NFP_PF_FORCE_RELOAD_FW "=<0|1>");
+RTE_PMD_REGISTER_PARAM_STRING(NFP_PF_DRIVER_NAME,
+		NFP_PF_FORCE_RELOAD_FW "=<0|1>"
+		NFP_CPP_SERVICE_ENABLE "=<0|1>");
diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index 8d9851f969..2feeb6f5bd 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -94,6 +94,9 @@ struct nfp_process_share {
 struct nfp_devargs {
 	/** Force reload firmware */
 	bool force_reload_fw;
+
+	/** Enable CPP bridge service */
+	bool cpp_service_enable;
 };
 
 struct nfp_pf_dev {
-- 
2.39.1


  parent reply	other threads:[~2024-06-19  3:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-19  3:06 [PATCH 0/6] refactor the service module Chaoyong He
2024-06-19  3:06 ` [PATCH 1/6] net/nfp: fix check logic for device arguments Chaoyong He
2024-06-19  3:06 ` [PATCH 2/6] net/nfp: remove redundant NFP service code Chaoyong He
2024-06-19  3:06 ` [PATCH 3/6] net/nfp: remove the flower service dead loop Chaoyong He
2024-06-19  3:06 ` [PATCH 4/6] net/nfp: fix disable CPP service Chaoyong He
2024-06-19  3:06 ` Chaoyong He [this message]
2024-06-19  3:06 ` [PATCH 6/6] net/nfp: add CPP service abnormal exit logic Chaoyong He
2024-07-06 18:51 ` [PATCH 0/6] refactor the service module 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=20240619030655.3216268-6-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=long.wu@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=peng.zhang@corigine.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).