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 A7627A0C4B; Thu, 14 Oct 2021 19:42:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 30D97410F2; Thu, 14 Oct 2021 19:41:57 +0200 (CEST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2076.outbound.protection.outlook.com [40.107.96.76]) by mails.dpdk.org (Postfix) with ESMTP id 5B3E3410F0 for ; Thu, 14 Oct 2021 19:41:54 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UEjBUrYewbtBeEqNG7ofxGFYxDyOOUOl4RLYkNIxWfPjffu9tpBoFbgoQLcZfxMgHRTpwoX3TvncDNNrb/kw0d5i2HTIcC5BuV1pHOEH6gdNnZp4+gXh6UsOfZiMUinJwqeN1ErqvrD//fIlrO9o7MkUQRoxcd1QR3b88B3IiQjHt0f1/7AVCX3GjPfqs65w5vsWfvfaYzd/HobQvseCp2QU57azoQVtXCtzeEocNbfGP5tZnYneZZ2i+s1XoPsWgVcv+i6N4VnYjDziPeI0jurK9i+izF0qCX3vsTVzQYKdBVBBnHrOkio0CIgqNChLP5fsBreQs4tPdHoguapy2g== 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=qtl2XiXEJdhOMZ43p0B9Z89zXHCa37/xbXat/gkTs30=; b=PI4BMCDrpoXO7dvFdDnsRtqQQnK+kO36dmxZgY0/fBZ+Nioi9vx5NvBEh3melzmJ8DpPL28JYZFCJqXPcF12xoOvbrdvemu8mNK1VxBtXKa7ZnR5M2Ezm5EFHb1vGO2zyKDXuQ3qiv7CwMoqasXB1L708XRpuU1EVo/4uPtS8seDBv4OhcVsZ+flFemDWjwdJBJv/gOMKFC+sMu6xsNRkn4+1ogH6uBsUaYfpcc0TAoYDI5bw/0Bo8U55svBlmQrhBorEvMcL5hOhcOccu9ujGGmrMuhXsZaOVnOKFhtKsE6i65o4qblhW2OSXg+dm2J6JhLLwFZi/NH3IbZXs0GlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qtl2XiXEJdhOMZ43p0B9Z89zXHCa37/xbXat/gkTs30=; b=J8AyngwtulallVxnaNkTH6gqjIoo1Iz2HyLSnFtwBOgBapw6as3zPMx0TzlxteYZ3CucnJVxiybxaJDv0LikXK8NDdo1lIJDy0rME5V8REpwcbkuJHycarJDn9LNCyTwT9595r6vX3u18IM0t/EW6f2ND5SGKDij5C3CnhKWf47w6QjDCxB9TVc+b8Y/4JKrYjb7CR/3+nI5kkswKm9RUIJX7kq4UQbNcfO6pMRoOQh9AxpZDiTVzT98Mr6mjLzm9Ji2g4wNjxiaSX1fqC5HZy24kqBWNkWgUrwASpr6DqD9bagvPG8dulfHjztKX/4Lb0sVLX4QOFyCz5jeS0HiiA== Received: from MW4PR04CA0285.namprd04.prod.outlook.com (2603:10b6:303:89::20) by SA0PR12MB4559.namprd12.prod.outlook.com (2603:10b6:806:9e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.22; Thu, 14 Oct 2021 17:41:51 +0000 Received: from CO1NAM11FT041.eop-nam11.prod.protection.outlook.com (2603:10b6:303:89:cafe::de) by MW4PR04CA0285.outlook.office365.com (2603:10b6:303:89::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Thu, 14 Oct 2021 17:41:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT041.mail.protection.outlook.com (10.13.174.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4608.15 via Frontend Transport; Thu, 14 Oct 2021 17:41:51 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 14 Oct 2021 17:41:48 +0000 From: Gregory Etelson To: , CC: , , , , , Ray Kinsella , Bernard Iremonger Date: Thu, 14 Oct 2021 20:41:13 +0300 Message-ID: <20211014174113.10237-3-getelson@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211014174113.10237-1-getelson@nvidia.com> References: <20210527152858.13312-1-getelson@nvidia.com> <20211014174113.10237-1-getelson@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 179535ea-4ea4-4cde-c9be-08d98f39e7e5 X-MS-TrafficTypeDiagnostic: SA0PR12MB4559: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1824; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fp5+TAxmQV5bbrbgIf3H1ym9WH5tw7gdTmlsBk+Pd2ge6oYq2NsvuwOm6C7GbIzrYH7ic3BAieN+gqEG1D+cto+L7S7gVCMLTGvwkG5sGtnsqLQKz8c6MGmJ3U7OGmH8gPa7PaqFd12oSoMT9kBX6vru7UpmvQSmpucikRLqSsp0tWCKUPlj5jDMXBMZz6I+HBoDCt3G/LYXxBo62e8yb+S99K4IFc1NhFYTXOKx93sIT1aylFST5OWiBcTkHRs4TZfnrc3R9QZfiEYcoLxLjsu+3HrAnA5U8cvI8qO63W0HmFyknEk+MkcDLpJw1p1OMOWUCYZFvJBS2xqMROOyjx3Ah4Krj5DQddxIkjEUIyZC5EJD3C/lFLlZMrisjvlguwMjvB65m30Ji+FaD7ytMweVBoy9J6Bwm7c7rZiRMlnu/CSShzPHq/203ZAtk669EcZYGH0xf5RUYqlEkHMki33DMN+Q2edWzRcnZikqxbI2jM0gVi+IlcmoZe0pd6u7D562i5DJEjGWGNUFEfzntp4fjvFVIPz9WOUGFKM3+MAl/eKfFwEzHjdJh0zrjNk+5FvX3mT/MBq9rL9sHKx7zpIZqJjHj0GXPM5G9xj9Pli/em4RjGm6iL+34ttQF2ibKn0+uRV9deb84UFB0WWwFLtmmBf/7tja61zHNMdpequGIJCQfrHM7QzV6F0fRvN+L0mSwvszffhXmtgfvFFcmA== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(47076005)(2616005)(6286002)(36756003)(8676002)(83380400001)(5660300002)(82310400003)(55016002)(7696005)(186003)(426003)(86362001)(54906003)(7049001)(1076003)(26005)(70586007)(7636003)(2906002)(110136005)(336012)(6666004)(36906005)(70206006)(36860700001)(508600001)(16526019)(316002)(356005)(4326008)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2021 17:41:51.5400 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 179535ea-4ea4-4cde-c9be-08d98f39e7e5 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT041.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4559 Subject: [dpdk-dev] [PATCH v7 2/2] net: introduce IPv4 ihl and version fields 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 Sender: "dev" RTE IPv4 header definition combines the `version' and `ihl' fields into a single structure member. This patch introduces dedicated structure members for both `version' and `ihl' IPv4 fields. Separated header fields definitions allow to create simplified code to match on the IHL value in a flow rule. The original `version_ihl' structure member is kept for backward compatibility. Signed-off-by: Gregory Etelson Acked-by: Olivier Matz Acked-by: Ray Kinsella --- v2: Add dependency. v3: Add comments. v4: Update release notes. v5: Remove deprecation notice. Update the patch comment. v6: split the patch into 2 parts: 1: update the announce. 2: implement the IPv4 header changes. v7: Remove `#else`. --- app/test/test_flow_classify.c | 8 ++++---- doc/guides/rel_notes/deprecation.rst | 3 --- doc/guides/rel_notes/release_21_11.rst | 3 +++ lib/net/rte_ip.h | 14 +++++++++++++- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index 951606f248..4f64be5357 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -95,7 +95,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { * dst mask 255.255.255.00 / udp src is 32 dst is 33 / end" */ static struct rte_flow_item_ipv4 ipv4_udp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_UDP, 0, + { { .version_ihl = 0}, 0, 0, 0, 0, 0, IPPROTO_UDP, 0, RTE_IPV4(2, 2, 2, 3), RTE_IPV4(2, 2, 2, 7)} }; static const struct rte_flow_item_ipv4 ipv4_mask_24 = { @@ -131,7 +131,7 @@ static struct rte_flow_item end_item = { RTE_FLOW_ITEM_TYPE_END, * dst mask 255.255.255.00 / tcp src is 16 dst is 17 / end" */ static struct rte_flow_item_ipv4 ipv4_tcp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_TCP, 0, + { { .version_ihl = 0}, 0, 0, 0, 0, 0, IPPROTO_TCP, 0, RTE_IPV4(1, 2, 3, 4), RTE_IPV4(5, 6, 7, 8)} }; @@ -150,8 +150,8 @@ static struct rte_flow_item tcp_item_1 = { RTE_FLOW_ITEM_TYPE_TCP, * dst mask 255.255.255.00 / sctp src is 16 dst is 17/ end" */ static struct rte_flow_item_ipv4 ipv4_sctp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_SCTP, 0, RTE_IPV4(11, 12, 13, 14), - RTE_IPV4(15, 16, 17, 18)} + { { .version_ihl = 0}, 0, 0, 0, 0, 0, IPPROTO_SCTP, 0, + RTE_IPV4(11, 12, 13, 14), RTE_IPV4(15, 16, 17, 18)} }; static struct rte_flow_item_sctp sctp_spec_1 = { diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 841653fe30..d1f3faac39 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -158,9 +158,6 @@ Deprecation Notices consistent with existing outer header checksum status flag naming, which should help in reducing confusion about its usage. -* net: The structure ``rte_ipv4_hdr`` will have a union for - existing ``version_ihl`` byte and new bitfield for ``version`` and ``ihl``. - * vhost: ``rte_vdpa_register_device``, ``rte_vdpa_unregister_device``, ``rte_vhost_host_notifier_ctrl`` and ``rte_vdpa_relay_vring_used`` vDPA driver interface will be marked as internal in DPDK v21.11. diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index e1726774ba..fa60fd9a85 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -216,6 +216,9 @@ API Changes the crypto/security operation. This field will be used to communicate events such as soft expiry with IPsec in lookaside mode. +* net: Add ``version`` and ``ihl`` bit-fields to ``struct rte_ipv4_hdr``. + Existing ``version_ihl`` field was kept for backward compatibility. + ABI Changes ----------- diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h index b3d45e85db..0ef2430607 100644 --- a/lib/net/rte_ip.h +++ b/lib/net/rte_ip.h @@ -39,7 +39,19 @@ extern "C" { * IPv4 Header */ struct rte_ipv4_hdr { - uint8_t version_ihl; /**< version and header length */ + __extension__ + union { + uint8_t version_ihl; /**< version and header length */ + struct { +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN + uint8_t ihl:4; /**< header length */ + uint8_t version:4; /**< version */ +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN + uint8_t version:4; /**< version */ + uint8_t ihl:4; /**< header length */ +#endif + }; + }; uint8_t type_of_service; /**< type of service */ rte_be16_t total_length; /**< length of packet */ rte_be16_t packet_id; /**< packet ID */ -- 2.33.0