提交 b971c668 编写于 作者: W Weihang Li 提交者: Zheng Zengkai

RDMA/hns: Avoid filling sl in high 3 bits of vlan_id

stable inclusion
from stable-5.10.8
commit 85bbe2e64ab430af3c27a0bc4e22dae04a5e10e6
bugzilla: 47450

--------------------------------

[ Upstream commit 94a8c4df ]

Only the low 12 bits of vlan_id is valid, and service level has been
filled in Address Vector. So there is no need to fill sl in vlan_id in
Address Vector.

Fixes: 7406c003 ("RDMA/hns: Only record vlan info for HIP08")
Link: https://lore.kernel.org/r/1607650657-35992-5-git-send-email-liweihang@huawei.comSigned-off-by: NWeihang Li <liweihang@huawei.com>
Signed-off-by: NJason Gunthorpe <jgg@nvidia.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 52927550
......@@ -36,9 +36,6 @@
#include <rdma/ib_cache.h>
#include "hns_roce_device.h"
#define VLAN_SL_MASK 7
#define VLAN_SL_SHIFT 13
static inline u16 get_ah_udp_sport(const struct rdma_ah_attr *ah_attr)
{
u32 fl = ah_attr->grh.flow_label;
......@@ -81,18 +78,12 @@ int hns_roce_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr,
/* HIP08 needs to record vlan info in Address Vector */
if (hr_dev->pci_dev->revision <= PCI_REVISION_ID_HIP08) {
ah->av.vlan_en = 0;
ret = rdma_read_gid_l2_fields(ah_attr->grh.sgid_attr,
&ah->av.vlan_id, NULL);
if (ret)
return ret;
if (ah->av.vlan_id < VLAN_N_VID) {
ah->av.vlan_en = 1;
ah->av.vlan_id |= (rdma_ah_get_sl(ah_attr) & VLAN_SL_MASK) <<
VLAN_SL_SHIFT;
}
ah->av.vlan_en = ah->av.vlan_id < VLAN_N_VID;
}
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册