!100 [sync] PR-99: libhns: Get dmac from kernel driver

From: @openeuler-sync-bot 
Reviewed-by: @hellotcc 
Signed-off-by: @hellotcc
This commit is contained in:
openeuler-ci-bot 2023-11-23 06:56:29 +00:00 committed by Gitee
commit 648c1d4556
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 66 additions and 1 deletions

View File

@ -0,0 +1,58 @@
From 7d81108ba99d349558bc8c6d65c787efc31c52f4 Mon Sep 17 00:00:00 2001
From: Junxian Huang <huangjunxian6@hisilicon.com>
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 <huangjunxian6@hisilicon.com>
---
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

View File

@ -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 <zhouran10@h-partners.com> - 41.0-20
- Type: bugfix
- ID: NA
- SUG: NA
- DESC: Get dmac from kernel driver
* Tue Oct 31 2023 Ran Zhou <zhouran10@h-partners.com> - 41.0-19
- Type: requirement
- ID: NA