From: "Krzysztof Olędzki" <ole@ans.pl>
To: Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Tariq Toukan <tariqt@nvidia.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
linux-rdma@vger.kernel.org, Ido Schimmel <idosch@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Gal Pressman <gal@nvidia.com>, Amir Vadai <amirv@mellanox.com>,
Saeed Mahameed <saeedm@mellanox.com>
Subject: Re: [PATCH net-next 3/4] mlx4: Do not mask failure accessing page A2h (0x51)
Date: Mon, 16 Sep 2024 09:37:33 -0700 [thread overview]
Message-ID: <156f9ba7-7b85-46eb-9e70-606b0c4e0498@ans.pl> (raw)
In-Reply-To: <8e5d257f-dc4e-44e9-96c8-7698451a71bb@intel.com>
On 16.09.2024 at 02:44, Przemek Kitszel wrote:
> On 9/12/24 08:41, Krzysztof Olędzki wrote:
>> Due to HW/FW limitation, page A2h (I2C 0x51) may not be available.
>> Do not mask the problem so the userspace can properly handle it.
>>
>> When returning the error to the userspace, use -EIO instead of
>> "err" because it holds MAD_STATUS.
>>
>> Fixes: f5826c8c9d57 ("net/mlx4_en: Fix wrong return value on ioctl EEPROM query failure")
>> Fixes: 32a173c7f9e9 ("net/mlx4_core: Introduce mlx4_get_module_info for cable module info reading")
>> Signed-off-by: Krzysztof Piotr Oledzki <ole@ans.pl>
>> ---
>> drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 2 +-
>> drivers/net/ethernet/mellanox/mlx4/port.c | 9 +--------
>> 2 files changed, 2 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
>> index 4c985d62af12..677917168bd5 100644
>> --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
>> +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
>> @@ -2094,7 +2094,7 @@ static int mlx4_en_get_module_eeprom(struct net_device *dev,
>> en_err(priv,
>> "mlx4_get_module_info i(%d) offset(%d) bytes_to_read(%d) - FAILED (0x%x)\n",
>> i, offset, ee->len - i, ret);
>> - return ret;
>> + return -EIO;
>
> here you are masking also all other explicit error paths of
> mlx4_get_module_info(), what is not good in general, I would instead
> mask below (see next comment)
I agree, for this reason mlx4_get_module_info() seems to be a much better choice.
Will update, thanks!
>
>> }
>>
>> i += ret;
>> diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c
>> index 1ebd459d1d21..8c2a384404f9 100644
>> --- a/drivers/net/ethernet/mellanox/mlx4/port.c
>> +++ b/drivers/net/ethernet/mellanox/mlx4/port.c
>> @@ -2198,14 +2198,7 @@ int mlx4_get_module_info(struct mlx4_dev *dev, u8 port,
>> MLX4_ATTR_CABLE_INFO, port, i2c_addr, offset, size,
>> ret, cable_info_mad_err_str(ret));
>>
>> - if (i2c_addr == I2C_ADDR_HIGH &&
>> - MAD_STATUS_2_CABLE_ERR(ret) == CABLE_INF_I2C_ADDR)
>> - /* Some SFP cables do not support i2c slave
>> - * address 0x51 (high page), abort silently.
>> - */
>> - ret = 0;
>> - else
>> - ret = -ret;
>> + ret = -ret;
>
> this is the only place that mlx4_get_module_info() returns non standard
> error code so, I believe, it's here where we want to overwrite with -EIO
>
> then you could limit to just a single Fixes: tag (the second one)
Sure, I can handle it in mlx4_get_module_info(). I will also need to
cover the return from the call to mlx4_get_module_id() however.
Thanks,
Krzysztof
prev parent reply other threads:[~2024-09-16 16:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-12 6:41 [PATCH net-next 3/4] mlx4: Do not mask failure accessing page A2h (0x51) Krzysztof Olędzki
2024-09-16 9:44 ` Przemek Kitszel
2024-09-16 16:37 ` Krzysztof Olędzki [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=156f9ba7-7b85-46eb-9e70-606b0c4e0498@ans.pl \
--to=ole@ans.pl \
--cc=amirv@mellanox.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=saeedm@mellanox.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox