Skip to contentSkip to conversation

RDMA/srpt: Fix disabling device management

PATCH Applied Kamal Heib 3 participants 3 messages May 14, 2020 – May 17, 2020

Subsystems (2)
lore
Share & tools
lore

Kamal Heib

author
#0 lore raw

PATCH v2 1/1 RDMA/srpt: Fix disabling device management

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")
---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/srpt/ib_srpt.c +6 -2
index 7ed38d1cb997..7dfc0138b973 100644
@@ -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;
 		}
Signature · 1 line
2.25.4
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · 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.

#2 lore raw
In reply to Kamal Heib
Quoted 6 lines · 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.

Quoted 6 lines
Fixes 09f8a1486dca ("RDMA/srpt: Fix handling of SR-IOV and iWARP ports")
---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Applied to for-next, thanks

Jason