mbuf: add new Rx flags for stripped VLAN
[dpdk.git] / drivers / net / ixgbe / ixgbe_ethdev.c
index c203382..5f3e047 100644 (file)
@@ -232,7 +232,7 @@ static void ixgbe_add_rar(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
 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 void ixgbe_dcb_init(struct ixgbe_hw *hw, struct ixgbe_dcb_config *dcb_config);
 
 /* For Virtual Function support */
 static int eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev);
@@ -264,14 +264,14 @@ static void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev);
 
 /* For Eth VMDQ APIs support */
 static int ixgbe_uc_hash_table_set(struct rte_eth_dev *dev, struct
-               ether_addr* mac_addr,uint8_t on);
-static int ixgbe_uc_all_hash_table_set(struct rte_eth_dev *dev,uint8_t on);
+               ether_addr * mac_addr, uint8_t on);
+static int ixgbe_uc_all_hash_table_set(struct rte_eth_dev *dev, uint8_t on);
 static int  ixgbe_set_pool_rx_mode(struct rte_eth_dev *dev,  uint16_t pool,
                uint16_t rx_mask, uint8_t on);
-static int ixgbe_set_pool_rx(struct rte_eth_dev *dev,uint16_t pool,uint8_t on);
-static int ixgbe_set_pool_tx(struct rte_eth_dev *dev,uint16_t pool,uint8_t on);
+static int ixgbe_set_pool_rx(struct rte_eth_dev *dev, uint16_t pool, uint8_t on);
+static int ixgbe_set_pool_tx(struct rte_eth_dev *dev, uint16_t pool, uint8_t on);
 static int ixgbe_set_pool_vlan_filter(struct rte_eth_dev *dev, uint16_t vlan,
-               uint64_t pool_mask,uint8_t vlan_on);
+               uint64_t pool_mask, uint8_t vlan_on);
 static int ixgbe_mirror_rule_set(struct rte_eth_dev *dev,
                struct rte_eth_mirror_conf *mirror_conf,
                uint8_t rule_id, uint8_t on);
@@ -397,21 +397,21 @@ static int ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
        last = latest;                                           \
 }
 
-#define IXGBE_SET_HWSTRIP(h, q) do{\
-               uint32_t idx = (q) / (sizeof ((h)->bitmap[0]) * NBBY); \
-               uint32_t bit = (q) % (sizeof ((h)->bitmap[0]) * NBBY); \
+#define IXGBE_SET_HWSTRIP(h, q) do {\
+               uint32_t idx = (q) / (sizeof((h)->bitmap[0]) * NBBY); \
+               uint32_t bit = (q) % (sizeof((h)->bitmap[0]) * NBBY); \
                (h)->bitmap[idx] |= 1 << bit;\
        } while (0)
 
-#define IXGBE_CLEAR_HWSTRIP(h, q) do{\
-               uint32_t idx = (q) / (sizeof ((h)->bitmap[0]) * NBBY); \
-               uint32_t bit = (q) % (sizeof ((h)->bitmap[0]) * NBBY); \
+#define IXGBE_CLEAR_HWSTRIP(h, q) do {\
+               uint32_t idx = (q) / (sizeof((h)->bitmap[0]) * NBBY); \
+               uint32_t bit = (q) % (sizeof((h)->bitmap[0]) * NBBY); \
                (h)->bitmap[idx] &= ~(1 << bit);\
        } while (0)
 
-#define IXGBE_GET_HWSTRIP(h, q, r) do{\
-               uint32_t idx = (q) / (sizeof ((h)->bitmap[0]) * NBBY); \
-               uint32_t bit = (q) % (sizeof ((h)->bitmap[0]) * NBBY); \
+#define IXGBE_GET_HWSTRIP(h, q, r) do {\
+               uint32_t idx = (q) / (sizeof((h)->bitmap[0]) * NBBY); \
+               uint32_t bit = (q) % (sizeof((h)->bitmap[0]) * NBBY); \
                (r) = (h)->bitmap[idx] >> bit & 1;\
        } while (0)
 
@@ -901,8 +901,7 @@ ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
                PMD_INIT_LOG(DEBUG, "Write 0x%x to RX IXGBE stat mapping reg:%d",
                             stat_mappings->rqsmr[n], n);
                IXGBE_WRITE_REG(hw, IXGBE_RQSMR(n), stat_mappings->rqsmr[n]);
-       }
-       else {
+       } else {
                PMD_INIT_LOG(DEBUG, "Write 0x%x to TX IXGBE stat mapping reg:%d",
                             stat_mappings->tqsm[n], n);
                IXGBE_WRITE_REG(hw, IXGBE_TQSM(n), stat_mappings->tqsm[n]);
@@ -911,7 +910,7 @@ ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 }
 
 static void
-ixgbe_restore_statistics_mapping(struct rte_eth_dev * dev)
+ixgbe_restore_statistics_mapping(struct rte_eth_dev *dev)
 {
        struct ixgbe_stat_mapping_registers *stat_mappings =
                IXGBE_DEV_PRIVATE_TO_STAT_MAPPINGS(dev->data->dev_private);
@@ -929,7 +928,7 @@ ixgbe_restore_statistics_mapping(struct rte_eth_dev * dev)
 }
 
 static void
