public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module
@ 2017-10-27 12:30 Thomas Bogendoerfer
       [not found] ` <20171027123011.10454-1-tbogendoerfer-l3A5Bk7waGM@public.gmane.org>
  0 siblings, 1 reply; 14+ 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] 14+ 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; 14+ 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] 14+ 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
  0 siblings, 1 reply; 14+ 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] 14+ messages in thread

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

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

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