All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-next 0/2] RDMA/vmw_pvrdma: Patches for 4.14
@ 2017-08-29  0:19 Adit Ranadive
       [not found] ` <cover.1503965717.git.aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Adit Ranadive @ 2017-08-29  0:19 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Adit Ranadive, pv-drivers-pghWNbHTmq7QT0dZR+AlfA

Hi Doug,

Here are a couple more patches for the VMware PVRDMA driver for 4.14.
These are based on your for-next branch.

Thanks,
Adit
---
Adit Ranadive (1):
  RDMA/vmw_pvrdma: Fix a signedness

Aditya Sarwade (1):
  RDMA/vmw_pvrdma: Report network header type in WC

 drivers/infiniband/hw/vmw_pvrdma/pvrdma.h    |  6 ++++++
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c |  4 +++-
 include/uapi/rdma/vmw_pvrdma-abi.h           | 13 +++++++++++--
 3 files changed, 20 insertions(+), 3 deletions(-)

-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH for-next 1/2] RDMA/vmw_pvrdma: Report network header type in WC
       [not found] ` <cover.1503965717.git.aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
@ 2017-08-29  0:19   ` Adit Ranadive
       [not found]     ` <521f5e2169789e31a7e91dab691cd155f0100090.1503965717.git.aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
  2017-08-29  0:19   ` [PATCH for-next 2/2] RDMA/vmw_pvrdma: Fix a signedness Adit Ranadive
  2017-08-29  0:40   ` [PATCH for-next 0/2] RDMA/vmw_pvrdma: Patches for 4.14 Doug Ledford
  2 siblings, 1 reply; 10+ messages in thread
From: Adit Ranadive @ 2017-08-29  0:19 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Aditya Sarwade, pv-drivers-pghWNbHTmq7QT0dZR+AlfA, Adit Ranadive

From: Aditya Sarwade <asarwade-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>

We should report the network header type in the work completion so that
the kernel can infer the right RoCE type headers.

Reviewed-by: Bryan Tan <bryantan-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
Signed-off-by: Aditya Sarwade <asarwade-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
Signed-off-by: Adit Ranadive <aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
---
 drivers/infiniband/hw/vmw_pvrdma/pvrdma.h    |  6 ++++++
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c |  2 ++
 include/uapi/rdma/vmw_pvrdma-abi.h           | 13 +++++++++++--
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
index 663a0c3..99b2c97 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
@@ -426,6 +426,12 @@ static inline int pvrdma_wc_flags_to_ib(int flags)
 	return flags;
 }
 