-ixgbe_dcb_init(struct ixgbe_hw *hw,struct ixgbe_dcb_config *dcb_config)
+ixgbe_dcb_init(struct ixgbe_hw *hw, struct ixgbe_dcb_config *dcb_config)
 {
        uint8_t i;
        struct ixgbe_dcb_tc_config *tc;
@@ -952,7 +951,7 @@ ixgbe_dcb_init(struct ixgbe_hw *hw,struct ixgbe_dcb_config *dcb_config)
        tc = &dcb_config->tc_config[0];
        tc->path[IXGBE_DCB_TX_CONFIG].up_to_tc_bitmap = 0xFF;
        tc->path[IXGBE_DCB_RX_CONFIG].up_to_tc_bitmap = 0xFF;
-       for (i = 0; i< IXGBE_DCB_MAX_BW_GROUP; i++) {
+       for (i = 0; i < IXGBE_DCB_MAX_BW_GROUP; i++) {
                dcb_config->bw_percentage[IXGBE_DCB_TX_CONFIG][i] = 100;
                dcb_config->bw_percentage[IXGBE_DCB_RX_CONFIG][i] = 100;
        }
@@ -1016,7 +1015,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
        struct rte_pci_device *pci_dev;
        struct ixgbe_hw *hw =
                IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
-       struct ixgbe_vfta * shadow_vfta =
+       struct ixgbe_vfta *shadow_vfta =
                IXGBE_DEV_PRIVATE_TO_VFTA(eth_dev->data->dev_private);
        struct ixgbe_hwstrip *hwstrip =
                IXGBE_DEV_PRIVATE_TO_HWSTRIP_BITMAP(eth_dev->data->dev_private);
@@ -1039,17 +1038,18 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
         * has already done this work. Only check we don't need a different
         * RX and TX function.
         */
-       if (rte_eal_process_type() != RTE_PROC_PRIMARY){
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
                struct ixgbe_tx_queue *txq;
                /* TX queue function in primary, set by last queue initialized
-                * Tx queue may not initialized by primary process */
+                * Tx queue may not initialized by primary process
+                */
                if (eth_dev->data->tx_queues) {
                        txq = eth_dev->data->tx_queues[eth_dev->data->nb_tx_queues-1];
                        ixgbe_set_tx_function(eth_dev, txq);
                } else {
                        /* Use default TX function if we get here */
                        PMD_INIT_LOG(NOTICE, "No TX queues configured yet. "
-                                            "Using default TX function.");
+                                    "Using default TX function.");
                }
 
                ixgbe_set_rx_function(eth_dev);
@@ -1086,7 +1086,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
 
        /* Initialize DCB configuration*/
        memset(dcb_config, 0, sizeof(struct ixgbe_dcb_config));
-       ixgbe_dcb_init(hw,dcb_config);
+       ixgbe_dcb_init(hw, dcb_config);
        /* Get Hardware Flow Control setting */
        hw->fc.requested_mode = ixgbe_fc_full;
        hw->fc.current_mode = ixgbe_fc_full;
@@ -1127,11 +1127,11 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
 
        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 "
-                   "with your hardware.");
+                            "LOM.  Please be aware there may be issues associated "
+                            "with your hardware.");
                PMD_INIT_LOG(ERR, "If you are experiencing problems "
-                   "please contact your Intel or hardware representative "
-                   "who provided you with this hardware.");
+                            "please contact your Intel or hardware representative "
+                            "who provided you with this hardware.");
        } else if (diag == IXGBE_ERR_SFP_NOT_SUPPORTED)
                PMD_INIT_LOG(ERR, "Unsupported SFP+ Module");
        if (diag) {
@@ -1150,12 +1150,12 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
 
        /* Allocate memory for storing MAC addresses */
        eth_dev->data->mac_addrs = rte_zmalloc("ixgbe", ETHER_ADDR_LEN *
-                       hw->mac.num_rar_entries, 0);
+                                              hw->mac.num_rar_entries, 0);
        if (eth_dev->data->mac_addrs == NULL) {
                PMD_INIT_LOG(ERR,
-                       "Failed to allocate %u bytes needed to store "
-                       "MAC addresses",
-                       ETHER_ADDR_LEN * hw->mac.num_rar_entries);
+                            "Failed to allocate %u bytes needed to store "
+                            "MAC addresses",
+                            ETHER_ADDR_LEN * hw->mac.num_rar_entries);
                return -ENOMEM;
        }
        /* Copy the permanent MAC address */
@@ -1164,11 +1164,11 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
 
        /* Allocate memory for storing hash filter MAC addresses */
        eth_dev->data->hash_mac_addrs = rte_zmalloc("ixgbe", ETHER_ADDR_LEN *
-                       IXGBE_VMDQ_NUM_UC_MAC, 0);
+                                                   IXGBE_VMDQ_NUM_UC_MAC, 0);
        if (eth_dev->data->hash_mac_addrs == NULL) {
                PMD_INIT_LOG(ERR,
-                       "Failed to allocate %d bytes needed to store MAC addresses",
-                       ETHER_ADDR_LEN * IXGBE_VMDQ_NUM_UC_MAC);
+                            "Failed to allocate %d bytes needed to store MAC addresses",
+                            ETHER_ADDR_LEN * IXGBE_VMDQ_NUM_UC_MAC);
                return -ENOMEM;
        }
 
@@ -1198,8 +1198,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
                             (int) hw->mac.type, (int) hw->phy.type);
 
        PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x",
-                       eth_dev->data->port_id, pci_dev->id.vendor_id,
-                       pci_dev->id.device_id);
+                    eth_dev->data->port_id, pci_dev->id.vendor_id,
+                    pci_dev->id.device_id);
 
        rte_intr_callback_register(&pci_dev->intr_handle,
                                   ixgbe_dev_interrupt_handler,
@@ -1214,7 +1214,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
        /* initialize 5tuple filter list */
        TAILQ_INIT(&filter_info->fivetuple_list);
        memset(filter_info->fivetuple_mask, 0,
-               sizeof(uint32_t) * IXGBE_5TUPLE_ARRAY_SIZE);
+              sizeof(uint32_t) * IXGBE_5TUPLE_ARRAY_SIZE);
 
        return 0;
 }
@@ -1313,7 +1313,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
        struct rte_pci_device *pci_dev;
        struct ixgbe_hw *hw =
                IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
-       struct ixgbe_vfta * shadow_vfta =
+       struct ixgbe_vfta *shadow_vfta =
                IXGBE_DEV_PRIVATE_TO_VFTA(eth_dev->data->dev_private);
        struct ixgbe_hwstrip *hwstrip =
                IXGBE_DEV_PRIVATE_TO_HWSTRIP_BITMAP(eth_dev->data->dev_private);
@@ -1327,8 +1327,9 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
 
        /* for secondary processes, we don't initialise any further as primary
         * has already done this work. Only check we don't need a different
-        * RX function */
-       if (rte_eal_process_type() != RTE_PROC_PRIMARY){
+        * RX function
+        */
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
                struct ixgbe_tx_queue *txq;
                /* TX queue function in primary, set by last queue initialized
                 * Tx queue may not initialized by primary process
@@ -1339,7 +1340,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
                } else {
                        /* Use default TX function if we get here */
                        PMD_INIT_LOG(NOTICE,
-                               "No TX queues configured yet. Using default TX function.");
+                                    "No TX queues configured yet. Using default TX function.");
                }
 
                ixgbe_set_rx_function(eth_dev);
@@ -1398,12 +1399,12 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
 
        /* Allocate memory for storing MAC addresses */
        eth_dev->data->mac_addrs = rte_zmalloc("ixgbevf", ETHER_ADDR_LEN *
-                       hw->mac.num_rar_entries, 0);
+                                              hw->mac.num_rar_entries, 0);
        if (eth_dev->data->mac_addrs == NULL) {
                PMD_INIT_LOG(ERR,
-                       "Failed to allocate %u bytes needed to store "
-                       "MAC addresses",
-                       ETHER_ADDR_LEN * hw->mac.num_rar_entries);
+                            "Failed to allocate %u bytes needed to store "
+                            "MAC addresses",
+                            ETHER_ADDR_LEN * hw->mac.num_rar_entries);
                return -ENOMEM;
        }
 
@@ -1433,12 +1434,12 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
        /* reset the hardware with the new settings */
        diag = hw->mac.ops.start_hw(hw);
        switch (diag) {
-               case  0:
-                       break;
+       case  0:
+               break;
 
-               default:
-                       PMD_INIT_LOG(ERR, "VF Initialization Failure: %d", diag);
-                       return -EIO;
+       default:
+               PMD_INIT_LOG(ERR, "VF Initialization Failure: %d", diag);
+               return -EIO;
        }
 
        PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x mac.type=%s",
@@ -1537,7 +1538,7 @@ ixgbe_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 {
        struct ixgbe_hw *hw =
                IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-       struct ixgbe_vfta * shadow_vfta =
+       struct ixgbe_vfta *shadow_vfta =
                IXGBE_DEV_PRIVATE_TO_VFTA(dev->data->dev_private);
        uint32_t vfta;
        uint32_t vid_idx;
@@ -1611,7 +1612,7 @@ ixgbe_vlan_hw_filter_enable(struct rte_eth_dev *dev)
 {
        struct ixgbe_hw *hw =
                IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-       struct ixgbe_vfta * shadow_vfta =
+       struct ixgbe_vfta *shadow_vfta =
                IXGBE_DEV_PRIVATE_TO_VFTA(dev->data->dev_private);
        uint32_t vlnctrl;
        uint16_t i;
@@ -1635,6 +1636,7 @@ ixgbe_vlan_hw_strip_bitmap_set(struct rte_eth_dev *dev, uint16_t queue, bool on)
 {
        struct ixgbe_hwstrip *hwstrip =
                IXGBE_DEV_PRIVATE_TO_HWSTRIP_BITMAP(dev->data->dev_private);
+       struct ixgbe_rx_queue *rxq;
 
        if (queue >= IXGBE_MAX_RX_QUEUE_NUM)
                return;
@@ -1643,6 +1645,16 @@ ixgbe_vlan_hw_strip_bitmap_set(struct rte_eth_dev *dev, uint16_t queue, bool on)
                IXGBE_SET_HWSTRIP(hwstrip, queue);
        else
                IXGBE_CLEAR_HWSTRIP(hwstrip, queue);
+
+       if (queue >= dev->data->nb_rx_queues)
+               return;
+
+       rxq = dev->data->rx_queues[queue];
+
+       if (on)
+               rxq->vlan_flags = PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED;
+       else
+               rxq->vlan_flags = PKT_RX_VLAN_PKT;
 }
 
 static void
@@ -1659,12 +1671,12 @@ ixgbe_vlan_hw_strip_disable(struct rte_eth_dev *dev, uint16_t queue)
                PMD_INIT_LOG(NOTICE, "82598EB not support queue level hw strip");
                return;
        }
-       else {
-               /* Other 10G NIC, the VLAN strip can be setup per queue in RXDCTL */
-               ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(queue));
-               ctrl &= ~IXGBE_RXDCTL_VME;
-               IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(queue), ctrl);
-       }
+
+       /* Other 10G NIC, the VLAN strip can be setup per queue in RXDCTL */
+       ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(queue));
+       ctrl &= ~IXGBE_RXDCTL_VME;
+       IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(queue), ctrl);
+
        /* record those setting for HW strip per queue */
        ixgbe_vlan_hw_strip_bitmap_set(dev, queue, 0);
 }
@@ -1683,12 +1695,12 @@ ixgbe_vlan_hw_strip_enable(struct rte_eth_dev *dev, uint16_t queue)
                PMD_INIT_LOG(NOTICE, "82598EB not support queue level hw strip");
                return;
        }
-       else {
-               /* Other 10G NIC, the VLAN strip can be setup per queue in RXDCTL */
-               ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(queue));
-               ctrl |= IXGBE_RXDCTL_VME;
-               IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(queue), ctrl);
-       }
+
+       /* Other 10G NIC, the VLAN strip can be setup per queue in RXDCTL */
+       ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(queue));
+       ctrl |= IXGBE_RXDCTL_VME;
+       IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(queue), ctrl);
+
        /* record those setting for HW strip per queue */
        ixgbe_vlan_hw_strip_bitmap_set(dev, queue, 1);
 }
@@ -1707,8 +1719,7 @@ ixgbe_vlan_hw_strip_disable_all(struct rte_eth_dev *dev)
                ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
                ctrl &= ~IXGBE_VLNCTRL_VME;
                IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl);
-       }
-       else {
+       } else {
                /* Other 10G NIC, the VLAN strip can be setup per queue in RXDCTL */
                for (i = 0; i < dev->data->nb_rx_queues; i++) {
                        ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(i));
@@ -1735,8 +1746,7 @@ ixgbe_vlan_hw_strip_enable_all(struct rte_eth_dev *dev)
                ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
                ctrl |= IXGBE_VLNCTRL_VME;
                IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl);
-       }
-       else {
+       } else {
                /* Other 10G NIC, the VLAN strip can be setup per queue in RXDCTL */
                for (i = 0; i < dev->data->nb_rx_queues; i++) {
                        ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(i));
@@ -1791,7 +1801,8 @@ ixgbe_vlan_hw_extend_enable(struct rte_eth_dev *dev)
 
        /* Clear pooling mode of PFVTCTL. It's required by X550. */
        if (hw->mac.type == ixgbe_mac_X550 ||
-           hw->mac.type == ixgbe_mac_X550EM_x) {
+           hw->mac.type == ixgbe_mac_X550EM_x ||
+           hw->mac.type == ixgbe_mac_X550EM_a) {
                ctrl = IXGBE_READ_REG(hw, IXGBE_VT_CTL);
                ctrl &= ~IXGBE_VT_CTL_POOLING_MODE_MASK;
                IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, ctrl);
@@ -1835,6 +1846,7 @@ ixgbe_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
                IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        /* VLNCTRL: enable vlan filtering and allow all vlan tags through */
        uint32_t vlanctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
+
        vlanctrl |= IXGBE_VLNCTRL_VFE; /* enable vlan filters */
        IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlanctrl);
 }
@@ -1864,8 +1876,9 @@ static int
 ixgbe_check_mq_mode(struct rte_eth_dev *dev)
 {
        struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
+       struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        uint16_t nb_rx_q = dev->data->nb_rx_queues;
-       uint16_t nb_tx_q = dev->data->nb_rx_queues;
+       uint16_t nb_tx_q = dev->data->nb_tx_queues;
 
        if (RTE_ETH_DEV_SRIOV(dev).active != 0) {
                /* check multi-queue mode */
@@ -2005,6 +2018,21 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)
                                return -EINVAL;
                        }
                }
+
+               /*
+                * When DCB/VT is off, maximum number of queues changes,
+                * except for 82598EB, which remains constant.
+                */
+               if (dev_conf->txmode.mq_mode == ETH_MQ_TX_NONE &&
+                               hw->mac.type != ixgbe_mac_82598EB) {
+                       if (nb_tx_q > IXGBE_NONE_MODE_TX_NB_QUEUES) {
+                               PMD_INIT_LOG(ERR,
+                                            "Neither VT nor DCB are enabled, "
+                                            "nb_tx_q > %d.",
+                                            IXGBE_NONE_MODE_TX_NB_QUEUES);
+                               return -EINVAL;
+                       }
+               }
        }
        return 0;
 }
@@ -2077,14 +2105,16 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
        int mask = 0;
        int status;
        uint16_t vf, idx;
+       uint32_t *link_speeds;
 
        PMD_INIT_FUNC_TRACE();
 
-       /* IXGBE devices don't support half duplex */
-       if ((dev->data->dev_conf.link_duplex != ETH_LINK_AUTONEG_DUPLEX) &&
-                       (dev->data->dev_conf.link_duplex != ETH_LINK_FULL_DUPLEX)) {
-               PMD_INIT_LOG(ERR, "Invalid link_duplex (%hu) for port %hhu",
-                            dev->data->dev_conf.link_duplex,
+       /* IXGBE devices don't support:
+       *    - half duplex (checked afterwards for valid speeds)
+       *    - fixed speed: TODO implement
+       */
+       if (dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED) {
+               PMD_INIT_LOG(ERR, "Invalid link_speeds for port %hhu; fix speed not supported",
                             dev->data->port_id);
                return -EINVAL;
        }
@@ -2097,7 +2127,8 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
        ixgbe_stop_adapter(hw);
 
        /* reinitialize adapter
-        * this calls reset and start */
+        * this calls reset and start
+        */
        status = ixgbe_pf_reset_hw(hw);
        if (status != 0)
                return -1;
@@ -2114,6 +2145,11 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
             !RTE_ETH_DEV_SRIOV(dev).active) &&
            dev->data->dev_conf.intr_conf.rxq != 0) {
                intr_vector = dev->data->nb_rx_queues;
+               if (intr_vector > IXGBE_MAX_INTR_QUEUE_NUM) {
+                       PMD_INIT_LOG(ERR, "At most %d intr queues supported",
+                                       IXGBE_MAX_INTR_QUEUE_NUM);
+                       return -ENOTSUP;
+               }
                if (rte_intr_efd_enable(intr_handle, intr_vector))
                        return -1;
        }
