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 AC1BBA0C47; Tue, 12 Oct 2021 14:29:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7EB9A41165; Tue, 12 Oct 2021 14:29:57 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2044.outbound.protection.outlook.com [40.107.220.44]) by mails.dpdk.org (Postfix) with ESMTP id 4B6C341141 for ; Tue, 12 Oct 2021 14:29:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Znm93vi9v+aep5/yA5qC1DzC/HsaVKw5RIIsm70lBBI/AWsx5BHuJDzV139wSzTCtqmVRghCO0kbzvFalGMkmdJ8VSI56r/OXwyEbZRWhkGmkSizyxMiNtf6YdY1pYpCVCYdUyRu6Mjtl5f1LxAJZPifta1lcio0cs47D+HOSOq0Xbysk+F1uV1uQ6uL1vQZRORGRQNUJ4JqkjJZuLkUDvfSVTGdQxDsDsQ2Mfxe9wLUD0OoZAfkokcvXEdnMQuy0w+P2FO04M1t0/nCuxV8gctT2GYjW0gW/eYZ9Ii9ovsqvBNiXxGc+gkWadV6eOEZ70sCUR7fbCskmDkIwOAlZg== 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=J1SHSvGctJJBMfMnyU8ou9WX1q/wDFcaZbgkfKgjanI=; b=i4MTMU9UpTovUF3bO3WzEHouLStohVRupTX7Q7fA6TxDrmsiABg/j97xZzbv6BPgmc6WrATSZi49gtdu4A2y1mPneKmxiAhv0+OKiVmwk6ZgpR6yuiwl54z6UdF1RJbb5QgBMCtVU2bfQsasXSCEgwRAYPkZJZVKLMGdr74LNGkh+3VcHtRU7EAXADmmsYNFIBt9o23IBT6Eh0Y3nDAN/VsiFk9cRkbov1sKRHeT4kcyF2qNkF5bj9iVgT7fbihrUax5qDcUQDl9CyCHw1wikaiUA5CjQj6UNLf6/JmbJ0mDnrGFvznNtpqzmnCXe1/yi3QYY+KTgWvA6OuUlGaHeg== 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=J1SHSvGctJJBMfMnyU8ou9WX1q/wDFcaZbgkfKgjanI=; b=RRzXCLVjbRfSaIjJPQ2JOoD5AChDFxv0SZRlbdBxB5RZ8MZO21dlK0RvFCs4iBSVQRgHIq3F6pn8/J134Cz3VuJ/EhP8tYmhBXXO6LDVSDrMxp+S0AmuAQvkkIfAMof14g1IXing1EWakjxLOKDsvV96yUpR1Js9d5dyA5gQOXbgL+EEKe06sSjQxl/YBtL+/lsgYerGJ5a/+foxq+Q+/YwRFgW+1Wodh5QixcWVMMoqsJHZlQjtxdXf7wMp9LSGaKgKGuTzrWnk7J5kuDSztlDUWwGt6j1JEEOxizFNZEvXUMX8F+K3sMahN29XZRFFQc5VdheNyK0ZB0ZhISLrFg== Received: from CO2PR05CA0103.namprd05.prod.outlook.com (2603:10b6:104:1::29) by MWHPR12MB1168.namprd12.prod.outlook.com (2603:10b6:300:e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.19; Tue, 12 Oct 2021 12:29:52 +0000 Received: from CO1NAM11FT019.eop-nam11.prod.protection.outlook.com (2603:10b6:104:1:cafe::5a) by CO2PR05CA0103.outlook.office365.com (2603:10b6:104:1::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.4 via Frontend Transport; Tue, 12 Oct 2021 12:29:52 +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 CO1NAM11FT019.mail.protection.outlook.com (10.13.175.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4587.18 via Frontend Transport; Tue, 12 Oct 2021 12:29:52 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 12 Oct 2021 12:29:49 +0000 From: Gregory Etelson To: , CC: , , , , Bernard Iremonger , "Ray Kinsella" Date: Tue, 12 Oct 2021 15:29:34 +0300 Message-ID: <20211012122934.23659-1-getelson@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210527152858.13312-1-getelson@nvidia.com> References: <20210527152858.13312-1-getelson@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c67fed68-14de-4deb-31a1-08d98d7bfd70 X-MS-TrafficTypeDiagnostic: MWHPR12MB1168: 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: Q8/o3Bdo5ZtIjGsJAfBc7TZORhv/hJzITDDMUAWja3CdlPpP04I4LnF5buHlygtXGobthzP5wb0VMPnRI0CFIseZVBxSvC/C1SyQcp1JtAcWD7xfW8fuelkTsX1c5FWiMRA7k09ous0JA0QbpFtjIuHEb/pDCyu+/rzpuIb4zgSxa5HdilaxNN1P+4jAAkGqEswHnyJQ2Atz9YMciQOZWXL+CJ1xrKTaBfXV3OL4OuorvLCsisOLAblrS4MRyA7CnptjYuJ6lNnp65YzakLPyXz9kblxfYs+Us0RSUQD9C5Vxsdon7nzTvj+Spu2qrX2bhMHmoGofuzZXQqQkFSKqsWBMOBfC5epPmNFh4R6yvnmn2dZ87vzKzos4iG8QAmehJvOb+ot9thvw5/W5MSLSUDQ7ttKqYqGUxaOqDKFA8x1Coa+Xg9+K7UmReJO71gsUngi+VueQGm295UhGFqbD5YaSIfpdLFRDktbgLBW53OY26jLxx1uvg7JTDmG/1btB6A3HVonpFItwVG0YefeNbyeoczdX1uacLmtDA/oDwDQn4Osf26a0b+Z0CyIFsIWdtUfktTUK6BRhUFFskEePPfHB9a1418bsSvSCB7Xmu1XnfKyW5P3pJV2pIW511bwJGXQ8oLMwarTf5BMWbkFpQY2w+inAfLnmGXCEj5S9i0U73CxyUSJI1nXI7PztX9rxb11jwkoRPP65rwO7SVdAg== 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)(36860700001)(55016002)(356005)(110136005)(54906003)(47076005)(7636003)(508600001)(5660300002)(7696005)(7049001)(316002)(4326008)(36906005)(26005)(86362001)(6286002)(16526019)(83380400001)(6666004)(8936002)(36756003)(426003)(70586007)(336012)(82310400003)(2616005)(1076003)(2906002)(8676002)(186003)(70206006); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2021 12:29:52.1128 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c67fed68-14de-4deb-31a1-08d98d7bfd70 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: CO1NAM11FT019.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1168 Subject: [dpdk-dev] [PATCH v5] 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. The patch implements one of 2 announced changes to the IPv4 header. IPv4 header encodes fragment information into 16 bits field. 3 bits hold flags and remaining 13 bits are for fragment offset. 13 bits bit-field cannot be defined both for big and little endian systems. Signed-off-by: Gregory Etelson Acked-by: Olivier Matz --- v2: Add dependency. v3: Add comments. v4: Update release notes. v5: Remove deprecation notice. Update the patch comment. --- app/test/test_flow_classify.c | 8 ++++---- doc/guides/rel_notes/deprecation.rst | 6 ------ doc/guides/rel_notes/release_21_11.rst | 3 +++ lib/net/rte_ip.h | 16 +++++++++++++++- 4 files changed, 22 insertions(+), 11 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 a2fe766d4b..040f4a8868 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -167,12 +167,6 @@ Deprecation Notices * net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets headers. -* net: The structure ``rte_ipv4_hdr`` will have two unions. - The first union is for existing ``version_ihl`` byte - and new bitfield for version and IHL. - The second union is for existing ``fragment_offset`` - and new bitfield for fragment flags and offset. - * 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 dfc2cbdeed..4fb4a1dac4 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -187,6 +187,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 05948b69b7..89a68d9433 100644 --- a/lib/net/rte_ip.h +++ b/lib/net/rte_ip.h @@ -38,7 +38,21 @@ 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 */ +#else +#error "setup endian definition" +#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