ethdev: fix default VLAN TCI mask in flow API
authorAdrien Mazarguil <adrien.mazarguil@6wind.com>
Wed, 25 Apr 2018 15:27:58 +0000 (17:27 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 27 Apr 2018 17:00:54 +0000 (18:00 +0100)
VLAN TCI is a 16-bit field broken down as PCP (3b), DEI (1b) and VID (12b).

The default mask used by PMDs for the VLAN pattern when one isn't provided
by the application comprises the entire TCI, which is problematic because
most devices only support VID matching.

This forces applications to always provide a mask limited to the VID part
in order to successfully apply a flow rule with a VLAN pattern item.
Moreover, applications rarely want to match PCP and DEI intentionally.

Given the above and since VID is what is commonly referred to when talking
about VLAN, this commit excludes PCP and DEI from the default mask.

Fixes: 6de5c0f1302c ("ethdev: define default item masks in flow API")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
doc/guides/prog_guide/rte_flow.rst
doc/guides/rel_notes/release_18_05.rst
lib/librte_ether/rte_flow.h

index fd317b4..c62a805 100644 (file)
@@ -806,7 +806,7 @@ preceding pattern item.
 
 - ``tci``: tag control information.
 - ``inner_type``: inner EtherType or TPID.
-- Default ``mask`` matches TCI only.
+- Default ``mask`` matches the VID part of TCI only (lower 12 bits).
 
 Item: ``IPV4``
 ^^^^^^^^^^^^^^
index b8c594a..5cdc4f4 100644 (file)
@@ -279,7 +279,8 @@ API Changes
     (``func`` for RSS hash function to apply and ``level`` for the
     encapsulation level).
   * The VLAN pattern item (``struct rte_flow_item_vlan``) was modified to
-    include inner EtherType instead of outer TPID.
+    include inner EtherType instead of outer TPID. Its default mask was also
+    modified to cover the VID part (lower 12 bits) of TCI only.
 
 
 ABI Changes
index 8e50384..513734d 100644 (file)
@@ -493,7 +493,7 @@ struct rte_flow_item_vlan {
 /** Default mask for RTE_FLOW_ITEM_TYPE_VLAN. */
 #ifndef __cplusplus
 static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = {
-       .tci = RTE_BE16(0xffff),
+       .tci = RTE_BE16(0x0fff),
        .inner_type = RTE_BE16(0x0000),
 };
 #endif