From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 71D0EA0544; Tue, 25 Oct 2022 23:45:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 81BE042C59; Tue, 25 Oct 2022 23:45:07 +0200 (CEST) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by mails.dpdk.org (Postfix) with ESMTP id C81E4410D2 for ; Tue, 25 Oct 2022 23:45:06 +0200 (CEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 870805C01AC; Tue, 25 Oct 2022 17:45:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 25 Oct 2022 17:45:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1666734306; x=1666820706; bh=YC Rfc0bL2y7vwVY00aP0rRE5yM+6qksSA7GtoGPvEDo=; b=hNEhONfCHZX5dxFv48 MHiGk+xuTgUaFBhY0InOjE2xvxu5OJU1awBX1k0jRutpq+jaHfgxgZdG2qEnpKco qItwIPnJf2yUHMMREe7A+lWOaYLPXB+JpkCWTDyWE5kiRiwhqzeGnunADnt+j4HB XPw+I7etXv5VbIj4YIUHmvbs9Wxp64XipZEM8rySNxCbSb0hHQCRj8phhCoj/6rF ukriKOWxUh0oLR5F2HPnl4LCs0xjau8AR9qqH7UoUTzQzH9c2gzIJ27Xi75fZFZC l3kH4Y+jG0mWe2EvX2f7S9LjXHwmbysqvmLdqM1P+/57/ZS/vNHsS54p+fjXtEJB TD2g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1666734306; x=1666820706; bh=YCRfc0bL2y7vw VY00aP0rRE5yM+6qksSA7GtoGPvEDo=; b=hn9JB7lfuh749BISj39GDo8ugq2xP oRTcRxiLAo50TOkyZ+nPZt3iOUvHlJ5Lkhaezok5nq5uuoaq+/w1fWa3PsnwL0mB tgfc1Oiqvvvaj0Rp9OKnkh0oe4uzYordz/XwDE558fsheTriDWriqWDk8Iibwl45 PfJil20s+zxG0R5q85sPvO9HsYc9iu1EY2H7rIXBG4Swh8wqokcb97EEOWYUB+Uv HjnEOMlbQMlpcCysPvAEMR3DR30dlHZftcr5l8nC1npJsNPCv+vkKuq5xUdjE5DF 4P9ryqEOzy0U3eP/8Q485n7MdiNo2SEL4mGswMD3Oa6jcCC+bkeA37CGw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrtddugddtvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdejhfdugeehvddtieejieegteeuudfgjeeukeeiledthfetveek hefhieelhfdtnecuvehluhhsthgvrhfuihiivgepfeenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 25 Oct 2022 17:45:05 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@amd.com, andrew.rybchenko@oktetlabs.ru, Ori Kam , Aman Singh , Yuying Zhang Subject: [PATCH 6/8] ethdev: use ARP protocol struct for flow matching Date: Tue, 25 Oct 2022 23:44:08 +0200 Message-Id: <20221025214410.715864-7-thomas@monjalon.net> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221025214410.715864-1-thomas@monjalon.net> References: <20221025214410.715864-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org As announced in the deprecation notice, flow item structures should re-use the protocol header definitions from the directory lib/net/. The protocol struct is added in an unnamed union, keeping old field names. The ARP header struct members are used in testpmd instead of the redundant fields in the flow items. Signed-off-by: Thomas Monjalon --- app/test-pmd/cmdline_flow.c | 8 +++--- doc/guides/prog_guide/rte_flow.rst | 10 +------- doc/guides/rel_notes/deprecation.rst | 1 - lib/ethdev/rte_flow.h | 37 ++++++++++++++++++---------- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 90da247eaf..84e1ed039f 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -4192,7 +4192,7 @@ static const struct token token_list[] = { .next = NEXT(item_arp_eth_ipv4, NEXT_ENTRY(COMMON_MAC_ADDR), item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_arp_eth_ipv4, - sha)), + hdr.arp_data.arp_sha)), }, [ITEM_ARP_ETH_IPV4_SPA] = { .name = "spa", @@ -4200,7 +4200,7 @@ static const struct token token_list[] = { .next = NEXT(item_arp_eth_ipv4, NEXT_ENTRY(COMMON_IPV4_ADDR), item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_arp_eth_ipv4, - spa)), + hdr.arp_data.arp_sip)), }, [ITEM_ARP_ETH_IPV4_THA] = { .name = "tha", @@ -4208,7 +4208,7 @@ static const struct token token_list[] = { .next = NEXT(item_arp_eth_ipv4, NEXT_ENTRY(COMMON_MAC_ADDR), item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_arp_eth_ipv4, - tha)), + hdr.arp_data.arp_tha)), }, [ITEM_ARP_ETH_IPV4_TPA] = { .name = "tpa", @@ -4216,7 +4216,7 @@ static const struct token token_list[] = { .next = NEXT(item_arp_eth_ipv4, NEXT_ENTRY(COMMON_IPV4_ADDR), item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_arp_eth_ipv4, - tpa)), + hdr.arp_data.arp_tip)), }, [ITEM_IPV6_EXT] = { .name = "ipv6_ext", diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index e8512e0a03..421c6407a9 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1100,15 +1100,7 @@ Item: ``ARP_ETH_IPV4`` Matches an ARP header for Ethernet/IPv4. -- ``hdr``: hardware type, normally 1. -- ``pro``: protocol type, normally 0x0800. -- ``hln``: hardware address length, normally 6. -- ``pln``: protocol address length, normally 4. -- ``op``: opcode (1 for request, 2 for reply). -- ``sha``: sender hardware address. -- ``spa``: sender IPv4 address. -- ``tha``: target hardware address. -- ``tpa``: target IPv4 address. +- ``hdr``: header definition (``rte_arp.h``). - Default ``mask`` matches SHA, SPA, THA and TPA. Item: ``IPV6_EXT`` diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index b4b97d3165..af266cf9f4 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -66,7 +66,6 @@ Deprecation Notices These items are not compliant (not including struct from lib/net/): - ``rte_flow_item_ah`` - - ``rte_flow_item_arp_eth_ipv4`` - ``rte_flow_item_e_tag`` - ``rte_flow_item_geneve`` - ``rte_flow_item_geneve_opt`` diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 02c6cc9981..d890c253b4 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -1254,26 +1255,36 @@ static const struct rte_flow_item_vxlan_gpe rte_flow_item_vxlan_gpe_mask = { * * Matches an ARP header for Ethernet/IPv4. */ +RTE_STD_C11 struct rte_flow_item_arp_eth_ipv4 { - rte_be16_t hrd; /**< Hardware type, normally 1. */ - rte_be16_t pro; /**< Protocol type, normally 0x0800. */ - uint8_t hln; /**< Hardware address length, normally 6. */ - uint8_t pln; /**< Protocol address length, normally 4. */ - rte_be16_t op; /**< Opcode (1 for request, 2 for reply). */ - struct rte_ether_addr sha; /**< Sender hardware address. */ - rte_be32_t spa; /**< Sender IPv4 address. */ - struct rte_ether_addr tha; /**< Target hardware address. */ - rte_be32_t tpa; /**< Target IPv4 address. */ + union { + struct { + /* + * These are old fields kept for compatibility. + * Please prefer hdr field below. + */ + rte_be16_t hrd; /**< Hardware type, normally 1. */ + rte_be16_t pro; /**< Protocol type, normally 0x0800. */ + uint8_t hln; /**< Hardware address length, normally 6. */ + uint8_t pln; /**< Protocol address length, normally 4. */ + rte_be16_t op; /**< Opcode (1 for request, 2 for reply). */ + struct rte_ether_addr sha; /**< Sender hardware address. */ + rte_be32_t spa; /**< Sender IPv4 address. */ + struct rte_ether_addr tha; /**< Target hardware address. */ + rte_be32_t tpa; /**< Target IPv4 address. */ + }; + struct rte_arp_hdr hdr; /**< ARP header definition. */ + }; }; /** Default mask for RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4. */ #ifndef __cplusplus static const struct rte_flow_item_arp_eth_ipv4 rte_flow_item_arp_eth_ipv4_mask = { - .sha.addr_bytes = "\xff\xff\xff\xff\xff\xff", - .spa = RTE_BE32(0xffffffff), - .tha.addr_bytes = "\xff\xff\xff\xff\xff\xff", - .tpa = RTE_BE32(0xffffffff), + .hdr.arp_data.arp_sha.addr_bytes = "\xff\xff\xff\xff\xff\xff", + .hdr.arp_data.arp_sip = RTE_BE32(UINT32_MAX), + .hdr.arp_data.arp_tha.addr_bytes = "\xff\xff\xff\xff\xff\xff", + .hdr.arp_data.arp_tip = RTE_BE32(UINT32_MAX), }; #endif -- 2.36.1