summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/hns/hns_roce_ah.c
diff options
context:
space:
mode:
authorLijun Ou2018-09-22 10:21:08 +0200
committerJason Gunthorpe2018-09-26 22:59:13 +0200
commit8320deb88c03a842f8c2db92e2b4a86d2bb6df76 (patch)
tree8552c9b97ae96735871074be0777f6e659be0773 /drivers/infiniband/hw/hns/hns_roce_ah.c
parentRDMA/hns: Add CM of vlan device support (diff)
downloadkernel-qcow2-linux-8320deb88c03a842f8c2db92e2b4a86d2bb6df76.tar.gz
kernel-qcow2-linux-8320deb88c03a842f8c2db92e2b4a86d2bb6df76.tar.xz
kernel-qcow2-linux-8320deb88c03a842f8c2db92e2b4a86d2bb6df76.zip
RDMA/hns: Add enable judgement for UD vlan
According to the hardware modification, the vlan of the UD packet is based on the ud_vlan_en field of the UD wqe to determine whether to add a vlan header to the UD packet. The ud_vlan_en field is filled by the driver according to the net device. Signed-off-by: Lijun Ou <oulijun@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/hns/hns_roce_ah.c')
-rw-r--r--drivers/infiniband/hw/hns/hns_roce_ah.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/hns/hns_roce_ah.c b/drivers/infiniband/hw/hns/hns_roce_ah.c
index 0d96c5bb38cd..9990dc9eb96a 100644
--- a/drivers/infiniband/hw/hns/hns_roce_ah.c
+++ b/drivers/infiniband/hw/hns/hns_roce_ah.c
@@ -49,6 +49,7 @@ struct ib_ah *hns_roce_create_ah(struct ib_pd *ibpd,
struct hns_roce_ah *ah;
u16 vlan_tag = 0xffff;
const struct ib_global_route *grh = rdma_ah_read_grh(ah_attr);
+ bool vlan_en = false;
ah = kzalloc(sizeof(*ah), GFP_ATOMIC);
if (!ah)
@@ -58,8 +59,10 @@ struct ib_ah *hns_roce_create_ah(struct ib_pd *ibpd,
memcpy(ah->av.mac, ah_attr->roce.dmac, ETH_ALEN);
gid_attr = ah_attr->grh.sgid_attr;
- if (is_vlan_dev(gid_attr->ndev))
+ if (is_vlan_dev(gid_attr->ndev)) {
vlan_tag = vlan_dev_vlan_id(gid_attr->ndev);
+ vlan_en = true;
+ }
if (vlan_tag < 0x1000)
vlan_tag |= (rdma_ah_get_sl(ah_attr) &
@@ -71,6 +74,7 @@ struct ib_ah *hns_roce_create_ah(struct ib_pd *ibpd,
HNS_ROCE_PORT_NUM_SHIFT));
ah->av.gid_index = grh->sgid_index;
ah->av.vlan = cpu_to_le16(vlan_tag);
+ ah->av.vlan_en = vlan_en;
dev_dbg(dev, "gid_index = 0x%x,vlan = 0x%x\n", ah->av.gid_index,
ah->av.vlan);