+static inline enum rdma_network_type pvrdma_wc_network_hdr_to_ib(
+					enum pvrdma_network_type type)
+{
+	return (enum rdma_network_type)type;
+}
+
 static inline int ib_send_flags_to_pvrdma(int flags)
 {
 	return flags & PVRDMA_MASK(PVRDMA_SEND_FLAGS_MAX);
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
index 90aa326..34727f6 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
@@ -389,6 +389,8 @@ 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 =
+			pvrdma_wc_network_hdr_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 c8c1d2d..6a87806 100644
--- a/include/uapi/rdma/vmw_pvrdma-abi.h
+++ b/include/uapi/rdma/vmw_pvrdma-abi.h
@@ -58,6 +58,13 @@
 #define PVRDMA_UAR_CQ_ARM		BIT(30)		/* Arm bit. */
 #define PVRDMA_UAR_CQ_POLL		BIT(31)		/* Poll bit. */
 
+enum pvrdma_network_type {
+	PVRDMA_NETWORK_IB,
+	PVRDMA_NETWORK_ROCE_V1 = PVRDMA_NETWORK_IB,
+	PVRDMA_NETWORK_IPV4,
+	PVRDMA_NETWORK_IPV6
+};
+
 enum pvrdma_wr_opcode {
 	PVRDMA_WR_RDMA_WRITE,
 	PVRDMA_WR_RDMA_WRITE_WITH_IMM,
@@ -125,7 +132,8 @@ enum pvrdma_wc_flags {
 	PVRDMA_WC_IP_CSUM_OK		= 1 << 3,
 	PVRDMA_WC_WITH_SMAC		= 1 << 4,
 	PVRDMA_WC_WITH_VLAN		= 1 << 5,
-	PVRDMA_WC_FLAGS_MAX		= PVRDMA_WC_WITH_VLAN,
+	PVRDMA_WC_WITH_NETWORK_HDR_TYPE	= 1 << 6,
+	PVRDMA_WC_FLAGS_MAX		= PVRDMA_WC_WITH_NETWORK_HDR_TYPE,
 };
 
 struct pvrdma_alloc_ucontext_resp {
@@ -283,7 +291,8 @@ struct pvrdma_cqe {
 	__u8 dlid_path_bits;
 	__u8 port_num;
 	__u8 smac[6];
-	__u8 reserved2[7]; /* Pad to next power of 2 (64). */
+	__u8 network_hdr_type;
+	__u8 reserved2[6]; /* Pad to next power of 2 (64). */
 };
 
 #endif /* __VMW_PVRDMA_ABI_H__ */
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH for-next 2/2] RDMA/vmw_pvrdma: Fix a signedness
       [not found] ` <cover.1503965717.git.aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
  2017-08-29  0:19   ` [PATCH for-next 1/2] RDMA/vmw_pvrdma: Report network header type in WC Adit Ranadive
@ 2017-08-29  0:19   ` Adit Ranadive
  2017-08-29  0:40   ` [PATCH for-next 0/2] RDMA/vmw_pvrdma: Patches for 4.14 Doug Ledford
  2 siblings, 0 replies; 10+ messages in thread
From: Adit Ranadive @ 2017-08-29  0:19 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Adit Ranadive, pv-drivers-pghWNbHTmq7QT0dZR+AlfA

Fixes: 29c8d9eba550 ("IB: Add vmw_pvrdma driver")
Signed-off-by: Adit Ranadive <aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
---
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
index 34727f6..6b98890 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
@@ -299,7 +299,7 @@ static inline struct pvrdma_cqe *get_cqe(struct pvrdma_cq *cq, int i)
 
 void _pvrdma_flush_cqe(struct pvrdma_qp *qp, struct pvrdma_cq *cq)
 {
-	int head;
+	unsigned int head;
 	int has_data;
 
 	if (!cq->is_kernel)
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH for-next 0/2] RDMA/vmw_pvrdma: Patches for 4.14
       [not found] ` <cover.1503965717.git.aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
  2017-08-29  0:19   ` [PATCH for-next 1/2] RDMA/vmw_pvrdma: Report network header type in WC Adit Ranadive
  2017-08-29  0:19   ` [PATCH for-next 2/2] RDMA/vmw_pvrdma: Fix a signedness Adit Ranadive
@ 2017-08-29  0:40   ` Doug Ledford
  2 siblings, 0 replies; 10+ messages in thread
From: Doug Ledford @ 2017-08-29  0:40 UTC (permalink / raw)
  To: Adit Ranadive, linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: pv-drivers-pghWNbHTmq7QT0dZR+AlfA

On Mon, 2017-08-28 at 17:19 -0700, Adit Ranadive wrote:
> Hi Doug,
> 
> Here are a couple more patches for the VMware PVRDMA driver for 4.14.
> These are based on your for-next branch.

Thanks, applied.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH for-next 1/2] RDMA/vmw_pvrdma: Report network header type in WC
       [not found]     ` <521f5e2169789e31a7e91dab691cd155f0100090.1503965717.git.aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
@ 2017-08-29  5:45       ` Leon Romanovsky
       [not found]         ` <20170829054533.GH23726-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Leon Romanovsky @ 2017-08-29  5:45 UTC (permalink / raw)
  To: Doug Ledford, Adit Ranadive
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Aditya Sarwade,
	pv-drivers-pghWNbHTmq7QT0dZR+AlfA

[-- Attachment #1: Type: text/plain, Size: 4092 bytes --]

On Mon, Aug 28, 2017 at 05:19:35PM -0700, Adit Ranadive wrote:
> From: Aditya Sarwade <asarwade-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
>
> We should report the network header type in the work completion so that
> the kernel can infer the right RoCE type headers.
>
> Reviewed-by: Bryan Tan <bryantan-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Aditya Sarwade <asarwade-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Adit Ranadive <aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/infiniband/hw/vmw_pvrdma/pvrdma.h    |  6 ++++++
>  drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c |  2 ++
>  include/uapi/rdma/vmw_pvrdma-abi.h           | 13 +++++++++++--
>  3 files changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
> index 663a0c3..99b2c97 100644
> --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
> +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
> @@ -426,6 +426,12 @@ static inline int pvrdma_wc_flags_to_ib(int flags)
>  	return flags;
>  }
>
> +static inline enum rdma_network_type pvrdma_wc_network_hdr_to_ib(
> +					enum pvrdma_network_type type)
> +{
> +	return (enum rdma_network_type)type;
> +}
> +
>  static inline int ib_send_flags_to_pvrdma(int flags)
>  {
>  	return flags & PVRDMA_MASK(PVRDMA_SEND_FLAGS_MAX);
> diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> index 90aa326..34727f6 100644
> --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> @@ -389,6 +389,8 @@ 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 =
> +			pvrdma_wc_network_hdr_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 c8c1d2d..6a87806 100644
> --- a/include/uapi/rdma/vmw_pvrdma-abi.h
> +++ b/include/uapi/rdma/vmw_pvrdma-abi.h
> @@ -58,6 +58,13 @@
>  #define PVRDMA_UAR_CQ_ARM		BIT(30)		/* Arm bit. */
>  #define PVRDMA_UAR_CQ_POLL		BIT(31)		/* Poll bit. */
>
> +enum pvrdma_network_type {
> +	PVRDMA_NETWORK_IB,
> +	PVRDMA_NETWORK_ROCE_V1 = PVRDMA_NETWORK_IB,
> +	PVRDMA_NETWORK_IPV4,
> +	PVRDMA_NETWORK_IPV6
> +};

Doug,

I see that you are already merged this patch, but it is problematic patch.

They defined in uapi file, the new enum which is equal to already existed
 128 enum rdma_network_type {
 129         RDMA_NETWORK_IB,
 130         RDMA_NETWORK_ROCE_V1 = RDMA_NETWORK_IB,
 131         RDMA_NETWORK_IPV4,
 132         RDMA_NETWORK_IPV6
 133 };

And the more important they are doing direct casting from rdma_network_type to
pvrdma_network_type as is in the same patch.

The proper way to do it is to return rdma_network_type directly without obfuscation
and without creating new supported forever UAPI enum.


> +
>  enum pvrdma_wr_opcode {
>  	PVRDMA_WR_RDMA_WRITE,
>  	PVRDMA_WR_RDMA_WRITE_WITH_IMM,
> @@ -125,7 +132,8 @@ enum pvrdma_wc_flags {
>  	PVRDMA_WC_IP_CSUM_OK		= 1 << 3,
>  	PVRDMA_WC_WITH_SMAC		= 1 << 4,
>  	PVRDMA_WC_WITH_VLAN		= 1 << 5,
> -	PVRDMA_WC_FLAGS_MAX		= PVRDMA_WC_WITH_VLAN,
> +	PVRDMA_WC_WITH_NETWORK_HDR_TYPE	= 1 << 6,
> +	PVRDMA_WC_FLAGS_MAX		= PVRDMA_WC_WITH_NETWORK_HDR_TYPE,
>  };
>
>  struct pvrdma_alloc_ucontext_resp {
> @@ -283,7 +291,8 @@ struct pvrdma_cqe {
>  	__u8 dlid_path_bits;
>  	__u8 port_num;
>  	__u8 smac[6];
> -	__u8 reserved2[7]; /* Pad to next power of 2 (64). */
> +	__u8 network_hdr_type;
> +	__u8 reserved2[6]; /* Pad to next power of 2 (64). */
>  };
>
>  #endif /* __VMW_PVRDMA_ABI_H__ */
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH for-next 1/2] RDMA/vmw_pvrdma: Report network header type in WC
       [not found]         ` <20170829054533.GH23726-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
@ 2017-08-29 13:54           ` Doug Ledford
       [not found]             ` <1504014883.52034.33.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Doug Ledford @ 2017-08-29 13:54 UTC (permalink / raw)
  To: Leon Romanovsky, Adit Ranadive
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Aditya Sarwade,
	pv-drivers-pghWNbHTmq7QT0dZR+AlfA

On Tue, 2017-08-29 at 08:45 +0300, Leon Romanovsky wrote:
> On Mon, Aug 28, 2017 at 05:19:35PM -0700, Adit Ranadive wrote:
> > From: Aditya Sarwade <asarwade-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> > 
> > We should report the network header type in the work completion so
> > that
> > the kernel can infer the right RoCE type headers.
> > 
> > Reviewed-by: Bryan Tan <bryantan-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> > Signed-off-by: Aditya Sarwade <asarwade-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> > Signed-off-by: Adit Ranadive <aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> > ---
> >  drivers/infiniband/hw/vmw_pvrdma/pvrdma.h    |  6 ++++++
> >  drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c |  2 ++
> >  include/uapi/rdma/vmw_pvrdma-abi.h           | 13 +++++++++++--
> >  3 files changed, 19 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
> > b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
> > index 663a0c3..99b2c97 100644
> > --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
> > +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
> > @@ -426,6 +426,12 @@ static inline int pvrdma_wc_flags_to_ib(int
> > flags)
> >  	return flags;
> >  }
> > 
> > +static inline enum rdma_network_type pvrdma_wc_network_hdr_to_ib(
> > +					enum pvrdma_network_type
> > type)
> > +{
> > +	return (enum rdma_network_type)type;
> > +}
> > +
> >  static inline int ib_send_flags_to_pvrdma(int flags)
> >  {
> >  	return flags & PVRDMA_MASK(PVRDMA_SEND_FLAGS_MAX);
> > diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> > b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> > index 90aa326..34727f6 100644
> > --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> > +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> > @@ -389,6 +389,8 @@ 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 =
> > +			pvrdma_wc_network_hdr_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 c8c1d2d..6a87806 100644
> > --- a/include/uapi/rdma/vmw_pvrdma-abi.h
> > +++ b/include/uapi/rdma/vmw_pvrdma-abi.h
> > @@ -58,6 +58,13 @@
> >  #define PVRDMA_UAR_CQ_ARM		BIT(30)		/*
> > Arm bit. */
> >  #define PVRDMA_UAR_CQ_POLL		BIT(31)		/
> > * Poll bit. */
> > 
> > +enum pvrdma_network_type {
> > +	PVRDMA_NETWORK_IB,
> > +	PVRDMA_NETWORK_ROCE_V1 = PVRDMA_NETWORK_IB,
> > +	PVRDMA_NETWORK_IPV4,
> > +	PVRDMA_NETWORK_IPV6
> > +};
> 
> Doug,
> 
> I see that you are already merged this patch, but it is problematic
> patch.

It's only gone to github, so it's not set in stone.

> They defined in uapi file, the new enum which is equal to already
> existed
>  128 enum rdma_network_type {
>  129         RDMA_NETWORK_IB,
>  130         RDMA_NETWORK_ROCE_V1 = RDMA_NETWORK_IB,
>  131         RDMA_NETWORK_IPV4,
>  132         RDMA_NETWORK_IPV6
>  133 };
> 
> And the more important they are doing direct casting from
> rdma_network_type to
> pvrdma_network_type as is in the same patch.
> 
> The proper way to do it is to return rdma_network_type directly
> without obfuscation
> and without creating new supported forever UAPI enum.

Generally, I would agree with you.  I guess that's what I get for
trying to get everything done and working late last night :-/.

Adit, is there a reason for the duplicate enum and silly casting in
this patch?  If there isn't a specific reason for it, then it would be
best to re-write it without this silliness.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH for-next 1/2] RDMA/vmw_pvrdma: Report network header type in WC
       [not found]             ` <1504014883.52034.33.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2017-08-29 17:42               ` Adit Ranadive
  2017-08-29 20:50               ` Adit Ranadive
  1 sibling, 0 replies; 10+ messages in thread
From: Adit Ranadive @ 2017-08-29 17:42 UTC (permalink / raw)
  To: Doug Ledford, Leon Romanovsky
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Aditya Sarwade,
	pv-drivers-pghWNbHTmq7QT0dZR+AlfA

On Tue, Aug 29, 2017 at 06:54:48AM -0700, Doug Ledford wrote:
> On Tue, 2017-08-29 at 08:45 +0300, Leon Romanovsky wrote:
> > On Mon, Aug 28, 2017 at 05:19:35PM -0700, Adit Ranadive wrote:
> > > From: Aditya Sarwade <asarwade-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> > >
> > > We should report the network header type in the work completion so
> > > that
> > > the kernel can infer the right RoCE type headers.
> > >
> > > Reviewed-by: Bryan Tan <bryantan-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> > > Signed-off-by: Aditya Sarwade <asarwade-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> > > Signed-off-by: Adit Ranadive <aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> > > ---
> > >  drivers/infiniband/hw/vmw_pvrdma/pvrdma.h    |  6 ++++++
> > >  drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c |  2 ++
> > >  include/uapi/rdma/vmw_pvrdma-abi.h           | 13 +++++++++++--
> > >  3 files changed, 19 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
> > > b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
> > > index 663a0c3..99b2c97 100644
> > > --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
> > > +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
> > > @@ -426,6 +426,12 @@ static inline int pvrdma_wc_flags_to_ib(int
> > > flags)
> > >  	return flags;
> > >  }
> > >
> > > +static inline enum rdma_network_type pvrdma_wc_network_hdr_to_ib(
> > > +					enum pvrdma_network_type
> > > type)
> > > +{
> > > +	return (enum rdma_network_type)type;
> > > +}
> > > +
> > >  static inline int ib_send_flags_to_pvrdma(int flags)
> > >  {
> > >  	return flags & PVRDMA_MASK(PVRDMA_SEND_FLAGS_MAX);
> > > diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> > > b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> > > index 90aa326..34727f6 100644
> > > --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> > > +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> > > @@ -389,6 +389,8 @@ 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 =
> > > +			pvrdma_wc_network_hdr_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 c8c1d2d..6a87806 100644
> > > --- a/include/uapi/rdma/vmw_pvrdma-abi.h
> > > +++ b/include/uapi/rdma/vmw_pvrdma-abi.h
> > > @@ -58,6 +58,13 @@
> > >  #define PVRDMA_UAR_CQ_ARM		BIT(30)		/*
> > > Arm bit. */
> > >  #define PVRDMA_UAR_CQ_POLL		BIT(31)		/
> > > * Poll bit. */
> > >
> > > +enum pvrdma_network_type {
> > > +	PVRDMA_NETWORK_IB,
> > > +	PVRDMA_NETWORK_ROCE_V1 = PVRDMA_NETWORK_IB,
> > > +	PVRDMA_NETWORK_IPV4,
> > > +	PVRDMA_NETWORK_IPV6
> > > +};
> >
> > Doug,
> >
> > I see that you are already merged this patch, but it is problematic
> > patch.
>
> It's only gone to github, so it's not set in stone.
>
> > They defined in uapi file, the new enum which is equal to already
> > existed
> >  128 enum rdma_network_type {
> >  129         RDMA_NETWORK_IB,
> >  130         RDMA_NETWORK_ROCE_V1 = RDMA_NETWORK_IB,
> >  131         RDMA_NETWORK_IPV4,
> >  132         RDMA_NETWORK_IPV6
> >  133 };
> >
> > And the more important they are doing direct casting from
> > rdma_network_type to
> > pvrdma_network_type as is in the same patch.
> >
> > The proper way to do it is to return rdma_network_type directly
> > without obfuscation
> > and without creating new supported forever UAPI enum.
>
> Generally, I would agree with you.  I guess that's what I get for
> trying to get everything done and working late last night :-/.
>
> Adit, is there a reason for the duplicate enum and silly casting in
> this patch?  If there isn't a specific reason for it, then it would be
> best to re-write it without this silliness.

Thanks Leon, Doug. Well, we were only keeping it consistent with what we
do for our other device <-> driver interactions. We can probably remove the
enum and directly assign the network_hdr_type from our cqe to the IB stack's
WC.

Doug, let me know if you prefer a v1 of this patch series or a patch that just
removes the enum.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH for-next 1/2] RDMA/vmw_pvrdma: Report network header type in WC
       [not found]             ` <1504014883.52034.33.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2017-08-29 17:42               ` Adit Ranadive
@ 2017-08-29 20:50               ` Adit Ranadive
       [not found]                 ` <1164391a-01e3-f067-10c8-61d70bd22b2e-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
  1 sibling, 1 reply; 10+ messages in thread
From: Adit Ranadive @ 2017-08-29 20:50 UTC (permalink / raw)
  To: Doug Ledford, Leon Romanovsky
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Aditya Sarwade,
	pv-drivers-pghWNbHTmq7QT0dZR+AlfA

On Tue, Aug 29, 2017 at 06:54:48AM -0700, Doug Ledford wrote:
> On Tue, 2017-08-29 at 08:45 +0300, Leon Romanovsky wrote:
> > On Mon, Aug 28, 2017 at 05:19:35PM -0700, Adit Ranadive wrote:
> > > From: Aditya Sarwade <asarwade-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> > >
> > > We should report the network header type in the work completion so
> > > that
> > > the kernel can infer the right RoCE type headers.
> > >
> > > Reviewed-by: Bryan Tan <bryantan-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> > > Signed-off-by: Aditya Sarwade <asarwade-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> > > Signed-off-by: Adit Ranadive <aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> > > ---
> > >  drivers/infiniband/hw/vmw_pvrdma/pvrdma.h    |  6 ++++++
> > >  drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c |  2 ++
> > >  include/uapi/rdma/vmw_pvrdma-abi.h           | 13 +++++++++++--
> > >  3 files changed, 19 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
> > > b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
> > > index 663a0c3..99b2c97 100644
> > > --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
> > > +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
> > > @@ -426,6 +426,12 @@ static inline int pvrdma_wc_flags_to_ib(int
> > > flags)
> > >  	return flags;
> > >  }
> > >
> > > +static inline enum rdma_network_type pvrdma_wc_network_hdr_to_ib(
> > > +					enum pvrdma_network_type
> > > type)
> > > +{
> > > +	return (enum rdma_network_type)type;
> > > +}
> > > +
> > >  static inline int ib_send_flags_to_pvrdma(int flags)
> > >  {
> > >  	return flags & PVRDMA_MASK(PVRDMA_SEND_FLAGS_MAX);
> > > diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> > > b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> > > index 90aa326..34727f6 100644
> > > --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> > > +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> > > @@ -389,6 +389,8 @@ 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 =
> > > +			pvrdma_wc_network_hdr_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 c8c1d2d..6a87806 100644
> > > --- a/include/uapi/rdma/vmw_pvrdma-abi.h
> > > +++ b/include/uapi/rdma/vmw_pvrdma-abi.h
> > > @@ -58,6 +58,13 @@
> > >  #define PVRDMA_UAR_CQ_ARM		BIT(30)		/*
> > > Arm bit. */
> > >  #define PVRDMA_UAR_CQ_POLL		BIT(31)		/
> > > * Poll bit. */
> > >
> > > +enum pvrdma_network_type {
> > > +	PVRDMA_NETWORK_IB,
> > > +	PVRDMA_NETWORK_ROCE_V1 = PVRDMA_NETWORK_IB,
> > > +	PVRDMA_NETWORK_IPV4,
> > > +	PVRDMA_NETWORK_IPV6
> > > +};
> >
> > Doug,
> >
> > I see that you are already merged this patch, but it is problematic
> > patch.
> 
> It's only gone to github, so it's not set in stone.
> 
> > They defined in uapi file, the new enum which is equal to already
> > existed
> >  128 enum rdma_network_type {
> >  129         RDMA_NETWORK_IB,
> >  130         RDMA_NETWORK_ROCE_V1 = RDMA_NETWORK_IB,
> >  131         RDMA_NETWORK_IPV4,
> >  132         RDMA_NETWORK_IPV6
> >  133 };
> >
> > And the more important they are doing direct casting from
> > rdma_network_type to
> > pvrdma_network_type as is in the same patch.
> >
> > The proper way to do it is to return rdma_network_type directly
> > without obfuscation
> > and without creating new supported forever UAPI enum.
> 
> Generally, I would agree with you.  I guess that's what I get for
> trying to get everything done and working late last night :-/.
> 
> Adit, is there a reason for the duplicate enum and silly casting in
> this patch?  If there isn't a specific reason for it, then it would be
> best to re-write it without this silliness.

Doug, sorry to go back and forth on this. We had an internal discussion on this.
Jorgen pointed out that having the enum is to isolate our device from future
changes to rdma_network_type. Our enum reflects the device value independent of
the RDMA stack and does need to be converted (even though the values are the same
and we don't return the rdma_network_type enum from our device anyways).

Instead of dropping this enum we would like to just drop the casting and move to
a switch case to make the conversion clearer.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH for-next 1/2] RDMA/vmw_pvrdma: Report network header type in WC
       [not found]                 ` <1164391a-01e3-f067-10c8-61d70bd22b2e-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
@ 2017-08-29 20:58                   ` Doug Ledford
       [not found]                     ` <7174aeee-087e-c938-e15f-f3641e170dc9-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Doug Ledford @ 2017-08-29 20:58 UTC (permalink / raw)
  To: Adit Ranadive, Leon Romanovsky
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Aditya Sarwade,
	pv-drivers-pghWNbHTmq7QT0dZR+AlfA


[-- Attachment #1.1: Type: text/plain, Size: 5504 bytes --]

On 8/29/2017 4:50 PM, Adit Ranadive wrote:
> On Tue, Aug 29, 2017 at 06:54:48AM -0700, Doug Ledford wrote:
>> On Tue, 2017-08-29 at 08:45 +0300, Leon Romanovsky wrote:
>>> On Mon, Aug 28, 2017 at 05:19:35PM -0700, Adit Ranadive wrote:
>>>> From: Aditya Sarwade <asarwade-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
>>>>
>>>> We should report the network header type in the work completion so
>>>> that
>>>> the kernel can infer the right RoCE type headers.
>>>>
>>>> Reviewed-by: Bryan Tan <bryantan-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
>>>> Signed-off-by: Aditya Sarwade <asarwade-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
>>>> Signed-off-by: Adit Ranadive <aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
>>>> ---
>>>>  drivers/infiniband/hw/vmw_pvrdma/pvrdma.h    |  6 ++++++
>>>>  drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c |  2 ++
>>>>  include/uapi/rdma/vmw_pvrdma-abi.h           | 13 +++++++++++--
>>>>  3 files changed, 19 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
>>>> b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
>>>> index 663a0c3..99b2c97 100644
>>>> --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
>>>> +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
>>>> @@ -426,6 +426,12 @@ static inline int pvrdma_wc_flags_to_ib(int
>>>> flags)
>>>>  	return flags;
>>>>  }
>>>>
>>>> +static inline enum rdma_network_type pvrdma_wc_network_hdr_to_ib(
>>>> +					enum pvrdma_network_type
>>>> type)
>>>> +{
>>>> +	return (enum rdma_network_type)type;
>>>> +}
>>>> +
>>>>  static inline int ib_send_flags_to_pvrdma(int flags)
>>>>  {
>>>>  	return flags & PVRDMA_MASK(PVRDMA_SEND_FLAGS_MAX);
>>>> diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
>>>> b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
>>>> index 90aa326..34727f6 100644
>>>> --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
>>>> +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
>>>> @@ -389,6 +389,8 @@ 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 =
>>>> +			pvrdma_wc_network_hdr_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 c8c1d2d..6a87806 100644
>>>> --- a/include/uapi/rdma/vmw_pvrdma-abi.h
>>>> +++ b/include/uapi/rdma/vmw_pvrdma-abi.h
>>>> @@ -58,6 +58,13 @@
>>>>  #define PVRDMA_UAR_CQ_ARM		BIT(30)		/*
>>>> Arm bit. */
>>>>  #define PVRDMA_UAR_CQ_POLL		BIT(31)		/
>>>> * Poll bit. */
>>>>
>>>> +enum pvrdma_network_type {
>>>> +	PVRDMA_NETWORK_IB,
>>>> +	PVRDMA_NETWORK_ROCE_V1 = PVRDMA_NETWORK_IB,
>>>> +	PVRDMA_NETWORK_IPV4,
>>>> +	PVRDMA_NETWORK_IPV6
>>>> +};
>>>
>>> Doug,
>>>
>>> I see that you are already merged this patch, but it is problematic
>>> patch.
>>
>> It's only gone to github, so it's not set in stone.
>>
>>> They defined in uapi file, the new enum which is equal to already
>>> existed
>>>  128 enum rdma_network_type {
>>>  129         RDMA_NETWORK_IB,
>>>  130         RDMA_NETWORK_ROCE_V1 = RDMA_NETWORK_IB,
>>>  131         RDMA_NETWORK_IPV4,
>>>  132         RDMA_NETWORK_IPV6
>>>  133 };
>>>
>>> And the more important they are doing direct casting from
>>> rdma_network_type to
>>> pvrdma_network_type as is in the same patch.
>>>
>>> The proper way to do it is to return rdma_network_type directly
>>> without obfuscation
>>> and without creating new supported forever UAPI enum.
>>
>> Generally, I would agree with you.  I guess that's what I get for
>> trying to get everything done and working late last night :-/.
>>
>> Adit, is there a reason for the duplicate enum and silly casting in
>> this patch?  If there isn't a specific reason for it, then it would be
>> best to re-write it without this silliness.
> 
> Doug, sorry to go back and forth on this. We had an internal discussion on this.
> Jorgen pointed out that having the enum is to isolate our device from future
> changes to rdma_network_type.

The rdma_network_type is not going to change.  It might get extended,
but not changed.

> Our enum reflects the device value independent of
> the RDMA stack and does need to be converted (even though the values are the same
> and we don't return the rdma_network_type enum from our device anyways).
> 
> Instead of dropping this enum we would like to just drop the casting and move to
> a switch case to make the conversion clearer.

As long as you guys are returning the same thing, you can just use the
enum as it is.  If the enum gets updated and you don't want your driver
to reflect that update, then that would be the appropriate time to
create a switch or a different enum with a conversion or whatever.  You
would have to update your driver in that case even if you do a switch
right now because you can't put in the option for the extension in your
conversion function before the extension exists, so there is no savings
or safety in adding a conversion that doesn't actually convert at this time.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    GPG Key ID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

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

* Re: [PATCH for-next 1/2] RDMA/vmw_pvrdma: Report network header type in WC
       [not found]                     ` <7174aeee-087e-c938-e15f-f3641e170dc9-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2017-08-29 21:49                       ` Adit Ranadive
  0 siblings, 0 replies; 10+ messages in thread
From: Adit Ranadive @ 2017-08-29 21:49 UTC (permalink / raw)
  To: Doug Ledford, Leon Romanovsky
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Aditya Sarwade,
	pv-drivers-pghWNbHTmq7QT0dZR+AlfA

On 8/29/17 1:58 PM, Doug Ledford wrote:
> On 8/29/2017 4:50 PM, Adit Ranadive wrote:
>> On Tue, Aug 29, 2017 at 06:54:48AM -0700, Doug Ledford wrote:
>>> On Tue, 2017-08-29 at 08:45 +0300, Leon Romanovsky wrote:
>>>> On Mon, Aug 28, 2017 at 05:19:35PM -0700, Adit Ranadive wrote:
>>>>> From: Aditya Sarwade <asarwade-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
>>>>>
>>>>> We should report the network header type in the work completion so
>>>>> that
>>>>> the kernel can infer the right RoCE type headers.
>>>>>
>>>>> Reviewed-by: Bryan Tan <bryantan-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
>>>>> Signed-off-by: Aditya Sarwade <asarwade-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
>>>>> Signed-off-by: Adit Ranadive <aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
>>>>> ---
>>>>>  drivers/infiniband/hw/vmw_pvrdma/pvrdma.h    |  6 ++++++
>>>>>  drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c |  2 ++
>>>>>  include/uapi/rdma/vmw_pvrdma-abi.h           | 13 +++++++++++--
>>>>>  3 files changed, 19 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
>>>>> b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
>>>>> index 663a0c3..99b2c97 100644
>>>>> --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
>>>>> +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
>>>>> @@ -426,6 +426,12 @@ static inline int pvrdma_wc_flags_to_ib(int
>>>>> flags)
>>>>>  	return flags;
>>>>>  }
>>>>>
>>>>> +static inline enum rdma_network_type pvrdma_wc_network_hdr_to_ib(
>>>>> +					enum pvrdma_network_type
>>>>> type)
>>>>> +{
>>>>> +	return (enum rdma_network_type)type;
>>>>> +}
>>>>> +
>>>>>  static inline int ib_send_flags_to_pvrdma(int flags)
>>>>>  {
>>>>>  	return flags & PVRDMA_MASK(PVRDMA_SEND_FLAGS_MAX);
>>>>> diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
>>>>> b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
>>>>> index 90aa326..34727f6 100644
>>>>> --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
>>>>> +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
>>>>> @@ -389,6 +389,8 @@ 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 =
>>>>> +			pvrdma_wc_network_hdr_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 c8c1d2d..6a87806 100644
>>>>> --- a/include/uapi/rdma/vmw_pvrdma-abi.h
>>>>> +++ b/include/uapi/rdma/vmw_pvrdma-abi.h
>>>>> @@ -58,6 +58,13 @@
>>>>>  #define PVRDMA_UAR_CQ_ARM		BIT(30)		/*
>>>>> Arm bit. */
>>>>>  #define PVRDMA_UAR_CQ_POLL		BIT(31)		/
>>>>> * Poll bit. */
>>>>>
>>>>> +enum pvrdma_network_type {
>>>>> +	PVRDMA_NETWORK_IB,
>>>>> +	PVRDMA_NETWORK_ROCE_V1 = PVRDMA_NETWORK_IB,
>>>>> +	PVRDMA_NETWORK_IPV4,
>>>>> +	PVRDMA_NETWORK_IPV6
>>>>> +};
>>>>
>>>> Doug,
>>>>
>>>> I see that you are already merged this patch, but it is problematic
>>>> patch.
>>>
>>> It's only gone to github, so it's not set in stone.
>>>
>>>> They defined in uapi file, the new enum which is equal to already
>>>> existed
>>>>  128 enum rdma_network_type {
>>>>  129         RDMA_NETWORK_IB,
>>>>  130         RDMA_NETWORK_ROCE_V1 = RDMA_NETWORK_IB,
>>>>  131         RDMA_NETWORK_IPV4,
>>>>  132         RDMA_NETWORK_IPV6
>>>>  133 };
>>>>
>>>> And the more important they are doing direct casting from
>>>> rdma_network_type to
>>>> pvrdma_network_type as is in the same patch.
>>>>
>>>> The proper way to do it is to return rdma_network_type directly
>>>> without obfuscation
>>>> and without creating new supported forever UAPI enum.
>>>
>>> Generally, I would agree with you.  I guess that's what I get for
>>> trying to get everything done and working late last night :-/.
>>>
>>> Adit, is there a reason for the duplicate enum and silly casting in
>>> this patch?  If there isn't a specific reason for it, then it would be
>>> best to re-write it without this silliness.
>>
>> Doug, sorry to go back and forth on this. We had an internal discussion on this.
>> Jorgen pointed out that having the enum is to isolate our device from future
>> changes to rdma_network_type.
> 
> The rdma_network_type is not going to change.  It might get extended,
> but not changed.
> 
>> Our enum reflects the device value independent of
>> the RDMA stack and does need to be converted (even though the values are the same
>> and we don't return the rdma_network_type enum from our device anyways).
>>
>> Instead of dropping this enum we would like to just drop the casting and move to
>> a switch case to make the conversion clearer.
> 
> As long as you guys are returning the same thing, you can just use the
> enum as it is.  If the enum gets updated and you don't want your driver
> to reflect that update, then that would be the appropriate time to
> create a switch or a different enum with a conversion or whatever.  You
> would have to update your driver in that case even if you do a switch
> right now because you can't put in the option for the extension in your
> conversion function before the extension exists, so there is no savings
> or safety in adding a conversion that doesn't actually convert at this time.

I didn't quite understand why that would be case since we would only have to
extend the conversion function if we add support for the extension in the
device. Otherwise, we simply wouldn't report the rdma network type extension.

I guess we can just drop the enum for now and re-add if and when you guys decide to
extend the rdma_network_type.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2017-08-29 21:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-29  0:19 [PATCH for-next 0/2] RDMA/vmw_pvrdma: Patches for 4.14 Adit Ranadive
     [not found] ` <cover.1503965717.git.aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
2017-08-29  0:19   ` [PATCH for-next 1/2] RDMA/vmw_pvrdma: Report network header type in WC Adit Ranadive
     [not found]     ` <521f5e2169789e31a7e91dab691cd155f0100090.1503965717.git.aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
2017-08-29  5:45       ` Leon Romanovsky
     [not found]         ` <20170829054533.GH23726-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-08-29 13:54           ` Doug Ledford
     [not found]             ` <1504014883.52034.33.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-08-29 17:42               ` Adit Ranadive
2017-08-29 20:50               ` Adit Ranadive
     [not found]                 ` <1164391a-01e3-f067-10c8-61d70bd22b2e-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
2017-08-29 20:58                   ` Doug Ledford
     [not found]                     ` <7174aeee-087e-c938-e15f-f3641e170dc9-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-08-29 21:49                       ` Adit Ranadive
2017-08-29  0:19   ` [PATCH for-next 2/2] RDMA/vmw_pvrdma: Fix a signedness Adit Ranadive
2017-08-29  0:40   ` [PATCH for-next 0/2] RDMA/vmw_pvrdma: Patches for 4.14 Doug Ledford

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.