All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
@ 2017-10-27 20:35 ` Ghazale Hosseinabadi
  0 siblings, 0 replies; 28+ messages in thread
From: Ghazale Hosseinabadi @ 2017-10-27 20:35 UTC (permalink / raw)
  To: hal
  Cc: linux-rdma, tbogendoerfer, matanb, leonro, parav, linux-kernel, dledford

Hi,

----- Original Message -----
From: hal@dev.mellanox.co.il
To: parav@mellanox.com, tbogendoerfer@suse.de, matanb@mellanox.com, leonro@mellanox.com, dledford@redhat.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: ghazale.hosseinabadi@oracle.com
Sent: Friday, October 27, 2017 1:18:50 PM GMT -08:00 US/Canada Pacific
Subject: Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module

On 10/27/2017 2:32 PM, Parav Pandit wrote:
> However I believe that ibstat tool should be enhanced to report unknown port speed instead of expecting drivers to supply some random number like this.

ibstat gets the rate from libibumad via /sys/class/infiniband/<IB device>/ports/<port number>/rate file which is supposed to be populated by the driver. Is there no rate file in this error case ?

There is a rate file, but it is empty.

Thanks,
Ghazale

-- Hal

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

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
@ 2017-10-27 20:35 ` Ghazale Hosseinabadi
  0 siblings, 0 replies; 28+ messages in thread
From: Ghazale Hosseinabadi @ 2017-10-27 20:35 UTC (permalink / raw)
  To: hal
  Cc: linux-rdma, tbogendoerfer, matanb, leonro, parav, linux-kernel, dledford

Hi,

----- Original Message -----
From: hal@dev.mellanox.co.il
To: parav@mellanox.com, tbogendoerfer@suse.de, matanb@mellanox.com, leonro@mellanox.com, dledford@redhat.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: ghazale.hosseinabadi@oracle.com
Sent: Friday, October 27, 2017 1:18:50 PM GMT -08:00 US/Canada Pacific
Subject: Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module

On 10/27/2017 2:32 PM, Parav Pandit wrote:
> However I believe that ibstat tool should be enhanced to report unknown port speed instead of expecting drivers to supply some random number like this.

ibstat gets the rate from libibumad via /sys/class/infiniband/<IB device>/ports/<port number>/rate file which is supposed to be populated by the driver. Is there no rate file in this error case ?

There is a rate file, but it is empty.

Thanks,
Ghazale

-- Hal

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

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
  2017-10-28 10:42               ` Thomas Bogendoerfer
  (?)
@ 2017-10-28 11:59               ` Hal Rosenstock
  -1 siblings, 0 replies; 28+ messages in thread
From: Hal Rosenstock @ 2017-10-28 11:59 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Ghazale Hosseinabadi, linux-rdma, matanb, leonro, parav,
	linux-kernel, dledford

On 10/28/2017 6:42 AM, Thomas Bogendoerfer wrote:
>> I must be missing something as to what is going on in this scenario.

I think I see what's going on now. The -EINVAL in kernel sysfs/rate_show
causes error to either open or read of file. I had checked that an empty
file is parsed correctly but didn't consider an error on open or read.

>> sysfs.c:rate_show is inconsistent as it paves over an invalid speed
>> setting that to SDR but does not pave over invalid width returning
>> -EINVAL but this comment is in another "direction".
> I thought about going in the other direction by making the speed/width unknown case
> somehow visible in rate_show(). When I checked all other drivers only mlx5 stand out
> so I decided to only change mlx5. But I make a change to let rate_show() print out, 
> that is currently has no rate for the port.

I wasn't proposing to make that visible in rate_show() but rather
pointing out the inconsistency in changing unknown speeds to SDR but
unknown widths are error. There were comments on not having to set
"random" numbers for speed/width. If so, shouldn't these be handled
consistently here ? Would setting -EINVAL when not one of recognized
speeds cause an issue (rather than setting to SDR) ?

IMO a more future proof implementation is not to have error for
ib_width_enum_to_int but have unknown widths default to 1x similar to
how unknown speeds default to SDR:

include/rdma/ib_verbs.h:
static inline int ib_width_enum_to_int(enum ib_port_width width)
{
        switch (width) {
        case IB_WIDTH_1X:  return  1;
        case IB_WIDTH_4X:  return  4;
        case IB_WIDTH_8X:  return  8;
        case IB_WIDTH_12X: return 12;
        default:          return 1;
        }
}

For example, 2x link widths have been added to IBA spec.

This is alternative approach to libibumad/ibstat patches for invalid
link width as it's not set when QSFP is not plugged into port.

-- Hal

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

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
  2017-10-27 23:19           ` Hal Rosenstock
@ 2017-10-28 10:42               ` Thomas Bogendoerfer
  -1 siblings, 0 replies; 28+ messages in thread
From: Thomas Bogendoerfer @ 2017-10-28 10:42 UTC (permalink / raw)
  To: Hal Rosenstock
  Cc: Ghazale Hosseinabadi, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	parav-VPRAkNaXOzVWk0Htik3J/w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	dledford-H+wXaHxf7aLQT0dZR+AlfA

On Fri, 27 Oct 2017 19:19:05 -0400
Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> wrote:

> On 10/27/2017 7:04 PM, Ghazale Hosseinabadi wrote:
> > 
> > 
> > On 10/27/2017 03:52 PM, Hal Rosenstock wrote:
> >> On 10/27/2017 5:54 PM, Ghazale Hosseinabadi wrote:
> >>> When running ibstat (if transceiver is not connected in adapter):
> >>>
> >>> ibpanic: [7851] main: stat of IB device 'mlx5_1' failed: Invalid
> >>> argument
> >> Any output before that ?
> > no, It only prints this line.

rate_show() generates an EINVAL, that's propably what ibstat/*libs confuses.

> and setting the width to 1x in the driver so the rate file is properly
> populated fixes this ? 

yes, because then rate_show() will not return EINVAL.

> I must be missing something as to what is going on in this scenario.
> 
> sysfs.c:rate_show is inconsistent as it paves over an invalid speed
> setting that to SDR but does not pave over invalid width returning
> -EINVAL but this comment is in another "direction".

I thought about going in the other direction by making the speed/width unknown case
somehow visible in rate_show(). When I checked all other drivers only mlx5 stand out
so I decided to only change mlx5. But I make a change to let rate_show() print out, 
that is currently has no rate for the port.

Thomas.

-- 
Thomas Bogendoerfer <tbogendoerfer-l3A5Bk7waGM@public.gmane.org>
--
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] 28+ messages in thread

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
@ 2017-10-28 10:42               ` Thomas Bogendoerfer
  0 siblings, 0 replies; 28+ messages in thread
From: Thomas Bogendoerfer @ 2017-10-28 10:42 UTC (permalink / raw)
  To: Hal Rosenstock
  Cc: Ghazale Hosseinabadi, linux-rdma, matanb, leonro, parav,
	linux-kernel, dledford

On Fri, 27 Oct 2017 19:19:05 -0400
Hal Rosenstock <hal@dev.mellanox.co.il> wrote:

> On 10/27/2017 7:04 PM, Ghazale Hosseinabadi wrote:
> > 
> > 
> > On 10/27/2017 03:52 PM, Hal Rosenstock wrote:
> >> On 10/27/2017 5:54 PM, Ghazale Hosseinabadi wrote:
> >>> When running ibstat (if transceiver is not connected in adapter):
> >>>
> >>> ibpanic: [7851] main: stat of IB device 'mlx5_1' failed: Invalid
> >>> argument
> >> Any output before that ?
> > no, It only prints this line.

rate_show() generates an EINVAL, that's propably what ibstat/*libs confuses.

> and setting the width to 1x in the driver so the rate file is properly
> populated fixes this ? 

yes, because then rate_show() will not return EINVAL.

> I must be missing something as to what is going on in this scenario.
> 
> sysfs.c:rate_show is inconsistent as it paves over an invalid speed
> setting that to SDR but does not pave over invalid width returning
> -EINVAL but this comment is in another "direction".

I thought about going in the other direction by making the speed/width unknown case
somehow visible in rate_show(). When I checked all other drivers only mlx5 stand out
so I decided to only change mlx5. But I make a change to let rate_show() print out, 
that is currently has no rate for the port.

Thomas.

-- 
Thomas Bogendoerfer <tbogendoerfer@suse.de>

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

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
  2017-10-27 23:19           ` Hal Rosenstock
@ 2017-10-28  0:36               ` Ghazale Hosseinabadi
  -1 siblings, 0 replies; 28+ messages in thread
From: Ghazale Hosseinabadi @ 2017-10-28  0:36 UTC (permalink / raw)
  To: Hal Rosenstock
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, tbogendoerfer-l3A5Bk7waGM,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	parav-VPRAkNaXOzVWk0Htik3J/w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	dledford-H+wXaHxf7aLQT0dZR+AlfA



On 10/27/2017 04:19 PM, Hal Rosenstock wrote:
> On 10/27/2017 7:04 PM, Ghazale Hosseinabadi wrote:
>>
>> On 10/27/2017 03:52 PM, Hal Rosenstock wrote:
>>> On 10/27/2017 5:54 PM, Ghazale Hosseinabadi wrote:
>>>> When running ibstat (if transceiver is not connected in adapter):
>>>>
>>>> ibpanic: [7851] main: stat of IB device 'mlx5_1' failed: Invalid
>>>> argument
>>> Any output before that ?
>> no, It only prints this line.
> and setting the width to 1x in the driver so the rate file is properly
> populated fixes this ?
Yes, because a value is written in 
/sys/class/infiniband/mlx5_X/ports/1/rate
>   I must be missing something as to what is going
> on in this scenario.
Without this bug fix, file /sys/class/infiniband/mlx5_X/ports/1/rate is 
empty, which results in ibpanic.

-- Ghazale
>
> sysfs.c:rate_show is inconsistent as it paves over an invalid speed
> setting that to SDR but does not pave over invalid width returning
> -EINVAL but this comment is in another "direction".
>
> -- Hal
>
>> -- Ghazale
>>>    I'm trying to understand how far it gets. It
>>> looks to me that empty rate file would be parsed as 0 and ibstat would
>>> show that rate. ibpanic would occur if file was not found but I could be
>>> missing something.
>>>
>>

--
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] 28+ messages in thread

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
@ 2017-10-28  0:36               ` Ghazale Hosseinabadi
  0 siblings, 0 replies; 28+ messages in thread
From: Ghazale Hosseinabadi @ 2017-10-28  0:36 UTC (permalink / raw)
  To: Hal Rosenstock
  Cc: linux-rdma, tbogendoerfer, matanb, leonro, parav, linux-kernel, dledford



On 10/27/2017 04:19 PM, Hal Rosenstock wrote:
> On 10/27/2017 7:04 PM, Ghazale Hosseinabadi wrote:
>>
>> On 10/27/2017 03:52 PM, Hal Rosenstock wrote:
>>> On 10/27/2017 5:54 PM, Ghazale Hosseinabadi wrote:
>>>> When running ibstat (if transceiver is not connected in adapter):
>>>>
>>>> ibpanic: [7851] main: stat of IB device 'mlx5_1' failed: Invalid
>>>> argument
>>> Any output before that ?
>> no, It only prints this line.
> and setting the width to 1x in the driver so the rate file is properly
> populated fixes this ?
Yes, because a value is written in 
/sys/class/infiniband/mlx5_X/ports/1/rate
>   I must be missing something as to what is going
> on in this scenario.
Without this bug fix, file /sys/class/infiniband/mlx5_X/ports/1/rate is 
empty, which results in ibpanic.

-- Ghazale
>
> sysfs.c:rate_show is inconsistent as it paves over an invalid speed
> setting that to SDR but does not pave over invalid width returning
> -EINVAL but this comment is in another "direction".
>
> -- Hal
>
>> -- Ghazale
>>>    I'm trying to understand how far it gets. It
>>> looks to me that empty rate file would be parsed as 0 and ibstat would
>>> show that rate. ibpanic would occur if file was not found but I could be
>>> missing something.
>>>
>>

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

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
  2017-10-28  0:17           ` Hal Rosenstock
@ 2017-10-28  0:29             ` Ghazale Hosseinabadi
  0 siblings, 0 replies; 28+ messages in thread
From: Ghazale Hosseinabadi @ 2017-10-28  0:29 UTC (permalink / raw)
  To: Hal Rosenstock; +Cc: matanb, leonro, parav, linux-kernel, dledford



On 10/27/2017 05:17 PM, Hal Rosenstock wrote:
> On 10/27/2017 7:19 PM, Hal Rosenstock wrote:
>> On 10/27/2017 7:04 PM, Ghazale Hosseinabadi wrote:
>>>
>>> On 10/27/2017 03:52 PM, Hal Rosenstock wrote:
>>>> On 10/27/2017 5:54 PM, Ghazale Hosseinabadi wrote:
>>>>> When running ibstat (if transceiver is not connected in adapter):
>>>>>
>>>>> ibpanic: [7851] main: stat of IB device 'mlx5_1' failed: Invalid
>>>>> argument
>>>> Any output before that ?
>>> no, It only prints this line.
>> and setting the width to 1x in the driver so the rate file is properly
>> populated fixes this ? I must be missing something as to what is going
>> on in this scenario.
> [off list...]
> Are you using libibumad or rdma-core package ?
rdma-core
>   Which version ?
rdma-core-13-25
> What version of infiniband-diags are you using ?
infiniband-diags-1.6.7-1
> Can you build from sources ?
> I have patch to libibumad/rdma-core and another patch to ibstat
> (infiniband-diags) which I'd like you to try. Is that possible ?
I haven't built user-land packages myself, but I can definitely try it.
Please send me the patches and I will try to build.

Thanks,
Ghazale
>
> Thanks.
>
> -- Hal
>
>> sysfs.c:rate_show is inconsistent as it paves over an invalid speed
>> setting that to SDR but does not pave over invalid width returning
>> -EINVAL but this comment is in another "direction".
>>
>> -- Hal
>>
>>> -- Ghazale
>>>>    I'm trying to understand how far it gets. It
>>>> looks to me that empty rate file would be parsed as 0 and ibstat would
>>>> show that rate. ibpanic would occur if file was not found but I could be
>>>> missing something.
>>>>
>>>

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

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
  2017-10-27 23:19           ` Hal Rosenstock
  (?)
@ 2017-10-28  0:17           ` Hal Rosenstock
  2017-10-28  0:29             ` Ghazale Hosseinabadi
  -1 siblings, 1 reply; 28+ messages in thread
From: Hal Rosenstock @ 2017-10-28  0:17 UTC (permalink / raw)
  To: Ghazale Hosseinabadi; +Cc: matanb, leonro, parav, linux-kernel, dledford

On 10/27/2017 7:19 PM, Hal Rosenstock wrote:
> On 10/27/2017 7:04 PM, Ghazale Hosseinabadi wrote:
>>
>>
>> On 10/27/2017 03:52 PM, Hal Rosenstock wrote:
>>> On 10/27/2017 5:54 PM, Ghazale Hosseinabadi wrote:
>>>> When running ibstat (if transceiver is not connected in adapter):
>>>>
>>>> ibpanic: [7851] main: stat of IB device 'mlx5_1' failed: Invalid
>>>> argument
>>> Any output before that ?
>> no, It only prints this line.
> 
> and setting the width to 1x in the driver so the rate file is properly
> populated fixes this ? I must be missing something as to what is going
> on in this scenario.

[off list...]
Are you using libibumad or rdma-core package ? Which version ?
What version of infiniband-diags are you using ?
Can you build from sources ?
I have patch to libibumad/rdma-core and another patch to ibstat
(infiniband-diags) which I'd like you to try. Is that possible ?

Thanks.

-- Hal

> sysfs.c:rate_show is inconsistent as it paves over an invalid speed
> setting that to SDR but does not pave over invalid width returning
> -EINVAL but this comment is in another "direction".
> 
> -- Hal
> 
>>
>> -- Ghazale
>>>   I'm trying to understand how far it gets. It
>>> looks to me that empty rate file would be parsed as 0 and ibstat would
>>> show that rate. ibpanic would occur if file was not found but I could be
>>> missing something.
>>>
>>
>>

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

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
  2017-10-27 23:04       ` Ghazale Hosseinabadi
@ 2017-10-27 23:19           ` Hal Rosenstock
  -1 siblings, 0 replies; 28+ messages in thread
From: Hal Rosenstock @ 2017-10-27 23:19 UTC (permalink / raw)
  To: Ghazale Hosseinabadi
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, tbogendoerfer-l3A5Bk7waGM,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	parav-VPRAkNaXOzVWk0Htik3J/w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	dledford-H+wXaHxf7aLQT0dZR+AlfA

On 10/27/2017 7:04 PM, Ghazale Hosseinabadi wrote:
> 
> 
> On 10/27/2017 03:52 PM, Hal Rosenstock wrote:
>> On 10/27/2017 5:54 PM, Ghazale Hosseinabadi wrote:
>>> When running ibstat (if transceiver is not connected in adapter):
>>>
>>> ibpanic: [7851] main: stat of IB device 'mlx5_1' failed: Invalid
>>> argument
>> Any output before that ?
> no, It only prints this line.

and setting the width to 1x in the driver so the rate file is properly
populated fixes this ? I must be missing something as to what is going
on in this scenario.

sysfs.c:rate_show is inconsistent as it paves over an invalid speed
setting that to SDR but does not pave over invalid width returning
-EINVAL but this comment is in another "direction".

-- Hal

> 
> -- Ghazale
>>   I'm trying to understand how far it gets. It
>> looks to me that empty rate file would be parsed as 0 and ibstat would
>> show that rate. ibpanic would occur if file was not found but I could be
>> missing something.
>>
> 
> 
--
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] 28+ messages in thread

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
@ 2017-10-27 23:19           ` Hal Rosenstock
  0 siblings, 0 replies; 28+ messages in thread
