Commit 9f206f73 authored by Bryan Tan's avatar Bryan Tan Committed by Jason Gunthorpe

RDMA/vmw_pvrdma: Fix network_hdr_type reported in WC

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: 1c15b4f2 ("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.comReviewed-by: default avatarAdit Ranadive <aditr@vmware.com>
Signed-off-by: default avatarBryan Tan <bryantan@vmware.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent a372173b
...@@ -509,6 +509,20 @@ static inline int ib_send_flags_to_pvrdma(int flags) ...@@ -509,6 +509,20 @@ static inline int ib_send_flags_to_pvrdma(int flags)
return flags & PVRDMA_MASK(PVRDMA_SEND_FLAGS_MAX); return flags & PVRDMA_MASK(PVRDMA_SEND_FLAGS_MAX);
} }
static inline int pvrdma_network_type_to_ib(enum pvrdma_network_type type)
{
switch (type) {
case PVRDMA_NETWORK_ROCE_V1:
return RDMA_NETWORK_ROCE_V1;
case PVRDMA_NETWORK_IPV4:
return RDMA_NETWORK_IPV4;
case PVRDMA_NETWORK_IPV6:
return RDMA_NETWORK_IPV6;
default:
return RDMA_NETWORK_IPV6;
}
}
void pvrdma_qp_cap_to_ib(struct ib_qp_cap *dst, void pvrdma_qp_cap_to_ib(struct ib_qp_cap *dst,
const struct pvrdma_qp_cap *src); const struct pvrdma_qp_cap *src);
void ib_qp_cap_to_pvrdma(struct pvrdma_qp_cap *dst, void ib_qp_cap_to_pvrdma(struct pvrdma_qp_cap *dst,
......
...@@ -367,7 +367,7 @@ static int pvrdma_poll_one(struct pvrdma_cq *cq, struct pvrdma_qp **cur_qp, ...@@ -367,7 +367,7 @@ static int pvrdma_poll_one(struct pvrdma_cq *cq, struct pvrdma_qp **cur_qp,
wc->dlid_path_bits = cqe->dlid_path_bits; wc->dlid_path_bits = cqe->dlid_path_bits;
wc->port_num = cqe->port_num; wc->port_num = cqe->port_num;
wc->vendor_err = cqe->vendor_err; wc->vendor_err = cqe->vendor_err;
wc->network_hdr_type = cqe->network_hdr_type; wc->network_hdr_type = pvrdma_network_type_to_ib(cqe->network_hdr_type);
/* Update shared ring state */ /* Update shared ring state */
pvrdma_idx_ring_inc(&cq->ring_state->rx.cons_head, cq->ibcq.cqe); pvrdma_idx_ring_inc(&cq->ring_state->rx.cons_head, cq->ibcq.cqe);
......
...@@ -133,6 +133,13 @@ enum pvrdma_wc_flags { ...@@ -133,6 +133,13 @@ enum pvrdma_wc_flags {
PVRDMA_WC_FLAGS_MAX = PVRDMA_WC_WITH_NETWORK_HDR_TYPE, PVRDMA_WC_FLAGS_MAX = PVRDMA_WC_WITH_NETWORK_HDR_TYPE,
}; };
enum pvrdma_network_type {
PVRDMA_NETWORK_IB,
PVRDMA_NETWORK_ROCE_V1 = PVRDMA_NETWORK_IB,
PVRDMA_NETWORK_IPV4,
PVRDMA_NETWORK_IPV6
};
struct pvrdma_alloc_ucontext_resp { struct pvrdma_alloc_ucontext_resp {
__u32 qp_tab_size; __u32 qp_tab_size;
__u32 reserved; __u32 reserved;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment