Skip to contentSkip to conversation

srp_daemon: check that port LID is valid before calling create_ah

PATCH Applied Sergey Gorenko 3 participants 3 messages Jul 30, 2019 – Jul 31, 2019 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 srp_daemon: check that port LID is valid before calling create_ah

From: Vladimir Koushnir <[email protected]>

The default LID that is given to the port is not valid (a valid LID value is > 0 and < 0xc000), so in case the port didn't get a valid lid from the SM there is no need to call create_ah.

---
 srp_daemon/srp_daemon.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
srp_daemon/srp_daemon.c +3 -2
index e85b96686d47..337b21c7d7c9 100644
@@ -2228,8 +2228,9 @@ catas_start:
 			pr_debug("Starting a recalculation\n");
 			port_lid = get_port_lid(res->ud_res->ib_ctx,
 						config->port_num, &sm_lid);
-			if (port_lid != res->ud_res->port_attr.lid ||
-				sm_lid != res->ud_res->port_attr.sm_lid) {
+			if (port_lid > 0 && port_lid < 0xc000 &&
+			    (port_lid != res->ud_res->port_attr.lid ||
+			     sm_lid != res->ud_res->port_attr.sm_lid)) {
 
 				if (res->ud_res->ah) {
 					ibv_destroy_ah(res->ud_res->ah);
Signature · 1 line
2.17.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Sergey Gorenko

From: Vladimir Koushnir <[email protected]>

The default LID that is given to the port is not valid (a valid LID value is > 0 and < 0xc000), so in case the port didn't get a valid lid from the SM there is no need to call create_ah.

---
  srp_daemon/srp_daemon.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
srp_daemon/srp_daemon.c +0 -0
index e85b96686d47..337b21c7d7c9 100644
@@ -2228,8 +2228,9 @@ catas_start:
  			pr_debug("Starting a recalculation\n");

srp_daemon/srp_daemon.c catas_start: · line 2236

Quoted 10 lines
srp_daemon/srp_daemon.c +3 -2
  			port_lid = get_port_lid(res->ud_res->ib_ctx,
  						config->port_num, &sm_lid);
-			if (port_lid != res->ud_res->port_attr.lid ||
-				sm_lid != res->ud_res->port_attr.sm_lid) {
+			if (port_lid > 0 && port_lid < 0xc000 &&
+			    (port_lid != res->ud_res->port_attr.lid ||
+			     sm_lid != res->ud_res->port_attr.sm_lid)) {
 
  				if (res->ud_res->ah) {
  					ibv_destroy_ah(res->ud_res->ah);
Applied
#2 lore raw
In reply to Sergey Gorenko
Quoted 11 lines · Sergey Gorenko

From: Vladimir Koushnir <[email protected]>

The default LID that is given to the port is not valid (a valid LID value
is > 0 and < 0xc000), so in case the port didn't get a valid lid from the
SM there is no need to call create_ah.

---

Thanks, applied.

Signature · 3 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
    Fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD