From 452a7b95b74397671acf83cde26ede812a160028 Mon Sep 17 00:00:00 2001 From: Ran Zhou Date: Thu, 11 Jan 2024 19:12:46 +0800 Subject: [PATCH] Get dmac from kernel driver As dmac is already resolved in kernel while creating AH, there is no need to repeat the resolving in userspace. Prioritizes getting dmac from kernel driver, unless kernel driver didn't response one. Singed-off-by: Junxian Huang Singed-off-by: Ran Zhou --- 0051-libhns-Get-dmac-from-kernel-driver.patch | 53 +++++++++++++++++++ rdma-core.spec | 9 +++- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 0051-libhns-Get-dmac-from-kernel-driver.patch diff --git a/0051-libhns-Get-dmac-from-kernel-driver.patch b/0051-libhns-Get-dmac-from-kernel-driver.patch new file mode 100644 index 0000000..96e8a8f --- /dev/null +++ b/0051-libhns-Get-dmac-from-kernel-driver.patch @@ -0,0 +1,53 @@ +From 965d2b8068cb4479149058a9e9abf3c996d53fcc Mon Sep 17 00:00:00 2001 +From: Junxian Huang +Date: Wed, 22 Nov 2023 16:07:14 +0800 +Subject: [PATCH] libhns: Get dmac from kernel driver + +driver inclusion +category: bugfix +bugzilla: https://gitee.com/openeuler/kernel/issues/I8HZ7W + +-------------------------------------------------------------------------- + +As dmac is already resolved in kernel while creating AH, there is no +need to repeat the resolving in userspace. Prioritizes getting dmac +from kernel driver, unless kernel driver didn't response one. + +Signed-off-by: Junxian Huang +--- + kernel-headers/rdma/hns-abi.h | 2 +- + providers/hns/hns_roce_u_verbs.c | 5 ++++- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/kernel-headers/rdma/hns-abi.h b/kernel-headers/rdma/hns-abi.h +index cab941f..46373ba 100644 +--- a/kernel-headers/rdma/hns-abi.h ++++ b/kernel-headers/rdma/hns-abi.h +@@ -106,7 +106,7 @@ struct hns_roce_ib_create_qp_resp { + struct hns_roce_ib_create_ah_resp { + __u8 priority; + __u8 tc_mode; +- __u8 reserved[6]; ++ __u8 dmac[6]; + }; + + struct hns_roce_ib_modify_qp_resp { +diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c +index 4b641ea..5600c5f 100644 +--- a/providers/hns/hns_roce_u_verbs.c ++++ b/providers/hns/hns_roce_u_verbs.c +@@ -1877,7 +1877,10 @@ struct ibv_ah *hns_roce_u_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr) + if (ibv_cmd_create_ah(pd, &ah->ibv_ah, attr, &resp.ibv_resp, sizeof(resp))) + goto err; + +- if (ibv_resolve_eth_l2_from_gid(pd->context, attr, ah->av.mac, NULL)) ++ if (memcmp(ah->av.mac, resp.dmac, ETH_ALEN)) ++ memcpy(ah->av.mac, resp.dmac, ETH_ALEN); ++ else if (ibv_resolve_eth_l2_from_gid(pd->context, attr, ++ ah->av.mac, NULL)) + goto err; + + if (resp.tc_mode == HNS_ROCE_TC_MAP_MODE_DSCP) +-- +2.25.1 + diff --git a/rdma-core.spec b/rdma-core.spec index 07b220a..8fdbc3a 100644 --- a/rdma-core.spec +++ b/rdma-core.spec @@ -1,6 +1,6 @@ Name: rdma-core Version: 41.0 -Release: 13 +Release: 14 Summary: RDMA core userspace libraries and daemons License: GPLv2 or BSD Url: https://github.com/linux-rdma/rdma-core @@ -56,6 +56,7 @@ Patch46: 0047-libhns-Fix-the-owner-bit-error-of-sq-in-new-io.patch Patch47: 0048-libhns-Fix-incorrect-post-send-with-direct-wqe-of-wr.patch Patch48: 0049-libhns-Add-a-judgment-to-the-congestion-control-algo.patch Patch49: 0050-libhns-Support-user-to-choose-using-UD-sl-or-pktype-.patch +Patch50: 0051-libhns-Get-dmac-from-kernel-driver.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 @@ -303,6 +304,12 @@ fi %{_mandir}/* %changelog +* Thu Jan 11 2024 Juan Zhou - 41.0-14 +- Type: bugfix +- ID: NA +- SUG: NA +- DESC: Get dmac from kernel driver + * Fri Jun 9 2023 Juan Zhou - 41.0-13 - Type: bugfix - ID: NA -- Gitee