Skip to contentSkip to conversation

acm.c: In acm_port_up, handle noncontiguous pkeys

PATCH In review Hal Rosenstock 2 participants 3 messages Aug 6, 2013 – Aug 7, 2013 2 messages not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 2/8 acm.c: In acm_port_up, handle noncontiguous pkeys

There can be "holes" in pkey table although this is not usually the case but since IBA spec allows for this, it should be handled.

---
 src/acm.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
src/acm.c +7 -7
index 81aeeb4..a15f094 100644
@@ -3192,11 +3192,6 @@ static void acm_port_up(struct acm_port *port)
 			break;
 	}
 
-	for (port->pkey_cnt = 0;; port->pkey_cnt++) {
-		ret = ibv_query_pkey(port->dev->verbs, port->port_num, port->pkey_cnt, &pkey);
-		if (ret || !pkey)
-			break;
-	}
 	port->lid = attr.lid;
 	port->lid_mask = 0xffff - ((1 << attr.lmc) - 1);
 
@@ -3214,8 +3209,13 @@ static void acm_port_up(struct acm_port *port)
 		return;
 
 	atomic_set(&port->sa_dest.refcnt, 1);
-	for (i = 0; i < port->pkey_cnt; i++)
-		 acm_ep_up(port, (uint16_t) i);
+	for (i = 0; i < attr.pkey_tbl_len; i++) {
+		ret = ibv_query_pkey(port->dev->verbs, port->port_num, i, &pkey);
+		if (ret || !pkey)
+			continue;
+		port->pkey_cnt++;
+		acm_ep_up(port, (uint16_t) i);
+	}
 
 	acm_port_join(port);
 	port->state = IBV_PORT_ACTIVE;
Signature · 6 lines
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
In reply to a message not in the archive
Quoted 28 lines

There can be "holes" in pkey table although this is not usually the case but since IBA spec allows for this, it should be handled.

---
 src/acm.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
src/acm.c +0 -5
index 81aeeb4..a15f094 100644
@@ -3192,11 +3192,6 @@ static void acm_port_up(struct acm_port *port)
 			break;
 	}
 
-	for (port->pkey_cnt = 0;; port->pkey_cnt++) {
-		ret = ibv_query_pkey(port->dev->verbs, port->port_num, port-
 >pkey_cnt, &pkey);
-		if (ret || !pkey)
-			break;
-	}
 	port->lid = attr.lid;
 	port->lid_mask = 0xffff - ((1 << attr.lmc) - 1);
@@ -3214,8 +3209,13 @@ static void acm_port_up(struct acm_port *port)
 		return;
 

src/acm.c static void acm_port_up(struct acm_port *port) · line 3218

Quoted 10 lines
src/acm.c +7 -2
 	atomic_set(&port->sa_dest.refcnt, 1);
-	for (i = 0; i < port->pkey_cnt; i++)
-		 acm_ep_up(port, (uint16_t) i);
+	for (i = 0; i < attr.pkey_tbl_len; i++) {
+		ret = ibv_query_pkey(port->dev->verbs, port->port_num, i, &pkey);
+		if (ret || !pkey)
+			continue;
+		port->pkey_cnt++;
+		acm_ep_up(port, (uint16_t) i);
+	}

I think we can remove pkey_cnt from struct acm_port as part of this change. If you agree, I can fix that up when applying the patch (no need to update). --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to a message not in the archive
Quoted 28 lines · Sean
Quoted 28 lines

There can be "holes" in pkey table although this is not usually the case but since IBA spec allows for this, it should be handled.

---
 src/acm.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
src/acm.c +0 -5
index 81aeeb4..a15f094 100644
@@ -3192,11 +3192,6 @@ static void acm_port_up(struct acm_port *port)
 			break;
 	}
 
-	for (port->pkey_cnt = 0;; port->pkey_cnt++) {
-		ret = ibv_query_pkey(port->dev->verbs, port->port_num, port-
 > pkey_cnt, &pkey);
-		if (ret || !pkey)
-			break;
-	}
 	port->lid = attr.lid;
 	port->lid_mask = 0xffff - ((1 << attr.lmc) - 1);
@@ -3214,8 +3209,13 @@ static void acm_port_up(struct acm_port *port)
 		return;
 
Quoted 12 lines

src/acm.c static void acm_port_up(struct acm_port *port) · line 3218

Quoted 10 lines
src/acm.c +7 -2
 	atomic_set(&port->sa_dest.refcnt, 1);
-	for (i = 0; i < port->pkey_cnt; i++)
-		 acm_ep_up(port, (uint16_t) i);
+	for (i = 0; i < attr.pkey_tbl_len; i++) {
+		ret = ibv_query_pkey(port->dev->verbs, port->port_num, i, &pkey);
+		if (ret || !pkey)
+			continue;
+		port->pkey_cnt++;
+		acm_ep_up(port, (uint16_t) i);
+	}

I think we can remove pkey_cnt from struct acm_port as part of this change. If you agree, I can fix that up when applying the patch (no need to update).

Agreed. Thanks.

-- Hal

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html