From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 02BE8A052E; Mon, 9 Mar 2020 15:22:34 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6A07E1C0B2; Mon, 9 Mar 2020 15:22:26 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id A52BE2BE6 for ; Mon, 9 Mar 2020 15:22:23 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Mar 2020 07:22:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,533,1574150400"; d="scan'208";a="235704311" Received: from npg-dpdk-haiyue-1.sh.intel.com ([10.67.119.213]) by orsmga008.jf.intel.com with ESMTP; 09 Mar 2020 07:22:21 -0700 From: Haiyue Wang To: dev@dpdk.org, xiaolong.ye@intel.com, qi.z.zhang@intel.com, qiming.yang@intel.com, beilei.xing@intel.com Cc: wei.zhao1@intel.com, Haiyue Wang Date: Mon, 9 Mar 2020 22:14:34 +0800 Message-Id: <20200309141437.11800-2-haiyue.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200309141437.11800-1-haiyue.wang@intel.com> References: <20200309141437.11800-1-haiyue.wang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v1 1/4] net/iavf: stop the PCI probe in DCF mode X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" A new DCF PMD will be introduced, which runs on Intel VF hardware, and it is a pure software design to control the advance functionality (such as switch, ACL) for rest of the VFs. So if the DCF (Device Config Function) mode is specified by the devarg 'cap=dcf', then it will stop the PCI probe in the iavf PMD. Signed-off-by: Haiyue Wang --- drivers/net/iavf/iavf_ethdev.c | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 34913f9c4..8ff26c0e7 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -1416,9 +1416,49 @@ iavf_dev_uninit(struct rte_eth_dev *dev) return 0; } +static int +handle_dcf_arg(__rte_unused const char *key, const char *value, + __rte_unused void *arg) +{ + bool *dcf = arg; + + if (arg == NULL || value == NULL) + return -EINVAL; + + if (strcmp(value, "dcf") == 0) + *dcf = true; + else + *dcf = false; + + return 0; +} + +static bool +check_cap_dcf_enable(struct rte_devargs *devargs) +{ + struct rte_kvargs *kvlist; + bool enable = false; + + if (devargs == NULL) + return false; + + kvlist = rte_kvargs_parse(devargs->args, NULL); + if (kvlist == NULL) + return false; + + rte_kvargs_process(kvlist, "cap", handle_dcf_arg, &enable); + + rte_kvargs_free(kvlist); + + return enable; +} + static int eth_iavf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, struct rte_pci_device *pci_dev) { + if (check_cap_dcf_enable(pci_dev->device.devargs)) + return 1; /* continue to probe */ + return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct iavf_adapter), iavf_dev_init); } @@ -1439,6 +1479,7 @@ static struct rte_pci_driver rte_iavf_pmd = { RTE_PMD_REGISTER_PCI(net_iavf, rte_iavf_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_iavf, pci_id_iavf_map); RTE_PMD_REGISTER_KMOD_DEP(net_iavf, "* igb_uio | vfio-pci"); +RTE_PMD_REGISTER_PARAM_STRING(net_iavf, "cap=dcf"); RTE_INIT(iavf_init_log) { iavf_logtype_init = rte_log_register("pmd.net.iavf.init"); -- 2.25.1