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 D9571A0C47; Wed, 13 Oct 2021 19:14:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 842E241145; Wed, 13 Oct 2021 19:14:20 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2051.outbound.protection.outlook.com [40.107.92.51]) by mails.dpdk.org (Postfix) with ESMTP id 6D07741143 for ; Wed, 13 Oct 2021 19:14:19 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oQp6jfOpT6s3i8x5ifLydcbSMHwVKJrtfVlwTsylIi5BxV/q891dBEarrI44QyDz9RtTMIPB8wG3D6VYpCll5ykCsy2XfbKtk4+OMZKSw3bWbPvqG6Zb20+pemaauDUqpO4tY2hZBFW60xWNH1UsF6gTmhfQxRQK6QbXRluKpK5lpeQIGOKzoaqNSKEIhFXxHeLEGHfUyapMy7QxgPdB+Qr/lPrVdT512D5gernn63MgInK1fZ5s7czCOsBsRzoQiXO1Ve6g5bt1ItsIJcA0mMDfg6+aAOMDShZOA/HzjAxsMyww3nIU5Ep1RNp8TOBPxcXnBtQbq8cZfz1CPIc8kA== 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=wQrNdNRUGjOwT0G8KGL9IDcDidRWY3b15hXDeoCHSKA=; b=DI5zDPDA/VBGT5QvezmaMd6VXQL/mfrzLYfFVmCFNFgJntu+XRdyBem943KgSyIx+PaPZliEvqE1dmT6tg5kAtwRekCEk71Ei2agswHQxMuFGV1dls7Loetsd0RNCd3JHpCPzmKgLd0vKmR/K2GIc0jV1C3+AH68Ud4MqtBjIq6gfGuTAwQxdGu4/BHsX4tT3XW/rc07t3v3EPG2m9tvJGOyU2tBlF4z78sOdBUCmtdzWPFq27zX3odh2rE7XcRD7UJOTKsg4DOWMhcaLFDilrVHPfvsUZH88ptNYZ3i4wqRpGRw2WzOC62ygxVYTD8DiBQoWhcjfiVx1OE59tYTcQ== 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=wQrNdNRUGjOwT0G8KGL9IDcDidRWY3b15hXDeoCHSKA=; b=CXoh9+9i/l5Ux6LMVfWXlZDvpMm9V1+qqvueFTlYmWNVEZS8+8ijrHwG5+ebMXkck/LDObvwzexIpYKkqmjTbIAXUWldvFYpvMzWS6o1tsMdAhiwGvy3WahAqpVKDAS7amavL/b3bj+LxSOFB9WtinREfYeyB8tyRQC2qEq5a+LZ3eib+Hw71CgidadegHE7S8lquK2IKdfoyrHj4FCwBqyTeD8cOABJndoDt9M3HSUIRC/EdmK07fABY4yD0+NJhJTw+tKm4uMQnHPBRVduawC+CD1wcHl+i5vX761dsT+iRfGcX22wT/7eJUvUl2zD6/UmFERwqh/8ixn7/INIYQ== Received: from MW4PR04CA0211.namprd04.prod.outlook.com (2603:10b6:303:87::6) by DM6PR12MB3100.namprd12.prod.outlook.com (2603:10b6:5:11b::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.25; Wed, 13 Oct 2021 17:14:18 +0000 Received: from CO1NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:303:87:cafe::58) by MW4PR04CA0211.outlook.office365.com (2603:10b6:303:87::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Wed, 13 Oct 2021 17:14:17 +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 CO1NAM11FT068.mail.protection.outlook.com (10.13.175.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4608.15 via Frontend Transport; Wed, 13 Oct 2021 17:14:17 +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; Wed, 13 Oct 2021 17:14:14 +0000 From: Gregory Etelson To: , CC: , , , , , Ray Kinsella , Bernard Iremonger Date: Wed, 13 Oct 2021 20:13:54 +0300 Message-ID: <20211013171354.27817-3-getelson@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211013171354.27817-1-getelson@nvidia.com> References: <20210527152858.13312-1-getelson@nvidia.com> <20211013171354.27817-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: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05e37133-ffcb-42ed-6cd2-08d98e6ce394 X-MS-TrafficTypeDiagnostic: DM6PR12MB3100: 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: UV+gf4i+zLPV/0Uonsg1gZsDwL6Tiu1MbNNHmx1NLAmF5AXnppXA8WAUCQB7t8V2XPH/soEi0hrncjJy6ZZnClKnRXV3+DGA20Ul06qU3KDKY5utynaw3AnNqOmbDUQ7O5ZY1ZUOPElEQe2NZhGMLluGKtb06umq31pEm6ZTeHKQS5hUt9+nTf+RSFzsoGIWa8gyGbpjAF0tslWhki9NaWr1Pto5A6Ye6Uq9PNBBW2F/e1TILZXrN8nPnkDSpFFVZ73bnu8LjdPyR9JZoQWJ7+k5N2z5TqLszuC1R87o+6znUmBsxNYnCScRum4KdD/JgXbOjTTLPcV4QN2uYeXk1fpOPNLeXopWm2hkLlzGServM4NwVhH9WazPz1X8goCshSZMPFL7S0/pBorq+aw1M9iS1rG6SMja5qSrLSd+CYNYAmWHGmPThFWDpi8LTAqZ59qmkXXa5KAR/quu8tAdNGBF5H1dy0BDcmyDmLiWMdUeGmsKZpzbqhpk77f6a2QYdcaAbkOA6ZygUawtBA8cUAwmhGkUv7ZfxguOygGEV24BhR5XPGCFIlkSkwx4ZJ9JWab4+VpSzFgvEjNWnkCGoUDA0JhKi090WjGK0/tpVmCpe6FvKE1glZU8YJaW/GmIYbGC6Ef0cLuNy8OitwZxmfwAM49wSibkl5e9zRNFlEbk6np5v+3U/fa2tMeHwVUTIocrnSG0qczucEICogEl8g== 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)(36756003)(83380400001)(2616005)(7696005)(1076003)(8936002)(7636003)(2906002)(6286002)(70206006)(426003)(336012)(70586007)(47076005)(356005)(7049001)(508600001)(6666004)(5660300002)(55016002)(82310400003)(86362001)(26005)(4326008)(186003)(16526019)(54906003)(110136005)(36860700001)(8676002)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2021 17:14:17.4333 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05e37133-ffcb-42ed-6cd2-08d98e6ce394 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: CO1NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3100 Subject: [dpdk-dev] [PATCH v6 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. --- 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 | 16 +++++++++++++++- 4 files changed, 22 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..1f3660e8b4 100644 --- a/lib/net/rte_ip.h +++ b/lib/net/rte_ip.h @@ -39,7 +39,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