net/i40e: flush tunnel filters
[dpdk.git] / app / test-pmd / config.c
index 9716ce7..11a930d 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"
 
@@ -884,7 +887,7 @@ store:
        do {
                struct rte_flow_item *dst = NULL;
 
-               if ((unsigned int)item->type > RTE_DIM(flow_item) ||
+               if ((unsigned int)item->type >= RTE_DIM(flow_item) ||
                    !flow_item[item->type].name)
                        goto notsup;
                if (pf)
@@ -918,7 +921,7 @@ store:
        do {
                struct rte_flow_action *dst = NULL;
 
-               if ((unsigned int)action->type > RTE_DIM(flow_action) ||
+               if ((unsigned int)action->type >= RTE_DIM(flow_action) ||
                    !flow_action[action->type].name)
                        goto notsup;
                if (pf)
@@ -977,7 +980,7 @@ port_flow_complain(struct rte_flow_error *error)
        char buf[32];
        int err = rte_errno;
 
-       if ((unsigned int)error->type > RTE_DIM(errstrlist) ||
+       if ((unsigned int)error->type >= RTE_DIM(errstrlist) ||
            !errstrlist[error->type])
                errstr = "unknown type";
        else
@@ -1146,7 +1149,7 @@ port_flow_query(portid_t port_id, uint32_t rule,
                printf("Flow rule #%u not found\n", rule);
                return -ENOENT;
        }
-       if ((unsigned int)action > RTE_DIM(flow_action) ||
+       if ((unsigned int)action >= RTE_DIM(flow_action) ||
            !flow_action[action].name)
                name = "unknown";
        else
@@ -2822,24 +2825,24 @@ 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)
 {
        int diag;
 
-       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);
 
 }
@@ -2849,16 +2852,14 @@ set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on)
 {
        int diag;
 
-       if (port_id_is_invalid(port_id, ENABLED_WARN))
-               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,30 +2883,20 @@ 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)
 {
        int diag;
-       struct rte_eth_link link;
 
-       if (q_msk == 0)
-               return 0;
-
-       if (port_id_is_invalid(port_id, ENABLED_WARN))
-               return 1;
-       rte_eth_link_get_nowait(port_id, &link);
-       if (rate > link.link_speed) {
-               printf("Invalid rate value:%u bigger than link speed: %u\n",
-                       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.