Skip to content

Commit 1fa2fa7

Browse files
bryantan-vmwaregregkh
authored andcommitted
RDMA/vmw_pvrdma: Fix network_hdr_type reported in WC
commit 9f206f7 upstream. The PVRDMA device HW interface defines network_hdr_type according to an old definition of the internal kernel rdma_network_type enum that has since changed, resulting in the wrong rdma_network_type being reported. Fix this by explicitly defining the enum used by the PVRDMA device and adding a function to convert the pvrdma_network_type to rdma_network_type enum. Cc: stable@vger.kernel.org # 5.10+ Fixes: 1c15b4f ("RDMA/core: Modify enum ib_gid_type and enum rdma_network_type") Link: https://lore.kernel.org/r/1611026189-17943-1-git-send-email-bryantan@vmware.com Reviewed-by: Adit Ranadive <aditr@vmware.com> Signed-off-by: Bryan Tan <bryantan@vmware.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 77727df commit 1fa2fa7

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

‎drivers/infiniband/hw/vmw_pvrdma/pvrdma.h‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,20 @@ static inline int ib_send_flags_to_pvrdma(int flags)
509509
return flags & PVRDMA_MASK(PVRDMA_SEND_FLAGS_MAX);
510510
}
511511

512+
static inline int pvrdma_network_type_to_ib(enum pvrdma_network_type type)
513+
{
514+
switch (type) {
515+
case PVRDMA_NETWORK_ROCE_V1:
516+
return RDMA_NETWORK_ROCE_V1;
517+
case PVRDMA_NETWORK_IPV4:
518+
return RDMA_NETWORK_IPV4;
519+
case PVRDMA_NETWORK_IPV6:
520+
return RDMA_NETWORK_IPV6;
521+
default:
522+
return RDMA_NETWORK_IPV6;
523+
}
524+
}
525+
512526
void pvrdma_qp_cap_to_ib(struct ib_qp_cap *dst,
513527
const struct pvrdma_qp_cap *src);
514528
void ib_qp_cap_to_pvrdma(struct pvrdma_qp_cap *dst,

‎drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ static int pvrdma_poll_one(struct pvrdma_cq *cq, struct pvrdma_qp **cur_qp,
364364
wc->dlid_path_bits = cqe->dlid_path_bits;
365365
wc->port_num = cqe->port_num;
366366
wc->vendor_err = cqe->vendor_err;
367-
wc->network_hdr_type = cqe->network_hdr_type;
367+
wc->network_hdr_type = pvrdma_network_type_to_ib(cqe->network_hdr_type);
368368

369369
/* Update shared ring state */
370370
pvrdma_idx_ring_inc(&cq->ring_state->rx.cons_head, cq->ibcq.cqe);

‎include/uapi/rdma/vmw_pvrdma-abi.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ enum pvrdma_wc_flags {
133133
PVRDMA_WC_FLAGS_MAX = PVRDMA_WC_WITH_NETWORK_HDR_TYPE,
134134
};
135135

136+
enum pvrdma_network_type {
137+
PVRDMA_NETWORK_IB,
138+
PVRDMA_NETWORK_ROCE_V1 = PVRDMA_NETWORK_IB,
139+
PVRDMA_NETWORK_IPV4,
140+
PVRDMA_NETWORK_IPV6
141+
};
142+
136143
struct pvrdma_alloc_ucontext_resp {
137144
__u32 qp_tab_size;
138145
__u32 reserved;

0 commit comments

Comments
 (0)