@@ -2176,30 +2212,25 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
        if (err)
                goto error;
 
-       switch(dev->data->dev_conf.link_speed) {
-       case ETH_LINK_SPEED_AUTONEG:
+       link_speeds = &dev->data->dev_conf.link_speeds;
+       if (*link_speeds & ~(ETH_LINK_SPEED_100M | ETH_LINK_SPEED_1G |
+                       ETH_LINK_SPEED_10G)) {
+               PMD_INIT_LOG(ERR, "Invalid link setting");
+               goto error;
+       }
+
+       speed = 0x0;
+       if (*link_speeds == ETH_LINK_SPEED_AUTONEG) {
                speed = (hw->mac.type != ixgbe_mac_82598EB) ?
                                IXGBE_LINK_SPEED_82599_AUTONEG :
                                IXGBE_LINK_SPEED_82598_AUTONEG;
-               break;
-       case ETH_LINK_SPEED_100:
-               /*
-                * Invalid for 82598 but error will be detected by
-                * ixgbe_setup_link()
-                */
-               speed = IXGBE_LINK_SPEED_100_FULL;
-               break;
-       case ETH_LINK_SPEED_1000:
-               speed = IXGBE_LINK_SPEED_1GB_FULL;
-               break;
-       case ETH_LINK_SPEED_10000:
-               speed = IXGBE_LINK_SPEED_10GB_FULL;
-               break;
-       default:
-               PMD_INIT_LOG(ERR, "Invalid link_speed (%hu) for port %hhu",
-                            dev->data->dev_conf.link_speed,
-                            dev->data->port_id);
-               goto error;
+       } else {
+               if (*link_speeds & ETH_LINK_SPEED_10G)
+                       speed |= IXGBE_LINK_SPEED_10GB_FULL;
+               if (*link_speeds & ETH_LINK_SPEED_1G)
+                       speed |= IXGBE_LINK_SPEED_1GB_FULL;
+               if (*link_speeds & ETH_LINK_SPEED_100M)
+                       speed |= IXGBE_LINK_SPEED_100_FULL;
        }
 
        err = ixgbe_setup_link(hw, speed, link_up);
@@ -2232,7 +2263,7 @@ skip_link_setup:
        /* resume enabled intr since hw reset */
        ixgbe_enable_intr(dev);
 
-       mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK | \
+       mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK |
                ETH_VLAN_EXTEND_MASK;
        ixgbe_vlan_offload_set(dev, mask);
 
@@ -2452,8 +2483,8 @@ ixgbe_read_stats_registers(struct ixgbe_hw *hw,
        hw_stats->mspdc += IXGBE_READ_REG(hw, IXGBE_MSPDC);
 
        for (i = 0; i < 8; i++) {
-               uint32_t mp;
-               mp = IXGBE_READ_REG(hw, IXGBE_MPC(i));
+               uint32_t mp = IXGBE_READ_REG(hw, IXGBE_MPC(i));
+
                /* global total per queue */
                hw_stats->mpc[i] += mp;
                /* Running comprehensive total for stats display */
@@ -2645,15 +2676,15 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
        /* Rx Errors */
        stats->imissed  = total_missed_rx;
        stats->ierrors  = hw_stats->crcerrs +
-                         hw_stats->mspdc +
-                         hw_stats->rlec +
-                         hw_stats->ruc +
-                         hw_stats->roc +
-                         hw_stats->illerrc +
-                         hw_stats->errbc +
-                         hw_stats->rfc +
-                         hw_stats->fccrc +
-                         hw_stats->fclast;
+                         hw_stats->mspdc +
+                         hw_stats->rlec +
+                         hw_stats->ruc +
+                         hw_stats->roc +
+                         hw_stats->illerrc +
+                         hw_stats->errbc +
+                         hw_stats->rfc +
+                         hw_stats->fccrc +
+                         hw_stats->fclast;
 
        /* Tx Errors */
        stats->oerrors  = 0;
@@ -2767,7 +2798,7 @@ static void
 ixgbevf_update_stats(struct rte_eth_dev *dev)
 {
        struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-       struct ixgbevf_hw_stats *hw_stats = (struct ixgbevf_hw_stats*)
+       struct ixgbevf_hw_stats *hw_stats = (struct ixgbevf_hw_stats *)
                          IXGBE_DEV_PRIVATE_TO_STATS(dev->data->dev_private);
 
        /* Good Rx packet, include VF loopback */
@@ -2833,14 +2864,12 @@ ixgbevf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
        stats->ibytes = hw_stats->vfgorc;
        stats->opackets = hw_stats->vfgptc;
        stats->obytes = hw_stats->vfgotc;
-       stats->imcasts = hw_stats->vfmprc;
-       /* stats->imcasts should be removed as imcasts is deprecated */
 }
 
 static void
 ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
 {
-       struct ixgbevf_hw_stats *hw_stats = (struct ixgbevf_hw_stats*)
+       struct ixgbevf_hw_stats *hw_stats = (struct ixgbevf_hw_stats *)
                        IXGBE_DEV_PRIVATE_TO_STATS(dev->data->dev_private);
 
        /* Sync HW register to the last stats */
@@ -2851,17 +2880,25 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
        hw_stats->vfgorc = 0;
        hw_stats->vfgptc = 0;
        hw_stats->vfgotc = 0;
-       hw_stats->vfmprc = 0;
-
 }
 
 static void
 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
        struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+       struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
 
        dev_info->max_rx_queues = (uint16_t)hw->mac.max_rx_queues;
        dev_info->max_tx_queues = (uint16_t)hw->mac.max_tx_queues;
+       if (RTE_ETH_DEV_SRIOV(dev).active == 0) {
+               /*
+                * When DCB/VT is off, maximum number of queues changes,
+                * except for 82598EB, which remains constant.
+                */
+               if (dev_conf->txmode.mq_mode == ETH_MQ_TX_NONE &&
+                               hw->mac.type != ixgbe_mac_82598EB)
+                       dev_info->max_tx_queues = IXGBE_NONE_MODE_TX_NB_QUEUES;
+       }
        dev_info->min_rx_bufsize = 1024; /* cf BSIZEPACKET in SRRCTL register */
        dev_info->max_rx_pktlen = 15872; /* includes CRC, cf MAXFRS register */
        dev_info->max_mac_addrs = hw->mac.num_rar_entries;
@@ -2888,7 +2925,8 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
                dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO;
 
        if (hw->mac.type == ixgbe_mac_X550 ||
-           hw->mac.type == ixgbe_mac_X550EM_x)
+           hw->mac.type == ixgbe_mac_X550EM_x ||
+           hw->mac.type == ixgbe_mac_X550EM_a)
                dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM;
 
        dev_info->tx_offload_capa =
@@ -2900,7 +2938,8 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
                DEV_TX_OFFLOAD_TCP_TSO;
 
        if (hw->mac.type == ixgbe_mac_X550 ||
-           hw->mac.type == ixgbe_mac_X550EM_x)
+           hw->mac.type == ixgbe_mac_X550EM_x ||
+           hw->mac.type == ixgbe_mac_X550EM_a)
                dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM;
 
        dev_info->default_rxconf = (struct rte_eth_rxconf) {
@@ -2931,6 +2970,14 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        dev_info->hash_key_size = IXGBE_HKEY_MAX_INDEX * sizeof(uint32_t);
        dev_info->reta_size = ixgbe_reta_size_get(hw->mac.type);
        dev_info->flow_type_rss_offloads = IXGBE_RSS_OFFLOAD_ALL;
+
+       dev_info->speed_capa = ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G;
+       if (hw->mac.type == ixgbe_mac_X540 ||
+           hw->mac.type == ixgbe_mac_X540_vf ||
+           hw->mac.type == ixgbe_mac_X550 ||
+           hw->mac.type == ixgbe_mac_X550_vf) {
+               dev_info->speed_capa |= ETH_LINK_SPEED_100M;
+       }
 }
 
 static const uint32_t *
@@ -2961,9 +3008,7 @@ ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev)
        if (dev->rx_pkt_burst == ixgbe_recv_pkts ||
            dev->rx_pkt_burst == ixgbe_recv_pkts_lro_single_alloc ||
            dev->rx_pkt_burst == ixgbe_recv_pkts_lro_bulk_alloc ||
-           dev->rx_pkt_burst == ixgbe_recv_pkts_bulk_alloc ||
-           dev->rx_pkt_burst == ixgbe_recv_pkts_vec ||
-           dev->rx_pkt_burst == ixgbe_recv_scattered_pkts_vec)
+           dev->rx_pkt_burst == ixgbe_recv_pkts_bulk_alloc)
                return ptypes;
        return NULL;
 }
