]> git.droids-corp.org - dpdk.git/commitdiff
app/testpmd: check vlan filter configuration
authorMichal Jastrzebski <michalx.k.jastrzebski@intel.com>
Fri, 20 Feb 2015 10:26:12 +0000 (11:26 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 9 Mar 2015 11:47:26 +0000 (12:47 +0100)
This patch modifies testpmd behavior when setting:
rx_vlan add all vf_port (enabling all vlanids
to be passed thru rx filter on VF).
Rx_vlan_all_filter_set() function,
checks if the next vlanid can be enabled by the driver.
Number of vlanids is limited by the NIC and thus the NIC
do not allow to enable more vlanids than it can allocate
in VFTA table.

Signed-off-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
app/test-pmd/config.c
app/test-pmd/testpmd.h
lib/librte_ether/rte_ethdev.c

index ec53923e3be058604770173eb97c017af7e2419a..73f7230e786613dd449aa4a3cbe04da9ca404853 100644 (file)
@@ -1679,21 +1679,22 @@ rx_vlan_filter_set(portid_t port_id, int on)
               "diag=%d\n", port_id, on, diag);
 }
 
-void
+int
 rx_vft_set(portid_t port_id, uint16_t vlan_id, int on)
 {
        int diag;
 
        if (port_id_is_invalid(port_id, ENABLED_WARN))
-               return;
+               return 1;
        if (vlan_id_is_invalid(vlan_id))
-               return;
+               return 1;
        diag = rte_eth_dev_vlan_filter(port_id, vlan_id, on);
        if (diag == 0)
-               return;
+               return 0;
        printf("rte_eth_dev_vlan_filter(port_pi=%d, vlan_id=%d, on=%d) failed "
               "diag=%d\n",
               port_id, vlan_id, on, diag);
+       return -1;
 }
 
 void
@@ -1703,8 +1704,10 @@ rx_vlan_all_filter_set(portid_t port_id, int on)
 
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
-       for (vlan_id = 0; vlan_id < 4096; vlan_id++)
-               rx_vft_set(port_id, vlan_id, on);
+       for (vlan_id = 0; vlan_id < 4096; vlan_id++) {
+               if (rx_vft_set(port_id, vlan_id, on))
+                       break;
+       }
 }
 
 void
index 0d5a526dc300b44c7520cd2c4b18b1b7f261c6e6..389fc24f8a717aab734b357dd89ae2c55f0d43d7 100644 (file)
@@ -508,7 +508,7 @@ void rx_vlan_strip_set_on_queue(portid_t port_id, uint16_t queue_id, int on);
 
 void rx_vlan_filter_set(portid_t port_id, int on);
 void rx_vlan_all_filter_set(portid_t port_id, int on);
-void rx_vft_set(portid_t port_id, uint16_t vlan_id, int on);
+int rx_vft_set(portid_t port_id, uint16_t vlan_id, int on);
 void vlan_extend_set(portid_t port_id, int on);
 void vlan_tpid_set(portid_t port_id, uint16_t tp_id);
 void tx_vlan_set(portid_t port_id, uint16_t vlan_id);
index f70fc7525f9eeb65732965c0bdd13688c78c1322..03e0af1cd5f83be5b3ec556d83fc08cb9e73fee0 100644 (file)
@@ -2002,8 +2002,8 @@ rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on)
                return (-EINVAL);
        }
        FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_filter_set, -ENOTSUP);
-       (*dev->dev_ops->vlan_filter_set)(dev, vlan_id, on);
-       return (0);
+
+       return (*dev->dev_ops->vlan_filter_set)(dev, vlan_id, on);
 }
 
 int