From 12c5c68053977fcd3ac872f080de6d5a2377f5e6 Mon Sep 17 00:00:00 2001
From: Dazhao Lao <laodazhao@huawei.com>
Date: Tue, 25 Feb 2025 14:51:07 +0800
Subject: [PATCH] libhns: Fix the identification mark of RDMA UD packets in ROH
 mode.

Currently, DMAC[0]=0xFF is used as the special processing
identification mark of RDMA UD packets. After ROH_MAC
recognizes this mark, it goes to IP over HCCS and retains
the IP header information to meet the needs of MPI and RDMA
CM link establishment; but DMAC[0]=0xFF is a special
processing that will modify the DMAC to a multicast MAC
address. In MPI usage scenarios, there are a large number
of loopback messages, causing the multicast address to be
directly loopback processed by the SSU. The performance of
the SSU in processing multicast messages Lower than unicast
packets, there is a performance bottleneck.

The patch modifies the special identification mark of RMDA
UD messages in ROH mode, using DMAC[0]=0xF0 as the
identifier, so that DMAC is a unicast MAC address, thereby
avoiding the bottleneck of multicast message processing.

Fixes: 406d04f2ec27 ("libhns: Add the parsing of mac type in RoH mode")
Signed-off-by: Dazhao Lao <laodazhao@huawei.com>
---
 providers/hns/hns_roce_u_hw_v2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
index 62bf478..1bbd788 100644
--- a/providers/hns/hns_roce_u_hw_v2.c
+++ b/providers/hns/hns_roce_u_hw_v2.c
@@ -1428,7 +1428,7 @@ static int set_ud_wqe(void *wqe, struct hns_roce_qp *qp, struct ibv_send_wr *wr,
 		return ret;
 
 	if (hr_dev->link_type == HNS_DEV_LINK_TYPE_HCCS)
-		ud_sq_wqe->dmac[0] = 0xFF;
+		ud_sq_wqe->dmac[0] = 0xF0;
 
 	ret = fill_ud_data_seg(ud_sq_wqe, qp, wr, sge_info);
 	if (ret)
-- 
2.33.0

