All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH ibacm 2/8] acm.c: In acm_port_up, handle noncontiguous pkeys
@ 2013-08-06 11:45 Hal Rosenstock
       [not found] ` <5200E1CD.6070705-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Hal Rosenstock @ 2013-08-06 11:45 UTC (permalink / raw)
  To: Hefty, Sean
  Cc: linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)


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.

Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 src/acm.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/acm.c b/src/acm.c
index 81aeeb4..a15f094 100644
--- a/src/acm.c
+++ b/src/acm.c
@@ -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;
-- 
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCH ibacm 2/8] acm.c: In acm_port_up, handle noncontiguous pkeys
       [not found] ` <5200E1CD.6070705-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
@ 2013-08-07 17:35   ` Hefty, Sean
       [not found]     ` <1828884A29C6694DAF28B7E6B8A8237388CA48C0-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Hefty, Sean @ 2013-08-07 17:35 UTC (permalink / raw)
  To: Hal Rosenstock
  Cc: linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)

> 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.
> 
> Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
>  src/acm.c |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/src/acm.c b/src/acm.c
> index 81aeeb4..a15f094 100644
> --- a/src/acm.c
> +++ b/src/acm.c
> @@ -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);
> +	}

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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH ibacm 2/8] acm.c: In acm_port_up, handle noncontiguous pkeys
       [not found]     ` <1828884A29C6694DAF28B7E6B8A8237388CA48C0-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2013-08-07 18:20       ` Hal Rosenstock
  0 siblings, 0 replies; 3+ messages in thread
From: Hal Rosenstock @ 2013-08-07 18:20 UTC (permalink / raw)
  To: Hefty, Sean
  Cc: linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)

On 8/7/2013 1:35 PM, Hefty, Sean wrote:
>> 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.
>>
>> Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>> ---
>>  src/acm.c |   14 +++++++-------
>>  1 files changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/src/acm.c b/src/acm.c
>> index 81aeeb4..a15f094 100644
>> --- a/src/acm.c
>> +++ b/src/acm.c
>> @@ -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);
>> +	}
> 
> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2013-08-07 18:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-06 11:45 [PATCH ibacm 2/8] acm.c: In acm_port_up, handle noncontiguous pkeys Hal Rosenstock
     [not found] ` <5200E1CD.6070705-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2013-08-07 17:35   ` Hefty, Sean
     [not found]     ` <1828884A29C6694DAF28B7E6B8A8237388CA48C0-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-08-07 18:20       ` Hal Rosenstock

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.