[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZvrDhfaIe-bgOyVd@shredder.mtl.com>
Date: Mon, 30 Sep 2024 18:28:05 +0300
From: Ido Schimmel <idosch@...dia.com>
To: Krzysztof Olędzki <ole@....pl>
Cc: gal@...dia.com, Tariq Toukan <tariqt@...dia.com>,
Yishai Hadas <yishaih@...dia.com>,
Michal Kubecek <mkubecek@...e.cz>, Jakub Kicinski <kuba@...nel.org>,
Andrew Lunn <andrew@...n.ch>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [mlx4] Mellanox ConnectX2 (MHQH29C aka 26428) and module
diagnostic support (ethtool -m) issues
On Wed, Sep 11, 2024 at 11:46:11PM -0700, Krzysztof Olędzki wrote:
> Sure, I can also try to work on that one. Would mlx5/core/en_ethtool.c
> be a good example of how this should be implemented?
Yes. You can also look at mlxsw_env_get_module_eeprom_by_page() which is
using the same firmware interface as mlx5 (but not mlx4). Basically,
this operation is very simple as far as the driver is concerned. You get
a "3D address" (bank + page + offset) from user space and ask the device
to fetch the required info.
In the case of mlx4 bank is irrelevant so you can always return an error
for "bank != 0". For the rest of the fields in 'struct
ethtool_module_eeprom' the mapping to 'struct mlx4_cable_info' is as
follows (AFAIU):
struct ethtool_module_eeprom::offset -> struct mlx4_cable_info::dev_mem_address
struct ethtool_module_eeprom::length -> struct mlx4_cable_info::size
struct ethtool_module_eeprom::page -> struct mlx4_cable_info::page_num
struct ethtool_module_eeprom::i2c_address -> struct mlx4_cable_info::i2c_addr
Note that mlx4 firmware can only read up to 48 bytes
(MODULE_INFO_MAX_READ), so you need to implement a loop like the one in
mlx5e_get_module_eeprom_by_page(). Also note that extack is available so
try to use it to communicate failures instead of printing to the kernel
log.
Powered by blists - more mailing lists