From patchwork Thu Jan 26 16:19:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 122578 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F1FB842493; Thu, 26 Jan 2023 17:20:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BE48A42DA6; Thu, 26 Jan 2023 17:19:38 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2054.outbound.protection.outlook.com [40.107.243.54]) by mails.dpdk.org (Postfix) with ESMTP id 05CC640684 for ; Thu, 26 Jan 2023 17:19:37 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X2KJuSulLLuW6de6RrwjKwn+f1UEvGup8rVD4a2Qv+T9OsZai+AilyrJogGJ4uNqllmeOUOPP0cNBr1e4Zx92TPYwvLzie3Vq+S8nAyuVv+BNzrkYUSxi/WHvKXDRjgQWRhP2hrtb5bkSZNt9suge1n/0GO8PYOjl2LQQ0LYSCn/bbvS5+hy+WDd+Ta9WLJWYpAvO5cimmwDlCTPxTuIZ13Tva7v4Rmp6VTRvj8cd+v4dTJqkvZ10vbMmCLy/3ir4Vqt2KUR7p6EBtebIGL8TBrXtlo4G9+y0UdZ1lffY6jRKez5BqWqKme1Ft33frwL4wzQUadxI5U2WyoQUzjVRA== 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=LFfhf0jL8yex4misse2ZZgB3pTDuf9WSLKJLtZp/Ttw=; b=ZDHZtlSU4bC8Yp0io5uDetPnGSSt5iIgaTcAkelXjidOOAN4UGPcb44aK05rA+08pPxCYBgcO7RdMcRiOpnFoYOP9/X8zHsQYIKRNbtpTVrZSgMIr9MDauMzXWta/ntda90M7Z1IlXry1ITdyQcBu0kp25JZ6eO/76CVN1/dzaCXauSr2UU+/ss7ABA5vlK7rrHafrz9dk7iZ1UIsRVOTEG52JP28RTkUUfIz/zSgGZXvHsnaN3lQfFfEHJRmc47oUmSdj6wCC09UqOJYAbGVcUvdmZlDObIsbV5oPd59e3RBk2J8BkCc6RVDc0BhAGQ1XSBYOxL35cq/X0tV2sKoA== 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=LFfhf0jL8yex4misse2ZZgB3pTDuf9WSLKJLtZp/Ttw=; b=HQFfs4+T3hw/6aFymhn2skyDwu6QwqYUUHcDXWupmK5golGZyJ5+Yxzb2Nvg3B3TfMCfn8UdjdjndGobWiYG5GmqnQD1ydQWx32WKxllEylk14WOb/BI0gKJy/UfKbXxVICccGcmpKR/80cE57Vn8M0g9RB6iAZcTn4do8VbNRE= Received: from BN9PR03CA0671.namprd03.prod.outlook.com (2603:10b6:408:10e::16) by SA3PR12MB7975.namprd12.prod.outlook.com (2603:10b6:806:320::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Thu, 26 Jan 2023 16:19:35 +0000 Received: from BN8NAM11FT047.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10e:cafe::28) by BN9PR03CA0671.outlook.office365.com (2603:10b6:408:10e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33 via Frontend Transport; Thu, 26 Jan 2023 16:19:34 +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 BN8NAM11FT047.mail.protection.outlook.com (10.13.177.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.22 via Frontend Transport; Thu, 26 Jan 2023 16:19:34 +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; Thu, 26 Jan 2023 10:19:33 -0600 From: Ferruh Yigit To: Thomas Monjalon , Ori Kam , Aman Singh , Yuying Zhang , Andrew Rybchenko CC: David Marchand , Subject: [PATCH v5 6/8] ethdev: use ARP protocol struct for flow matching Date: Thu, 26 Jan 2023 16:19:02 +0000 Message-ID: <20230126161904.864517-7-ferruh.yigit@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230126161904.864517-1-ferruh.yigit@amd.com> References: <20221025214410.715864-1-thomas@monjalon.net> <20230126161904.864517-1-ferruh.yigit@amd.com> MIME-Version: 1.0 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: BN8NAM11FT047:EE_|SA3PR12MB7975:EE_ X-MS-Office365-Filtering-Correlation-Id: a3a1d6e7-87cb-4798-0d6d-08daffb91cd4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dP2CTovS2O3w9fdzZD64P06J+aQqR56MircB80tvdkZ0IVat59mqKPKyLsjWTAS05fF2rcaIj6PD6GHV40XGDDPlE8ASW0FvN/B5ZzC0OqE8J6IvhJLWz1J+nZ/hpb8U8yzaLMLFTf2kSCjtoEU2llxkVLjT73aiLxqFg0n8ltW43Ly5y7AUJJmDxybz6IvenFgUgdMkq70ehlvARM7YD49b6mHxhQAvVfVdOq4KJmAURsTNdBiRtsVLaKTC0788nJ52CehPwVmZIUwdS2rYDTn5uB6iZ4lGjU3RnghhwbygtMM6mB8bFevZ9eWfnNUwYltWby7VrWVJLPElx1G6duD7xxtQBZlZjnWOiGuZUDOKU4ZeC+g1PR4syGewSTPCkY2/l4/let1Bnsv4U0tBT2emuoR/KYvSJwdMjtqQBmHKLYtnyhfoEjqIimpf3mZF1skqI3H9+Cw7tcFd2DuDjr0Vc2DATHomqc+SEadlAK1mcSSWj+1+qn1zbBMsLl5PmgHtUrRCU7w0K50tqXyI0MLThC0Qvi8Zcgm4z2ws19ha6K+0nlqSUiTnLyFCyP47QoqI5o2qzajFlVnRj3NkEYPJFvKoPh2cCdhlCy1QTVpEYXAXno68Y4zFE0f+l8Dx6po3ECCamtTiU7P80JaibSzcn2edWlMvYt6nYIPcgo8HcNP2ZGGK/ZY2Gcgo05MHduI8Y4hmkUJwPO+Il/4o4p3IwZdl5jbnMsLlkRrNG6A= 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)(376002)(39860400002)(136003)(346002)(451199018)(36840700001)(46966006)(40470700004)(36860700001)(26005)(83380400001)(81166007)(5660300002)(82740400003)(7696005)(41300700001)(2906002)(86362001)(82310400005)(8936002)(4326008)(44832011)(16526019)(40460700003)(40480700001)(356005)(6666004)(316002)(186003)(336012)(8676002)(47076005)(2616005)(478600001)(54906003)(36756003)(110136005)(70586007)(426003)(1076003)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2023 16:19:34.3569 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3a1d6e7-87cb-4798-0d6d-08daffb91cd4 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: BN8NAM11FT047.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7975 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: 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 dd6da9d98d9b..1d337a96199d 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 ec2e335fac3d..8bf85df2f611 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 b89450b239ef..8e3683990117 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -64,7 +64,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 85ca73d1dc04..a215daa83640 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -1255,26 +1256,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