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 B566342BEF; Wed, 31 May 2023 10:01:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 89DB540F18; Wed, 31 May 2023 10:01:40 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2060.outbound.protection.outlook.com [40.107.94.60]) by mails.dpdk.org (Postfix) with ESMTP id 7A1EF40A82 for ; Wed, 31 May 2023 10:01:38 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PCGuB9vnErWn9tTiYcLq+nwgxaYZZGPPnIq8Fg/2pgDlZO6IazOe5/0dxg7wy9UU9Mop75UwmxyPEMIrcwEOj5g2hcWRiNLxgNQ2sRTcmdU9WCIeYY9EFCw18aEYFjP7aL9PmY+PbEA2Ta57/nuOvQyjwZ1tJCZWTHE26P6JJ7w35jtt+iqLYJCVS4YOr1LIun6Xt1Sz8pp3u1JdAHq2QEzrtDiWGdDTNyheRIpi9Anvz9v9FYHsBpdkcTA87E1ute8TuNZGG08wOnb1/lAeGpckWC8od5eJKQ50DoVfLj6rnAU36JZKDmBpZ5TrQSAuJdpDnfPWD7zz4yE5ew7gvg== 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=U+m4AHG8iSSzxfsu7KSg5nREkFaR6nvWC7ZjZZnUBxo=; b=QqBU1Ds4qmxE17QzgkCs4KNPAtv0YRWs5n4wshK9+F9ZqkqS+GbPxT6TYqlEHxVLU75yOnlBK9y7rO1TtmmfBpBqwuXFF4Ir67GkmGBrJK/UhxinTtabOOoVDkBokKsMD+qCv9IvxncwdxJb+fYwEVVS9qlE0enXzjolRG19rOEQeohkfI+Jv3Yp4ceuyh6iVvh13SolX108k1tU4JNz9h0ktKHg1CXhWp9GMYodpmPOHGMcgBBnukD+afUffvlTltDBBpG5ic4YENvfDRzIhWlzAZIxWu2Tjrg3xBKN5TVOthoZfvJajIdDMNPkwjYzsOC/7lWbkNQ0LAsU6O46ZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject 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=U+m4AHG8iSSzxfsu7KSg5nREkFaR6nvWC7ZjZZnUBxo=; b=mwC5/taxOYU2avbaYNV9vss9guhFr49yWa+MI7s2tgFmxQopxqUV2csAs2/KOvklzIITAyW1vudBzmF2erRywitcR7QvpU5aurxYSuSSpFJPGwaAAI6j9mqW0z1dNhF27Za3100+31uorrA8PfjaWTA94JZZsEau2Ay0LtMPItk835TGsHJFGHiBjotWItFFhE4WPA6RkA3jktlKvsHqaKmwis+y4wBoHJRgoRI23GT5Zfu28scsg1b4JC+WMRa9P9z+ywB3Mj9mlEMpo2br4MXwM3Sl5a+qfyLLOkmBtTo2xjuM2i9oaSjvHNn0ZkHNMDuPjGSLSnpU7dCXuCjxYA== Received: from DM6PR06CA0027.namprd06.prod.outlook.com (2603:10b6:5:120::40) by SJ0PR12MB8114.namprd12.prod.outlook.com (2603:10b6:a03:4e8::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.24; Wed, 31 May 2023 08:01:36 +0000 Received: from DM6NAM11FT073.eop-nam11.prod.protection.outlook.com (2603:10b6:5:120:cafe::c7) by DM6PR06CA0027.outlook.office365.com (2603:10b6:5:120::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.22 via Frontend Transport; Wed, 31 May 2023 08:01:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT073.mail.protection.outlook.com (10.13.173.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.22 via Frontend Transport; Wed, 31 May 2023 08:01:35 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 31 May 2023 01:01:22 -0700 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Wed, 31 May 2023 01:01:19 -0700 From: Dong Zhou To: , , Aman Singh , Yuying Zhang , "Ferruh Yigit" , Andrew Rybchenko , Olivier Matz CC: Subject: [PATCH v6] ethdev: add flow item for RoCE infiniband BTH Date: Wed, 31 May 2023 11:01:08 +0300 Message-ID: <20230531080108.3113171-1-dongzhou@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230531032653.3037946-1-dongzhou@nvidia.com> References: <20230531032653.3037946-1-dongzhou@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT073:EE_|SJ0PR12MB8114:EE_ X-MS-Office365-Filtering-Correlation-Id: ef5f51a0-cd85-4426-83aa-08db61ad416d X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /ttNDYzkEKGbj4ZuP927trXyr8eAT/Y8UCOuMFsqOjuCSSAhxTARMpa10W1vMeuLl/LAzN0lF5bOeiFQhDSlpOtoqhq7pKEk33Xl0V5ZrIhSU3M6mw/k5NjdITWU/Rh3ePNv4ds/2yQ1onlDI2egQNFsx5eMvdzdKI0QZl02V3Z043qlNrKLpkmg/ssvYCf32gxFfc84pTZbJaeUXVUsn76FbWACLHssUoY3xPIhX8hsxZRfGDSZJE3jZukNaLhvRPVi3328VySQe0dYylENtHKFA7aNmS7HVxUNL2aLee9AWBlYo1wnYWSnu3IuNEB4TJQUTL1aMop3Vr9+TQkGWs7kV+uxOTd4Enf3n9n+rTrZNvkpabwG9VGBXWh1WJ1wQVpk/g2mbfs4y61QEKHgfAuFVYHtPPdsn2S/hEqCT8ZCDo/OgsEh4zKVRM06+yfICMvlNjzddMwSJ0BQHn17+O7/mjrbyaDKllTKij1UtC5gRNFmHLFXsfN26bt5bBd6wfOJXFQNCGIKgqmudKow9/KbHi0CXRdJhXi5pUue6KC5B6zbreMgZ+AeGsy/Q12ZvxfUmHeSwQ7mxoxm8QQ/m2hqA7pIUAgddtXfn0Xa8vH8bj2MKAp1LXZIgAeLwDZOmc9jztJGKUFa/RcX0NRwfL8kyC6qFx77fDXorTsoo7SwHpxBIyG1YEWfUxzqxJFFWJP23fxa3k4zWS2Gi7el915mBd/opjCMm3/hs3aknSkA9WBFlGDM56EP8TtuCi4G X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(346002)(136003)(39860400002)(396003)(376002)(451199021)(46966006)(40470700004)(36840700001)(82310400005)(5660300002)(40460700003)(8936002)(8676002)(110136005)(478600001)(55016003)(7696005)(40480700001)(6666004)(316002)(36756003)(70206006)(7636003)(70586007)(4326008)(356005)(82740400003)(83380400001)(47076005)(16526019)(6286002)(186003)(66574015)(336012)(426003)(2906002)(30864003)(26005)(1076003)(41300700001)(86362001)(36860700001)(2616005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2023 08:01:35.6583 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ef5f51a0-cd85-4426-83aa-08db61ad416d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT073.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB8114 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 IB(InfiniBand) is one type of networking used in high-performance computing with high throughput and low latency. Like Ethernet, IB defines a layered protocol (Physical, Link, Network, Transport Layers). IB provides native support for RDMA(Remote DMA), an extension of the DMA that allows direct access to remote host memory without CPU intervention. IB network requires NICs and switches to support the IB protocol. RoCE(RDMA over Converged Ethernet) is a network protocol that allows RDMA to run on Ethernet. RoCE encapsulates IB packets on Ethernet and has two versions, RoCEv1 and RoCEv2. RoCEv1 is an Ethernet link layer protocol, IB packets are encapsulated in the Ethernet layer and use Ethernet type 0x8915. RoCEv2 is an internet layer protocol, IB packets are encapsulated in UDP payload and use a destination port 4791, The format of the RoCEv2 packet is as follows: ETH + IP + UDP(dport 4791) + IB(BTH + ExtHDR + PAYLOAD + CRC) BTH(Base Transport Header) is the IB transport layer header, RoCEv1 and RoCEv2 both contain this header. This patch introduces a new RTE item to match the IB BTH in RoCE packets. One use of this match is that the user can monitor RoCEv2's CNP(Congestion Notification Packet) by matching BTH opcode 0x81. This patch also adds the testpmd command line to match the RoCEv2 BTH. Usage example: testpmd> flow create 0 group 1 ingress pattern eth / ipv4 / udp dst is 4791 / ib_bth opcode is 0x81 dst_qp is 0xd3 / end actions queue index 0 / end Signed-off-by: Dong Zhou Acked-by: Ori Kam Acked-by: Andrew Rybchenko v2: - Change "ethernet" name to "Ethernet" in the commit log. - Add "RoCE" and "IB" 2 words to words-case.txt. - Add "rte_byteorder.h" header file in "rte_ib.h" to fix compile errors. - Add "Acked-by" labels in the first ethdev patch. v3: - Do rebase to fix the patch apply failure. - Add "Acked-by" label in the second net/mlx5 patch. v4: - Split this series of patches, only keep the first ethdev patch. v5: - Update the release notes. - Update the doxy-api-index.md file. v6: - Fix warning in release_23_07.rst. --- app/test-pmd/cmdline_flow.c | 58 +++++++++++++++++ devtools/words-case.txt | 2 + doc/api/doxy-api-index.md | 3 +- doc/guides/nics/features/default.ini | 1 + doc/guides/prog_guide/rte_flow.rst | 7 +++ doc/guides/rel_notes/release_23_07.rst | 4 ++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 27 ++++++++ lib/net/meson.build | 1 + lib/net/rte_ib.h | 70 +++++++++++++++++++++ 11 files changed, 180 insertions(+), 1 deletion(-) create mode 100644 lib/net/rte_ib.h diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 58939ec321..3ade229ffc 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -496,6 +496,11 @@ enum index { ITEM_QUOTA_STATE_NAME, ITEM_AGGR_AFFINITY, ITEM_AGGR_AFFINITY_VALUE, + ITEM_IB_BTH, + ITEM_IB_BTH_OPCODE, + ITEM_IB_BTH_PKEY, + ITEM_IB_BTH_DST_QPN, + ITEM_IB_BTH_PSN, /* Validate/create actions. */ ACTIONS, @@ -1452,6 +1457,7 @@ static const enum index next_item[] = { ITEM_METER, ITEM_QUOTA, ITEM_AGGR_AFFINITY, + ITEM_IB_BTH, END_SET, ZERO, }; @@ -1953,6 +1959,15 @@ static const enum index item_aggr_affinity[] = { ZERO, }; +static const enum index item_ib_bth[] = { + ITEM_IB_BTH_OPCODE, + ITEM_IB_BTH_PKEY, + ITEM_IB_BTH_DST_QPN, + ITEM_IB_BTH_PSN, + ITEM_NEXT, + ZERO, +}; + static const enum index next_action[] = { ACTION_END, ACTION_VOID, @@ -5523,6 +5538,46 @@ static const struct token token_list[] = { .call = parse_quota_state_name, .comp = comp_quota_state_name }, + [ITEM_IB_BTH] = { + .name = "ib_bth", + .help = "match ib bth fields", + .priv = PRIV_ITEM(IB_BTH, + sizeof(struct rte_flow_item_ib_bth)), + .next = NEXT(item_ib_bth), + .call = parse_vc, + }, + [ITEM_IB_BTH_OPCODE] = { + .name = "opcode", + .help = "match ib bth opcode", + .next = NEXT(item_ib_bth, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ib_bth, + hdr.opcode)), + }, + [ITEM_IB_BTH_PKEY] = { + .name = "pkey", + .help = "partition key", + .next = NEXT(item_ib_bth, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ib_bth, + hdr.pkey)), + }, + [ITEM_IB_BTH_DST_QPN] = { + .name = "dst_qp", + .help = "destination qp", + .next = NEXT(item_ib_bth, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ib_bth, + hdr.dst_qp)), + }, + [ITEM_IB_BTH_PSN] = { + .name = "psn", + .help = "packet sequence number", + .next = NEXT(item_ib_bth, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ib_bth, + hdr.psn)), + }, /* Validate/create actions. */ [ACTIONS] = { .name = "actions", @@ -11849,6 +11904,9 @@ flow_item_default_mask(const struct rte_flow_item *item) case RTE_FLOW_ITEM_TYPE_AGGR_AFFINITY: mask = &rte_flow_item_aggr_affinity_mask; break; + case RTE_FLOW_ITEM_TYPE_IB_BTH: + mask = &rte_flow_item_ib_bth_mask; + break; default: break; } diff --git a/devtools/words-case.txt b/devtools/words-case.txt index 42c7861b68..5bd34e8b88 100644 --- a/devtools/words-case.txt +++ b/devtools/words-case.txt @@ -27,6 +27,7 @@ GENEVE GTPU GUID HW +IB ICMP ID IO @@ -74,6 +75,7 @@ QinQ RDMA RETA ROC +RoCE RQ RSS RVU diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index c709fd48ad..a98439c4fb 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -127,7 +127,8 @@ The public API headers are grouped by topics: [Geneve](@ref rte_geneve.h), [eCPRI](@ref rte_ecpri.h), [L2TPv2](@ref rte_l2tpv2.h), - [PPP](@ref rte_ppp.h) + [PPP](@ref rte_ppp.h), + [IB](@ref rte_ib.h) - **QoS**: [metering](@ref rte_meter.h), diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini index 1a5087abad..1738715e26 100644 --- a/doc/guides/nics/features/default.ini +++ b/doc/guides/nics/features/default.ini @@ -104,6 +104,7 @@ gtpc = gtpu = gtp_psc = higig2 = +ib_bth = icmp = icmp6 = icmp6_echo_request = diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 32fc45516a..e2957df71c 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1551,6 +1551,13 @@ Matches flow quota state set by quota action. - ``state``: Flow quota state +Item: ``IB_BTH`` +^^^^^^^^^^^^^^^^ + +Matches an InfiniBand base transport header in RoCE packet. + +- ``hdr``: InfiniBand base transport header definition (``rte_ib.h``). + Actions ~~~~~~~ diff --git a/doc/guides/rel_notes/release_23_07.rst b/doc/guides/rel_notes/release_23_07.rst index a9b1293689..cc9ee8e170 100644 --- a/doc/guides/rel_notes/release_23_07.rst +++ b/doc/guides/rel_notes/release_23_07.rst @@ -55,6 +55,10 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added flow matching of infiniband BTH.** + + Added ``RTE_FLOW_ITEM_TYPE_IB_BTH`` to match infiniband BTH fields. + Removed Items ------------- diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 8f23847859..4bad244029 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3781,6 +3781,13 @@ This section lists supported pattern items and their attributes, if any. - ``send_to_kernel``: send packets to kernel. +- ``ib_bth``: match InfiniBand BTH(base transport header). + + - ``opcode {unsigned}``: Opcode. + - ``pkey {unsigned}``: Partition key. + - ``dst_qp {unsigned}``: Destination Queue Pair. + - ``psn {unsigned}``: Packet Sequence Number. + Actions list ^^^^^^^^^^^^ diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 69e6e749f7..6e099deca3 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -164,6 +164,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { MK_FLOW_ITEM(IPV6_ROUTING_EXT, sizeof(struct rte_flow_item_ipv6_routing_ext)), MK_FLOW_ITEM(QUOTA, sizeof(struct rte_flow_item_quota)), MK_FLOW_ITEM(AGGR_AFFINITY, sizeof(struct rte_flow_item_aggr_affinity)), + MK_FLOW_ITEM(IB_BTH, sizeof(struct rte_flow_item_ib_bth)), }; /** Generate flow_action[] entry. */ diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 713ba8b65c..2b7f144c27 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -38,6 +38,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -672,6 +673,13 @@ enum rte_flow_item_type { * @see struct rte_flow_item_aggr_affinity. */ RTE_FLOW_ITEM_TYPE_AGGR_AFFINITY, + + /** + * Matches an InfiniBand base transport header in RoCE packet. + * + * See struct rte_flow_item_ib_bth. + */ + RTE_FLOW_ITEM_TYPE_IB_BTH, }; /** @@ -2260,6 +2268,25 @@ rte_flow_item_aggr_affinity_mask = { }; #endif +/** + * RTE_FLOW_ITEM_TYPE_IB_BTH. + * + * Matches an InfiniBand base transport header in RoCE packet. + */ +struct rte_flow_item_ib_bth { + struct rte_ib_bth hdr; /**< InfiniBand base transport header definition. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_IB_BTH. */ +#ifndef __cplusplus +static const struct rte_flow_item_ib_bth rte_flow_item_ib_bth_mask = { + .hdr = { + .opcode = 0xff, + .dst_qp = "\xff\xff\xff", + }, +}; +#endif + /** * Action types. * diff --git a/lib/net/meson.build b/lib/net/meson.build index 379d161ee0..b7a0684101 100644 --- a/lib/net/meson.build +++ b/lib/net/meson.build @@ -22,6 +22,7 @@ headers = files( 'rte_geneve.h', 'rte_l2tpv2.h', 'rte_ppp.h', + 'rte_ib.h', ) sources = files( diff --git a/lib/net/rte_ib.h b/lib/net/rte_ib.h new file mode 100644 index 0000000000..9eab5f9e15 --- /dev/null +++ b/lib/net/rte_ib.h @@ -0,0 +1,70 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2023 NVIDIA Corporation & Affiliates + */ + +#ifndef RTE_IB_H +#define RTE_IB_H + +/** + * @file + * + * InfiniBand headers definitions + * + * The infiniBand headers are used by RoCE (RDMA over Converged Ethernet). + */ + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * InfiniBand Base Transport Header according to + * IB Specification Vol 1-Release-1.4. + */ +__extension__ +struct rte_ib_bth { + uint8_t opcode; /**< Opcode. */ +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN + uint8_t tver:4; /**< Transport Header Version. */ + uint8_t padcnt:2; /**< Pad Count. */ + uint8_t m:1; /**< MigReq. */ + uint8_t se:1; /**< Solicited Event. */ +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN + uint8_t se:1; /**< Solicited Event. */ + uint8_t m:1; /**< MigReq. */ + uint8_t padcnt:2; /**< Pad Count. */ + uint8_t tver:4; /**< Transport Header Version. */ +#endif + rte_be16_t pkey; /**< Partition key. */ +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN + uint8_t rsvd0:6; /**< Reserved. */ + uint8_t b:1; /**< BECN. */ + uint8_t f:1; /**< FECN. */ +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN + uint8_t f:1; /**< FECN. */ + uint8_t b:1; /**< BECN. */ + uint8_t rsvd0:6; /**< Reserved. */ +#endif + uint8_t dst_qp[3]; /**< Destination QP */ +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN + uint8_t rsvd1:7; /**< Reserved. */ + uint8_t a:1; /**< Acknowledge Request. */ +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN + uint8_t a:1; /**< Acknowledge Request. */ + uint8_t rsvd1:7; /**< Reserved. */ +#endif + uint8_t psn[3]; /**< Packet Sequence Number */ +} __rte_packed; + +/** RoCEv2 default port. */ +#define RTE_ROCEV2_DEFAULT_PORT 4791 + +#ifdef __cplusplus +} +#endif + +#endif /* RTE_IB_H */ -- 2.27.0