netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 ethtool] qsfp: Better handling of Page 03h netlink read failure
@ 2024-07-31  0:49 Krzysztof Olędzki
  2024-07-31  8:20 ` Ido Schimmel
  2024-08-08 13:41 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Krzysztof Olędzki @ 2024-07-31  0:49 UTC (permalink / raw)
  To: Ido Schimmel, Andrew Lunn, Michal Kubecek, Moshe Shemesh,
	netdev@vger.kernel.org, tariqt, Dan Merillat

When dumping the EEPROM contents of a QSFP transceiver module, ethtool
will only ask the kernel to retrieve Upper Page 03h if the module
advertised it as supported.

However, some kernel drivers like mlx4 are currently unable to provide
the page, resulting in the kernel returning an error. Since Upper Page
03h is optional, do not treat the error as fatal. Instead, print an
error message and allow ethtool to continue and parse / print the
contents of the other pages.

Also, clarify potentially cryptic "netlink error: Invalid argument" message.

Before:
 # ethtool -m eth3
 netlink error: Invalid argument

After:
 # ethtool -m eth3
 netlink error: Invalid argument
 Failed to read Upper Page 03h, driver error?
         Identifier                                : 0x0d (QSFP+)
         Extended identifier                       : 0x00
 (...)

Fixes: 25b64c66f58d ("ethtool: Add netlink handler for getmodule (-m)")

Signed-off-by: Krzysztof Piotr Oledzki <ole@ans.pl>
---
 qsfp.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/qsfp.c b/qsfp.c
index a2921fb..a3a919d 100644
--- a/qsfp.c
+++ b/qsfp.c
@@ -1038,8 +1038,15 @@ sff8636_memory_map_init_pages(struct cmd_context *ctx,
 
 	sff8636_request_init(&request, 0x3, SFF8636_PAGE_SIZE);
 	ret = nl_get_eeprom_page(ctx, &request);
-	if (ret < 0)
-		return ret;
+	if (ret < 0) {
+		/* Page 03h is not available due to a bug in the driver.
+		 * This is a non-fatal error and sff8636_dom_parse()
+		 * handles this correctly.
+		 */
+		fprintf(stderr, "Failed to read Upper Page 03h, driver error?\n");
+		return 0;
+	}
+
 	map->page_03h = request.data - SFF8636_PAGE_SIZE;
 
 	return 0;
-- 
2.45.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 ethtool] qsfp: Better handling of Page 03h netlink read failure
  2024-07-31  0:49 [PATCH v2 ethtool] qsfp: Better handling of Page 03h netlink read failure Krzysztof Olędzki
@ 2024-07-31  8:20 ` Ido Schimmel
  2024-07-31 13:58   ` Krzysztof Olędzki
  2024-08-08 13:41 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 5+ messages in thread
From: Ido Schimmel @ 2024-07-31  8:20 UTC (permalink / raw)
  To: Krzysztof Olędzki
  Cc: Andrew Lunn, Michal Kubecek, Moshe Shemesh,
	netdev@vger.kernel.org, tariqt, Dan Merillat

On Tue, Jul 30, 2024 at 05:49:33PM -0700, Krzysztof Olędzki wrote:
> When dumping the EEPROM contents of a QSFP transceiver module, ethtool
> will only ask the kernel to retrieve Upper Page 03h if the module
> advertised it as supported.
> 
> However, some kernel drivers like mlx4 are currently unable to provide
> the page, resulting in the kernel returning an error. Since Upper Page
> 03h is optional, do not treat the error as fatal. Instead, print an
> error message and allow ethtool to continue and parse / print the
> contents of the other pages.
> 
> Also, clarify potentially cryptic "netlink error: Invalid argument" message.
> 
> Before:
>  # ethtool -m eth3
>  netlink error: Invalid argument
> 
> After:
>  # ethtool -m eth3
>  netlink error: Invalid argument
>  Failed to read Upper Page 03h, driver error?
>          Identifier                                : 0x0d (QSFP+)
>          Extended identifier                       : 0x00
>  (...)
> 
> Fixes: 25b64c66f58d ("ethtool: Add netlink handler for getmodule (-m)")
> 

Nit: No blank line between Fixes and SoB, but maybe Michal can fix it up
when applying

> Signed-off-by: Krzysztof Piotr Oledzki <ole@ans.pl>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 ethtool] qsfp: Better handling of Page 03h netlink read failure
  2024-07-31  8:20 ` Ido Schimmel
