RDMA/hns: Update the verbs of polling for completion
authoroulijun <oulijun@huawei.com>
Wed, 10 Jan 2018 06:39:52 +0000 (14:39 +0800)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 17 Jan 2018 03:38:18 +0000 (20:38 -0700)
If the port is a RoCEv2 port, the remote port address and QP information
which returned for UD will be modified.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Yixian Liu <liuyixian@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/hns/hns_roce_hw_v2.c
drivers/infiniband/hw/hns/hns_roce_hw_v2.h

index 321f5932bb363a9e12c2db7bc745bc61aab68777..11391c8ce6df5a2e4bbd0f7554a6ae01a208b422 100644 (file)
@@ -1913,6 +1913,18 @@ static int hns_roce_v2_poll_one(struct hns_roce_cq *hr_cq,
                wc->port_num = roce_get_field(cqe->byte_32,
                                V2_CQE_BYTE_32_PORTN_M, V2_CQE_BYTE_32_PORTN_S);
                wc->pkey_index = 0;
+               memcpy(wc->smac, cqe->smac, 4);
+               wc->smac[4] = roce_get_field(cqe->byte_28,
+                                            V2_CQE_BYTE_28_SMAC_4_M,
+                                            V2_CQE_BYTE_28_SMAC_4_S);
+               wc->smac[5] = roce_get_field(cqe->byte_28,
+                                            V2_CQE_BYTE_28_SMAC_5_M,
+                                            V2_CQE_BYTE_28_SMAC_5_S);
+               wc->vlan_id = 0xffff;
+               wc->wc_flags |= (IB_WC_WITH_VLAN | IB_WC_WITH_SMAC);
+               wc->network_hdr_type = roce_get_field(cqe->byte_28,
+                                                   V2_CQE_BYTE_28_PORT_TYPE_M,
+                                                   V2_CQE_BYTE_28_PORT_TYPE_S);
        }
 
        return 0;
index 26fa7005dbf10ef889d88a3ca46072d94eebd29e..960df095392a617be814c9c0fee2f9ad0cc4fb32 100644 (file)
@@ -769,7 +769,7 @@ struct hns_roce_v2_cqe {
        u32     byte_12;
        u32     byte_16;
        u32     byte_cnt;
-       u32     smac;
+       u8      smac[4];
        u32     byte_28;
        u32     byte_32;
 };