linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Tariq Toukan <tariqt@nvidia.com>
Cc: Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Mark Bloch <mbloch@nvidia.com>, Leon Romanovsky <leon@kernel.org>,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org, Gal Pressman <gal@nvidia.com>,
	Alex Lazar <alazar@nvidia.com>
Subject: Re: [PATCH net] net/mlx5e: Fix return value in case of module EEPROM read error
Date: Wed, 5 Nov 2025 10:27:50 +0000	[thread overview]
Message-ID: <aQsmpgIU-cbbRykF@horms.kernel.org> (raw)
In-Reply-To: <1762265736-1028868-1-git-send-email-tariqt@nvidia.com>

On Tue, Nov 04, 2025 at 04:15:36PM +0200, Tariq Toukan wrote:
> From: Gal Pressman <gal@nvidia.com>
> 
> mlx5e_get_module_eeprom_by_page() has weird error handling.
> 
> First, it is treating -EINVAL as a special case, but it is unclear why.
> 
> Second, it tries to fail "gracefully" by returning the number of bytes
> read even in case of an error. This results in wrongly returning
> success (0 return value) if the error occurs before any bytes were
> read.
> 
> Simplify the error handling by returning an error when such occurs. This
> also aligns with the error handling we have in mlx5e_get_module_eeprom()
> for the old API.
> 
> This fixes the following case where the query fails, but userspace
> ethtool wrongly treats it as success and dumps an output:
> 
>   # ethtool -m eth2
>   netlink warning: mlx5_core: Query module eeprom by page failed, read 0 bytes, err -5
>   netlink warning: mlx5_core: Query module eeprom by page failed, read 0 bytes, err -5
>   Offset		Values
>   ------		------
>   0x0000:		00 00 00 00 05 00 04 00 00 00 00 00 05 00 05 00
>   0x0010:		00 00 00 00 05 00 06 00 50 00 00 00 67 65 20 66
>   0x0020:		61 69 6c 65 64 2c 20 72 65 61 64 20 30 20 62 79
>   0x0030:		74 65 73 2c 20 65 72 72 20 2d 35 00 14 00 03 00
>   0x0040:		08 00 01 00 03 00 00 00 08 00 02 00 1a 00 00 00
>   0x0050:		14 00 04 00 08 00 01 00 04 00 00 00 08 00 02 00
>   0x0060:		0e 00 00 00 14 00 05 00 08 00 01 00 05 00 00 00
>   0x0070:		08 00 02 00 1a 00 00 00 14 00 06 00 08 00 01 00
> 
> Fixes: e109d2b204da ("net/mlx5: Implement get_module_eeprom_by_page()")
> Signed-off-by: Gal Pressman <gal@nvidia.com>
> Reviewed-by: Alex Lazar <alazar@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>

Thanks for the detailed description.

Reviewed-by: Simon Horman <horms@kernel.org>

  reply	other threads:[~2025-11-05 10:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04 14:15 [PATCH net] net/mlx5e: Fix return value in case of module EEPROM read error Tariq Toukan
2025-11-05 10:27 ` Simon Horman [this message]
2025-11-06  1:50 ` patchwork-bot+netdevbpf

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=aQsmpgIU-cbbRykF@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=alazar@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.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;
as well as URLs for NNTP newsgroup(s).