net/cxgbe: fix check for redefined match items
authorRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Fri, 9 Nov 2018 07:56:25 +0000 (13:26 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 13 Nov 2018 23:35:53 +0000 (00:35 +0100)
Fix issue where ethertype is set to 0x800 for IPv4 by ether match
item and IPv4 match item also inherently sets ethertype to 0x800.

Current logic returns error when IPv4 match item is parsed. So, fix
by only bailing if the redefined match items have different values.

Fixes: ee61f5113b17 ("net/cxgbe: parse and validate flows")
Cc: stable@dpdk.org
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
drivers/net/cxgbe/cxgbe_flow.c

index 54ec7e5..a8f076e 100644 (file)
@@ -7,14 +7,12 @@
 
 #define __CXGBE_FILL_FS(__v, __m, fs, elem, e) \
 do { \
-       if (!((fs)->val.elem || (fs)->mask.elem)) { \
-               (fs)->val.elem = (__v); \
-               (fs)->mask.elem = (__m); \
-       } else { \
+       if ((fs)->mask.elem && ((fs)->val.elem != (__v))) \
                return rte_flow_error_set(e, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, \
-                                         NULL, "a filter can be specified" \
-                                         " only once"); \
-       } \
+                                         NULL, "Redefined match item with" \
+                                         " different values found"); \
+       (fs)->val.elem = (__v); \
+       (fs)->mask.elem = (__m); \
 } while (0)
 
 #define __CXGBE_FILL_FS_MEMCPY(__v, __m, fs, elem) \