From: Hal Rosenstock @ 2017-10-27 23:19 UTC (permalink / raw)
  To: Ghazale Hosseinabadi
  Cc: linux-rdma, tbogendoerfer, matanb, leonro, parav, linux-kernel, dledford

On 10/27/2017 7:04 PM, Ghazale Hosseinabadi wrote:
> 
> 
> On 10/27/2017 03:52 PM, Hal Rosenstock wrote:
>> On 10/27/2017 5:54 PM, Ghazale Hosseinabadi wrote:
>>> When running ibstat (if transceiver is not connected in adapter):
>>>
>>> ibpanic: [7851] main: stat of IB device 'mlx5_1' failed: Invalid
>>> argument
>> Any output before that ?
> no, It only prints this line.

and setting the width to 1x in the driver so the rate file is properly
populated fixes this ? I must be missing something as to what is going
on in this scenario.

sysfs.c:rate_show is inconsistent as it paves over an invalid speed
setting that to SDR but does not pave over invalid width returning
-EINVAL but this comment is in another "direction".

-- Hal

> 
> -- Ghazale
>>   I'm trying to understand how far it gets. It
>> looks to me that empty rate file would be parsed as 0 and ibstat would
>> show that rate. ibpanic would occur if file was not found but I could be
>> missing something.
>>
> 
> 

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

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
  2017-10-27 22:52   ` Hal Rosenstock
@ 2017-10-27 23:04       ` Ghazale Hosseinabadi
  -1 siblings, 0 replies; 28+ messages in thread
From: Ghazale Hosseinabadi @ 2017-10-27 23:04 UTC (permalink / raw)
  To: Hal Rosenstock
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, tbogendoerfer-l3A5Bk7waGM,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	parav-VPRAkNaXOzVWk0Htik3J/w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	dledford-H+wXaHxf7aLQT0dZR+AlfA



On 10/27/2017 03:52 PM, Hal Rosenstock wrote:
> On 10/27/2017 5:54 PM, Ghazale Hosseinabadi wrote:
>> When running ibstat (if transceiver is not connected in adapter):
>>
>> ibpanic: [7851] main: stat of IB device 'mlx5_1' failed: Invalid argument
> Any output before that ?
no, It only prints this line.

-- Ghazale
>   I'm trying to understand how far it gets. It
> looks to me that empty rate file would be parsed as 0 and ibstat would
> show that rate. ibpanic would occur if file was not found but I could be
> missing something.
>

--
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] 28+ messages in thread

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
@ 2017-10-27 23:04       ` Ghazale Hosseinabadi
  0 siblings, 0 replies; 28+ messages in thread
From: Ghazale Hosseinabadi @ 2017-10-27 23:04 UTC (permalink / raw)
  To: Hal Rosenstock
  Cc: linux-rdma, tbogendoerfer, matanb, leonro, parav, linux-kernel, dledford



On 10/27/2017 03:52 PM, Hal Rosenstock wrote:
> On 10/27/2017 5:54 PM, Ghazale Hosseinabadi wrote:
>> When running ibstat (if transceiver is not connected in adapter):
>>
>> ibpanic: [7851] main: stat of IB device 'mlx5_1' failed: Invalid argument
> Any output before that ?
no, It only prints this line.

-- Ghazale
>   I'm trying to understand how far it gets. It
> looks to me that empty rate file would be parsed as 0 and ibstat would
> show that rate. ibpanic would occur if file was not found but I could be
> missing something.
>

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

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
  2017-10-27 21:54 ` Ghazale Hosseinabadi
@ 2017-10-27 22:52   ` Hal Rosenstock
  -1 siblings, 0 replies; 28+ messages in thread
From: Hal Rosenstock @ 2017-10-27 22:52 UTC (permalink / raw)
  To: Ghazale Hosseinabadi
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, tbogendoerfer-l3A5Bk7waGM,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	parav-VPRAkNaXOzVWk0Htik3J/w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	dledford-H+wXaHxf7aLQT0dZR+AlfA

On 10/27/2017 5:54 PM, Ghazale Hosseinabadi wrote:
> When running ibstat (if transceiver is not connected in adapter):
> 
> ibpanic: [7851] main: stat of IB device 'mlx5_1' failed: Invalid argument

Any output before that ? I'm trying to understand how far it gets. It
looks to me that empty rate file would be parsed as 0 and ibstat would
show that rate. ibpanic would occur if file was not found but I could be
missing something.

--
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] 28+ messages in thread

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
@ 2017-10-27 22:52   ` Hal Rosenstock
  0 siblings, 0 replies; 28+ messages in thread
From: Hal Rosenstock @ 2017-10-27 22:52 UTC (permalink / raw)
  To: Ghazale Hosseinabadi
  Cc: linux-rdma, tbogendoerfer, matanb, leonro, parav, linux-kernel, dledford

On 10/27/2017 5:54 PM, Ghazale Hosseinabadi wrote:
> When running ibstat (if transceiver is not connected in adapter):
> 
> ibpanic: [7851] main: stat of IB device 'mlx5_1' failed: Invalid argument

