net: add macro for VLAN header length
[dpdk.git] / drivers / net / txgbe / txgbe_ethdev.c
index 4b3b703..47d0e6e 100644 (file)
@@ -495,7 +495,7 @@ txgbe_parse_devargs(struct txgbe_hw *hw, struct rte_devargs *devargs)
        struct rte_kvargs *kvlist;
        u16 auto_neg = 1;
        u16 poll = 0;
-       u16 present = 1;
+       u16 present = 0;
        u16 sgmii = 0;
        u16 ffe_set = 0;
        u16 ffe_main = 27;
@@ -548,7 +548,7 @@ eth_txgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
        struct txgbe_dcb_config *dcb_config = TXGBE_DEV_DCB_CONFIG(eth_dev);
        struct txgbe_filter_info *filter_info = TXGBE_DEV_FILTER(eth_dev);
        struct txgbe_bw_conf *bw_conf = TXGBE_DEV_BW_CONF(eth_dev);
-       struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+       struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
        const struct rte_memzone *mz;
        uint32_t ctrl_ext;
        uint16_t csum;
@@ -1620,7 +1620,7 @@ txgbe_dev_start(struct rte_eth_dev *dev)
        struct txgbe_hw_stats *hw_stats = TXGBE_DEV_STATS(dev);
        struct txgbe_vf_info *vfinfo = *TXGBE_DEV_VFDATA(dev);
        struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
-       struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+       struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
        uint32_t intr_vector = 0;
        int err;
        bool link_up = false, negotiate = 0;
@@ -1670,17 +1670,14 @@ txgbe_dev_start(struct rte_eth_dev *dev)
                        return -1;
        }
 
-       if (rte_intr_dp_is_en(intr_handle) && !intr_handle->intr_vec) {
-               intr_handle->intr_vec =
-                       rte_zmalloc("intr_vec",
-                                   dev->data->nb_rx_queues * sizeof(int), 0);
-               if (intr_handle->intr_vec == NULL) {
+       if (rte_intr_dp_is_en(intr_handle)) {
+               if (rte_intr_vec_list_alloc(intr_handle, "intr_vec",
+                                                  dev->data->nb_rx_queues)) {
                        PMD_INIT_LOG(ERR, "Failed to allocate %d rx_queues"
                                     " intr_vec", dev->data->nb_rx_queues);
                        return -ENOMEM;
                }
        }
-
        /* confiugre msix for sleep until rx interrupt */
        txgbe_configure_msix(dev);
 
@@ -1861,7 +1858,7 @@ txgbe_dev_stop(struct rte_eth_dev *dev)
        struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
        struct txgbe_vf_info *vfinfo = *TXGBE_DEV_VFDATA(dev);
        struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
-       struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+       struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
        int vf;
        struct txgbe_tm_conf *tm_conf = TXGBE_DEV_TM_CONF(dev);
 
@@ -1911,10 +1908,7 @@ txgbe_dev_stop(struct rte_eth_dev *dev)
 
        /* Clean datapath event and queue/vec mapping */
        rte_intr_efd_disable(intr_handle);
-       if (intr_handle->intr_vec != NULL) {
-               rte_free(intr_handle->intr_vec);
-               intr_handle->intr_vec = NULL;
-       }
+       rte_intr_vec_list_free(intr_handle);
 
        /* reset hierarchy commit */
        tm_conf->committed = false;
@@ -1977,7 +1971,7 @@ txgbe_dev_close(struct rte_eth_dev *dev)
 {
        struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
        struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
-       struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+       struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
        int retries = 0;
        int ret;
 
@@ -2603,6 +2597,7 @@ txgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        dev_info->max_vfs = pci_dev->max_vfs;
        dev_info->max_vmdq_pools = RTE_ETH_64_POOLS;
        dev_info->vmdq_queue_num = dev_info->max_rx_queues;
+       dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP;
        dev_info->rx_queue_offload_capa = txgbe_get_rx_queue_offloads(dev);
        dev_info->rx_offload_capa = (txgbe_get_rx_port_offloads(dev) |
                                     dev_info->rx_queue_offload_capa);
@@ -2699,7 +2694,7 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev,
        link.link_speed = RTE_ETH_SPEED_NUM_NONE;
        link.link_duplex = RTE_ETH_LINK_HALF_DUPLEX;
        link.link_autoneg = !(dev->data->dev_conf.link_speeds &
-                       RTE_ETH_LINK_AUTONEG);
+                       RTE_ETH_LINK_SPEED_FIXED);
 
        hw->mac.get_link_status = true;
 
@@ -2936,8 +2931,8 @@ txgbe_dev_interrupt_get_status(struct rte_eth_dev *dev,
        struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
        struct txgbe_interrupt *intr = TXGBE_DEV_INTR(dev);
 
-       if (intr_handle->type != RTE_INTR_HANDLE_UIO &&
-                       intr_handle->type != RTE_INTR_HANDLE_VFIO_MSIX)
+       if (rte_intr_type_get(intr_handle) != RTE_INTR_HANDLE_UIO &&
+               rte_intr_type_get(intr_handle) != RTE_INTR_HANDLE_VFIO_MSIX)
                wr32(hw, TXGBE_PX_INTA, 1);
 
        /* clear all cause mask */
@@ -3103,7 +3098,7 @@ txgbe_dev_interrupt_delayed_handler(void *param)
 {
        struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
        struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
-       struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+       struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
        struct txgbe_interrupt *intr = TXGBE_DEV_INTR(dev);
        struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
        uint32_t eicr;
@@ -3466,7 +3461,7 @@ txgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
         * scattered packets when this feature has not been enabled before.
         */
        if (dev_data->dev_started && !dev_data->scattered_rx &&
-           (frame_size + 2 * TXGBE_VLAN_TAG_SIZE >
+           (frame_size + 2 * RTE_VLAN_HLEN >
             dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)) {
                PMD_INIT_LOG(ERR, "Stop port first.");
                return -EINVAL;
@@ -3623,7 +3618,7 @@ static int
 txgbe_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
 {
        struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
-       struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+       struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
        uint32_t mask;
        struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
 
@@ -3705,7 +3700,7 @@ static void
 txgbe_configure_msix(struct rte_eth_dev *dev)
 {
        struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
-       struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+       struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
        struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
        uint32_t queue_id, base = TXGBE_MISC_VEC_ID;
        uint32_t vec = TXGBE_MISC_VEC_ID;
@@ -3739,8 +3734,10 @@ txgbe_configure_msix(struct rte_eth_dev *dev)
                        queue_id++) {
                        /* by default, 1:1 mapping */
                        txgbe_set_ivar_map(hw, 0, queue_id, vec);
-                       intr_handle->intr_vec[queue_id] = vec;
-                       if (vec < base + intr_handle->nb_efd - 1)
+                       rte_intr_vec_list_index_set(intr_handle,
+                                                          queue_id, vec);
+                       if (vec < base + rte_intr_nb_efd_get(intr_handle)
+                           - 1)
                                vec++;
                }