net/iavf: stop PCI probe in DCF mode
authorHaiyue Wang <haiyue.wang@intel.com>
Fri, 27 Mar 2020 02:56:35 +0000 (10:56 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 21 Apr 2020 11:57:05 +0000 (13:57 +0200)
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 <haiyue.wang@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/iavf/iavf_ethdev.c

index ee9f822..7a8bec9 100644 (file)
@@ -1419,9 +1419,51 @@ iavf_dev_uninit(struct rte_eth_dev *dev)
        return 0;
 }
 
+static int
+iavf_dcf_cap_check_handler(__rte_unused const char *key,
+                          const char *value, __rte_unused void *opaque)
+{
+       if (strcmp(value, "dcf"))
+               return -1;
+
+       return 0;
+}
+
+static int
+iavf_dcf_cap_selected(struct rte_devargs *devargs)
+{
+       struct rte_kvargs *kvlist;
+       const char *key = "cap";
+       int ret = 0;
+
+       if (devargs == NULL)
+               return 0;
+
+       kvlist = rte_kvargs_parse(devargs->args, NULL);
+       if (kvlist == NULL)
+               return 0;
+
+       if (!rte_kvargs_count(kvlist, key))
+               goto exit;
+
+       /* dcf capability selected when there's a key-value pair: cap=dcf */
+       if (rte_kvargs_process(kvlist, key,
+                              iavf_dcf_cap_check_handler, NULL) < 0)
+               goto exit;
+
+       ret = 1;
+
+exit:
+       rte_kvargs_free(kvlist);
+       return ret;
+}
+
 static int eth_iavf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
                             struct rte_pci_device *pci_dev)
 {
+       if (iavf_dcf_cap_selected(pci_dev->device.devargs))
+               return 1;
+
        return rte_eth_dev_pci_generic_probe(pci_dev,
                sizeof(struct iavf_adapter), iavf_dev_init);
 }
@@ -1442,6 +1484,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");