@@ -3032,9 +3077,9 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
        int link_up;
        int diag;
 
-       link.link_status = 0;
+       link.link_status = ETH_LINK_DOWN;
        link.link_speed = 0;
-       link.link_duplex = 0;
+       link.link_duplex = ETH_LINK_HALF_DUPLEX;
        memset(&old, 0, sizeof(old));
        rte_ixgbe_dev_atomic_read_link_status(dev, &old);
 
@@ -3047,8 +3092,8 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
                diag = ixgbe_check_link(hw, &link_speed, &link_up, 1);
 
        if (diag != 0) {
-               link.link_speed = ETH_LINK_SPEED_100;
-               link.link_duplex = ETH_LINK_HALF_DUPLEX;
+               link.link_speed = ETH_SPEED_NUM_100M;
+               link.link_duplex = ETH_LINK_FULL_DUPLEX;
                rte_ixgbe_dev_atomic_write_link_status(dev, &link);
                if (link.link_status == old.link_status)
                        return -1;
@@ -3061,26 +3106,26 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
                        return -1;
                return 0;
        }
-       link.link_status = 1;
+       link.link_status = ETH_LINK_UP;
        link.link_duplex = ETH_LINK_FULL_DUPLEX;
 
        switch (link_speed) {
        default:
        case IXGBE_LINK_SPEED_UNKNOWN:
-               link.link_duplex = ETH_LINK_HALF_DUPLEX;
-               link.link_speed = ETH_LINK_SPEED_100;
+               link.link_duplex = ETH_LINK_FULL_DUPLEX;
+               link.link_speed = ETH_SPEED_NUM_100M;
                break;
 
        case IXGBE_LINK_SPEED_100_FULL:
-               link.link_speed = ETH_LINK_SPEED_100;
+               link.link_speed = ETH_SPEED_NUM_100M;
                break;
 
        case IXGBE_LINK_SPEED_1GB_FULL:
-               link.link_speed = ETH_LINK_SPEED_1000;
+               link.link_speed = ETH_SPEED_NUM_1G;
                break;
 
        case IXGBE_LINK_SPEED_10GB_FULL:
-               link.link_speed = ETH_LINK_SPEED_10000;
+               link.link_speed = ETH_SPEED_NUM_10G;
                break;
        }
        rte_ixgbe_dev_atomic_write_link_status(dev, &link);
@@ -3319,7 +3364,7 @@ ixgbe_dev_interrupt_action(struct rte_eth_dev *dev)
 
        if (intr_enable_delay) {
                if (rte_eal_alarm_set(timeout * 1000,
-                                     ixgbe_dev_interrupt_delayed_handler, (void*)dev) < 0)
+                                     ixgbe_dev_interrupt_delayed_handler, (void *)dev) < 0)
                        PMD_DRV_LOG(ERR, "Error setting alarm");
        } else {
                PMD_DRV_LOG(DEBUG, "enable intr immediately");
@@ -3538,7 +3583,7 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
  *  Enable flow control according to the current settings.
  */
 static int
-ixgbe_dcb_pfc_enable_generic(struct ixgbe_hw *hw,uint8_t tc_num)
+ixgbe_dcb_pfc_enable_generic(struct ixgbe_hw *hw, uint8_t tc_num)
 {
        int ret_val = 0;
        uint32_t mflcn_reg, fccfg_reg;
@@ -3585,13 +3630,13 @@ ixgbe_dcb_pfc_enable_generic(struct ixgbe_hw *hw,uint8_t tc_num)
                 * and the TX pause can not be disabled
                 */
                nb_rx_en = 0;
-               for (i =0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
+               for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
                        reg = IXGBE_READ_REG(hw, IXGBE_FCRTH_82599(i));
                        if (reg & IXGBE_FCRTH_FCEN)
                                nb_rx_en++;
                }
                if (nb_rx_en > 1)
-                       fccfg_reg |=IXGBE_FCCFG_TFCE_PRIORITY;
+                       fccfg_reg |= IXGBE_FCCFG_TFCE_PRIORITY;
                break;
        case ixgbe_fc_rx_pause:
                /*
@@ -3608,20 +3653,20 @@ ixgbe_dcb_pfc_enable_generic(struct ixgbe_hw *hw,uint8_t tc_num)
                 * and the TX pause can not be disabled
                 */
                nb_rx_en = 0;
-               for (i =0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
+               for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
                        reg = IXGBE_READ_REG(hw, IXGBE_FCRTH_82599(i));
                        if (reg & IXGBE_FCRTH_FCEN)
                                nb_rx_en++;
                }
                if (nb_rx_en > 1)
-                       fccfg_reg |=IXGBE_FCCFG_TFCE_PRIORITY;
+                       fccfg_reg |= IXGBE_FCCFG_TFCE_PRIORITY;
                break;
        case ixgbe_fc_tx_pause:
                /*
                 * Tx Flow control is enabled, and Rx Flow control is
                 * disabled by software override.
                 */
-               fccfg_reg |=IXGBE_FCCFG_TFCE_PRIORITY;
+               fccfg_reg |= IXGBE_FCCFG_TFCE_PRIORITY;
                break;
        case ixgbe_fc_full:
                /* Flow control (both Rx and Tx) is enabled by SW override. */
@@ -3632,7 +3677,6 @@ ixgbe_dcb_pfc_enable_generic(struct ixgbe_hw *hw,uint8_t tc_num)
                PMD_DRV_LOG(DEBUG, "Flow control param set incorrectly");
                ret_val = IXGBE_ERR_CONFIG;
                goto out;
-               break;
        }
 
        /* Set 802.3x based flow control settings. */
@@ -3671,13 +3715,13 @@ out:
 }
 
 static int
