stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 for-rc] RDMA/vmw_pvrdma: Fix network_hdr_type reported in WC
@ 2021-01-19  3:16 Bryan Tan
  2021-01-20  0:19 ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: Bryan Tan @ 2021-01-19  3:16 UTC (permalink / raw)
  To: linux-rdma; +Cc: pv-drivers, stable, Bryan Tan

The PVRDMA device defines network_hdr_type according to an old
definition of the 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: 1c15b4f2a42f ("RDMA/core: Modify enum ib_gid_type and enum rdma_network_type")
Reviewed-by: Adit Ranadive <aditr@vmware.com>
Signed-off-by: Bryan Tan <bryantan@vmware.com>
---

Changelog:
 - v0->v1: Moved new enum to uapi header and added Cc as per Jason.
---
 drivers/infiniband/hw/vmw_pvrdma/pvrdma.h    | 14 ++++++++++++++
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c |  2 +-
 include/uapi/rdma/vmw_pvrdma-abi.h           |  7 +++++++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
index c142f5e7f25f..de57f2fed743 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
@@ -509,6 +509,20 @@ static inline int ib_send_flags_to_pvrdma(int flags)
 	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,
 			 const struct pvrdma_qp_cap *src);
 void ib_qp_cap_to_pvrdma(struct pvrdma_qp_cap *dst,
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
index a119ac3e103c..6aa40bd2fd52 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
@@ -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->port_num = cqe->port_num;
 	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 */
 	pvrdma_idx_ring_inc(&cq->ring_state->rx.cons_head, cq->ibcq.cqe);
diff --git a/include/uapi/rdma/vmw_pvrdma-abi.h b/include/uapi/rdma/vmw_pvrdma-abi.h
index f8b638c73371..901a4fd72c09 100644
--- a/include/uapi/rdma/vmw_pvrdma-abi.h
+++ b/include/uapi/rdma/vmw_pvrdma-abi.h
@@ -133,6 +133,13 @@ enum pvrdma_wc_flags {
 	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 {
 	__u32 qp_tab_size;
 	__u32 reserved;
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 for-rc] RDMA/vmw_pvrdma: Fix network_hdr_type reported in WC
  2021-01-19  3:16 [PATCH v1 for-rc] RDMA/vmw_pvrdma: Fix network_hdr_type reported in WC Bryan Tan
@ 2021-01-20  0:19 ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2021-01-20  0:19 UTC (permalink / raw)
  To: Bryan Tan; +Cc: linux-rdma, pv-drivers, stable

On Mon, Jan 18, 2021 at 07:16:29PM -0800, Bryan Tan wrote:
> The PVRDMA device defines network_hdr_type according to an old
> definition of the 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: 1c15b4f2a42f ("RDMA/core: Modify enum ib_gid_type and enum rdma_network_type")
> Reviewed-by: Adit Ranadive <aditr@vmware.com>
> Signed-off-by: Bryan Tan <bryantan@vmware.com>
> ---
> 
> Changelog:
>  - v0->v1: Moved new enum to uapi header and added Cc as per Jason.
> ---
>  drivers/infiniband/hw/vmw_pvrdma/pvrdma.h    | 14 ++++++++++++++
>  drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c |  2 +-
>  include/uapi/rdma/vmw_pvrdma-abi.h           |  7 +++++++
>  3 files changed, 22 insertions(+), 1 deletion(-)

Applied to for-next, thanks

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-20  0:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19  3:16 [PATCH v1 for-rc] RDMA/vmw_pvrdma: Fix network_hdr_type reported in WC Bryan Tan
2021-01-20  0:19 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).