public inbox for linux-kernel@vger.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 21:54 Ghazale Hosseinabadi
  2017-10-27 22:52 ` Hal Rosenstock
  0 siblings, 1 reply; 16+ 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] 16+ 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; 16+ 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] 16+ messages in thread
* [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
  2017-10-27 19:35 ` Leon Romanovsky
  0 siblings, 2 replies; 16+ 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] 16+ messages in thread

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

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-27 21:54 [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module Ghazale Hosseinabadi
2017-10-27 22:52 ` Hal Rosenstock
2017-10-27 23:04   ` Ghazale Hosseinabadi
2017-10-27 23:19     ` Hal Rosenstock
2017-10-28  0:17       ` Hal Rosenstock
2017-10-28  0:29         ` Ghazale Hosseinabadi
2017-10-28  0:36       ` Ghazale Hosseinabadi
2017-10-28 10:42       ` Thomas Bogendoerfer
2017-10-28 11:59         ` Hal Rosenstock
  -- strict thread matches above, loose matches on Subject: below --
2017-10-27 20:35 Ghazale Hosseinabadi
2017-10-27 12:30 Thomas Bogendoerfer
2017-10-27 18:32 ` Parav Pandit
2017-10-27 20:18   ` Hal Rosenstock
2017-10-27 20:33     ` Parav Pandit
2017-10-27 21:30       ` Hal Rosenstock
2017-10-27 19:35 ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox