drivers/net: do not use ethdev driver
[dpdk.git] / drivers / net / ixgbe / ixgbe_ethdev.c
index 9d9f331..ef781ca 100644 (file)
@@ -56,6 +56,7 @@
 #include <rte_alarm.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
 #include <rte_atomic.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
 #define IXGBE_QDE_STRIP_TAG                    0x00000004
 #define IXGBE_VTEICR_MASK                      0x07
 
-enum ixgbevf_xcast_modes {
-       IXGBEVF_XCAST_MODE_NONE = 0,
-       IXGBEVF_XCAST_MODE_MULTI,
-       IXGBEVF_XCAST_MODE_ALLMULTI,
-};
-
 #define IXGBE_EXVET_VET_EXT_SHIFT              16
 #define IXGBE_DMATXCTL_VT_MASK                 0xFFFF0000
 
@@ -244,8 +239,7 @@ static int ixgbe_dev_rxq_interrupt_setup(struct rte_eth_dev *dev);
 static int ixgbe_dev_interrupt_get_status(struct rte_eth_dev *dev);
 static int ixgbe_dev_interrupt_action(struct rte_eth_dev *dev,
                                      struct rte_intr_handle *handle);
-static void ixgbe_dev_interrupt_handler(struct rte_intr_handle *handle,
-               void *param);
+static void ixgbe_dev_interrupt_handler(void *param);
 static void ixgbe_dev_interrupt_delayed_handler(void *param);
 static void ixgbe_add_rar(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
                uint32_t index, uint32_t pool);
@@ -253,7 +247,8 @@ static void ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index);
 static void ixgbe_set_default_mac_addr(struct rte_eth_dev *dev,
                                           struct ether_addr *mac_addr);
 static void ixgbe_dcb_init(struct ixgbe_hw *hw, struct ixgbe_dcb_config *dcb_config);
-static int is_ixgbe_pmd(const char *driver_name);
+static bool is_device_supported(struct rte_eth_dev *dev,
+                               struct rte_pci_driver *drv);
 
 /* For Virtual Function support */
 static int eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev);
@@ -309,9 +304,6 @@ static void ixgbevf_add_mac_addr(struct rte_eth_dev *dev,
 static void ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index);
 static void ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev,
                                             struct ether_addr *mac_addr);
-static int ixgbe_syn_filter_set(struct rte_eth_dev *dev,
-                       struct rte_eth_syn_filter *filter,
-                       bool add);
 static int ixgbe_syn_filter_get(struct rte_eth_dev *dev,
                        struct rte_eth_syn_filter *filter);
 static int ixgbe_syn_filter_handle(struct rte_eth_dev *dev,
@@ -321,17 +313,11 @@ static int ixgbe_add_5tuple_filter(struct rte_eth_dev *dev,
                        struct ixgbe_5tuple_filter *filter);
 static void ixgbe_remove_5tuple_filter(struct rte_eth_dev *dev,
                        struct ixgbe_5tuple_filter *filter);
-static int ixgbe_add_del_ntuple_filter(struct rte_eth_dev *dev,
-                       struct rte_eth_ntuple_filter *filter,
-                       bool add);
 static int ixgbe_ntuple_filter_handle(struct rte_eth_dev *dev,
                                enum rte_filter_op filter_op,
                                void *arg);
 static int ixgbe_get_ntuple_filter(struct rte_eth_dev *dev,
                        struct rte_eth_ntuple_filter *filter);
-static int ixgbe_add_del_ethertype_filter(struct rte_eth_dev *dev,
-                       struct rte_eth_ethertype_filter *filter,
-                       bool add);
 static int ixgbe_ethertype_filter_handle(struct rte_eth_dev *dev,
                                enum rte_filter_op filter_op,
                                void *arg);
@@ -374,8 +360,7 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev *dev,
                                   struct timespec *timestamp);
 static int ixgbe_timesync_write_time(struct rte_eth_dev *dev,
                                   const struct timespec *timestamp);
-static void ixgbevf_dev_interrupt_handler(struct rte_intr_handle *handle,
-                                         void *param);
+static void ixgbevf_dev_interrupt_handler(void *param);
 
 static int ixgbe_dev_l2_tunnel_eth_type_conf
        (struct rte_eth_dev *dev, struct rte_eth_l2_tunnel_conf *l2_tunnel);
@@ -562,6 +547,8 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
        .rx_queue_release     = ixgbe_dev_rx_queue_release,
        .rx_queue_count       = ixgbe_dev_rx_queue_count,
        .rx_descriptor_done   = ixgbe_dev_rx_descriptor_done,
+       .rx_descriptor_status = ixgbe_dev_rx_descriptor_status,
+       .tx_descriptor_status = ixgbe_dev_tx_descriptor_status,
        .tx_queue_setup       = ixgbe_dev_tx_queue_setup,
        .tx_queue_release     = ixgbe_dev_tx_queue_release,
        .dev_led_on           = ixgbe_dev_led_on,
@@ -640,6 +627,8 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = {
        .rx_queue_setup       = ixgbe_dev_rx_queue_setup,
        .rx_queue_release     = ixgbe_dev_rx_queue_release,
        .rx_descriptor_done   = ixgbe_dev_rx_descriptor_done,
+       .rx_descriptor_status = ixgbe_dev_rx_descriptor_status,
+       .tx_descriptor_status = ixgbe_dev_tx_descriptor_status,
        .tx_queue_setup       = ixgbe_dev_tx_queue_setup,
        .tx_queue_release     = ixgbe_dev_tx_queue_release,
        .rx_queue_intr_enable = ixgbevf_dev_rx_queue_intr_enable,
@@ -907,6 +896,8 @@ ixgbe_pf_reset_hw(struct ixgbe_hw *hw)
        IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext);
        IXGBE_WRITE_FLUSH(hw);
 
+       if (status == IXGBE_ERR_SFP_NOT_PRESENT)
+               status = IXGBE_SUCCESS;
        return status;
 }
 
@@ -1143,6 +1134,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
                IXGBE_DEV_PRIVATE_TO_DCB_CFG(eth_dev->data->dev_private);
        struct ixgbe_filter_info *filter_info =
                IXGBE_DEV_PRIVATE_TO_FILTER_INFO(eth_dev->data->dev_private);
+       struct ixgbe_bw_conf *bw_conf =
+               IXGBE_DEV_PRIVATE_TO_BW_CONF(eth_dev->data->dev_private);
        uint32_t ctrl_ext;
        uint16_t csum;
        int diag, i;
@@ -1179,7 +1172,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
        }
 
        rte_eth_copy_pci_info(eth_dev, pci_dev);
-       eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
+       eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
 
        /* Vendor and Device ID need to be set before init of shared code */
        hw->device_id = pci_dev->id.device_id;
@@ -1246,6 +1239,9 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
                diag = ixgbe_init_hw(hw);
        }
 
+       if (diag == IXGBE_ERR_SFP_NOT_PRESENT)
+               diag = IXGBE_SUCCESS;
+
        if (diag == IXGBE_ERR_EEPROM_VERSION) {
                PMD_INIT_LOG(ERR, "This device is a pre-production adapter/"
                             "LOM.  Please be aware there may be issues associated "
@@ -1343,6 +1339,17 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
 
        /* initialize l2 tunnel filter list & hash */
        ixgbe_l2_tn_filter_init(eth_dev);
+
+       TAILQ_INIT(&filter_ntuple_list);
+       TAILQ_INIT(&filter_ethertype_list);
+       TAILQ_INIT(&filter_syn_list);
+       TAILQ_INIT(&filter_fdir_list);
+       TAILQ_INIT(&filter_l2_tunnel_list);
+       TAILQ_INIT(&ixgbe_flow_list);
+
+       /* initialize bandwidth configuration info */
+       memset(bw_conf, 0, sizeof(struct ixgbe_bw_conf));
+
        return 0;
 }
 
@@ -1393,6 +1400,9 @@ eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev)
        /* Remove all ntuple filters of the device */
        ixgbe_ntuple_filter_uninit(eth_dev);
 
+       /* clear all the filters list */
+       ixgbe_filterlist_flush();
+
        return 0;
 }
 
@@ -1487,6 +1497,8 @@ static int ixgbe_fdir_filter_init(struct rte_eth_dev *eth_dev)
                             "Failed to allocate memory for fdir hash map!");
                return -ENOMEM;
        }
+       fdir_info->mask_added = FALSE;
+
        return 0;
 }
 
@@ -1617,7 +1629,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
        }
 
        rte_eth_copy_pci_info(eth_dev, pci_dev);
-       eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
+       eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
 
        hw->device_id = pci_dev->id.device_id;
        hw->vendor_id = pci_dev->id.vendor_id;
@@ -1757,31 +1769,45 @@ eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
        return 0;
 }
 
-static struct eth_driver rte_ixgbe_pmd = {
-       .pci_drv = {
-               .id_table = pci_id_ixgbe_map,
-               .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
-               .probe = rte_eth_dev_pci_probe,
-               .remove = rte_eth_dev_pci_remove,
-       },
-       .eth_dev_init = eth_ixgbe_dev_init,
-       .eth_dev_uninit = eth_ixgbe_dev_uninit,
-       .dev_private_size = sizeof(struct ixgbe_adapter),
+static int eth_ixgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+       struct rte_pci_device *pci_dev)
+{
+       return rte_eth_dev_pci_generic_probe(pci_dev,
+               sizeof(struct ixgbe_adapter), eth_ixgbe_dev_init);
+}
+
+static int eth_ixgbe_pci_remove(struct rte_pci_device *pci_dev)
+{
+       return rte_eth_dev_pci_generic_remove(pci_dev, eth_ixgbe_dev_uninit);
+}
+
+static struct rte_pci_driver rte_ixgbe_pmd = {
+       .id_table = pci_id_ixgbe_map,
+       .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+       .probe = eth_ixgbe_pci_probe,
+       .remove = eth_ixgbe_pci_remove,
 };
 
+static int eth_ixgbevf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+       struct rte_pci_device *pci_dev)
+{
+       return rte_eth_dev_pci_generic_probe(pci_dev,
+               sizeof(struct ixgbe_adapter), eth_ixgbevf_dev_init);
+}
+
+static int eth_ixgbevf_pci_remove(struct rte_pci_device *pci_dev)
+{
+       return rte_eth_dev_pci_generic_remove(pci_dev, eth_ixgbevf_dev_uninit);
+}
+
 /*
  * virtual function driver struct
  */
