public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Kamal Heib <kamalheib1@gmail.com>
Cc: linux-rdma@vger.kernel.org, Doug Ledford <dledford@redhat.com>,
	Lijun Ou <oulijun@huawei.com>,
	Selvin Xavier <selvin.xavier@broadcom.com>,
	Michal Kalderon <mkalderon@marvell.com>
Subject: Re: [PATCH for-next v3 1/4] RDMA/core: Fix return code when modify_port isn't supported
Date: Wed, 23 Oct 2019 11:40:22 -0300	[thread overview]
Message-ID: <20191023144022.GL23952@ziepe.ca> (raw)
In-Reply-To: <20191022202138.GA25589@kheib-workstation>

On Tue, Oct 22, 2019 at 11:21:38PM +0300, Kamal Heib wrote:
> On Tue, Oct 22, 2019 at 04:20:02PM -0300, Jason Gunthorpe wrote:
> > On Fri, Oct 18, 2019 at 12:41:12PM +0300, Kamal Heib wrote:
> > > Improving return code from ib_modify_port() by doing the following:
> > > 1- Use "-EOPNOTSUPP" instead "-ENOSYS" which is the proper return code.
> > > 2- Avoid confusion by return "-EOPNOTSUPP" when modify_port() isn't
> > >    supplied by the provider and the protocol is IB, otherwise return
> > >    success to avoid failure of the ib_modify_port() in CM layer.
> > > 
> > > Fixes: 61e0962d5221 ("IB: Avoid ib_modify_port() failure for RoCE devices")
> > > Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> > >  drivers/infiniband/core/device.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
> > > index a667636f74bf..626ac18dd3a7 100644
> > > +++ b/drivers/infiniband/core/device.c
> > > @@ -2397,7 +2397,7 @@ int ib_modify_port(struct ib_device *device,
> > >  					     port_modify_mask,
> > >  					     port_modify);
> > >  	else
> > > -		rc = rdma_protocol_roce(device, port_num) ? 0 : -ENOSYS;
> > > +		rc = rdma_protocol_ib(device, port_num) ? -EOPNOTSUPP : 0;
> > >  	return rc;
> > 
> > Oh gross, this is such an ugly hack
> > 
> > roce mode should allow a fake IB_PORT_CM_SUP to be manipulated and
> > nothing else.
> > 
> > All other cases should return EOPNOTSUPP as something has gone really
> > wrong
> > 
> > Jason
> 
> Do you mean something like the following:
> 
> diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
> index a667636f74bf..1db97f6f5dec 100644
> +++ b/drivers/infiniband/core/device.c
> @@ -2396,8 +2396,12 @@ int ib_modify_port(struct ib_device *device,
>                 rc = device->ops.modify_port(device, port_num,
>                                              port_modify_mask,
>                                              port_modify);
> +       else if (rdma_protocol_roce(device, port_num) &&
> +                ((port_modify->set_port_cap_mask & IB_PORT_CM_SUP) ||
> +                (port_modify->clr_port_cap_mask & IB_PORT_CM_SUP)))

That isn't the right logic.. it is more like & ~IB_PORT_CM_SUP) == 0

Jason

  reply	other threads:[~2019-10-23 14:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18  9:41 [PATCH for-next v3 0/4] RDMA: modify_port improvements Kamal Heib
2019-10-18  9:41 ` [PATCH for-next v3 1/4] RDMA/core: Fix return code when modify_port isn't supported Kamal Heib
2019-10-18 20:01   ` Michal Kalderon
2019-10-22 19:20   ` Jason Gunthorpe
2019-10-22 20:21     ` Kamal Heib
2019-10-23 14:40       ` Jason Gunthorpe [this message]
2019-10-18  9:41 ` [PATCH for-next v3 2/4] RDMA/hns: Remove unsupported modify_port callback Kamal Heib
2019-10-18  9:41 ` [PATCH for-next v3 3/4] RDMA/ocrdma: " Kamal Heib
2019-10-18  9:41 ` [PATCH for-next v3 4/4] RDMA/qedr: " Kamal Heib
2019-10-18 20:00   ` Michal Kalderon

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=20191023144022.GL23952@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dledford@redhat.com \
    --cc=kamalheib1@gmail.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mkalderon@marvell.com \
    --cc=oulijun@huawei.com \
    --cc=selvin.xavier@broadcom.com \
    /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