net/ngbe: fix packet statistics
[dpdk.git] / drivers / net / ixgbe / ixgbe_flow.c
index dff04c4..3683428 100644 (file)
@@ -10,7 +10,6 @@
 #include <unistd.h>
 #include <stdarg.h>
 #include <inttypes.h>
-#include <netinet/in.h>
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
@@ -25,7 +24,7 @@
 #include <rte_eal.h>
 #include <rte_alarm.h>
 #include <rte_ether.h>
-#include <rte_ethdev_driver.h>
+#include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_random.h>
 #include <rte_dev.h>
@@ -37,6 +36,7 @@
 #include "base/ixgbe_api.h"
 #include "base/ixgbe_vf.h"
 #include "base/ixgbe_common.h"
+#include "base/ixgbe_osdep.h"
 #include "ixgbe_ethdev.h"
 #include "ixgbe_bypass.h"
 #include "ixgbe_rxtx.h"
@@ -135,7 +135,7 @@ const struct rte_flow_action *next_no_void_action(
 }
 
 /**
- * Please aware there's an asumption for all the parsers.
+ * Please be aware there's an assumption for all the parsers.
  * rte_flow_item is using big endian, rte_flow_attr and
  * rte_flow_action are using CPU order.
  * Because the pattern is used to describe the packets,
@@ -870,15 +870,6 @@ ixgbe_parse_ethertype_filter(struct rte_eth_dev *dev,
        if (ret)
                return ret;
 
-       /* Ixgbe doesn't support MAC address. */
-       if (filter->flags & RTE_ETHTYPE_FLAGS_MAC) {
-               memset(filter, 0, sizeof(struct rte_eth_ethertype_filter));
-               rte_flow_error_set(error, EINVAL,
-                       RTE_FLOW_ERROR_TYPE_ITEM,
-                       NULL, "Not supported by ethertype filter");
-               return -rte_errno;
-       }
-
        if (filter->queue >= dev->data->nb_rx_queues) {
                memset(filter, 0, sizeof(struct rte_eth_ethertype_filter));
                rte_flow_error_set(error, EINVAL,
@@ -1268,7 +1259,7 @@ cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
                return -rte_errno;
        }
 
-       filter->l2_tunnel_type = RTE_L2_TUNNEL_TYPE_E_TAG;
+       filter->l2_tunnel_type = RTE_ETH_L2_TUNNEL_TYPE_E_TAG;
        /**
         * grp and e_cid_base are bit fields and only use 14 bits.
         * e-tag id is taken as little endian by HW.
@@ -3146,13 +3137,13 @@ ixgbe_flow_create(struct rte_eth_dev *dev,
                                rte_memcpy(&fdir_info->mask,
                                        &fdir_rule.mask,
                                        sizeof(struct ixgbe_hw_fdir_mask));
-                               fdir_info->flex_bytes_offset =
-                                       fdir_rule.flex_bytes_offset;
 
-                               if (fdir_rule.mask.flex_bytes_mask)
-                                       ixgbe_fdir_set_flexbytes_offset(dev,
+                               if (fdir_rule.mask.flex_bytes_mask) {
+                                       ret = ixgbe_fdir_set_flexbytes_offset(dev,
                                                fdir_rule.flex_bytes_offset);
-
+                                       if (ret)
+                                               goto out;
+                               }
                                ret = ixgbe_fdir_set_input_mask(dev);
                                if (ret)
                                        goto out;
@@ -3170,8 +3161,9 @@ ixgbe_flow_create(struct rte_eth_dev *dev,
                                if (ret)
                                        goto out;
 
-                               if (fdir_info->flex_bytes_offset !=
-                                               fdir_rule.flex_bytes_offset)
+                               if (fdir_rule.mask.flex_bytes_mask &&
+                                   fdir_info->flex_bytes_offset !=
+                                   fdir_rule.flex_bytes_offset)
                                        goto out;
                        }
                }
@@ -3269,7 +3261,7 @@ out:
 
 /**
  * Check if the flow rule is supported by ixgbe.
- * It only checkes the format. Don't guarantee the rule can be programmed into
+ * It only checks the format. Don't guarantee the rule can be programmed into
  * the HW. Because there can be no enough room for the rule.
  */
 static int
@@ -3445,6 +3437,7 @@ ixgbe_flow_destroy(struct rte_eth_dev *dev,
                        TAILQ_REMOVE(&ixgbe_flow_list,
                                ixgbe_flow_mem_ptr, entries);
                        rte_free(ixgbe_flow_mem_ptr);
+                       break;
                }
        }
        rte_free(flow);