-static struct eth_driver rte_ixgbevf_pmd = {
-       .pci_drv = {
-               .id_table = pci_id_ixgbevf_map,
-               .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
-               .probe = rte_eth_dev_pci_probe,
-               .remove = rte_eth_dev_pci_remove,
-       },
-       .eth_dev_init = eth_ixgbevf_dev_init,
-       .eth_dev_uninit = eth_ixgbevf_dev_uninit,
-       .dev_private_size = sizeof(struct ixgbe_adapter),
+static struct rte_pci_driver rte_ixgbevf_pmd = {
+       .id_table = pci_id_ixgbevf_map,
+       .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+       .probe = eth_ixgbevf_pci_probe,
+       .remove = eth_ixgbevf_pci_remove,
 };
 
 static int
@@ -2450,7 +2476,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
                                    dev->data->nb_rx_queues * sizeof(int), 0);
                if (intr_handle->intr_vec == NULL) {
                        PMD_INIT_LOG(ERR, "Failed to allocate %d rx_queues"
-                                    " intr_vec\n", dev->data->nb_rx_queues);
+                                    " intr_vec", dev->data->nb_rx_queues);
                        return -ENOMEM;
                }
        }
@@ -2570,7 +2596,7 @@ skip_link_setup:
                                             ixgbe_dev_interrupt_handler, dev);
                if (dev->data->dev_conf.intr_conf.lsc != 0)
                        PMD_INIT_LOG(INFO, "lsc won't enable because of"
-                                    " no intr multiplex\n");
+                                    " no intr multiplex");
        }
 
        /* check if rxq interrupt is enabled */
@@ -3239,6 +3265,7 @@ ixgbevf_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
 
        /* Extended stats */
        for (i = 0; i < IXGBEVF_NB_XSTATS; i++) {
+               xstats[i].id = i;
                xstats[i].value = *(uint64_t *)(((char *)hw_stats) +
                        rte_ixgbevf_stats_strings[i].offset);
        }
@@ -3452,7 +3479,7 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev,
        dev_info->max_rx_queues = (uint16_t)hw->mac.max_rx_queues;
        dev_info->max_tx_queues = (uint16_t)hw->mac.max_tx_queues;
        dev_info->min_rx_bufsize = 1024; /* cf BSIZEPACKET in SRRCTL reg */
-       dev_info->max_rx_pktlen = 15872; /* includes CRC, cf MAXFRS reg */
+       dev_info->max_rx_pktlen = 9728; /* includes CRC, cf MAXFRS reg */
        dev_info->max_mac_addrs = hw->mac.num_rar_entries;
        dev_info->max_hash_mac_addrs = IXGBE_VMDQ_NUM_UC_MAC;
        dev_info->max_vfs = pci_dev->max_vfs;
@@ -3782,7 +3809,6 @@ ixgbe_dev_interrupt_action(struct rte_eth_dev *dev,
                IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
        int64_t timeout;
        struct rte_eth_link link;
-       int intr_enable_delay = false;
        struct ixgbe_hw *hw =
                IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
@@ -3815,20 +3841,19 @@ ixgbe_dev_interrupt_action(struct rte_eth_dev *dev,
                        timeout = IXGBE_LINK_DOWN_CHECK_TIMEOUT;
 
                ixgbe_dev_link_status_print(dev);
-
-               intr_enable_delay = true;
-       }
-
-       if (intr_enable_delay) {
+               intr->mask_original = intr->mask;
+               /* only disable lsc interrupt */
+               intr->mask &= ~IXGBE_EIMS_LSC;
                if (rte_eal_alarm_set(timeout * 1000,
                                      ixgbe_dev_interrupt_delayed_handler, (void *)dev) < 0)
                        PMD_DRV_LOG(ERR, "Error setting alarm");
-       } else {
-               PMD_DRV_LOG(DEBUG, "enable intr immediately");
-               ixgbe_enable_intr(dev);
-               rte_intr_enable(intr_handle);
+               else
+                       intr->mask = intr->mask_original;
        }
 
+       PMD_DRV_LOG(DEBUG, "enable intr immediately");
+       ixgbe_enable_intr(dev);
+       rte_intr_enable(intr_handle);
 
        return 0;
 }
@@ -3859,6 +3884,8 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
                IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        uint32_t eicr;
 
+       ixgbe_disable_intr(hw);
+
        eicr = IXGBE_READ_REG(hw, IXGBE_EICR);
        if (eicr & IXGBE_EICR_MAILBOX)
                ixgbe_pf_mbx_process(dev);
@@ -3881,6 +3908,10 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
                intr->flags &= ~IXGBE_FLAG_MACSEC;
        }
 
+       /* restore original mask */
+       intr->mask = intr->mask_original;
+       intr->mask_original = 0;
+
        PMD_DRV_LOG(DEBUG, "enable intr in delayed handler S[%08x]", eicr);
        ixgbe_enable_intr(dev);
        rte_intr_enable(intr_handle);
@@ -3899,13 +3930,12 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
  *  void
  */
 static void
-ixgbe_dev_interrupt_handler(struct rte_intr_handle *handle,
-                           void *param)
+ixgbe_dev_interrupt_handler(void *param)
 {
        struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
        ixgbe_dev_interrupt_get_status(dev);
-       ixgbe_dev_interrupt_action(dev, handle);
+       ixgbe_dev_interrupt_action(dev, dev->intr_handle);
 }
 
 static int
@@ -4269,7 +4299,7 @@ ixgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
        if (reta_size != sp_reta_size) {
                PMD_DRV_LOG(ERR, "The size of hash lookup table configured "
                        "(%d) doesn't match the number hardware can supported "
-                       "(%d)\n", reta_size, sp_reta_size);
+                       "(%d)", reta_size, sp_reta_size);
                return -EINVAL;
        }
 
@@ -4316,7 +4346,7 @@ ixgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
        if (reta_size != sp_reta_size) {
                PMD_DRV_LOG(ERR, "The size of hash lookup table configured "
                        "(%d) doesn't match the number hardware can supported "
-                       "(%d)\n", reta_size, sp_reta_size);
+                       "(%d)", reta_size, sp_reta_size);
                return -EINVAL;
        }
 
@@ -4367,16 +4397,13 @@ ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr)
        ixgbe_add_rar(dev, addr, 0, 0);
 }
 
-static int
-is_ixgbe_pmd(const char *driver_name)
+static bool
+is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv)
 {
-       if (!strstr(driver_name, "ixgbe"))
-               return -ENOTSUP;
+       if (strcmp(dev->data->drv_name, drv->driver.name))
+               return false;
 
-       if (strstr(driver_name, "ixgbe_vf"))
-               return -ENOTSUP;
-
-       return 0;
+       return true;
 }
 
 int
@@ -4388,17 +4415,17 @@ rte_pmd_ixgbe_set_vf_mac_addr(uint8_t port, uint16_t vf,
        int rar_entry;
        uint8_t *new_mac = (uint8_t *)(mac_addr);
        struct rte_eth_dev *dev;
-       struct rte_eth_dev_info dev_info;
+       struct rte_pci_device *pci_dev;
 
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
-       rte_eth_dev_info_get(port, &dev_info);
+       pci_dev = IXGBE_DEV_TO_PCI(dev);
 
-       if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
                return -ENOTSUP;
 
-       if (vf >= dev_info.max_vfs)
+       if (vf >= pci_dev->max_vfs)
                return -EINVAL;
 
        hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -4576,7 +4603,7 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)
                                    dev->data->nb_rx_queues * sizeof(int), 0);
                if (intr_handle->intr_vec == NULL) {
                        PMD_INIT_LOG(ERR, "Failed to allocate %d rx_queues"
-                                    " intr_vec\n", dev->data->nb_rx_queues);
+                                    " intr_vec", dev->data->nb_rx_queues);
                        return -ENOMEM;
                }
        }
@@ -4882,6 +4909,37 @@ ixgbe_convert_vm_rx_mask_to_val(uint16_t rx_mask, uint32_t orig_val)
        return new_val;
 }
 
+int
+rte_pmd_ixgbe_ping_vf(uint8_t port, uint16_t vf)
+{
+       struct ixgbe_hw *hw;
+       struct ixgbe_vf_info *vfinfo;
+       struct rte_eth_dev *dev;
+       struct rte_pci_device *pci_dev;
+       uint32_t ctrl;
+
+       RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+       dev = &rte_eth_devices[port];
+       pci_dev = IXGBE_DEV_TO_PCI(dev);
+
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
+               return -ENOTSUP;
+
+       if (vf >= pci_dev->max_vfs)
+               return -EINVAL;
+
+       hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+       vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
+
+       ctrl = IXGBE_PF_CONTROL_MSG;
+       if (vfinfo[vf].clear_to_send)
+               ctrl |= IXGBE_VT_MSGTYPE_CTS;
+
+       ixgbe_write_mbx(hw, &ctrl, 1, vf);
+
+       return 0;
+}
 
 int
 rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
@@ -4889,17 +4947,17 @@ rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
        struct ixgbe_hw *hw;
        struct ixgbe_mac_info *mac;
        struct rte_eth_dev *dev;
-       struct rte_eth_dev_info dev_info;
+       struct rte_pci_device *pci_dev;
 
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
-       rte_eth_dev_info_get(port, &dev_info);
+       pci_dev = IXGBE_DEV_TO_PCI(dev);
 
-       if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
                return -ENOTSUP;
 
-       if (vf >= dev_info.max_vfs)
+       if (vf >= pci_dev->max_vfs)
                return -EINVAL;
 
        if (on > 1)
@@ -4919,17 +4977,17 @@ rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
        struct ixgbe_hw *hw;
        struct ixgbe_mac_info *mac;
        struct rte_eth_dev *dev;
-       struct rte_eth_dev_info dev_info;
+       struct rte_pci_device *pci_dev;
 
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
-       rte_eth_dev_info_get(port, &dev_info);
+       pci_dev = IXGBE_DEV_TO_PCI(dev);
 
-       if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
                return -ENOTSUP;
 
-       if (vf >= dev_info.max_vfs)
+       if (vf >= pci_dev->max_vfs)
                return -EINVAL;
 
        if (on > 1)
@@ -4948,17 +5006,17 @@ rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint16_t vlan_id)
        struct ixgbe_hw *hw;
        uint32_t ctrl;
        struct rte_eth_dev *dev;
-       struct rte_eth_dev_info dev_info;
+       struct rte_pci_device *pci_dev;
 
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
-       rte_eth_dev_info_get(port, &dev_info);
+       pci_dev = IXGBE_DEV_TO_PCI(dev);
 
-       if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
                return -ENOTSUP;
 
-       if (vf >= dev_info.max_vfs)
+       if (vf >= pci_dev->max_vfs)
                return -EINVAL;
 
        if (vlan_id > ETHER_MAX_VLAN_ID)
