Skip to contentSkip to conversation

qsfp: Better handling of Page 03h netlink read failure

PATCH Applied Krzysztof Olędzki 4 participants 5 messages Jul 31, 2024 – Aug 8, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 qsfp: Better handling of Page 03h netlink read failure

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)")
---
 qsfp.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
qsfp.c +9 -2
index a2921fb..a3a919d 100644
@@ -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;
Signature · 1 line
2.45.2
Reviewed-by on v2 1/1
#1 lore raw
Quoted 17 lines · Krzysztof Olędzki

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:

Quoted 9 lines
 # 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

Quoted 1 line

Thanks!

#2 lore raw
Quoted 25 lines · Ido Schimmel
Quoted 24 lines · Krzysztof Olędzki

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
 (...)
Quoted 5 lines
Quoted 2 lines
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

maintainer
#3 lore raw
Quoted 6 lines · On Wed, 31 Jul 2024 06:58:08 -0700 Krzysztof Olędzki wrote:
Quoted 2 lines

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 :(

#4 lore raw
In reply to Krzysztof Olędzki
This patch was applied to ethtool/ethtool.git (master) by Michal Kubecek <[email protected]>:

Hello:

This patch was applied to ethtool/ethtool.git (master) by Michal Kubecek <[email protected]>:

Quoted 11 lines · 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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html