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 8A20541BBE; Fri, 3 Feb 2023 17:49:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F85842D69; Fri, 3 Feb 2023 17:49:33 +0100 (CET) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2076.outbound.protection.outlook.com [40.107.95.76]) by mails.dpdk.org (Postfix) with ESMTP id DEE354021E for ; Fri, 3 Feb 2023 17:49:29 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S0rh2W1RCdL3qopuu/5DahZ11mNMcikHeLeMZSvzr9BiCdQOljgovUCoPM8mUkUDE+LnxIG4aH1imtXSKTQ/mYIbBudIPsffBCeeRy1taSA7acE0jsgP7Y3CbrbkgjkUHQAayrTRV/d27Qt9xfMZRsS1Dsr1Yl2kiJus2mn2SUw3v0zrQdPkLM2kzNAWJavJaR8FVFapQ8awNgpz+xM3PqMMLpLjsqg9H3ItRKN2YaUi1n7ycvWdKC9lHEnkkvcZzjt5aTKEqwrrnwXLbanCyAh4Y/AHKjOtrrdz2KkJomegKaGgKOIEHtrXoGuhdAhgMIRaHjTtbZcoG8p3EL6ZVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dY+DlSj7ioARu3Z9xUkD5rfIr25KJWVKSY1fM43xn8I=; b=d33bGjoThH2lQA2xjD0VJPG7MzcG84/qicE++Bg6LtaJuwOnbbi4MUxDxoPJOnhm55iw3QrXxEnw7JRSCNHCqkLhRiQySy5q0aRjwCGAsHl//9PFv82vOaV5GrW8fOpjzPfOF0xuRIGRr5fLsCygoIUbRunfTU9Gp07p1f/ORMggqI0XqrVUYyVTds4QnhQgyUGmc5QIUF+RP2KeeP1oBN75UaFX2JraGnJhflxh4SQwQNRAH6z05fEICOvC0SYtuRz+emDY2nk89SkfS1GNtcSn+6g4Her3aZDfKzZ6E6TSpCUrfiWQXJPv8ZyoQpaSG6YzMUjDp1e5LRGHLxGvcA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=monjalon.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dY+DlSj7ioARu3Z9xUkD5rfIr25KJWVKSY1fM43xn8I=; b=gIiRdH1GM8PIYSBIhg2+GVZgs+KeL2O29nZIfyUfqECujM17iJCrmcm27OqlhHvWZjH8d+nUujP65iB9jYXCCV9MZY3CF/UZiurRSd37PCUyErTy75makG+WEF22bbhHBMIPtTX20BnVAtVzMCHLOBOJuAdXLAO7ZcXCEOuhSUk= Received: from DS7PR06CA0037.namprd06.prod.outlook.com (2603:10b6:8:54::12) by BY5PR12MB4146.namprd12.prod.outlook.com (2603:10b6:a03:20d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.27; Fri, 3 Feb 2023 16:49:27 +0000 Received: from DS1PEPF0000E65C.namprd02.prod.outlook.com (2603:10b6:8:54:cafe::f2) by DS7PR06CA0037.outlook.office365.com (2603:10b6:8:54::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.29 via Frontend Transport; Fri, 3 Feb 2023 16:49:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF0000E65C.mail.protection.outlook.com (10.167.18.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6064.21 via Frontend Transport; Fri, 3 Feb 2023 16:49:26 +0000 Received: from telcodpdk.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 3 Feb 2023 10:49:25 -0600 From: Ferruh Yigit To: Thomas Monjalon , Ori Kam , Aman Singh , Yuying Zhang , Andrew Rybchenko CC: David Marchand , Subject: [PATCH v7 5/7] ethdev: use ARP protocol struct for flow matching Date: Fri, 3 Feb 2023 16:48:52 +0000 Message-ID: <20230203164854.602595-6-ferruh.yigit@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203164854.602595-1-ferruh.yigit@amd.com> References: <20221025214410.715864-1-thomas@monjalon.net> <20230203164854.602595-1-ferruh.yigit@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E65C:EE_|BY5PR12MB4146:EE_ X-MS-Office365-Filtering-Correlation-Id: d74ebe3e-d7eb-420b-7d48-08db06069c84 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xVHOTo/fsIrgFKwXjaXyTUYsxdsuBwfRfe7L4jZYXY0enLSXflygEqSu6ypJR/IIj5PfM6RCCGeu0VzDDMHEBpg6BHbFTJlcuxNqhRW07TFoQ6bXlgaAylyeT5T0AiKm9voIBhrq+mshVJAcNE5r4GeLpGzlhjMOoSQI3/ZYK/JdHr7JVYSooaBPFuoGC4gJYB/wn9SqXOuw+G9oqJKS4SXMKxwX7wVIylWnrucUWvwNoT74PnycOApprmnkpcfoOayc+QBLEl+WW9SiRV3lxSoemVpqlZmX+sryoCYZUVl/+I5wy9aTMdowXMEGskczgywK89jdBgE4vlkXZFMC1PI30dGqRikFmORb/Ypm0LpSasWoQ0xoWmvqiDGnjPptn6pA98eDpxQpL66RuYQblOdLFqUUQEJXzi/gYGzC4pro/7nRYcwdX4g6voEX1490cxGlpHEEZcqeWavB0cXER6gsIrz1GAcEh55kZxxyMvguUtVWYJfv5cdUSn3ez7E/Wm/hpk7eeE0pdScYPpfcwc0jHlOY5P4jLQB9plxe32fObFDNvN88vuULojfZJy39eReaS8cK14p3mH0LV1a5wkB2ic62niA1Ys054T/nlGDUWxiOy1eOFuAkAlh+x2/7eaOuJuNveVXMwvCt1d4rCge6tyn3N6k+RJe0hb8x8yq/J+QV8lu0f/SGUO+8UabEpzuFtThqqYTWUNPBI2gx30SOqZ26Mve6wBeucc24NGE= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230025)(4636009)(396003)(346002)(39860400002)(376002)(136003)(451199018)(40470700004)(46966006)(36840700001)(36756003)(8936002)(336012)(41300700001)(83380400001)(16526019)(186003)(2906002)(82310400005)(36860700001)(478600001)(82740400003)(356005)(70206006)(81166007)(7696005)(40460700003)(44832011)(47076005)(426003)(70586007)(26005)(4326008)(86362001)(6666004)(54906003)(316002)(8676002)(40480700001)(2616005)(110136005)(5660300002)(1076003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2023 16:49:26.7774 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d74ebe3e-d7eb-420b-7d48-08db06069c84 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0000E65C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4146 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 From: Thomas Monjalon 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 Acked-by: Ferruh Yigit Acked-by: Ori Kam Acked-by: Andrew Rybchenko --- 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 429d9cab8217..275a1f9d3b5e 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -4226,7 +4226,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", @@ -4234,7 +4234,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", @@ -4242,7 +4242,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", @@ -4250,7 +4250,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 c4b96b5d324b..085c93c89b3b 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1104,15 +1104,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 838d5854ad9b..6097eb5e0c5b 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -69,7 +69,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 8e8925277eb3..b8f66d668cac 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -1245,26 +1246,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.34.1