@@ -4984,14 +5042,12 @@ rte_pmd_ixgbe_set_tx_loopback(uint8_t port, uint8_t on)
        struct ixgbe_hw *hw;
        uint32_t ctrl;
        struct rte_eth_dev *dev;
-       struct rte_eth_dev_info dev_info;
 
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
-       rte_eth_dev_info_get(port, &dev_info);
 
-       if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
                return -ENOTSUP;
 
        if (on > 1)
@@ -5018,14 +5074,12 @@ rte_pmd_ixgbe_set_all_queues_drop_en(uint8_t port, uint8_t on)
        int i;
        int num_queues = (int)(IXGBE_QDE_IDX_MASK >> IXGBE_QDE_IDX_SHIFT);
        struct rte_eth_dev *dev;
-       struct rte_eth_dev_info dev_info;
 
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
-       rte_eth_dev_info_get(port, &dev_info);
 
-       if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
                return -ENOTSUP;
 
        if (on > 1)
@@ -5048,18 +5102,18 @@ rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, uint16_t vf, uint8_t on)
        struct ixgbe_hw *hw;
        uint32_t reg_value;
        struct rte_eth_dev *dev;
-       struct rte_eth_dev_info dev_info;
+       struct rte_pci_device *pci_dev;
 
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
-       rte_eth_dev_info_get(port, &dev_info);
+       pci_dev = IXGBE_DEV_TO_PCI(dev);
 
-       if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
                return -ENOTSUP;
 
        /* only support VF's 0 to 63 */
-       if ((vf >= dev_info.max_vfs) || (vf > 63))
+       if ((vf >= pci_dev->max_vfs) || (vf > 63))
                return -EINVAL;
 
        if (on > 1)
@@ -5081,19 +5135,21 @@ int
 rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on)
 {
        struct rte_eth_dev *dev;
-       struct rte_eth_dev_info dev_info;
+       struct rte_pci_device *pci_dev;
+       struct ixgbe_hw *hw;
        uint16_t queues_per_pool;
        uint32_t q;
 
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
-       rte_eth_dev_info_get(port, &dev_info);
+       pci_dev = IXGBE_DEV_TO_PCI(dev);
+       hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-       if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
                return -ENOTSUP;
 
-       if (vf >= dev_info.max_vfs)
+       if (vf >= pci_dev->max_vfs)
                return -EINVAL;
 
        if (on > 1)
@@ -5109,8 +5165,12 @@ rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on)
         * first 124 queues 0-123 will be allocated to VF's and only
         * the last 4 queues 123-127 will be assigned to the PF.
         */
-
-       queues_per_pool = dev_info.vmdq_queue_num / dev_info.max_vmdq_pools;
+       if (hw->mac.type == ixgbe_mac_82598EB)
+               queues_per_pool = (uint16_t)hw->mac.max_rx_queues /
+                                 ETH_16_POOLS;
+       else
+               queues_per_pool = (uint16_t)hw->mac.max_rx_queues /
+                                 ETH_64_POOLS;
 
        for (q = 0; q < queues_per_pool; q++)
                (*dev->dev_ops->vlan_strip_queue_set)(dev,
@@ -5123,19 +5183,19 @@ rte_pmd_ixgbe_set_vf_rxmode(uint8_t port, uint16_t vf, uint16_t rx_mask, uint8_t
 {
        int val = 0;
        struct rte_eth_dev *dev;
-       struct rte_eth_dev_info dev_info;
+       struct rte_pci_device *pci_dev;
        struct ixgbe_hw *hw;
        uint32_t vmolr;
 
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
-       rte_eth_dev_info_get(port, &dev_info);
+       pci_dev = IXGBE_DEV_TO_PCI(dev);
 
-       if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
                return -ENOTSUP;
 
-       if (vf >= dev_info.max_vfs)
+       if (vf >= pci_dev->max_vfs)
                return -EINVAL;
 
        if (on > 1)
@@ -5168,7 +5228,7 @@ int
 rte_pmd_ixgbe_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on)
 {
        struct rte_eth_dev *dev;
-       struct rte_eth_dev_info dev_info;
+       struct rte_pci_device *pci_dev;
        uint32_t reg, addr;
        uint32_t val;
        const uint8_t bit1 = 0x1;
@@ -5177,12 +5237,12 @@ rte_pmd_ixgbe_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on)
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
-       rte_eth_dev_info_get(port, &dev_info);
+       pci_dev = IXGBE_DEV_TO_PCI(dev);
 
-       if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
                return -ENOTSUP;
 
-       if (vf >= dev_info.max_vfs)
+       if (vf >= pci_dev->max_vfs)
                return -EINVAL;
 
        if (on > 1)
@@ -5218,7 +5278,7 @@ int
 rte_pmd_ixgbe_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on)
 {
        struct rte_eth_dev *dev;
-       struct rte_eth_dev_info dev_info;
+       struct rte_pci_device *pci_dev;
        uint32_t reg, addr;
        uint32_t val;
        const uint8_t bit1 = 0x1;
@@ -5228,12 +5288,12 @@ rte_pmd_ixgbe_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on)
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
-       rte_eth_dev_info_get(port, &dev_info);
+       pci_dev = IXGBE_DEV_TO_PCI(dev);
 
-       if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
                return -ENOTSUP;
 
-       if (vf >= dev_info.max_vfs)
+       if (vf >= pci_dev->max_vfs)
                return -EINVAL;
 
        if (on > 1)
@@ -5269,7 +5329,6 @@ rte_pmd_ixgbe_set_vf_vlan_filter(uint8_t port, uint16_t vlan,
                        uint64_t vf_mask, uint8_t vlan_on)
 {
        struct rte_eth_dev *dev;
-       struct rte_eth_dev_info dev_info;
        int ret = 0;
        uint16_t vf_idx;
        struct ixgbe_hw *hw;
@@ -5277,9 +5336,8 @@ rte_pmd_ixgbe_set_vf_vlan_filter(uint8_t port, uint16_t vlan,
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
-       rte_eth_dev_info_get(port, &dev_info);
 
-       if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
                return -ENOTSUP;
 
        if ((vlan > ETHER_MAX_VLAN_ID) || (vf_mask == 0))
@@ -5305,7 +5363,6 @@ int rte_pmd_ixgbe_set_vf_rate_limit(uint8_t port, uint16_t vf,
        uint16_t tx_rate, uint64_t q_msk)
 {
        struct rte_eth_dev *dev;
-       struct rte_eth_dev_info dev_info;
        struct ixgbe_hw *hw;
        struct ixgbe_vf_info *vfinfo;
        struct rte_eth_link link;
@@ -5319,13 +5376,13 @@ int rte_pmd_ixgbe_set_vf_rate_limit(uint8_t port, uint16_t vf,
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
-       rte_eth_dev_info_get(port, &dev_info);
+       pci_dev = IXGBE_DEV_TO_PCI(dev);
        rte_eth_link_get_nowait(port, &link);
 
-       if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
                return -ENOTSUP;
 
-       if (vf >= dev_info.max_vfs)
+       if (vf >= pci_dev->max_vfs)
                return -EINVAL;
 
        if (tx_rate > link.link_speed)
@@ -5334,7 +5391,6 @@ int rte_pmd_ixgbe_set_vf_rate_limit(uint8_t port, uint16_t vf,
        if (q_msk == 0)
                return 0;
 
-       pci_dev = IXGBE_DEV_TO_PCI(dev);
        hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
        nb_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
@@ -5947,14 +6003,7 @@ ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr)
        hw->mac.ops.set_rar(hw, 0, (void *)addr, 0, 0);
 }
 
-#define MAC_TYPE_FILTER_SUP(type)    do {\
-       if ((type) != ixgbe_mac_82599EB && (type) != ixgbe_mac_X540 &&\
-               (type) != ixgbe_mac_X550 && (type) != ixgbe_mac_X550EM_x &&\
-               (type) != ixgbe_mac_X550EM_a)\
-               return -ENOTSUP;\
-} while (0)
-
-static int
+int
 ixgbe_syn_filter_set(struct rte_eth_dev *dev,
                        struct rte_eth_syn_filter *filter,
                        bool add)
@@ -6043,7 +6092,7 @@ ixgbe_syn_filter_handle(struct rte_eth_dev *dev,
                                (struct rte_eth_syn_filter *)arg);
                break;
        default:
-               PMD_DRV_LOG(ERR, "unsupported operation %u\n", filter_op);
+               PMD_DRV_LOG(ERR, "unsupported operation %u", filter_op);
                ret = -EINVAL;
                break;
        }
@@ -6221,11 +6270,6 @@ ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
        return 0;
 }
 
-#define MAC_TYPE_FILTER_SUP_EXT(type)    do {\
-       if ((type) != ixgbe_mac_82599EB && (type) != ixgbe_mac_X540)\
-               return -ENOTSUP;\
-} while (0)
-
 static inline struct ixgbe_5tuple_filter *
 ixgbe_5tuple_filter_lookup(struct ixgbe_5tuple_filter_list *filter_list,
                        struct ixgbe_5tuple_filter_info *key)