-ixgbe_dcb_pfc_enable(struct rte_eth_dev *dev,uint8_t tc_num)
+ixgbe_dcb_pfc_enable(struct rte_eth_dev *dev, uint8_t tc_num)
 {
        struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        int32_t ret_val = IXGBE_NOT_IMPLEMENTED;
 
        if (hw->mac.type != ixgbe_mac_82598EB) {
-               ret_val = ixgbe_dcb_pfc_enable_generic(hw,tc_num);
+               ret_val = ixgbe_dcb_pfc_enable_generic(hw, tc_num);
        }
        return ret_val;
 }
@@ -3691,9 +3735,9 @@ ixgbe_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *p
        uint8_t tc_num;
        uint8_t  map[IXGBE_DCB_MAX_USER_PRIORITY] = { 0 };
        struct ixgbe_hw *hw =
-                IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+               IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        struct ixgbe_dcb_config *dcb_config =
-                IXGBE_DEV_PRIVATE_TO_DCB_CFG(dev->data->dev_private);
+               IXGBE_DEV_PRIVATE_TO_DCB_CFG(dev->data->dev_private);
 
        enum ixgbe_fc_mode rte_fcmode_2_ixgbe_fcmode[] = {
                ixgbe_fc_none,
@@ -3726,7 +3770,7 @@ ixgbe_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *p
        hw->fc.low_water[tc_num] =  pfc_conf->fc.low_water;
        hw->fc.high_water[tc_num] = pfc_conf->fc.high_water;
 
-       err = ixgbe_dcb_pfc_enable(dev,tc_num);
+       err = ixgbe_dcb_pfc_enable(dev, tc_num);
 
        /* Not negotiated is not an error case */
        if ((err == IXGBE_SUCCESS) || (err == IXGBE_ERR_FC_NOT_NEGOTIATED))
@@ -3874,7 +3918,8 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
                return -EINVAL;
 
        /* refuse mtu that requires the support of scattered packets when this
-        * feature has not been enabled before. */
+        * feature has not been enabled before.
+        */
        if (!dev->data->scattered_rx &&
            (frame_size + 2 * IXGBE_VLAN_TAG_SIZE >
             dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM))
@@ -3934,7 +3979,7 @@ ixgbevf_intr_enable(struct ixgbe_hw *hw)
 static int
 ixgbevf_dev_configure(struct rte_eth_dev *dev)
 {
-       struct rte_eth_confconf = &dev->data->dev_conf;
+       struct rte_eth_conf *conf = &dev->data->dev_conf;
        struct ixgbe_adapter *adapter =
                        (struct ixgbe_adapter *)dev->data->dev_private;
 
@@ -3996,10 +4041,10 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)
        }
 
        /* Set vfta */
-       ixgbevf_set_vfta_all(dev,1);
+       ixgbevf_set_vfta_all(dev, 1);
 
        /* Set HW strip */
-       mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK | \
+       mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK |
                ETH_VLAN_EXTEND_MASK;
        ixgbevf_vlan_offload_set(dev, mask);
 
@@ -4047,7 +4092,7 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev)
          * Clear what we set, but we still keep shadow_vfta to
          * restore after device starts
          */
-       ixgbevf_set_vfta_all(dev,0);
+       ixgbevf_set_vfta_all(dev, 0);
 
        /* Clear stored conf */
        dev->data->scattered_rx = 0;
@@ -4086,18 +4131,18 @@ ixgbevf_dev_close(struct rte_eth_dev *dev)
 static void ixgbevf_set_vfta_all(struct rte_eth_dev *dev, bool on)
 {
        struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-       struct ixgbe_vfta * shadow_vfta =
+       struct ixgbe_vfta *shadow_vfta =
                IXGBE_DEV_PRIVATE_TO_VFTA(dev->data->dev_private);
        int i = 0, j = 0, vfta = 0, mask = 1;
 
-       for (i = 0; i < IXGBE_VFTA_SIZE; i++){
+       for (i = 0; i < IXGBE_VFTA_SIZE; i++) {
                vfta = shadow_vfta->vfta[i];
                if (vfta) {
                        mask = 1;
-                       for (j = 0; j < 32; j++){
+                       for (j = 0; j < 32; j++) {
                                if (vfta & mask)
                                        ixgbe_set_vfta(hw, (i<<5)+j, 0, on);
-                               mask<<=1;
+                               mask <<= 1;
                        }
                }
        }
@@ -4109,7 +4154,7 @@ ixgbevf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 {
        struct ixgbe_hw *hw =
                IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-       struct ixgbe_vfta * shadow_vfta =
+       struct ixgbe_vfta *shadow_vfta =
                IXGBE_DEV_PRIVATE_TO_VFTA(dev->data->dev_private);
        uint32_t vid_idx = 0;
        uint32_t vid_bit = 0;
@@ -4154,7 +4199,7 @@ ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on)
                ctrl &= ~IXGBE_RXDCTL_VME;
        IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(queue), ctrl);
 
-       ixgbe_vlan_hw_strip_bitmap_set( dev, queue, on);
+       ixgbe_vlan_hw_strip_bitmap_set(dev, queue, on);
 }
 
 static void
@@ -4170,7 +4215,7 @@ ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask)
                on = !!(dev->data->dev_conf.rxmode.hw_vlan_strip);
 
                for (i = 0; i < hw->mac.max_rx_queues; i++)
-                       ixgbevf_vlan_strip_queue_set(dev,i,on);
+                       ixgbevf_vlan_strip_queue_set(dev, i, on);
        }
 }
 
@@ -4190,9 +4235,10 @@ ixgbe_vmdq_mode_check(struct ixgbe_hw *hw)
 }
 
 static uint32_t