Any output before that ? I'm trying to understand how far it gets. It
looks to me that empty rate file would be parsed as 0 and ibstat would
show that rate. ibpanic would occur if file was not found but I could be
missing something.

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

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
@ 2017-10-27 21:54 ` Ghazale Hosseinabadi
  0 siblings, 0 replies; 28+ messages in thread
From: Ghazale Hosseinabadi @ 2017-10-27 21:54 UTC (permalink / raw)
  To: hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, tbogendoerfer-l3A5Bk7waGM,
	matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	parav-VPRAkNaXOzVWk0Htik3J/w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	dledford-H+wXaHxf7aLQT0dZR+AlfA

Hi,

----- Original Message -----
From: hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org
To: parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org, tbogendoerfer-l3A5Bk7waGM@public.gmane.org, matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org, leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org, dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: ghazale.hosseinabadi-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org
Sent: Friday, October 27, 2017 2:30:33 PM GMT -08:00 US/Canada Pacific
Subject: Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module

On 10/27/2017 4:33 PM, Parav Pandit wrote:
> 
> 
>> -----Original Message-----
>> From: Hal Rosenstock [mailto:hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org]
>> Sent: Friday, October 27, 2017 3:19 PM
>> To: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>; Thomas Bogendoerfer
>> <tbogendoerfer-l3A5Bk7waGM@public.gmane.org>; Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>; Leon
>> Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>; Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>;
>> linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> Cc: Ghazale Hosseinabadi <ghazale.hosseinabadi-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>> Subject: Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged
>> in SFP module
>>
>> On 10/27/2017 2:32 PM, Parav Pandit wrote:
>>> However I believe that ibstat tool should be enhanced to report unknown port
>> speed instead of expecting drivers to supply some random number like this.
>>
>> ibstat gets the rate from libibumad via /sys/class/infiniband/<IB
>> device>/ports/<port number>/rate file which is supposed to be populated by the
>> driver. Is there no rate file in this error case ?
>>
> <...>/<port_num>/rate file exist.
> 
> rate_show() has invalid active_width as expected due to nonexistence of SFP.
> So sysfs call return invalid value.
> We don't have invalid_active_width defined right now.
> So ibstat and other applications should not crash on such valid errors.

Agreed. I haven't seen ibstat crash reported though. Can someone provide
the crash details ?

When running ibstat (if transceiver is not connected in adapter):

ibpanic: [7851] main: stat of IB device 'mlx5_1' failed: Invalid argument

Thanks,
Ghazale
--
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] 28+ messages in thread

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
@ 2017-10-27 21:54 ` Ghazale Hosseinabadi
  0 siblings, 0 replies; 28+ messages in thread
From: Ghazale Hosseinabadi @ 2017-10-27 21:54 UTC (permalink / raw)
  To: hal
  Cc: linux-rdma, tbogendoerfer, matanb, leonro, parav, linux-kernel, dledford

Hi,

----- Original Message -----
From: hal@dev.mellanox.co.il
To: parav@mellanox.com, tbogendoerfer@suse.de, matanb@mellanox.com, leonro@mellanox.com, dledford@redhat.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: ghazale.hosseinabadi@oracle.com
Sent: Friday, October 27, 2017 2:30:33 PM GMT -08:00 US/Canada Pacific
Subject: Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module

On 10/27/2017 4:33 PM, Parav Pandit wrote:
> 
> 
>> -----Original Message-----
>> From: Hal Rosenstock [mailto:hal@dev.mellanox.co.il]
>> Sent: Friday, October 27, 2017 3:19 PM
>> To: Parav Pandit <parav@mellanox.com>; Thomas Bogendoerfer
>> <tbogendoerfer@suse.de>; Matan Barak <matanb@mellanox.com>; Leon
>> Romanovsky <leonro@mellanox.com>; Doug Ledford <dledford@redhat.com>;
>> linux-rdma@vger.kernel.org; linux-kernel@vger.kernel.org
>> Cc: Ghazale Hosseinabadi <ghazale.hosseinabadi@oracle.com>
>> Subject: Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged
>> in SFP module
>>
>> On 10/27/2017 2:32 PM, Parav Pandit wrote:
>>> However I believe that ibstat tool should be enhanced to report unknown port
>> speed instead of expecting drivers to supply some random number like this.
>>
>> ibstat gets the rate from libibumad via /sys/class/infiniband/<IB
>> device>/ports/<port number>/rate file which is supposed to be populated by the
>> driver. Is there no rate file in this error case ?
>>
> <...>/<port_num>/rate file exist.
> 
> rate_show() has invalid active_width as expected due to nonexistence of SFP.
> So sysfs call return invalid value.
> We don't have invalid_active_width defined right now.
> So ibstat and other applications should not crash on such valid errors.

Agreed. I haven't seen ibstat crash reported though. Can someone provide
the crash details ?

When running ibstat (if transceiver is not connected in adapter):

ibpanic: [7851] main: stat of IB device 'mlx5_1' failed: Invalid argument

Thanks,
Ghazale

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

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
  2017-10-27 20:33             ` Parav Pandit
  (?)
@ 2017-10-27 21:30             ` Hal Rosenstock
  -1 siblings, 0 replies; 28+ messages in thread
From: Hal Rosenstock @ 2017-10-27 21:30 UTC (permalink / raw)
  To: Parav Pandit, Thomas Bogendoerfer, Matan Barak, Leon Romanovsky,
	Doug Ledford, linux-rdma, linux-kernel
  Cc: Ghazale Hosseinabadi

On 10/27/2017 4:33 PM, Parav Pandit wrote:
> 
> 
>> -----Original Message-----
>> From: Hal Rosenstock [mailto:hal@dev.mellanox.co.il]
>> Sent: Friday, October 27, 2017 3:19 PM
>> To: Parav Pandit <parav@mellanox.com>; Thomas Bogendoerfer
>> <tbogendoerfer@suse.de>; Matan Barak <matanb@mellanox.com>; Leon
>> Romanovsky <leonro@mellanox.com>; Doug Ledford <dledford@redhat.com>;
>> linux-rdma@vger.kernel.org; linux-kernel@vger.kernel.org
>> Cc: Ghazale Hosseinabadi <ghazale.hosseinabadi@oracle.com>
>> Subject: Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged
>> in SFP module
>>
>> On 10/27/2017 2:32 PM, Parav Pandit wrote:
>>> However I believe that ibstat tool should be enhanced to report unknown port
>> speed instead of expecting drivers to supply some random number like this.
>>
>> ibstat gets the rate from libibumad via /sys/class/infiniband/<IB
>> device>/ports/<port number>/rate file which is supposed to be populated by the
>> driver. Is there no rate file in this error case ?
>>
> <...>/<port_num>/rate file exist.
> 
> rate_show() has invalid active_width as expected due to nonexistence of SFP.
> So sysfs call return invalid value.
> We don't have invalid_active_width defined right now.
> So ibstat and other applications should not crash on such valid errors.

Agreed. I haven't seen ibstat crash reported though. Can someone provide
the crash details ?

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

* RE: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
  2017-10-27 20:18         ` Hal Rosenstock
@ 2017-10-27 20:33             ` Parav Pandit
  -1 siblings, 0 replies; 28+ messages in thread
From: Parav Pandit @ 2017-10-27 20:33 UTC (permalink / raw)
  To: Hal Rosenstock, Thomas Bogendoerfer, Matan Barak,
	Leon Romanovsky, Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Ghazale Hosseinabadi



> -----Original Message-----
> From: Hal Rosenstock [mailto:hal@dev.mellanox.co.il]
> Sent: Friday, October 27, 2017 3:19 PM
> To: Parav Pandit <parav@mellanox.com>; Thomas Bogendoerfer
> <tbogendoerfer@suse.de>; Matan Barak <matanb@mellanox.com>; Leon
> Romanovsky <leonro@mellanox.com>; Doug Ledford <dledford@redhat.com>;
> linux-rdma@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: Ghazale Hosseinabadi <ghazale.hosseinabadi@oracle.com>
> Subject: Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged
> in SFP module
> 
> On 10/27/2017 2:32 PM, Parav Pandit wrote:
> > However I believe that ibstat tool should be enhanced to report unknown port
> speed instead of expecting drivers to supply some random number like this.
> 
> ibstat gets the rate from libibumad via /sys/class/infiniband/<IB
> device>/ports/<port number>/rate file which is supposed to be populated by the
> driver. Is there no rate file in this error case ?
> 
<...>/<port_num>/rate file exist.

rate_show() has invalid active_width as expected due to nonexistence of SFP.
So sysfs call return invalid value.
We don't have invalid_active_width defined right now.
So ibstat and other applications should not crash on such valid errors.


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

* RE: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
@ 2017-10-27 20:33             ` Parav Pandit
  0 siblings, 0 replies; 28+ messages in thread
From: Parav Pandit @ 2017-10-27 20:33 UTC (permalink / raw)
  To: Hal Rosenstock, Thomas Bogendoerfer, Matan Barak,
	Leon Romanovsky, Doug Ledford, linux-rdma, linux-kernel
  Cc: Ghazale Hosseinabadi



> -----Original Message-----
> From: Hal Rosenstock [mailto:hal@dev.mellanox.co.il]
> Sent: Friday, October 27, 2017 3:19 PM
> To: Parav Pandit <parav@mellanox.com>; Thomas Bogendoerfer
> <tbogendoerfer@suse.de>; Matan Barak <matanb@mellanox.com>; Leon
> Romanovsky <leonro@mellanox.com>; Doug Ledford <dledford@redhat.com>;
> linux-rdma@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: Ghazale Hosseinabadi <ghazale.hosseinabadi@oracle.com>
> Subject: Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged
> in SFP module
> 
> On 10/27/2017 2:32 PM, Parav Pandit wrote:
> > However I believe that ibstat tool should be enhanced to report unknown port
> speed instead of expecting drivers to supply some random number like this.
> 
> ibstat gets the rate from libibumad via /sys/class/infiniband/<IB
> device>/ports/<port number>/rate file which is supposed to be populated by the
> driver. Is there no rate file in this error case ?
> 
<...>/<port_num>/rate file exist.

rate_show() has invalid active_width as expected due to nonexistence of SFP.
So sysfs call return invalid value.
We don't have invalid_active_width defined right now.
So ibstat and other applications should not crash on such valid errors.

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

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
  2017-10-27 18:32     ` Parav Pandit
@ 2017-10-27 20:18         ` Hal Rosenstock
  -1 siblings, 0 replies; 28+ messages in thread
From: Hal Rosenstock @ 2017-10-27 20:18 UTC (permalink / raw)
  To: Parav Pandit, Thomas Bogendoerfer, Matan Barak, Leon Romanovsky,
	Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Ghazale Hosseinabadi

On 10/27/2017 2:32 PM, Parav Pandit wrote:
> However I believe that ibstat tool should be enhanced to report unknown port speed instead of expecting drivers to supply some random number like this.

ibstat gets the rate from libibumad via /sys/class/infiniband/<IB device>/ports/<port number>/rate file which is supposed to be populated by the driver. Is there no rate file in this error case ?

-- 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] 28+ messages in thread

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
@ 2017-10-27 20:18         ` Hal Rosenstock
  0 siblings, 0 replies; 28+ messages in thread
From: Hal Rosenstock @ 2017-10-27 20:18 UTC (permalink / raw)
  To: Parav Pandit, Thomas Bogendoerfer, Matan Barak, Leon Romanovsky,
	Doug Ledford, linux-rdma, linux-kernel
  Cc: Ghazale Hosseinabadi

On 10/27/2017 2:32 PM, Parav Pandit wrote:
> However I believe that ibstat tool should be enhanced to report unknown port speed instead of expecting drivers to supply some random number like this.

ibstat gets the rate from libibumad via /sys/class/infiniband/<IB device>/ports/<port number>/rate file which is supposed to be populated by the driver. Is there no rate file in this error case ?

-- Hal

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

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
  2017-10-27 12:30 ` Thomas Bogendoerfer
@ 2017-10-27 19:35     ` Leon Romanovsky
  -1 siblings, 0 replies; 28+ messages in thread
From: Leon Romanovsky @ 2017-10-27 19:35 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Matan Barak, Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1627 bytes --]

On Fri, Oct 27, 2017 at 02:30:11PM +0200, Thomas Bogendoerfer wrote:
> If there is no SFP module plugged into a port of mlx5 cards
> 'cat /sys/class/infniband/mlx5_X/ports/1/rate' returns Invalid argument.
> This causes tools like 'ibstat' to malfunction. This change adjusts mlx5
> to all other RoCE/iWarp drivers, which always return valid speed/width.

Like Parav, I have mixed feelings about such change. It returns EINVAL
if nothing is connected and it is right thing to do. It is hard to call
"valid speed/width" for unconnected port.