@ 2024-07-31 13:58   ` Krzysztof Olędzki
  2024-08-01  0:16     ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Olędzki @ 2024-07-31 13:58 UTC (permalink / raw)
  To: Ido Schimmel, Michal Kubecek
  Cc: Andrew Lunn, Moshe Shemesh, netdev@vger.kernel.org, tariqt,
	Dan Merillat

On 31.07.2024 at 01:20, Ido Schimmel wrote:
> On Tue, Jul 30, 2024 at 05:49:33PM -0700, Krzysztof Olędzki wrote:
>> When dumping the EEPROM contents of a QSFP transceiver module, ethtool
>> will only ask the kernel to retrieve Upper Page 03h if the module
>> advertised it as supported.
>>
>> However, some kernel drivers like mlx4 are currently unable to provide
>> the page, resulting in the kernel returning an error. Since Upper Page
>> 03h is optional, do not treat the error as fatal. Instead, print an
>> error message and allow ethtool to continue and parse / print the
>> contents of the other pages.
>>
>> Also, clarify potentially cryptic "netlink error: Invalid argument" message.
>>
>> Before:
>>  # ethtool -m eth3
>>  netlink error: Invalid argument
>>
>> After:
>>  # ethtool -m eth3
>>  netlink error: Invalid argument
>>  Failed to read Upper Page 03h, driver error?
>>          Identifier                                : 0x0d (QSFP+)
>>          Extended identifier                       : 0x00
>>  (...)
>>
>> Fixes: 25b64c66f58d ("ethtool: Add netlink handler for getmodule (-m)")
>>
> 
> Nit: No blank line between Fixes and SoB, but maybe Michal can fix it up
> when applying

Ah... thanks. :/

Michal, please let me know if I should send a v3 or if you can correct this issue.

Krzysztof


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 ethtool] qsfp: Better handling of Page 03h netlink read failure
  2024-07-31 13:58   ` Krzysztof Olędzki
@ 2024-08-01  0:16     ` Jakub Kicinski
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2024-08-01  0:16 UTC (permalink / raw)
  To: Krzysztof Olędzki
  Cc: Ido Schimmel, Michal Kubecek, Andrew Lunn, Moshe Shemesh,
	netdev@vger.kernel.org, tariqt, Dan Merillat

On Wed, 31 Jul 2024 06:58:08 -0700 Krzysztof Olędzki wrote:
> > Nit: No blank line between Fixes and SoB, but maybe Michal can fix it up
> > when applying  
> 
> Ah... thanks. :/
> 
> Michal, please let me know if I should send a v3 or if you can correct this issue.

We haven't heard from Michal in a couple of weeks, I recommend you
correct and repost this one :(

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 ethtool] qsfp: Better handling of Page 03h netlink read failure
  2024-07-31  0:49 [PATCH v2 ethtool] qsfp: Better handling of Page 03h netlink read failure Krzysztof Olędzki
  2024-07-31  8:20 ` Ido Schimmel
@ 2024-08-08 13:41 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-08 13:41 UTC (permalink / raw)
  To: =?utf-8?q?Krzysztof_Ol=C4=99dzki_=3Cole=40ans=2Epl=3E?=
  Cc: idosch, andrew, mkubecek, moshe, netdev, tariqt, git

Hello:

This patch was applied to ethtool/ethtool.git (master)
by Michal Kubecek <mkubecek@suse.cz>:

On Tue, 30 Jul 2024 17:49:33 -0700 you wrote:
> When dumping the EEPROM contents of a QSFP transceiver module, ethtool
> will only ask the kernel to retrieve Upper Page 03h if the module
> advertised it as supported.
> 
> However, some kernel drivers like mlx4 are currently unable to provide
> the page, resulting in the kernel returning an error. Since Upper Page
> 03h is optional, do not treat the error as fatal. Instead, print an
> error message and allow ethtool to continue and parse / print the
> contents of the other pages.
> 
> [...]

Here is the summary with links:
  - [v2,ethtool] qsfp: Better handling of Page 03h netlink read failure
    https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/commit/?id=e1a65d47551f

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-08-08 13:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-31  0:49 [PATCH v2 ethtool] qsfp: Better handling of Page 03h netlink read failure Krzysztof Olędzki
2024-07-31  8:20 ` Ido Schimmel
2024-07-31 13:58   ` Krzysztof Olędzki
2024-08-01  0:16     ` Jakub Kicinski
2024-08-08 13:41 ` patchwork-bot+netdevbpf

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).