-ixgbe_uta_vector(struct ixgbe_hw *hw, struct ether_addruc_addr)
+ixgbe_uta_vector(struct ixgbe_hw *hw, struct ether_addr *uc_addr)
 {
        uint32_t vector = 0;
+
        switch (hw->mac.mc_filter_type) {
        case 0:   /* use bits [47:36] of the address */
                vector = ((uc_addr->addr_bytes[4] >> 4) |
@@ -4220,8 +4266,8 @@ ixgbe_uta_vector(struct ixgbe_hw *hw, struct ether_addr* uc_addr)
 }
 
 static int
-ixgbe_uc_hash_table_set(struct rte_eth_dev *dev,struct ether_addr* mac_addr,
-                              uint8_t on)
+ixgbe_uc_hash_table_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
+                       uint8_t on)
 {
        uint32_t vector;
        uint32_t uta_idx;
@@ -4242,7 +4288,7 @@ ixgbe_uc_hash_table_set(struct rte_eth_dev *dev,struct ether_addr* mac_addr,
        if (hw->mac.type < ixgbe_mac_82599EB)
                return -ENOTSUP;
 
-       vector = ixgbe_uta_vector(hw,mac_addr);
+       vector = ixgbe_uta_vector(hw, mac_addr);
        uta_idx = (vector >> ixgbe_uta_bit_shift) & ixgbe_uta_idx_mask;
        uta_shift = vector & ixgbe_uta_bit_mask;
 
@@ -4267,7 +4313,7 @@ ixgbe_uc_hash_table_set(struct rte_eth_dev *dev,struct ether_addr* mac_addr,
                IXGBE_WRITE_REG(hw, IXGBE_MCSTCTRL,
                                IXGBE_MCSTCTRL_MFE | hw->mac.mc_filter_type);
        else
-               IXGBE_WRITE_REG(hw, IXGBE_MCSTCTRL,hw->mac.mc_filter_type);
+               IXGBE_WRITE_REG(hw, IXGBE_MCSTCTRL, hw->mac.mc_filter_type);
 
        return 0;
 }
@@ -4352,7 +4398,7 @@ ixgbe_set_pool_rx_mode(struct rte_eth_dev *dev, uint16_t pool,
 static int
 ixgbe_set_pool_rx(struct rte_eth_dev *dev, uint16_t pool, uint8_t on)
 {
-       uint32_t reg,addr;
+       uint32_t reg, addr;
        uint32_t val;
        const uint8_t bit1 = 0x1;
 
@@ -4362,16 +4408,26 @@ ixgbe_set_pool_rx(struct rte_eth_dev *dev, uint16_t pool, uint8_t on)
        if (ixgbe_vmdq_mode_check(hw) < 0)
                return -ENOTSUP;
 
-       addr = IXGBE_VFRE(pool >= ETH_64_POOLS/2);
+       if (pool >= ETH_64_POOLS)
+               return -EINVAL;
+
+       /* for pool >= 32, set bit in PFVFRE[1], otherwise PFVFRE[0] */
+       if (pool >= 32) {
+               addr = IXGBE_VFRE(1);
+               val = bit1 << (pool - 32);
+       } else {
+               addr = IXGBE_VFRE(0);
+               val = bit1 << pool;
+       }
+
        reg = IXGBE_READ_REG(hw, addr);
-       val = bit1 << pool;
 
        if (on)
                reg |= val;
        else
                reg &= ~val;
 
-       IXGBE_WRITE_REG(hw, addr,reg);
+       IXGBE_WRITE_REG(hw, addr, reg);
 
        return 0;
 }
@@ -4379,7 +4435,7 @@ ixgbe_set_pool_rx(struct rte_eth_dev *dev, uint16_t pool, uint8_t on)
 static int
 ixgbe_set_pool_tx(struct rte_eth_dev *dev, uint16_t pool, uint8_t on)
 {
-       uint32_t reg,addr;
+       uint32_t reg, addr;
        uint32_t val;
        const uint8_t bit1 = 0x1;
 
@@ -4389,16 +4445,26 @@ ixgbe_set_pool_tx(struct rte_eth_dev *dev, uint16_t pool, uint8_t on)
        if (ixgbe_vmdq_mode_check(hw) < 0)
                return -ENOTSUP;
 
-       addr = IXGBE_VFTE(pool >= ETH_64_POOLS/2);
+       if (pool >= ETH_64_POOLS)
+               return -EINVAL;
+
+       /* for pool >= 32, set bit in PFVFTE[1], otherwise PFVFTE[0] */
+       if (pool >= 32) {
+               addr = IXGBE_VFTE(1);
+               val = bit1 << (pool - 32);
+       } else {
+               addr = IXGBE_VFTE(0);
+               val = bit1 << pool;
+       }
+
        reg = IXGBE_READ_REG(hw, addr);
-       val = bit1 << pool;
 
        if (on)
                reg |= val;
        else
                reg &= ~val;
 
-       IXGBE_WRITE_REG(hw, addr,reg);
+       IXGBE_WRITE_REG(hw, addr, reg);
 
        return 0;
 }
@@ -4415,10 +4481,11 @@ ixgbe_set_pool_vlan_filter(struct rte_eth_dev *dev, uint16_t vlan,
        if (ixgbe_vmdq_mode_check(hw) < 0)
                return -ENOTSUP;
        for (pool_idx = 0; pool_idx < ETH_64_POOLS; pool_idx++) {
-               if (pool_mask & ((uint64_t)(1ULL << pool_idx)))
-                       ret = hw->mac.ops.set_vfta(hw,vlan,pool_idx,vlan_on);
+               if (pool_mask & ((uint64_t)(1ULL << pool_idx))) {
+                       ret = hw->mac.ops.set_vfta(hw, vlan, pool_idx, vlan_on);
                        if (ret < 0)
                                return ret;
+               }
        }
 
        return ret;
@@ -4437,7 +4504,7 @@ ixgbe_mirror_rule_set(struct rte_eth_dev *dev,
                        struct rte_eth_mirror_conf *mirror_conf,
                        uint8_t rule_id, uint8_t on)
 {
-       uint32_t mr_ctl,vlvf;
+       uint32_t mr_ctl, vlvf;
        uint32_t mp_lsb = 0;
        uint32_t mv_msb = 0;
        uint32_t mv_lsb = 0;
@@ -4450,7 +4517,7 @@ ixgbe_mirror_rule_set(struct rte_eth_dev *dev,
        const uint8_t vlan_mask_offset = 32;
        const uint8_t dst_pool_offset = 8;
        const uint8_t rule_mr_offset  = 4;
-       const uint8_t mirror_rule_mask= 0x0F;
+       const uint8_t mirror_rule_mask = 0x0F;
 
        struct ixgbe_mirror_info *mr_info =
                        (IXGBE_DEV_PRIVATE_TO_PFDATA(dev->data->dev_private));
@@ -4473,7 +4540,7 @@ ixgbe_mirror_rule_set(struct rte_eth_dev *dev,
        if (mirror_conf->rule_type & ETH_MIRROR_VLAN) {
                mirror_type |= IXGBE_MRCTL_VLME;
                /* Check if vlan id is valid and find conresponding VLAN ID index in VLVF */
-               for (i = 0;i < IXGBE_VLVF_ENTRIES; i++) {
+               for (i = 0; i < IXGBE_VLVF_ENTRIES; i++) {
                        if (mirror_conf->vlan.vlan_mask & (1ULL << i)) {
                                /* search vlan id related pool vlan filter index */
                                reg_index = ixgbe_find_vlvf_slot(hw,
@@ -5038,7 +5105,8 @@ ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr)
 
 #define MAC_TYPE_FILTER_SUP(type)    do {\
        if ((type) != ixgbe_mac_82599EB && (type) != ixgbe_mac_X540 &&\
-               (type) != ixgbe_mac_X550)\
+               (type) != ixgbe_mac_X550 && (type) != ixgbe_mac_X550EM_x &&\
+               (type) != ixgbe_mac_X550EM_a)\
                return -ENOTSUP;\
 } while (0)
 
@@ -5267,7 +5335,8 @@ ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
                return -EINVAL;
 
        /* refuse mtu that requires the support of scattered packets when this
-        * feature has not been enabled before. */
+        * feature has not been enabled before.
+        */
        if (!dev->data->scattered_rx &&
            (max_frame + 2 * IXGBE_VLAN_TAG_SIZE >
             dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM))
@@ -5799,6 +5868,8 @@ ixgbe_read_systime_cyclecounter(struct rte_eth_dev *dev)
 
        switch (hw->mac.type) {
        case ixgbe_mac_X550:
+       case ixgbe_mac_X550EM_x:
+       case ixgbe_mac_X550EM_a:
                /* SYSTIMEL stores ns and SYSTIMEH stores seconds. */
                systime_cycles = (uint64_t)IXGBE_READ_REG(hw, IXGBE_SYSTIML);
                systime_cycles += (uint64_t)IXGBE_READ_REG(hw, IXGBE_SYSTIMH)
@@ -5821,6 +5892,8 @@ ixgbe_read_rx_tstamp_cyclecounter(struct rte_eth_dev *dev)
 
        switch (hw->mac.type) {
        case ixgbe_mac_X550:
+       case ixgbe_mac_X550EM_x:
+       case ixgbe_mac_X550EM_a:
                /* RXSTMPL stores ns and RXSTMPH stores seconds. */
                rx_tstamp_cycles = (uint64_t)IXGBE_READ_REG(hw, IXGBE_RXSTMPL);
                rx_tstamp_cycles += (uint64_t)IXGBE_READ_REG(hw, IXGBE_RXSTMPH)
@@ -5844,6 +5917,8 @@ ixgbe_read_tx_tstamp_cyclecounter(struct rte_eth_dev *dev)
 
        switch (hw->mac.type) {
        case ixgbe_mac_X550:
+       case ixgbe_mac_X550EM_x:
+       case ixgbe_mac_X550EM_a:
                /* TXSTMPL stores ns and TXSTMPH stores seconds. */
                tx_tstamp_cycles = (uint64_t)IXGBE_READ_REG(hw, IXGBE_TXSTMPL);
                tx_tstamp_cycles += (uint64_t)IXGBE_READ_REG(hw, IXGBE_TXSTMPH)
@@ -5875,15 +5950,15 @@ ixgbe_start_timecounters(struct rte_eth_dev *dev)
        rte_ixgbe_dev_atomic_read_link_status(dev, &link);
 
        switch (link.link_speed) {
-       case ETH_LINK_SPEED_100:
+       case ETH_SPEED_NUM_100M:
                incval = IXGBE_INCVAL_100;
                shift = IXGBE_INCVAL_SHIFT_100;
                break;
-       case ETH_LINK_SPEED_1000:
+       case ETH_SPEED_NUM_1G:
                incval = IXGBE_INCVAL_1GB;
                shift = IXGBE_INCVAL_SHIFT_1GB;
                break;
-       case ETH_LINK_SPEED_10000:
+       case ETH_SPEED_NUM_10G:
        default:
                incval = IXGBE_INCVAL_10GB;
                shift = IXGBE_INCVAL_SHIFT_10GB;
@@ -5892,6 +5967,8 @@ ixgbe_start_timecounters(struct rte_eth_dev *dev)
 
        switch (hw->mac.type) {
        case ixgbe_mac_X550:
+       case ixgbe_mac_X550EM_x:
+       case ixgbe_mac_X550EM_a:
                /* Independent of link speed. */
                incval = 1;
                /* Cycles read will be interpreted as ns. */
@@ -6365,7 +6442,8 @@ ixgbe_update_e_tag_eth_type(struct ixgbe_hw *hw,
        uint32_t etag_etype;
 
        if (hw->mac.type != ixgbe_mac_X550 &&
-           hw->mac.type != ixgbe_mac_X550EM_x) {
+           hw->mac.type != ixgbe_mac_X550EM_x &&
+           hw->mac.type != ixgbe_mac_X550EM_a) {
                return -ENOTSUP;
        }
 
@@ -6409,7 +6487,8 @@ ixgbe_e_tag_enable(struct ixgbe_hw *hw)
        uint32_t etag_etype;
 
        if (hw->mac.type != ixgbe_mac_X550 &&
-           hw->mac.type != ixgbe_mac_X550EM_x) {
+           hw->mac.type != ixgbe_mac_X550EM_x &&
+           hw->mac.type != ixgbe_mac_X550EM_a) {
                return -ENOTSUP;
        }
 
@@ -6449,7 +6528,8 @@ ixgbe_e_tag_disable(struct ixgbe_hw *hw)
        uint32_t etag_etype;
 
        if (hw->mac.type != ixgbe_mac_X550 &&
-           hw->mac.type != ixgbe_mac_X550EM_x) {
+           hw->mac.type != ixgbe_mac_X550EM_x &&
+           hw->mac.type != ixgbe_mac_X550EM_a) {
                return -ENOTSUP;
        }
 
@@ -6492,7 +6572,8 @@ ixgbe_e_tag_filter_del(struct rte_eth_dev *dev,
        uint32_t rar_low, rar_high;
 
        if (hw->mac.type != ixgbe_mac_X550 &&
-           hw->mac.type != ixgbe_mac_X550EM_x) {
+           hw->mac.type != ixgbe_mac_X550EM_x &&
+           hw->mac.type != ixgbe_mac_X550EM_a) {
                return -ENOTSUP;
        }
 
@@ -6527,7 +6608,8 @@ ixgbe_e_tag_filter_add(struct rte_eth_dev *dev,
        uint32_t rar_low, rar_high;
 
        if (hw->mac.type != ixgbe_mac_X550 &&
-           hw->mac.type != ixgbe_mac_X550EM_x) {
+           hw->mac.type != ixgbe_mac_X550EM_x &&
+           hw->mac.type != ixgbe_mac_X550EM_a) {
                return -ENOTSUP;
        }
 
@@ -6646,7 +6728,8 @@ ixgbe_e_tag_forwarding_en_dis(struct rte_eth_dev *dev, bool en)
        struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
        if (hw->mac.type != ixgbe_mac_X550 &&
-           hw->mac.type != ixgbe_mac_X550EM_x) {
+           hw->mac.type != ixgbe_mac_X550EM_x &&
+           hw->mac.type != ixgbe_mac_X550EM_a) {
                return -ENOTSUP;
        }
 
@@ -6719,7 +6802,8 @@ ixgbe_e_tag_insertion_en_dis(struct rte_eth_dev *dev,
        }
 
        if (hw->mac.type != ixgbe_mac_X550 &&
-           hw->mac.type != ixgbe_mac_X550EM_x) {
+           hw->mac.type != ixgbe_mac_X550EM_x &&
+           hw->mac.type != ixgbe_mac_X550EM_a) {
                return -ENOTSUP;
        }
 
@@ -6789,7 +6873,8 @@ ixgbe_e_tag_stripping_en_dis(struct rte_eth_dev *dev,
        struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
        if (hw->mac.type != ixgbe_mac_X550 &&
-           hw->mac.type != ixgbe_mac_X550EM_x) {
+           hw->mac.type != ixgbe_mac_X550EM_x &&
+           hw->mac.type != ixgbe_mac_X550EM_a) {
                return -ENOTSUP;
        }
 
@@ -6962,7 +7047,8 @@ ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev,
        struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
        if (hw->mac.type != ixgbe_mac_X550 &&
-           hw->mac.type != ixgbe_mac_X550EM_x) {
+           hw->mac.type != ixgbe_mac_X550EM_x &&
+           hw->mac.type != ixgbe_mac_X550EM_a) {
                return -ENOTSUP;
        }
 
@@ -6998,7 +7084,8 @@ ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
        struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
        if (hw->mac.type != ixgbe_mac_X550 &&
-           hw->mac.type != ixgbe_mac_X550EM_x) {
+           hw->mac.type != ixgbe_mac_X550EM_x &&
+           hw->mac.type != ixgbe_mac_X550EM_a) {
                return -ENOTSUP;
        }