diff --git a/0070-libhns-Get-dmac-from-kernel-driver.patch b/0070-libhns-Get-dmac-from-kernel-driver.patch new file mode 100644 index 0000000000000000000000000000000000000000..0ec3496496475630835df196c6eef8dda3ed89c0 --- /dev/null +++ b/0070-libhns-Get-dmac-from-kernel-driver.patch @@ -0,0 +1,58 @@ +From 7d81108ba99d349558bc8c6d65c787efc31c52f4 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 | 10 +++++++--- + 2 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/kernel-headers/rdma/hns-abi.h b/kernel-headers/rdma/hns-abi.h +index 785c4e1..8581df9 100644 +--- a/kernel-headers/rdma/hns-abi.h ++++ b/kernel-headers/rdma/hns-abi.h +@@ -135,7 +135,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 5e46f89..c906632 100644 +--- a/providers/hns/hns_roce_u_verbs.c ++++ b/providers/hns/hns_roce_u_verbs.c +@@ -2210,9 +2210,13 @@ 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 (hr_dev->link_type != HNS_DEV_LINK_TYPE_UB && +- ibv_resolve_eth_l2_from_gid(pd->context, attr, ah->av.mac, NULL)) +- goto err; ++ if (hr_dev->link_type != HNS_DEV_LINK_TYPE_UB) { ++ 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) + ah->av.sl = resp.priority; +-- +2.25.1 + diff --git a/rdma-core.spec b/rdma-core.spec index 119864798621492caf8133cc230c3af2d06e2c5c..895dadfd1f3599a3176a9c9db1d32dd6781ada7d 100644 --- a/rdma-core.spec +++ b/rdma-core.spec @@ -1,6 +1,6 @@ Name: rdma-core Version: 41.0 -Release: 19 +Release: 20 Summary: RDMA core userspace libraries and daemons License: GPLv2 or BSD Url: https://github.com/linux-rdma/rdma-core @@ -75,6 +75,7 @@ patch65: 0066-Update-kernel-headers-for-supporting-STARS-QP-in-HNS.patch patch66: 0067-libhns-Support-STARS-mode-QP.patch patch67: 0068-Update-kernel-headers-for-supporting-write-with-noti.patch patch68: 0069-libhns-Support-write-with-notify.patch +patch70: 0070-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 @@ -322,6 +323,12 @@ fi %{_mandir}/* %changelog +* Wed Nov 22 2023 Ran Zhou - 41.0-20 +- Type: bugfix +- ID: NA +- SUG: NA +- DESC: Get dmac from kernel driver + * Tue Oct 31 2023 Ran Zhou - 41.0-19 - Type: requirement - ID: NA