diff --git a/0027-libhns-Add-RoH-device-IDs.patch b/0027-libhns-Add-RoH-device-IDs.patch new file mode 100644 index 0000000000000000000000000000000000000000..fe5956aff058fb7f14302cc5ccb123ed8889081c --- /dev/null +++ b/0027-libhns-Add-RoH-device-IDs.patch @@ -0,0 +1,33 @@ +From 0fcebb18e318cb0af02afa055f4357ba3002280b Mon Sep 17 00:00:00 2001 +From: Lang Cheng +Date: Fri, 9 Oct 2020 11:14:39 +0800 +Subject: libhns: Add RoH device IDs + +Add RoH device IDs. +0xA227 is a 100Gb/s RoH device, and it was mistakenly added before. +0xA22C is a 200Gb/s RoH device. +0xA22D is a 400Gb/s RoH device. + +Fixes:a0f8a069799e("libhns: Add new PCI device matching for hip08") + +Signed-off-by: Lang Cheng +--- + providers/hns/hns_roce_u.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/providers/hns/hns_roce_u.c b/providers/hns/hns_roce_u.c +index 266e73e..60b3fe1 100644 +--- a/providers/hns/hns_roce_u.c ++++ b/providers/hns/hns_roce_u.c +@@ -53,6 +53,8 @@ static const struct verbs_match_ent hca_table[] = { + VERBS_PCI_MATCH(PCI_VENDOR_ID_HUAWEI, 0xA226, &hns_roce_u_hw_v2), + VERBS_PCI_MATCH(PCI_VENDOR_ID_HUAWEI, 0xA227, &hns_roce_u_hw_v2), + VERBS_PCI_MATCH(PCI_VENDOR_ID_HUAWEI, 0xA228, &hns_roce_u_hw_v2), ++ VERBS_PCI_MATCH(PCI_VENDOR_ID_HUAWEI, 0xA22C, &hns_roce_u_hw_v2), ++ VERBS_PCI_MATCH(PCI_VENDOR_ID_HUAWEI, 0xA22D, &hns_roce_u_hw_v2), + VERBS_PCI_MATCH(PCI_VENDOR_ID_HUAWEI, 0xA22F, &hns_roce_u_hw_v2), + {} + }; +-- +2.30.0 + diff --git a/0028-Update-kernel-headers.patch b/0028-Update-kernel-headers.patch new file mode 100644 index 0000000000000000000000000000000000000000..90daaf9ebc8cf2e45e246302e8fa828d436200d5 --- /dev/null +++ b/0028-Update-kernel-headers.patch @@ -0,0 +1,28 @@ +From 4050da82f772478e1ebbcc6bd1971ecfa07399ad Mon Sep 17 00:00:00 2001 +From: Guofeng Yue +Date: Mon, 17 Oct 2022 11:12:15 +0800 +Subject: Update kernel headers + +To commit ?? ("RDMA/hns: Pass mac type to user driver for RoH mode"). + +Signed-off-by: Guofeng Yue +--- + kernel-headers/rdma/hns-abi.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/kernel-headers/rdma/hns-abi.h b/kernel-headers/rdma/hns-abi.h +index 542be5e..9866c51 100644 +--- a/kernel-headers/rdma/hns-abi.h ++++ b/kernel-headers/rdma/hns-abi.h +@@ -116,6 +116,8 @@ struct hns_roce_ib_alloc_ucontext_resp { + __u32 reserved; + __u32 config; + __u32 max_inline_data; ++ __u8 mac_type; ++ __u8 rsv1[7]; + }; + + struct hns_roce_ib_alloc_ucontext { +-- +2.30.0 + diff --git a/0029-libhns-Add-the-parsing-of-mac-type-in-RoH-mode.patch b/0029-libhns-Add-the-parsing-of-mac-type-in-RoH-mode.patch new file mode 100644 index 0000000000000000000000000000000000000000..4c82033a2a5fdc57848a7cef6b56ac8aec0b56e5 --- /dev/null +++ b/0029-libhns-Add-the-parsing-of-mac-type-in-RoH-mode.patch @@ -0,0 +1,79 @@ +From f4626313eea2c78a8fac4b007b08533371ce1501 Mon Sep 17 00:00:00 2001 +From: Guofeng Yue +Date: Tue, 13 Sep 2022 20:09:27 +0800 +Subject: libhns: Add the parsing of mac type in RoH mode + +After parsing the mac type as RoH mode, the user driver +needs to set the dmac field of ud wqe to 0xFF, the hardware +will recognize this field, and increase the recognition of +the IP field in RoH mode, which is used for the CM link +building function in user mode. + +Signed-off-by: Yangyang Li +Signed-off-by: Guofeng Yue +--- + providers/hns/hns_roce_u.c | 2 ++ + providers/hns/hns_roce_u.h | 6 ++++++ + providers/hns/hns_roce_u_hw_v2.c | 4 ++++ + 3 files changed, 12 insertions(+) + +diff --git a/providers/hns/hns_roce_u.c b/providers/hns/hns_roce_u.c +index 60b3fe1..20e3698 100644 +--- a/providers/hns/hns_roce_u.c ++++ b/providers/hns/hns_roce_u.c +@@ -121,6 +121,8 @@ static struct verbs_context *hns_roce_alloc_context(struct ibv_device *ibdev, + &resp.ibv_resp, sizeof(resp))) + goto err_free; + ++ hr_dev->mac_type = resp.mac_type; ++ + if (!resp.cqe_size) + context->cqe_size = HNS_ROCE_CQE_SIZE; + else if (resp.cqe_size <= HNS_ROCE_V3_CQE_SIZE) +diff --git a/providers/hns/hns_roce_u.h b/providers/hns/hns_roce_u.h +index 8c1cb1e..623be79 100644 +--- a/providers/hns/hns_roce_u.h ++++ b/providers/hns/hns_roce_u.h +@@ -153,11 +153,17 @@ + #define HNS_ROCE_SRQ_TABLE_BITS 8 + #define HNS_ROCE_SRQ_TABLE_SIZE BIT(HNS_ROCE_SRQ_TABLE_BITS) + ++enum { ++ HNAE3_MAC_ETH, ++ HNAE3_MAC_ROH, ++}; ++ + struct hns_roce_device { + struct verbs_device ibv_dev; + int page_size; + const struct hns_roce_u_hw *u_hw; + int hw_version; ++ uint8_t mac_type; + }; + + struct hns_roce_buf { +diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c +index c652eea..b0c3109 100644 +--- a/providers/hns/hns_roce_u_hw_v2.c ++++ b/providers/hns/hns_roce_u_hw_v2.c +@@ -1068,6 +1068,7 @@ static inline void enable_wqe(struct hns_roce_qp *qp, void *sq_wqe, + static int set_ud_wqe(void *wqe, struct hns_roce_qp *qp, struct ibv_send_wr *wr, + unsigned int nreq, struct hns_roce_sge_info *sge_info) + { ++ struct hns_roce_device *hr_dev = to_hr_dev(qp->verbs_qp.qp.context->device); + struct hns_roce_ah *ah = to_hr_ah(wr->wr.ud.ah); + struct hns_roce_ud_sq_wqe *ud_sq_wqe = wqe; + int ret = 0; +@@ -1092,6 +1093,9 @@ static int set_ud_wqe(void *wqe, struct hns_roce_qp *qp, struct ibv_send_wr *wr, + if (ret) + return ret; + ++ if (hr_dev->mac_type == HNAE3_MAC_ROH) ++ ud_sq_wqe->dmac[0] = 0xFF; ++ + ret = fill_ud_data_seg(ud_sq_wqe, qp, wr, sge_info); + if (ret) + return ret; +-- +2.30.0 + diff --git a/rdma-core.spec b/rdma-core.spec index d8547de4f06cdbef862eaa297a0cab532d9432fc..82623d039d26fefff4893f38a10374e7cdbbd305 100644 --- a/rdma-core.spec +++ b/rdma-core.spec @@ -1,6 +1,6 @@ Name: rdma-core Version: 41.0 -Release: 4 +Release: 5 Summary: RDMA core userspace libraries and daemons License: GPLv2 or BSD Url: https://github.com/linux-rdma/rdma-core @@ -32,6 +32,9 @@ Patch22: 0023-pyverbs-Increment-the-correct-rkey-in-test_qpex.patch Patch23: 0024-mckey-Use-rdma_create_qp_ex-only-for-loopback-preven.patch Patch24: 0025-Fix-spelling-mistake-of-underlying.patch Patch25: 0026-rdma-ndd-disable-systemd-ProtectHostName-feature.patch +Patch26: 0027-libhns-Add-RoH-device-IDs.patch +Patch27: 0028-Update-kernel-headers.patch +Patch28: 0029-libhns-Add-the-parsing-of-mac-type-in-RoH-mode.patch BuildRequires: binutils cmake >= 2.8.11 gcc libudev-devel pkgconfig pkgconfig(libnl-3.0) BuildRequires: pkgconfig(libnl-route-3.0) valgrind-devel systemd systemd-devel @@ -276,6 +279,12 @@ fi %{_mandir}/* %changelog +* Mon Nov 07 2022 Guofeng Yue - 41.0-5 +- Type: requirement +- ID: NA +- SUG: NA +- DESC: Support hns RoH mode + * Sun Nov 06 2022 tangchengchang - 41.0-4 - Type: bugfix - ID: NA