summaryrefslogtreecommitdiff
path: root/backport-qsfp-Better-handling-of-Page-03h-netlink-read-failur.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2025-08-07 06:49:01 +0000
committerCoprDistGit <infra@openeuler.org>2025-08-07 06:49:01 +0000
commit8765044a415eaa071b3bd4217b30057af8dcf5b7 (patch)
tree45835ec5a8f37c44c826c83ceb8ba0095b54598d /backport-qsfp-Better-handling-of-Page-03h-netlink-read-failur.patch
parentc2027a35dbf73cd104fac843c4cabb074d99f36d (diff)
automatic import of ethtoolopeneuler22.03_LTS
Diffstat (limited to 'backport-qsfp-Better-handling-of-Page-03h-netlink-read-failur.patch')
-rw-r--r--backport-qsfp-Better-handling-of-Page-03h-netlink-read-failur.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/backport-qsfp-Better-handling-of-Page-03h-netlink-read-failur.patch b/backport-qsfp-Better-handling-of-Page-03h-netlink-read-failur.patch
new file mode 100644
index 0000000..0a01537
--- /dev/null
+++ b/backport-qsfp-Better-handling-of-Page-03h-netlink-read-failur.patch
@@ -0,0 +1,61 @@
+From e1a65d47551f3a9276767f482d1cf9a55c2b5460 Mon Sep 17 00:00:00 2001
+From: Krzysztof Olędzki <ole@ans.pl>
+Date: Tue, 30 Jul 2024 17:49:33 -0700
+Subject: 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)")
+Signed-off-by: Krzysztof Piotr Oledzki <ole@ans.pl>
+Reviewed-by: Ido Schimmel <idosch@nvidia.com>
+---
+ 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;
+--
+cgit 1.2.3-korg
+