Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Kamal Heib <kamalheib1@gmail.com>
Cc: linux-rdma@vger.kernel.org, Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	Bart Van Assche <bvanassche@acm.org>
Subject: Re: [PATCH for-rc] RDMA/srpt: Fix disabling device management
Date: Wed, 13 May 2020 10:22:03 +0300	[thread overview]
Message-ID: <20200513072203.GR4814@unreal> (raw)
In-Reply-To: <20200511222918.62576-1-kamalheib1@gmail.com>

On Tue, May 12, 2020 at 01:29:18AM +0300, Kamal Heib wrote:
> Avoid disabling device management for devices that don't support
> Management datagrams (MADs) by checking if the "mad_agent" pointer is
> initialized before calling ib_modify_port, also change the error message
> to a warning and make it more informative.
>
> Fixes: 09f8a1486dca ("RDMA/srpt: Fix handling of SR-IOV and iWARP ports")
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> ---
>  drivers/infiniband/ulp/srpt/ib_srpt.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
> index 7ed38d1cb997..7b21792ab6f7 100644
> --- a/drivers/infiniband/ulp/srpt/ib_srpt.c
> +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
> @@ -625,14 +625,18 @@ static void srpt_unregister_mad_agent(struct srpt_device *sdev)
>  		.clr_port_cap_mask = IB_PORT_DEVICE_MGMT_SUP,
>  	};
>  	struct srpt_port *sport;
> +	int ret;
>  	int i;
>
>  	for (i = 1; i <= sdev->device->phys_port_cnt; i++) {
>  		sport = &sdev->port[i - 1];
>  		WARN_ON(sport->port != i);
> -		if (ib_modify_port(sdev->device, i, 0, &port_modify) < 0)
> -			pr_err("disabling MAD processing failed.\n");
>  		if (sport->mad_agent) {
> +			ret = ib_modify_port(sdev->device, i, 0, &port_modify);
> +			if (ret < 0)
> +				pr_warn("%s-%d: disabling device management failed (%d). Note: this is expected if SR-IOV is enabled.\n",
> +					dev_name(&sport->sdev->device->dev),

The ib_modify_port() shouldn't be called if it expected to fail.

Thanks

> +					sport->port, ret);
>  			ib_unregister_mad_agent(sport->mad_agent);
>  			sport->mad_agent = NULL;
>  		}
> --
> 2.25.4
>

  reply	other threads:[~2020-05-13  7:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 22:29 [PATCH for-rc] RDMA/srpt: Fix disabling device management Kamal Heib
2020-05-13  7:22 ` Leon Romanovsky [this message]
2020-05-13 10:02   ` Kamal Heib
2020-05-13 10:21     ` Leon Romanovsky
2020-05-13 10:45       ` Kamal Heib
2020-05-13 10:50         ` Leon Romanovsky
2020-05-13 11:14           ` Kamal Heib
2020-05-13 11:31             ` Leon Romanovsky
2020-05-13 12:38               ` Kamal Heib
2020-05-13 12:43                 ` Jason Gunthorpe
2020-05-13 15:25                   ` Bart Van Assche
2020-05-13 18:02                     ` Jason Gunthorpe
2020-05-13 18:07                       ` Bart Van Assche
2020-05-13 18:08                         ` Jason Gunthorpe
2020-05-13 11:59         ` Gal Pressman
2020-05-13 12:54           ` Kamal Heib
2020-05-13 12:48 ` Jason Gunthorpe

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=20200513072203.GR4814@unreal \
    --to=leon@kernel.org \
    --cc=bvanassche@acm.org \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=kamalheib1@gmail.com \
    --cc=linux-rdma@vger.kernel.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