net/i40e: allow VF to configure pctype mapping
authorBeilei Xing <beilei.xing@intel.com>
Mon, 17 Jun 2019 03:17:35 +0000 (11:17 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 20 Jun 2019 21:42:04 +0000 (23:42 +0200)
This patch allows VF to get/update/reset pctype mapping info.

Cc: stable@dpdk.org
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/i40e/i40e_ethdev.c
drivers/net/i40e/i40e_ethdev.h
drivers/net/i40e/i40e_ethdev_vf.c
drivers/net/i40e/rte_pmd_i40e.c

index 3cf2c1b..a8688e0 100644 (file)
@@ -12132,7 +12132,7 @@ i40e_filter_restore(struct i40e_pf *pf)
        i40e_rss_filter_restore(pf);
 }
 
-static bool
+bool
 is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv)
 {
        if (strcmp(dev->device->driver->name, drv->driver.name))
index 6f2949e..38ac3ea 100644 (file)
@@ -271,6 +271,7 @@ enum i40e_flxpld_layer_idx {
        (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE * 2)
 
 struct i40e_adapter;
+struct rte_pci_driver;
 
 /**
  * MAC filter structure
@@ -1215,7 +1216,9 @@ void i40e_set_vlan_filter(struct i40e_vsi *vsi, uint16_t vlan_id, bool on);
 int i40e_add_macvlan_filters(struct i40e_vsi *vsi,
                             struct i40e_macvlan_filter *filter,
                             int total);
+bool is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv);
 bool is_i40e_supported(struct rte_eth_dev *dev);
+bool is_i40evf_supported(struct rte_eth_dev *dev);
 
 int i40e_validate_input_set(enum i40e_filter_pctype pctype,
                            enum rte_filter_type filter, uint64_t inset);
index 63dbe14..d922a84 100644 (file)
@@ -2808,3 +2808,9 @@ i40evf_set_mc_addr_list(struct rte_eth_dev *dev,
 
        return 0;
 }
+
+bool
+is_i40evf_supported(struct rte_eth_dev *dev)
+{
+       return is_device_supported(dev, &rte_i40evf_pmd);
+}
index 0fbf79c..24281c2 100644 (file)
@@ -2405,7 +2405,8 @@ int rte_pmd_i40e_flow_type_mapping_reset(uint16_t port)
 
        dev = &rte_eth_devices[port];
 
-       if (!is_i40e_supported(dev))
+       if (!is_i40e_supported(dev) &&
+           !is_i40evf_supported(dev))
                return -ENOTSUP;
 
        i40e_set_default_pctype_table(dev);
@@ -2425,7 +2426,8 @@ int rte_pmd_i40e_flow_type_mapping_get(
 
        dev = &rte_eth_devices[port];
 
-       if (!is_i40e_supported(dev))
+       if (!is_i40e_supported(dev) &&
+           !is_i40evf_supported(dev))
                return -ENOTSUP;
 
        ad = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
@@ -2453,7 +2455,8 @@ rte_pmd_i40e_flow_type_mapping_update(
 
        dev = &rte_eth_devices[port];
 
-       if (!is_i40e_supported(dev))
+       if (!is_i40e_supported(dev) &&
+           !is_i40evf_supported(dev))
                return -ENOTSUP;
 
        if (count > I40E_FLOW_TYPE_MAX)