public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Adit Ranadive <aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Aditya Sarwade <asarwade-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>,
	pv-drivers-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org
Subject: Re: [PATCH for-next 1/2] RDMA/vmw_pvrdma: Report network header type in WC
Date: Tue, 29 Aug 2017 09:54:43 -0400	[thread overview]
Message-ID: <1504014883.52034.33.camel@redhat.com> (raw)
In-Reply-To: <20170829054533.GH23726-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>

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

  parent reply	other threads:[~2017-08-29 13:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1504014883.52034.33.camel@redhat.com \
    --to=dledford-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org \
    --cc=asarwade-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org \
    --cc=leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=pv-drivers-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox