net/i40e: config flow director automatically
[dpdk.git] / drivers / net / i40e / i40e_ethdev.c
index 4d517c1..f7a685c 100644 (file)
@@ -1787,6 +1787,10 @@ i40e_dev_configure(struct rte_eth_dev *dev)
        ad->tx_simple_allowed = true;
        ad->tx_vec_allowed = true;
 
+       /* Only legacy filter API needs the following fdir config. So when the
+        * legacy filter API is deprecated, the following codes should also be
+        * removed.
+        */
        if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_PERFECT) {
                ret = i40e_fdir_setup(pf);
                if (ret != I40E_SUCCESS) {
@@ -1844,7 +1848,11 @@ err_dcb:
        rte_free(pf->vmdq);
        pf->vmdq = NULL;
 err:
-       /* need to release fdir resource if exists */
+       /* Need to release fdir resource if exists.
+        * Only legacy filter API needs the following fdir config. So when the
+        * legacy filter API is deprecated, the following code should also be
+        * removed.
+        */
        i40e_fdir_teardown(pf);
        return ret;
 }
@@ -2482,6 +2490,11 @@ i40e_dev_close(struct rte_eth_dev *dev)
        i40e_pf_disable_irq0(hw);
        rte_intr_disable(intr_handle);
 
+       /*
+        * Only legacy filter API needs the following fdir config. So when the
+        * legacy filter API is deprecated, the following code should also be
+        * removed.
+        */
        i40e_fdir_teardown(pf);
 
        /* shutdown and destroy the HMC */
@@ -6625,7 +6638,6 @@ i40e_dev_interrupt_handler(void *param)
 done:
        /* Enable interrupt */
        i40e_pf_enable_irq0(hw);
-       rte_intr_enable(dev->intr_handle);
 }
 
 static void
@@ -11717,7 +11729,7 @@ static int i40e_get_module_info(struct rte_eth_dev *dev,
        case I40E_MODULE_TYPE_SFP:
                status = i40e_aq_get_phy_register(hw,
                                I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE,
-                               I40E_I2C_EEPROM_DEV_ADDR,
+                               I40E_I2C_EEPROM_DEV_ADDR, 1,
                                I40E_MODULE_SFF_8472_COMP,
                                &sff8472_comp, NULL);
                if (status)
@@ -11725,7 +11737,7 @@ static int i40e_get_module_info(struct rte_eth_dev *dev,
 
                status = i40e_aq_get_phy_register(hw,
                                I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE,
-                               I40E_I2C_EEPROM_DEV_ADDR,
+                               I40E_I2C_EEPROM_DEV_ADDR, 1,
                                I40E_MODULE_SFF_8472_SWAP,
                                &sff8472_swap, NULL);
                if (status)
@@ -11753,7 +11765,7 @@ static int i40e_get_module_info(struct rte_eth_dev *dev,
                /* Read from memory page 0. */
                status = i40e_aq_get_phy_register(hw,
                                I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE,
-                               0,
+                               0, 1,
                                I40E_MODULE_REVISION_ADDR,
                                &sff8636_rev, NULL);
                if (status)
@@ -11814,7 +11826,7 @@ static int i40e_get_module_eeprom(struct rte_eth_dev *dev,
                }
                status = i40e_aq_get_phy_register(hw,
                                I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE,
-                               addr, offset, &value, NULL);
+                               addr, offset, 1, &value, NULL);
                if (status)
                        return -EIO;
                data[i] = (uint8_t)value;