linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-rc v2] RDMA/srpt: Fix disabling device management
@ 2020-05-14 11:47 Kamal Heib
  2020-05-14 14:07 ` Bart Van Assche
  2020-05-17 23:43 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Kamal Heib @ 2020-05-14 11:47 UTC (permalink / raw)
  To: linux-rdma; +Cc: Jason Gunthorpe, Doug Ledford, Bart Van Assche, Kamal Heib

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 fix the error flow in
srpt_refresh_port() to disable device management if
ib_register_mad_agent() fail.

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..7dfc0138b973 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -607,6 +607,11 @@ static int srpt_refresh_port(struct srpt_port *sport)
 			       dev_name(&sport->sdev->device->dev), sport->port,
 			       PTR_ERR(sport->mad_agent));
 			sport->mad_agent = NULL;
+			memset(&port_modify, 0, sizeof(port_modify));
+			port_modify.clr_port_cap_mask = IB_PORT_DEVICE_MGMT_SUP;
+			ib_modify_port(sport->sdev->device, sport->port, 0,
+				       &port_modify);
+
 		}
 	}
 
@@ -630,9 +635,8 @@ static void srpt_unregister_mad_agent(struct srpt_device *sdev)
 	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) {
+			ib_modify_port(sdev->device, i, 0, &port_modify);
 			ib_unregister_mad_agent(sport->mad_agent);
 			sport->mad_agent = NULL;
 		}
-- 
2.25.4


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

* Re: [PATCH for-rc v2] RDMA/srpt: Fix disabling device management
  2020-05-14 11:47 [PATCH for-rc v2] RDMA/srpt: Fix disabling device management Kamal Heib
@ 2020-05-14 14:07 ` Bart Van Assche
  2020-05-17 23:43 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2020-05-14 14:07 UTC (permalink / raw)
  To: Kamal Heib, linux-rdma; +Cc: Jason Gunthorpe, Doug Ledford

On 2020-05-14 04:47, 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 fix the error flow in
> srpt_refresh_port() to disable device management if
> ib_register_mad_agent() fail.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

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

* Re: [PATCH for-rc v2] RDMA/srpt: Fix disabling device management
  2020-05-14 11:47 [PATCH for-rc v2] RDMA/srpt: Fix disabling device management Kamal Heib
  2020-05-14 14:07 ` Bart Van Assche
@ 2020-05-17 23:43 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2020-05-17 23:43 UTC (permalink / raw)
  To: Kamal Heib; +Cc: linux-rdma, Doug Ledford, Bart Van Assche

On Thu, May 14, 2020 at 02:47:20PM +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 fix the error flow in
> srpt_refresh_port() to disable device management if
> ib_register_mad_agent() fail.
> 
> Fixes: 09f8a1486dca ("RDMA/srpt: Fix handling of SR-IOV and iWARP ports")
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> Reviewed-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  drivers/infiniband/ulp/srpt/ib_srpt.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

Applied to for-next, thanks

Jason

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

end of thread, other threads:[~2020-05-17 23:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14 11:47 [PATCH for-rc v2] RDMA/srpt: Fix disabling device management Kamal Heib
2020-05-14 14:07 ` Bart Van Assche
2020-05-17 23:43 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).