From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EF879A00C2; Thu, 23 Apr 2020 20:31:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AC78D1C1CA; Thu, 23 Apr 2020 20:31:28 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 0C26B1C1C9 for ; Thu, 23 Apr 2020 20:31:26 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from dekelp@mellanox.com) with ESMTPS (AES256-SHA encrypted); 23 Apr 2020 21:31:23 +0300 Received: from mtl-vdi-280.wap.labs.mlnx. (mtl-vdi-280.wap.labs.mlnx [10.228.134.250]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 03NIVNHg030810; Thu, 23 Apr 2020 21:31:23 +0300 From: Dekel Peled To: orika@mellanox.com, john.mcnamara@intel.com, marko.kovacevic@intel.com, thomas@monjalon.net, ferruh.yigit@intel.com, arybchenko@solarflare.com Cc: dev@dpdk.org, asafp@mellanox.com Date: Thu, 23 Apr 2020 21:30:33 +0300 Message-Id: X-Mailer: git-send-email 1.7.1 Subject: [dpdk-dev] [PATCH] doc: refine ethernet and VLAN flow rule items X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Specified pattern may be translated in different manner. For example the pattern "eth / ipv4" can be translated to match untagged packets only, since the pattern doesn't specify a vlan item. It can also be translated to match both tagged and untagged packets, for the same reason. This patch updates the rte_flow documentation to clearly specify the required pattern to use. For example: To match tagged ipv4 packets, the pattern "eth type is 0x8100 / vlan / ipv4 / end" should be used. To match untagged ipv4 packets, the pattern "eth type is 0x0800 / ipv4 / end" should be used. To match both tagged and untagged packets, the pattern "eth / end" should be used. Signed-off-by: Dekel Peled --- doc/guides/prog_guide/rte_flow.rst | 8 ++++++++ lib/librte_ethdev/rte_flow.h | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index cf4368e..0d1c305 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -905,6 +905,12 @@ so-called layer 2.5 pattern items such as ``RTE_FLOW_ITEM_TYPE_VLAN``. In the latter case, ``type`` refers to that of the outer header, with the inner EtherType/TPID provided by the subsequent pattern item. This is the same order as on the wire. +If the ``type`` field contains a TPID value, then only tagged packets will match +the pattern. +If the ``type`` field contains another EtherType value, then only untagged +packets will match the pattern. +If the ``ETH`` item is the only item in the pattern, and the ``type`` field is +not specified, then both tagged and untagged packets will match the pattern. - ``dst``: destination MAC. - ``src``: source MAC. @@ -919,6 +925,8 @@ Matches an 802.1Q/ad VLAN tag. The corresponding standard outer EtherType (TPID) values are ``RTE_ETHER_TYPE_VLAN`` or ``RTE_ETHER_TYPE_QINQ``. It can be overridden by the preceding pattern item. +If a ``VLAN`` item is present in the pattern, then only tagged packets will +match the pattern. - ``tci``: tag control information. - ``inner_type``: inner EtherType or TPID. diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 132b44e..178e87e 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -710,6 +710,13 @@ struct rte_flow_item_raw { * the latter case, @p type refers to that of the outer header, with the * inner EtherType/TPID provided by the subsequent pattern item. This is the * same order as on the wire. + * If the @p type field contains a TPID value, then only tagged packets will + * match the pattern. + * If the @p type field contains another EtherType value, then only untagged + * packets will match the pattern. + * If the @p ETH item is the only item in the pattern, and the @p type field + * is not specified, then both tagged and untagged packets will match the + * pattern. */ struct rte_flow_item_eth { struct rte_ether_addr dst; /**< Destination MAC. */ @@ -734,6 +741,8 @@ struct rte_flow_item_eth { * The corresponding standard outer EtherType (TPID) values are * RTE_ETHER_TYPE_VLAN or RTE_ETHER_TYPE_QINQ. It can be overridden by * the preceding pattern item. + * If a @p VLAN item is present in the pattern, then only tagged packets will + * match the pattern. */ struct rte_flow_item_vlan { rte_be16_t tci; /**< Tag control information. */ -- 1.8.3.1