From: Long Wu <long...@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...@corigine.com> Reviewed-by: Peng Zhang <peng.zh...@corigine.com> Reviewed-by: Chaoyong He <chaoyong...@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