app/testpmd: handle i40e in VF VLAN filter command
authorBernard Iremonger <bernard.iremonger@intel.com>
Tue, 17 Jan 2017 08:45:25 +0000 (16:45 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 17 Jan 2017 18:46:25 +0000 (19:46 +0100)
modify set_vf_rx_vlan function to handle the i40e PMD.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
app/test-pmd/cmdline.c
app/test-pmd/config.c
app/test-pmd/testpmd.h

index 0f542ae..2fd862f 100644 (file)
@@ -6877,7 +6877,6 @@ cmdline_parse_inst_t cmd_vf_mac_addr_filter = {
        },
 };
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
 /* *** ADD/REMOVE A VLAN IDENTIFIER TO/FROM A PORT VLAN RX FILTER *** */
 struct cmd_vf_rx_vlan_filter {
        cmdline_fixed_string_t rx_vlan;
@@ -6895,11 +6894,37 @@ cmd_vf_rx_vlan_filter_parsed(void *parsed_result,
                          __attribute__((unused)) void *data)
 {
        struct cmd_vf_rx_vlan_filter *res = parsed_result;
+       int ret = -ENOTSUP;
 
-       if (!strcmp(res->what, "add"))
-               set_vf_rx_vlan(res->port_id, res->vlan_id,res->vf_mask, 1);
-       else
-               set_vf_rx_vlan(res->port_id, res->vlan_id,res->vf_mask, 0);
+       __rte_unused int is_add = (strcmp(res->what, "add") == 0) ? 1 : 0;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_ixgbe_set_vf_vlan_filter(res->port_id,
+                               res->vlan_id, res->vf_mask, is_add);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_i40e_set_vf_vlan_filter(res->port_id,
+                               res->vlan_id, res->vf_mask, is_add);
+#endif
+
+       switch (ret) {
+       case 0:
+               break;
+       case -EINVAL:
+               printf("invalid vlan_id %d or vf_mask %"PRIu64"\n",
+                               res->vlan_id, res->vf_mask);
+               break;
+       case -ENODEV:
+               printf("invalid port_id %d\n", res->port_id);
+               break;
+       case -ENOTSUP:
+               printf("function not implemented or supported\n");
+               break;
+       default:
+               printf("programming error: (%s)\n", strerror(-ret));
+       }
 }
 
 cmdline_parse_token_string_t cmd_vf_rx_vlan_filter_rx_vlan =
@@ -6940,7 +6965,6 @@ cmdline_parse_inst_t cmd_vf_rxvlan_filter = {
                NULL,
        },
 };
-#endif
 
 /* *** SET RATE LIMIT FOR A QUEUE OF A PORT *** */
 struct cmd_queue_rate_limit_result {
@@ -12531,9 +12555,9 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_set_macsec_sa,
        (cmdline_parse_inst_t *)&cmd_set_vf_rxmode,
        (cmdline_parse_inst_t *)&cmd_set_vf_traffic,
-       (cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter,
        (cmdline_parse_inst_t *)&cmd_vf_rate_limit,
 #endif
+       (cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter,
        (cmdline_parse_inst_t *)&cmd_set_vf_mac_addr,
        (cmdline_parse_inst_t *)&cmd_set_vf_promisc,
        (cmdline_parse_inst_t *)&cmd_set_vf_allmulti,
index 11a930d..5834498 100644 (file)
@@ -2846,19 +2846,6 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)
                        "diag=%d\n", port_id, diag);
 
 }
-
-void
-set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on)
-{
-       int diag;
-
-       diag = rte_pmd_ixgbe_set_vf_vlan_filter(port_id, vlan_id, vf_mask, on);
-
-       if (diag == 0)
-               return;
-       printf("rte_pmd_ixgbe_set_vf_vlan_filter for port_id=%d failed "
-              "diag=%d\n", port_id, diag);
-}
 #endif
 
 int
index 0a9a1af..ee59460 100644 (file)
@@ -600,8 +600,6 @@ void port_rss_reta_info(portid_t port_id,
                        uint16_t nb_entries);
 
 void set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on);
-void set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id,
-               uint64_t vf_mask, uint8_t on);
 
 int set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate);
 int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate,