diff mbox

[infiniband-diags,6/6] ibdiag_common.c: In is_port_info_extended_supported, query PortInfo for port 0 when node is a switch

Message ID 372d2c64-ce18-4264-267b-294bac8524be@dev.mellanox.co.il (mailing list archive)
State Rejected, archived
Delegated to: Ira Weiny
Headers show

Commit Message

Hal Rosenstock Nov. 28, 2017, 10:12 p.m. UTC
to be able to obtain CapabilityMask and CapabilityMask2

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
---
 src/ibdiag_common.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Ira Weiny Dec. 4, 2017, 3:40 p.m. UTC | #1
On Tue, Nov 28, 2017 at 05:12:19PM -0500, Hal Rosenstock wrote:
> 
> to be able to obtain CapabilityMask and CapabilityMask2
> 
> Signed-off-by: Hal Rosenstock <hal@mellanox.com>


Rejected.  I already took an earlier version of this patch and I don't see any
difference in this one...

Ira


> ---
>  src/ibdiag_common.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/src/ibdiag_common.c b/src/ibdiag_common.c
> index 9245146..c33cacc 100644
> --- a/src/ibdiag_common.c
> +++ b/src/ibdiag_common.c
> @@ -506,8 +506,18 @@ int is_port_info_extended_supported(ib_portid_t * dest, int port,
>  	uint8_t data[IB_SMP_DATA_SIZE] = { 0 };
>  	uint32_t cap_mask;
>  	uint16_t cap_mask2;
> +	int type, portnum;
>  
> -	if (!smp_query_via(data, dest, IB_ATTR_PORT_INFO, port, 0, srcport))
> +	if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport))
> +		IBEXIT("node info query failed");
> +
> +	mad_decode_field(data, IB_NODE_TYPE_F, &type);
> +	if (type == IB_NODE_SWITCH)
> +		portnum = 0;
> +	else
> +		portnum = port;
> +
> +	if (!smp_query_via(data, dest, IB_ATTR_PORT_INFO, portnum, 0, srcport))
>  		IBEXIT("port info query failed");
>  
>  	mad_decode_field(data, IB_PORT_CAPMASK_F, &cap_mask);
> -- 
> 2.8.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hal Rosenstock Dec. 4, 2017, 4:02 p.m. UTC | #2
On 12/4/2017 10:40 AM, ira.weiny wrote:
> On Tue, Nov 28, 2017 at 05:12:19PM -0500, Hal Rosenstock wrote:
>>
>> to be able to obtain CapabilityMask and CapabilityMask2
>>
>> Signed-off-by: Hal Rosenstock <hal@mellanox.com>
> 
> 
> Rejected.  I already took an earlier version of this patch and I don't see any
> difference in this one...

My bad ;-( I missed that this patch was already incorporated upstream.

-- Hal

> Ira
> 
> 
>> ---
>>  src/ibdiag_common.c | 12 +++++++++++-
>>  1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/ibdiag_common.c b/src/ibdiag_common.c
>> index 9245146..c33cacc 100644
>> --- a/src/ibdiag_common.c
>> +++ b/src/ibdiag_common.c
>> @@ -506,8 +506,18 @@ int is_port_info_extended_supported(ib_portid_t * dest, int port,
>>  	uint8_t data[IB_SMP_DATA_SIZE] = { 0 };
>>  	uint32_t cap_mask;
>>  	uint16_t cap_mask2;
>> +	int type, portnum;
>>  
>> -	if (!smp_query_via(data, dest, IB_ATTR_PORT_INFO, port, 0, srcport))
>> +	if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport))
>> +		IBEXIT("node info query failed");
>> +
>> +	mad_decode_field(data, IB_NODE_TYPE_F, &type);
>> +	if (type == IB_NODE_SWITCH)
>> +		portnum = 0;
>> +	else
>> +		portnum = port;
>> +
>> +	if (!smp_query_via(data, dest, IB_ATTR_PORT_INFO, portnum, 0, srcport))
>>  		IBEXIT("port info query failed");
>>  
>>  	mad_decode_field(data, IB_PORT_CAPMASK_F, &cap_mask);
>> -- 
>> 2.8.4
>>
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/ibdiag_common.c b/src/ibdiag_common.c
index 9245146..c33cacc 100644
--- a/src/ibdiag_common.c
+++ b/src/ibdiag_common.c
@@ -506,8 +506,18 @@  int is_port_info_extended_supported(ib_portid_t * dest, int port,
 	uint8_t data[IB_SMP_DATA_SIZE] = { 0 };
 	uint32_t cap_mask;
 	uint16_t cap_mask2;
+	int type, portnum;
 
-	if (!smp_query_via(data, dest, IB_ATTR_PORT_INFO, port, 0, srcport))
+	if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport))
+		IBEXIT("node info query failed");
+
+	mad_decode_field(data, IB_NODE_TYPE_F, &type);
+	if (type == IB_NODE_SWITCH)
+		portnum = 0;
+	else
+		portnum = port;
+
+	if (!smp_query_via(data, dest, IB_ATTR_PORT_INFO, portnum, 0, srcport))
 		IBEXIT("port info query failed");
 
 	mad_decode_field(data, IB_PORT_CAPMASK_F, &cap_mask);