@@ -6333,7 +6377,7 @@ ntuple_filter_to_5tuple(struct rte_eth_ntuple_filter *filter,
  *    - On success, zero.
  *    - On failure, a negative value.
  */
-static int
+int
 ixgbe_add_del_ntuple_filter(struct rte_eth_dev *dev,
                        struct rte_eth_ntuple_filter *ntuple_filter,
                        bool add)
@@ -6478,7 +6522,7 @@ ixgbe_ntuple_filter_handle(struct rte_eth_dev *dev,
        return ret;
 }
 
-static int
+int
 ixgbe_add_del_ethertype_filter(struct rte_eth_dev *dev,
                        struct rte_eth_ethertype_filter *filter,
                        bool add)
@@ -6533,6 +6577,7 @@ ixgbe_add_del_ethertype_filter(struct rte_eth_dev *dev,
                ethertype_filter.ethertype = filter->ether_type;
                ethertype_filter.etqf = etqf;
                ethertype_filter.etqs = etqs;
+               ethertype_filter.conf = FALSE;
                ret = ixgbe_ethertype_filter_insert(filter_info,
                                                    &ethertype_filter);
                if (ret < 0) {
@@ -6634,7 +6679,7 @@ ixgbe_dev_filter_ctrl(struct rte_eth_dev *dev,
                     enum rte_filter_op filter_op,
                     void *arg)
 {
-       int ret = -EINVAL;
+       int ret = 0;
 
        switch (filter_type) {
        case RTE_ETH_FILTER_NTUPLE:
@@ -6652,9 +6697,15 @@ ixgbe_dev_filter_ctrl(struct rte_eth_dev *dev,
        case RTE_ETH_FILTER_L2_TUNNEL:
                ret = ixgbe_dev_l2_tunnel_filter_handle(dev, filter_op, arg);
                break;
+       case RTE_ETH_FILTER_GENERIC:
+               if (filter_op != RTE_ETH_FILTER_GET)
+                       return -EINVAL;
+               *(const void **)arg = &ixgbe_flow_ops;
+               break;
        default:
                PMD_DRV_LOG(WARNING, "Filter type (%d) not supported",
                                                        filter_type);
+               ret = -EINVAL;
                break;
        }
 
@@ -7550,7 +7601,7 @@ ixgbe_remove_l2_tn_filter(struct ixgbe_l2_tn_info *l2_tn_info,
 }
 
 /* Add l2 tunnel filter */
-static int
+int
 ixgbe_dev_l2_tunnel_filter_add(struct rte_eth_dev *dev,
                               struct rte_eth_l2_tunnel_conf *l2_tunnel,
                               bool restore)
@@ -7607,7 +7658,7 @@ ixgbe_dev_l2_tunnel_filter_add(struct rte_eth_dev *dev,
 }
 
 /* Delete l2 tunnel filter */
-static int
+int
 ixgbe_dev_l2_tunnel_filter_del(struct rte_eth_dev *dev,
                               struct rte_eth_l2_tunnel_conf *l2_tunnel)
 {
@@ -8142,8 +8193,7 @@ ixgbevf_dev_interrupt_action(struct rte_eth_dev *dev)
 }
 
 static void
-ixgbevf_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
-                             void *param)
+ixgbevf_dev_interrupt_handler(void *param)
 {
        struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
@@ -8179,7 +8229,7 @@ int ixgbe_disable_sec_tx_path_generic(struct ixgbe_hw *hw)
        /* For informational purposes only */
        if (i >= IXGBE_MAX_SECTX_POLL)
                PMD_DRV_LOG(DEBUG, "Tx unit being enabled before security "
-                        "path fully disabled.  Continuing with init.\n");
+                        "path fully disabled.  Continuing with init.");
 
        return IXGBE_SUCCESS;
 }
@@ -8212,6 +8262,10 @@ rte_pmd_ixgbe_macsec_enable(uint8_t port, uint8_t en, uint8_t rp)
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
+
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
+               return -ENOTSUP;
+
        hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
        /* Stop the data paths */
@@ -8291,6 +8345,10 @@ rte_pmd_ixgbe_macsec_disable(uint8_t port)
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
+
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
+               return -ENOTSUP;
+
        hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
        /* Stop the data paths */
@@ -8351,6 +8409,10 @@ rte_pmd_ixgbe_macsec_config_txsc(uint8_t port, uint8_t *mac)
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
+
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
+               return -ENOTSUP;
+
        hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
        ctrl = mac[0] | (mac[1] << 8) | (mac[2] << 16) | (mac[3] << 24);
@@ -8372,6 +8434,10 @@ rte_pmd_ixgbe_macsec_config_rxsc(uint8_t port, uint8_t *mac, uint16_t pi)
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
+
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
+               return -ENOTSUP;
+
        hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
        ctrl = mac[0] | (mac[1] << 8) | (mac[2] << 16) | (mac[3] << 24);
@@ -8395,6 +8461,10 @@ rte_pmd_ixgbe_macsec_select_txsa(uint8_t port, uint8_t idx, uint8_t an,
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
+
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
+               return -ENOTSUP;
+
        hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
        if (idx != 0 && idx != 1)
@@ -8447,6 +8517,10 @@ rte_pmd_ixgbe_macsec_select_rxsa(uint8_t port, uint8_t idx, uint8_t an,
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
        dev = &rte_eth_devices[port];
+
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
+               return -ENOTSUP;
+
        hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
        if (idx != 0 && idx != 1)
@@ -8570,9 +8644,153 @@ ixgbe_l2_tunnel_conf(struct rte_eth_dev *dev)
        (void)ixgbe_update_e_tag_eth_type(hw, l2_tn_info->e_tag_ether_type);
 }
 
-RTE_PMD_REGISTER_PCI(net_ixgbe, rte_ixgbe_pmd.pci_drv);
+/* remove all the n-tuple filters */
+void
+ixgbe_clear_all_ntuple_filter(struct rte_eth_dev *dev)
+{
+       struct ixgbe_filter_info *filter_info =
+               IXGBE_DEV_PRIVATE_TO_FILTER_INFO(dev->data->dev_private);
+       struct ixgbe_5tuple_filter *p_5tuple;
+
+       while ((p_5tuple = TAILQ_FIRST(&filter_info->fivetuple_list)))
+               ixgbe_remove_5tuple_filter(dev, p_5tuple);
+}
+
+/* remove all the ether type filters */
+void
+ixgbe_clear_all_ethertype_filter(struct rte_eth_dev *dev)
+{
+       struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+       struct ixgbe_filter_info *filter_info =
+               IXGBE_DEV_PRIVATE_TO_FILTER_INFO(dev->data->dev_private);
+       int i;
+
+       for (i = 0; i < IXGBE_MAX_ETQF_FILTERS; i++) {
+               if (filter_info->ethertype_mask & (1 << i) &&
+                   !filter_info->ethertype_filters[i].conf) {
+                       (void)ixgbe_ethertype_filter_remove(filter_info,
+                                                           (uint8_t)i);
+                       IXGBE_WRITE_REG(hw, IXGBE_ETQF(i), 0);
+                       IXGBE_WRITE_REG(hw, IXGBE_ETQS(i), 0);
+                       IXGBE_WRITE_FLUSH(hw);
+               }
+       }
+}
+
+/* remove the SYN filter */
+void
+ixgbe_clear_syn_filter(struct rte_eth_dev *dev)
+{
+       struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+       struct ixgbe_filter_info *filter_info =
+               IXGBE_DEV_PRIVATE_TO_FILTER_INFO(dev->data->dev_private);
+
+       if (filter_info->syn_info & IXGBE_SYN_FILTER_ENABLE) {
+               filter_info->syn_info = 0;
+
+               IXGBE_WRITE_REG(hw, IXGBE_SYNQF, 0);
+               IXGBE_WRITE_FLUSH(hw);
+       }
+}
+
+/* remove all the L2 tunnel filters */
+int
+ixgbe_clear_all_l2_tn_filter(struct rte_eth_dev *dev)
+{
+       struct ixgbe_l2_tn_info *l2_tn_info =
+               IXGBE_DEV_PRIVATE_TO_L2_TN_INFO(dev->data->dev_private);
+       struct ixgbe_l2_tn_filter *l2_tn_filter;
+       struct rte_eth_l2_tunnel_conf l2_tn_conf;
+       int ret = 0;
+
+       while ((l2_tn_filter = TAILQ_FIRST(&l2_tn_info->l2_tn_list))) {
+               l2_tn_conf.l2_tunnel_type = l2_tn_filter->key.l2_tn_type;
+               l2_tn_conf.tunnel_id      = l2_tn_filter->key.tn_id;
+               l2_tn_conf.pool           = l2_tn_filter->pool;
+               ret = ixgbe_dev_l2_tunnel_filter_del(dev, &l2_tn_conf);
+               if (ret < 0)
+                       return ret;
+       }
+
+       return 0;
+}
+
+int
+rte_pmd_ixgbe_set_tc_bw_alloc(uint8_t port,
+                             uint8_t tc_num,
+                             uint8_t *bw_weight)
+{
+       struct rte_eth_dev *dev;
+       struct ixgbe_dcb_config *dcb_config;
+       struct ixgbe_dcb_tc_config *tc;
+       struct rte_eth_conf *eth_conf;
+       struct ixgbe_bw_conf *bw_conf;
+       uint8_t i;
+       uint8_t nb_tcs;
+       uint16_t sum;
+
+       RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+       dev = &rte_eth_devices[port];
+
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
+               return -ENOTSUP;
+
+       if (tc_num > IXGBE_DCB_MAX_TRAFFIC_CLASS) {
+               PMD_DRV_LOG(ERR, "TCs should be no more than %d.",
+                           IXGBE_DCB_MAX_TRAFFIC_CLASS);
+               return -EINVAL;
+       }
+
+       dcb_config = IXGBE_DEV_PRIVATE_TO_DCB_CFG(dev->data->dev_private);
+       bw_conf = IXGBE_DEV_PRIVATE_TO_BW_CONF(dev->data->dev_private);
+       eth_conf = &dev->data->dev_conf;
+
+       if (eth_conf->txmode.mq_mode == ETH_MQ_TX_DCB) {
+               nb_tcs = eth_conf->tx_adv_conf.dcb_tx_conf.nb_tcs;
+       } else if (eth_conf->txmode.mq_mode == ETH_MQ_TX_VMDQ_DCB) {
+               if (eth_conf->tx_adv_conf.vmdq_dcb_tx_conf.nb_queue_pools ==
+                   ETH_32_POOLS)
+                       nb_tcs = ETH_4_TCS;
+               else
+                       nb_tcs = ETH_8_TCS;
+       } else {
+               nb_tcs = 1;
+       }
+
+       if (nb_tcs != tc_num) {
+               PMD_DRV_LOG(ERR,
+                           "Weight should be set for all %d enabled TCs.",
+                           nb_tcs);
+               return -EINVAL;
+       }
+
+       sum = 0;
+       for (i = 0; i < nb_tcs; i++)
+               sum += bw_weight[i];
+       if (sum != 100) {
+               PMD_DRV_LOG(ERR,
+                           "The summary of the TC weight should be 100.");
+               return -EINVAL;
+       }
+
+       for (i = 0; i < nb_tcs; i++) {
+               tc = &dcb_config->tc_config[i];
+               tc->path[IXGBE_DCB_TX_CONFIG].bwg_percent = bw_weight[i];
+       }
+       for (; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
+               tc = &dcb_config->tc_config[i];
+               tc->path[IXGBE_DCB_TX_CONFIG].bwg_percent = 0;
+       }
+
+       bw_conf->tc_num = nb_tcs;
+
+       return 0;
+}
+
+RTE_PMD_REGISTER_PCI(net_ixgbe, rte_ixgbe_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_ixgbe, pci_id_ixgbe_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_ixgbe, "* igb_uio | uio_pci_generic | vfio");
-RTE_PMD_REGISTER_PCI(net_ixgbe_vf, rte_ixgbevf_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_ixgbe_vf, rte_ixgbevf_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_ixgbe_vf, pci_id_ixgbevf_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_ixgbe_vf, "* igb_uio | vfio");