I would like to have ibstat and other drivers fixed instead of
converting mlx5 to be wrong.

Proposed change breaks existing scripts.

Thanks

>
> Signed-off-by: Thomas Bogendoerfer <tbogendoerfer-l3A5Bk7waGM@public.gmane.org>
> ---
>  drivers/infiniband/hw/mlx5/main.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 260f8be1d0ed..4388618e3434 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -246,7 +246,10 @@ static int translate_eth_proto_oper(u32 eth_proto_oper, u8 *active_speed,
>  		*active_speed = IB_SPEED_EDR;
>  		break;
>  	default:
> -		return -EINVAL;
> +		/* Unknown */
> +		*active_width = IB_WIDTH_1X;
> +		*active_speed = IB_SPEED_SDR;
> +		break;
>  	}
>
>  	return 0;
> --
> 2.12.3
>
> --
> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
@ 2017-10-27 19:35     ` Leon Romanovsky
  0 siblings, 0 replies; 28+ messages in thread
From: Leon Romanovsky @ 2017-10-27 19:35 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: Matan Barak, Doug Ledford, linux-rdma, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1582 bytes --]

On Fri, Oct 27, 2017 at 02:30:11PM +0200, Thomas Bogendoerfer wrote:
> If there is no SFP module plugged into a port of mlx5 cards
> 'cat /sys/class/infniband/mlx5_X/ports/1/rate' returns Invalid argument.
> This causes tools like 'ibstat' to malfunction. This change adjusts mlx5
> to all other RoCE/iWarp drivers, which always return valid speed/width.

Like Parav, I have mixed feelings about such change. It returns EINVAL
if nothing is connected and it is right thing to do. It is hard to call
"valid speed/width" for unconnected port.

I would like to have ibstat and other drivers fixed instead of
converting mlx5 to be wrong.

Proposed change breaks existing scripts.

Thanks

>
> Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
> ---
>  drivers/infiniband/hw/mlx5/main.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 260f8be1d0ed..4388618e3434 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -246,7 +246,10 @@ static int translate_eth_proto_oper(u32 eth_proto_oper, u8 *active_speed,
>  		*active_speed = IB_SPEED_EDR;
>  		break;
>  	default:
> -		return -EINVAL;
> +		/* Unknown */
> +		*active_width = IB_WIDTH_1X;
> +		*active_speed = IB_SPEED_SDR;
> +		break;
>  	}
>
>  	return 0;
> --
> 2.12.3
>
> --
> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* RE: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
  2017-10-27 12:30 ` Thomas Bogendoerfer
@ 2017-10-27 18:32     ` Parav Pandit
  -1 siblings, 0 replies; 28+ messages in thread
From: Parav Pandit @ 2017-10-27 18:32 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Matan Barak, Leon Romanovsky, Doug Ledford,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Ghazale Hosseinabadi



> -----Original Message-----
> From: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-rdma-
> owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Thomas Bogendoerfer
> Sent: Friday, October 27, 2017 7:30 AM
> To: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>; Leon Romanovsky
> <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>; Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>; linux-
> rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Subject: [PATCH] IB/mlx5: give back valid speed/width even without plugged in
> SFP module
> 
> If there is no SFP module plugged into a port of mlx5 cards 'cat
> /sys/class/infniband/mlx5_X/ports/1/rate' returns Invalid argument.
> This causes tools like 'ibstat' to malfunction. This change adjusts mlx5 to all
> other RoCE/iWarp drivers, which always return valid speed/width.
> 
> Signed-off-by: Thomas Bogendoerfer <tbogendoerfer-l3A5Bk7waGM@public.gmane.org>
> ---
>  drivers/infiniband/hw/mlx5/main.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/mlx5/main.c
> b/drivers/infiniband/hw/mlx5/main.c
> index 260f8be1d0ed..4388618e3434 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -246,7 +246,10 @@ static int translate_eth_proto_oper(u32
> eth_proto_oper, u8 *active_speed,
>  		*active_speed = IB_SPEED_EDR;
>  		break;
>  	default:
> -		return -EINVAL;
> +		/* Unknown */
> +		*active_width = IB_WIDTH_1X;
> +		*active_speed = IB_SPEED_SDR;
> +		break;
>  	}
> 
>  	return 0;
> --
> 2.12.3

Similar issue was reported by Ghazale in offline email and she also provided similar patch.
I added her in this mail thread.
Please add below reported-by tag if you find it appropriate.
Reported-by: Ghazale Hosseinabadi <ghazale.hosseinabadi-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

Thanks for the short term fix.
However I believe that ibstat tool should be enhanced to report unknown port speed instead of expecting drivers to supply some random number like this.
Similar tools such as ethtool does report unknown port speed as unknown like below output which doesn't have SFP.

ethtool ens2f0
        <....>
        Speed: Unknown!
        Duplex: Unknown! (255)
        <....>
        Link detected: no
--
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] 28+ messages in thread

* RE: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
@ 2017-10-27 18:32     ` Parav Pandit
  0 siblings, 0 replies; 28+ messages in thread
From: Parav Pandit @ 2017-10-27 18:32 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Matan Barak, Leon Romanovsky, Doug Ledford,
	linux-rdma, linux-kernel
  Cc: Ghazale Hosseinabadi



> -----Original Message-----
> From: linux-rdma-owner@vger.kernel.org [mailto:linux-rdma-
> owner@vger.kernel.org] On Behalf Of Thomas Bogendoerfer
> Sent: Friday, October 27, 2017 7:30 AM
> To: Matan Barak <matanb@mellanox.com>; Leon Romanovsky
> <leonro@mellanox.com>; Doug Ledford <dledford@redhat.com>; linux-
> rdma@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH] IB/mlx5: give back valid speed/width even without plugged in
> SFP module
> 
> If there is no SFP module plugged into a port of mlx5 cards 'cat
> /sys/class/infniband/mlx5_X/ports/1/rate' returns Invalid argument.
> This causes tools like 'ibstat' to malfunction. This change adjusts mlx5 to all
> other RoCE/iWarp drivers, which always return valid speed/width.
> 
> Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
> ---
>  drivers/infiniband/hw/mlx5/main.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/mlx5/main.c
> b/drivers/infiniband/hw/mlx5/main.c
> index 260f8be1d0ed..4388618e3434 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -246,7 +246,10 @@ static int translate_eth_proto_oper(u32
> eth_proto_oper, u8 *active_speed,
>  		*active_speed = IB_SPEED_EDR;
>  		break;
>  	default:
> -		return -EINVAL;
> +		/* Unknown */
> +		*active_width = IB_WIDTH_1X;
> +		*active_speed = IB_SPEED_SDR;
> +		break;
>  	}
> 
>  	return 0;
> --
> 2.12.3

