public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-next] RDMA/srpt: Avoid print error when modify_port is not supported
@ 2020-02-18 10:17 Kamal Heib
  2020-02-18 16:45 ` Leon Romanovsky
  2020-03-04 17:09 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Kamal Heib @ 2020-02-18 10:17 UTC (permalink / raw)
  To: linux-rdma; +Cc: Jason Gunthorpe, Doug Ledford, Bart Van Assche, Kamal Heib

Avoid printing the following error when modify_port isn't supported.

[47541.541145] ib_srpt disabling MAD processing failed.

Fixes: a42d985bd5b2 ("ib_srpt: Initial SRP Target merge for v3.3-rc1")
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 98552749d71c..eba2b156616d 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -628,12 +628,14 @@ 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)
+		ret = ib_modify_port(sdev->device, i, 0, &port_modify);
+		if (ret < 0 && ret != -EOPNOTSUPP)
 			pr_err("disabling MAD processing failed.\n");
 		if (sport->mad_agent) {
 			ib_unregister_mad_agent(sport->mad_agent);
-- 
2.21.1


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

* Re: [PATCH for-next] RDMA/srpt: Avoid print error when modify_port is not supported
  2020-02-18 10:17 [PATCH for-next] RDMA/srpt: Avoid print error when modify_port is not supported Kamal Heib
@ 2020-02-18 16:45 ` Leon Romanovsky
  2020-03-04 17:09 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2020-02-18 16:45 UTC (permalink / raw)
  To: Kamal Heib; +Cc: linux-rdma, Jason Gunthorpe, Doug Ledford, Bart Van Assche

On Tue, Feb 18, 2020 at 12:17:40PM +0200, Kamal Heib wrote:
> Avoid printing the following error when modify_port isn't supported.
>
> [47541.541145] ib_srpt disabling MAD processing failed.
>
> Fixes: a42d985bd5b2 ("ib_srpt: Initial SRP Target merge for v3.3-rc1")
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> ---
>  drivers/infiniband/ulp/srpt/ib_srpt.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
> index 98552749d71c..eba2b156616d 100644
> --- a/drivers/infiniband/ulp/srpt/ib_srpt.c
> +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
> @@ -628,12 +628,14 @@ 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)
> +		ret = ib_modify_port(sdev->device, i, 0, &port_modify);
> +		if (ret < 0 && ret != -EOPNOTSUPP)
>  			pr_err("disabling MAD processing failed.\n");

This print doesn't make any sense, we are unregistering MAD agent anyway.

>  		if (sport->mad_agent) {
>  			ib_unregister_mad_agent(sport->mad_agent);
> --
> 2.21.1
>

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

* Re: [PATCH for-next] RDMA/srpt: Avoid print error when modify_port is not supported
  2020-02-18 10:17 [PATCH for-next] RDMA/srpt: Avoid print error when modify_port is not supported Kamal Heib
  2020-02-18 16:45 ` Leon Romanovsky
@ 2020-03-04 17:09 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2020-03-04 17:09 UTC (permalink / raw)
  To: Kamal Heib; +Cc: linux-rdma, Doug Ledford, Bart Van Assche

On Tue, Feb 18, 2020 at 12:17:40PM +0200, Kamal Heib wrote:
> Avoid printing the following error when modify_port isn't supported.
> 
> [47541.541145] ib_srpt disabling MAD processing failed.
> 
> Fixes: a42d985bd5b2 ("ib_srpt: Initial SRP Target merge for v3.3-rc1")
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
>  drivers/infiniband/ulp/srpt/ib_srpt.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
> index 98552749d71c..eba2b156616d 100644
> +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
> @@ -628,12 +628,14 @@ 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)
> +		ret = ib_modify_port(sdev->device, i, 0, &port_modify);
> +		if (ret < 0 && ret != -EOPNOTSUPP)
>  			pr_err("disabling MAD processing failed.\n");
>  		if (sport->mad_agent) {
>  			ib_unregister_mad_agent(sport->mad_agent);

This logic is goofy if the original ib_modify_port fails then
sport->mad_agent should be NULL so it should just skip it anyhow.

If it is fixed up then we won't get the EOPNOTSUPP anymore.

I'm also unclear what this IB_PORT_DEVICE_MGMT_SUP is all about, it is
weird that a ULP is touching a device global flag like this

Jason

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

end of thread, other threads:[~2020-03-04 17:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-18 10:17 [PATCH for-next] RDMA/srpt: Avoid print error when modify_port is not supported Kamal Heib
2020-02-18 16:45 ` Leon Romanovsky
2020-03-04 17:09 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox