app/testpmd: use ixgbe public functions
authorBernard Iremonger <bernard.iremonger@intel.com>
Tue, 13 Dec 2016 11:40:36 +0000 (11:40 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 17 Jan 2017 18:39:28 +0000 (19:39 +0100)
Use the the following ixgbe public functions:

rte_pmd_ixgbe_set_vf_rate_limit
rte_pmd_ixgbe_set_vf_rx
rte_pmd_ixgbe_set_vf_rxmode
rte_pmd_ixgbe_set_vf_tx
rte_pmd_ixgbe_set_vf_vlan_filter

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
app/test-pmd/cmdline.c
app/test-pmd/config.c

index b4f35c3..35991df 100644 (file)
@@ -6654,6 +6654,7 @@ cmdline_parse_inst_t cmd_set_vf_macvlan_filter = {
        },
 };
 
+#ifdef RTE_LIBRTE_IXGBE_PMD
 /* *** CONFIGURE VF TRAFFIC CONTROL *** */
 struct cmd_set_vf_traffic {
        cmdline_fixed_string_t set;
@@ -6714,7 +6715,9 @@ cmdline_parse_inst_t cmd_set_vf_traffic = {
                NULL,
        },
 };
+#endif
 
+#ifdef RTE_LIBRTE_IXGBE_PMD
 /* *** CONFIGURE VF RECEIVE MODE *** */
 struct cmd_set_vf_rxmode {
        cmdline_fixed_string_t set;
@@ -6748,7 +6751,7 @@ cmd_set_vf_rxmode_parsed(void *parsed_result,
                        rx_mode |= ETH_VMDQ_ACCEPT_MULTICAST;
        }
 
-       ret = rte_eth_dev_set_vf_rxmode(res->port_id,res->vf_id,rx_mode,(uint8_t)is_on);
+       ret = rte_pmd_ixgbe_set_vf_rxmode(res->port_id, res->vf_id, rx_mode, (uint8_t)is_on);
        if (ret < 0)
                printf("bad VF receive mode parameter, return code = %d \n",
                ret);
@@ -6796,6 +6799,7 @@ cmdline_parse_inst_t cmd_set_vf_rxmode = {
                NULL,
        },
 };
+#endif
 
 /* *** ADD MAC ADDRESS FILTER FOR A VF OF A PORT *** */
 struct cmd_vf_mac_addr_result {
@@ -6862,6 +6866,7 @@ 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;
@@ -6924,6 +6929,7 @@ 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 {
@@ -6992,6 +6998,7 @@ cmdline_parse_inst_t cmd_queue_rate_limit = {
        },
 };
 
+#ifdef RTE_LIBRTE_IXGBE_PMD
 /* *** SET RATE LIMIT FOR A VF OF A PORT *** */
 struct cmd_vf_rate_limit_result {
        cmdline_fixed_string_t set;
@@ -7070,6 +7077,7 @@ cmdline_parse_inst_t cmd_vf_rate_limit = {
                NULL,
        },
 };
+#endif
 
 /* *** ADD TUNNEL FILTER OF A PORT *** */
 struct cmd_tunnel_filter_result {
@@ -12001,15 +12009,11 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_config_burst,
        (cmdline_parse_inst_t *)&cmd_config_thresh,
        (cmdline_parse_inst_t *)&cmd_config_threshold,
-       (cmdline_parse_inst_t *)&cmd_set_vf_rxmode,
        (cmdline_parse_inst_t *)&cmd_set_uc_hash_filter,
        (cmdline_parse_inst_t *)&cmd_set_uc_all_hash_filter,
        (cmdline_parse_inst_t *)&cmd_vf_mac_addr_filter,
        (cmdline_parse_inst_t *)&cmd_set_vf_macvlan_filter,
-       (cmdline_parse_inst_t *)&cmd_set_vf_traffic,
-       (cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter,
        (cmdline_parse_inst_t *)&cmd_queue_rate_limit,
-       (cmdline_parse_inst_t *)&cmd_vf_rate_limit,
        (cmdline_parse_inst_t *)&cmd_tunnel_filter,
        (cmdline_parse_inst_t *)&cmd_tunnel_udp_config,
        (cmdline_parse_inst_t *)&cmd_global_config,
@@ -12069,6 +12073,10 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_set_macsec_offload_off,
        (cmdline_parse_inst_t *)&cmd_set_macsec_sc,
        (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
        NULL,
 };
index e1af064..23e0bbf 100644 (file)
@@ -94,6 +94,9 @@
 #include <rte_cycles.h>
 #include <rte_flow.h>
 #include <rte_errno.h>
+#ifdef RTE_LIBRTE_IXGBE_PMD
+#include <rte_pmd_ixgbe.h>
+#endif
 
 #include "testpmd.h"
 
@@ -2822,6 +2825,7 @@ fdir_set_flex_payload(portid_t port_id, struct rte_eth_flex_payload_cfg *cfg)
 
 }
 
+#ifdef RTE_LIBRTE_IXGBE_PMD
 void
 set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)
 {
@@ -2830,16 +2834,17 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
        if (is_rx)
-               diag = rte_eth_dev_set_vf_rx(port_id,vf,on);
+               diag = rte_pmd_ixgbe_set_vf_rx(port_id, vf, on);
        else
-               diag = rte_eth_dev_set_vf_tx(port_id,vf,on);
+               diag = rte_pmd_ixgbe_set_vf_tx(port_id, vf, on);
+
        if (diag == 0)
                return;
        if(is_rx)
-               printf("rte_eth_dev_set_vf_rx for port_id=%d failed "
+               printf("rte_pmd_ixgbe_set_vf_rx for port_id=%d failed "
                        "diag=%d\n", port_id, diag);
        else
-               printf("rte_eth_dev_set_vf_tx for port_id=%d failed "
+               printf("rte_pmd_ixgbe_set_vf_tx for port_id=%d failed "
                        "diag=%d\n", port_id, diag);
 
 }
@@ -2853,12 +2858,15 @@ set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on)
                return;
        if (vlan_id_is_invalid(vlan_id))
                return;
-       diag = rte_eth_dev_set_vf_vlan_filter(port_id, vlan_id, vf_mask, on);
+
+       diag = rte_pmd_ixgbe_set_vf_vlan_filter(port_id, vlan_id, vf_mask, on);
+
        if (diag == 0)
                return;
-       printf("rte_eth_dev_set_vf_vlan_filter for port_id=%d failed "
+       printf("rte_pmd_ixgbe_set_vf_vlan_filter for port_id=%d failed "
               "diag=%d\n", port_id, diag);
 }
+#endif
 
 int
 set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate)
@@ -2882,6 +2890,7 @@ set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate)
        return diag;
 }
 
+#ifdef RTE_LIBRTE_IXGBE_PMD
 int
 set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)
 {
@@ -2899,13 +2908,14 @@ set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)
                        rate, link.link_speed);
                return 1;
        }
-       diag = rte_eth_set_vf_rate_limit(port_id, vf, rate, q_msk);
+       diag = rte_pmd_ixgbe_set_vf_rate_limit(port_id, vf, rate, q_msk);
        if (diag == 0)
                return diag;
-       printf("rte_eth_set_vf_rate_limit for port_id=%d failed diag=%d\n",
+       printf("rte_pmd_ixgbe_set_vf_rate_limit for port_id=%d failed diag=%d\n",
                port_id, diag);
        return diag;
 }
+#endif
 
 /*
  * Functions to manage the set of filtered Multicast MAC addresses.