DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ori Kam <orika@nvidia.com>
To: Ivan Malov <ivan.malov@oktetlabs.ru>, "dev@dpdk.org" <dev@dpdk.org>
Cc: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Andy Moreton <amoreton@xilinx.com>,
	NBU-Contact-Thomas Monjalon <thomas@monjalon.net>,
	Ferruh Yigit <ferruh.yigit@intel.com>
Subject: Re: [dpdk-dev] [PATCH 01/10] ethdev: reuse header definition in flow pattern item ETH
Date: Tue, 16 Mar 2021 23:03:48 +0000	[thread overview]
Message-ID: <DM6PR12MB49879D3BA6E27AE1BDE974DCD66B9@DM6PR12MB4987.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20210312093143.28186-1-ivan.malov@oktetlabs.ru>

Hi Ivan,

> -----Original Message-----
> From: Ivan Malov <ivan.malov@oktetlabs.ru>
> Sent: Friday, March 12, 2021 11:32 AM
> 
> One ought to reuse existing header structs in flow items.
> This particular item contains non-header fields, so it's
> important to keep the header fields in a separate struct.
> 
> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Reviewed-by: Andy Moreton <amoreton@xilinx.com>
> ---
>  lib/librte_ethdev/rte_flow.h | 44 ++++++++++++++++++++++--------------
>  1 file changed, 27 insertions(+), 17 deletions(-)
> 
> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index 669e677e9..96fd93ee1 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -728,22 +728,32 @@ static const struct rte_flow_item_raw
> rte_flow_item_raw_mask = {
>   *
>   * Matches an Ethernet header.
>   *
> - * The @p type field either stands for "EtherType" or "TPID" when followed
> - * by so-called layer 2.5 pattern items such as RTE_FLOW_ITEM_TYPE_VLAN.
> In
> - * 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 with the
> - * specified TPID will match the pattern.
> - * The field @p has_vlan can be used to match any type of tagged packets,
> - * instead of using the @p type field.
> - * If the @p type and @p has_vlan fields are not specified, then both tagged
> - * and untagged packets will match the pattern.
> + * Inside @p hdr field, the sub-field @p ether_type stands either for EtherType
> + * or TPID, depending on whether the item is followed by a VLAN item or not.
> If
> + * two VLAN items follow, the sub-field refers to the outer one, which, in turn,
> + * contains the inner TPID in the similar header field. The innermost VLAN
> item
> + * contains a layer-3 EtherType. All of that follows the order seen on the wire.
> + *
> + * If the field in question contains a TPID value, only tagged packets with the
> + * specified TPID will match the pattern. Alternatively, it's possible to match
> + * any type of tagged packets by means of the field @p has_vlan rather than
> use
> + * the EtherType/TPID field. Also, it's possible to leave the two fields unused.
> + * If this is the case, both tagged and untagged packets will match the pattern.
>   */
> +RTE_STD_C11
>  struct rte_flow_item_eth {
> -	struct rte_ether_addr dst; /**< Destination MAC. */
> -	struct rte_ether_addr src; /**< Source MAC. */
> -	rte_be16_t type; /**< EtherType or TPID. */
> +	union {
> +		struct {
> +			/*
> +			 * These fields are retained for compatibility.
> +			 * Please switch to the new header field below.
> +			 */
> +			struct rte_ether_addr dst; /**< Destination MAC. */
> +			struct rte_ether_addr src; /**< Source MAC. */
> +			rte_be16_t type; /**< EtherType or TPID. */
> +		};
> +		struct rte_ether_hdr hdr;
> +	};
>  	uint32_t has_vlan:1; /**< Packet header contains at least one VLAN. */
>  	uint32_t reserved:31; /**< Reserved, must be zero. */
>  };
> @@ -751,9 +761,9 @@ struct rte_flow_item_eth {
>  /** Default mask for RTE_FLOW_ITEM_TYPE_ETH. */
>  #ifndef __cplusplus
>  static const struct rte_flow_item_eth rte_flow_item_eth_mask = {
> -	.dst.addr_bytes = "\xff\xff\xff\xff\xff\xff",
> -	.src.addr_bytes = "\xff\xff\xff\xff\xff\xff",
> -	.type = RTE_BE16(0x0000),
> +	.hdr.d_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
> +	.hdr.s_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
> +	.hdr.ether_type = RTE_BE16(0x0000),
>  };
>  #endif
> 
> --
> 2.20.1

Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori

      parent reply	other threads:[~2021-03-16 23:03 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12  9:31 Ivan Malov
2021-03-12  9:31 ` [dpdk-dev] [PATCH 02/10] ethdev: reuse header definition in flow pattern item VLAN Ivan Malov
2021-03-16 23:05   ` Ori Kam
2021-03-12  9:31 ` [dpdk-dev] [PATCH 03/10] net: clarify endianness of 32-bit fields in VXLAN headers Ivan Malov
2021-03-12  9:31 ` [dpdk-dev] [PATCH 04/10] ethdev: reuse header definition in flow pattern item VXLAN Ivan Malov
2021-03-12  9:31 ` [dpdk-dev] [PATCH 05/10] common/sfc_efx/base: support encap. header provisioning Ivan Malov
2021-03-12  9:31 ` [dpdk-dev] [PATCH 06/10] common/sfc_efx/base: support adding action ENCAP to a set Ivan Malov
2021-03-12  9:31 ` [dpdk-dev] [PATCH 07/10] net/sfc: change MAE rule actions parse API Ivan Malov
2021-03-12  9:31 ` [dpdk-dev] [PATCH 08/10] net/sfc: support action VXLAN ENCAP in MAE backend Ivan Malov
2021-03-12  9:31 ` [dpdk-dev] [PATCH 09/10] common/sfc_efx/base: support adding action DECAP to a set Ivan Malov
2021-03-12  9:31 ` [dpdk-dev] [PATCH 10/10] net/sfc: support action VXLAN DECAP in transfer rules Ivan Malov
2021-03-12 11:07 ` [dpdk-dev] [PATCH v2 01/10] ethdev: reuse header definition in flow pattern item ETH Ivan Malov
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 02/10] ethdev: reuse header definition in flow pattern item VLAN Ivan Malov
2021-03-16 16:58     ` Ferruh Yigit
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 03/10] net: clarify endianness of 32-bit fields in VXLAN headers Ivan Malov
2021-03-16 17:34     ` Ferruh Yigit
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 04/10] ethdev: reuse header definition in flow pattern item VXLAN Ivan Malov
2021-03-16 17:35     ` Ferruh Yigit
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 05/10] common/sfc_efx/base: support encap. header provisioning Ivan Malov
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 06/10] common/sfc_efx/base: support adding action ENCAP to a set Ivan Malov
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 07/10] net/sfc: change MAE rule actions parse API Ivan Malov
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 08/10] net/sfc: support action VXLAN ENCAP in MAE backend Ivan Malov
2021-03-16 17:10     ` Ivan Malov
2021-03-16 17:15       ` Ferruh Yigit
2021-03-31 23:21     ` Thomas Monjalon
2021-03-31 23:36       ` Ivan Malov
2021-04-01  6:38         ` Andrew Rybchenko
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 09/10] common/sfc_efx/base: support adding action DECAP to a set Ivan Malov
2021-03-12 11:07   ` [dpdk-dev] [PATCH v2 10/10] net/sfc: support action VXLAN DECAP in transfer rules Ivan Malov
2021-03-16 16:58   ` [dpdk-dev] [PATCH v2 01/10] ethdev: reuse header definition in flow pattern item ETH Ferruh Yigit
2021-03-16 17:38   ` Ferruh Yigit
2021-03-17  6:40     ` Andrew Rybchenko
2021-03-22  9:01       ` Ferruh Yigit
2021-03-22 10:10         ` Andrew Rybchenko
2021-03-22 16:49   ` Ferruh Yigit
2021-03-16 23:03 ` Ori Kam [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM6PR12MB49879D3BA6E27AE1BDE974DCD66B9@DM6PR12MB4987.namprd12.prod.outlook.com \
    --to=orika@nvidia.com \
    --cc=amoreton@xilinx.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=ivan.malov@oktetlabs.ru \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).