59 lines
2.0 KiB
Diff
59 lines
2.0 KiB
Diff
|
|
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
|
||
|
|
|