Similar issue was reported by Ghazale in offline email and she also provided similar patch.
I added her in this mail thread.
Please add below reported-by tag if you find it appropriate.
Reported-by: Ghazale Hosseinabadi <ghazale.hosseinabadi@oracle.com>

Thanks for the short term fix.
However I believe that ibstat tool should be enhanced to report unknown port speed instead of expecting drivers to supply some random number like this.
Similar tools such as ethtool does report unknown port speed as unknown like below output which doesn't have SFP.

ethtool ens2f0
        <....>
        Speed: Unknown!
        Duplex: Unknown! (255)
        <....>
        Link detected: no

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

* [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
@ 2017-10-27 12:30 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 28+ messages in thread
From: Thomas Bogendoerfer @ 2017-10-27 12:30 UTC (permalink / raw)
  To: Matan Barak, Leon Romanovsky, Doug Ledford,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

If there is no SFP module plugged into a port of mlx5 cards
'cat /sys/class/infniband/mlx5_X/ports/1/rate' returns Invalid argument.
This causes tools like 'ibstat' to malfunction. This change adjusts mlx5
to all other RoCE/iWarp drivers, which always return valid speed/width.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer-l3A5Bk7waGM@public.gmane.org>
---
 drivers/infiniband/hw/mlx5/main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 260f8be1d0ed..4388618e3434 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -246,7 +246,10 @@ static int translate_eth_proto_oper(u32 eth_proto_oper, u8 *active_speed,
 		*active_speed = IB_SPEED_EDR;
 		break;
 	default:
-		return -EINVAL;
+		/* Unknown */
+		*active_width = IB_WIDTH_1X;
+		*active_speed = IB_SPEED_SDR;
+		break;
 	}
 
 	return 0;
-- 
2.12.3

--
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] 28+ messages in thread

* [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
@ 2017-10-27 12:30 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 28+ messages in thread
From: Thomas Bogendoerfer @ 2017-10-27 12:30 UTC (permalink / raw)
  To: Matan Barak, Leon Romanovsky, Doug Ledford, linux-rdma, linux-kernel

If there is no SFP module plugged into a port of mlx5 cards
'cat /sys/class/infniband/mlx5_X/ports/1/rate' returns Invalid argument.
This causes tools like 'ibstat' to malfunction. This change adjusts mlx5
to all other RoCE/iWarp drivers, which always return valid speed/width.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 drivers/infiniband/hw/mlx5/main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 260f8be1d0ed..4388618e3434 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -246,7 +246,10 @@ static int translate_eth_proto_oper(u32 eth_proto_oper, u8 *active_speed,
 		*active_speed = IB_SPEED_EDR;
 		break;
 	default:
-		return -EINVAL;
+		/* Unknown */
+		*active_width = IB_WIDTH_1X;
+		*active_speed = IB_SPEED_SDR;
+		break;
 	}
 
 	return 0;
-- 
2.12.3

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

end of thread, other threads:[~2017-10-28 11:59 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-27 20:35 [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module Ghazale Hosseinabadi
2017-10-27 20:35 ` Ghazale Hosseinabadi
  -- strict thread matches above, loose matches on Subject: below --
2017-10-27 21:54 Ghazale Hosseinabadi
2017-10-27 21:54 ` Ghazale Hosseinabadi
2017-10-27 22:52 ` Hal Rosenstock
2017-10-27 22:52   ` Hal Rosenstock
     [not found]   ` <0af834ca-52ff-47da-a225-744aab4e59d6-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2017-10-27 23:04     ` Ghazale Hosseinabadi
2017-10-27 23:04       ` Ghazale Hosseinabadi
     [not found]       ` <9be6d049-c3fc-6cf2-8d91-4449f4bcc896-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2017-10-27 23:19         ` Hal Rosenstock
2017-10-27 23:19           ` Hal Rosenstock
2017-10-28  0:17           ` Hal Rosenstock
2017-10-28  0:29             ` Ghazale Hosseinabadi
     [not found]           ` <4dcf0ca6-77ff-bfd3-9f79-c114617f536f-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2017-10-28  0:36             ` Ghazale Hosseinabadi
2017-10-28  0:36               ` Ghazale Hosseinabadi
2017-10-28 10:42             ` Thomas Bogendoerfer
2017-10-28 10:42               ` Thomas Bogendoerfer
2017-10-28 11:59               ` Hal Rosenstock
2017-10-27 12:30 Thomas Bogendoerfer
2017-10-27 12:30 ` Thomas Bogendoerfer
     [not found] ` <20171027123011.10454-1-tbogendoerfer-l3A5Bk7waGM@public.gmane.org>
2017-10-27 18:32   ` Parav Pandit
2017-10-27 18:32     ` Parav Pandit
     [not found]     ` <VI1PR0502MB3008AE9EEBF086840CC06077D15A0-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-10-27 20:18       ` Hal Rosenstock
2017-10-27 20:18         ` Hal Rosenstock
     [not found]         ` <20aece10-1188-6672-bd44-e78c50396445-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2017-10-27 20:33           ` Parav Pandit
2017-10-27 20:33             ` Parav Pandit
2017-10-27 21:30             ` Hal Rosenstock
2017-10-27 19:35   ` Leon Romanovsky
2017-10-27 19:35     ` Leon Romanovsky

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.