drivers: use PCI registration macro
[dpdk.git] / drivers / net / i40e / i40e_ethdev_vf.c
index 1a04c74..8177626 100644 (file)
@@ -1110,9 +1110,12 @@ i40evf_get_link_status(struct rte_eth_dev *dev, struct rte_eth_link *link)
 }
 
 static const struct rte_pci_id pci_id_i40evf_map[] = {
-#define RTE_PCI_DEV_ID_DECL_I40EVF(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
-#include "rte_pci_dev_ids.h"
-{ .vendor_id = 0, /* sentinel */ },
+       { RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_VF) },
+       { RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_VF_HV) },
+       { RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_X722_A0_VF) },
+       { RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_X722_VF) },
+       { RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_X722_VF_HV) },
+       { .vendor_id = 0, /* sentinel */ },
 };
 
 static inline int
@@ -1554,35 +1557,16 @@ static struct eth_driver rte_i40evf_pmd = {
                .name = "rte_i40evf_pmd",
                .id_table = pci_id_i40evf_map,
                .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+               .probe = rte_eth_dev_pci_probe,
+               .remove = rte_eth_dev_pci_remove,
        },
        .eth_dev_init = i40evf_dev_init,
        .eth_dev_uninit = i40evf_dev_uninit,
        .dev_private_size = sizeof(struct i40e_adapter),
 };
 
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI Fortville devices.
- */
-static int
-rte_i40evf_pmd_init(const char *name __rte_unused,
-                   const char *params __rte_unused)
-{
-       PMD_INIT_FUNC_TRACE();
-
-       rte_eth_driver_register(&rte_i40evf_pmd);
-
-       return 0;
-}
-
-static struct rte_driver rte_i40evf_driver = {
-       .type = PMD_PDEV,
-       .init = rte_i40evf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40evf_driver, i40evf);
-DRIVER_REGISTER_PCI_TABLE(i40evf, pci_id_i40evf_map);
+DRIVER_REGISTER_PCI(net_i40e_vf, rte_i40evf_pmd.pci_drv);
+DRIVER_REGISTER_PCI_TABLE(net_i40e_vf, pci_id_i40evf_map);
 
 static int
 i40evf_dev_configure(struct rte_eth_dev *dev)
@@ -2378,13 +2362,16 @@ i40evf_get_rss_lut(struct i40e_vsi *vsi, uint8_t *lut, uint16_t lut_size)
 static int
 i40evf_set_rss_lut(struct i40e_vsi *vsi, uint8_t *lut, uint16_t lut_size)
 {
-       struct i40e_vf *vf = I40E_VSI_TO_VF(vsi);
-       struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
+       struct i40e_vf *vf;
+       struct i40e_hw *hw;
        int ret;
 
        if (!vsi || !lut)
                return -EINVAL;
 
+       vf = I40E_VSI_TO_VF(vsi);
+       hw = I40E_VSI_TO_HW(vsi);
+
        if (vf->flags & I40E_FLAG_RSS_AQ_CAPABLE) {
                ret = i40e_aq_set_rss_lut(hw, vsi->vsi_id, FALSE,
                                          lut, lut_size);