This commit adds a framework to support querying CMIS module information category: Feature bugzilla: https://gitee.com/src-openeuler/ethtool/issues/I9VV62
105 lines
3.2 KiB
Diff
105 lines
3.2 KiB
Diff
From a9e34753118e1fea1cb5d7dc7ad09b8b66fa926f Mon Sep 17 00:00:00 2001
|
|
From: Ido Schimmel <idosch@nvidia.com>
|
|
Date: Tue, 12 Oct 2021 16:25:20 +0300
|
|
Subject: [PATCH 15/26] sff-8079: Split SFF-8079 parsing function
|
|
|
|
SFF-8079, unlike CMIS and SFF-8636, only has a single page and therefore
|
|
its parsing function (i.e., sff8079_show_all()) is called from both the
|
|
IOCTL and netlink paths with a buffer pointing to that single page.
|
|
|
|
In future patches, the netlink code (i.e., netlink/module-eeprom.c) will
|
|
no longer call the SFF-8079 code with a buffer pointing to the first 128
|
|
bytes of the EEPROM. Instead, the SFF-8079 code will need to request the
|
|
needed EEPROM data, as will be done in CMIS and SFF-8636.
|
|
|
|
Therefore, as a preparation for this change, split the main parsing
|
|
function into IOCTL and netlink variants.
|
|
|
|
No functional changes intended.
|
|
|
|
commit: 9fdf45c
|
|
Reference: https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/commit/?id=9fdf45ca1726
|
|
|
|
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
|
|
---
|
|
ethtool.c | 4 ++--
|
|
internal.h | 3 ++-
|
|
netlink/module-eeprom.c | 2 +-
|
|
sfpid.c | 12 +++++++++++-
|
|
4 files changed, 16 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/ethtool.c b/ethtool.c
|
|
index fa5a347..461d1f2 100644
|
|
--- a/ethtool.c
|
|
+++ b/ethtool.c
|
|
@@ -4901,10 +4901,10 @@ static int do_getmodule(struct cmd_context *ctx)
|
|
switch (modinfo.type) {
|
|
#ifdef ETHTOOL_ENABLE_PRETTY_DUMP
|
|
case ETH_MODULE_SFF_8079:
|
|
- sff8079_show_all(eeprom->data);
|
|
+ sff8079_show_all_ioctl(eeprom->data);
|
|
break;
|
|
case ETH_MODULE_SFF_8472:
|
|
- sff8079_show_all(eeprom->data);
|
|
+ sff8079_show_all_ioctl(eeprom->data);
|
|
sff8472_show_all(eeprom->data);
|
|
break;
|
|
case ETH_MODULE_SFF_8436:
|
|
diff --git a/internal.h b/internal.h
|
|
index ed4f180..aa033ca 100644
|
|
--- a/internal.h
|
|
+++ b/internal.h
|
|
@@ -387,7 +387,8 @@ int rxclass_rule_ins(struct cmd_context *ctx,
|
|
int rxclass_rule_del(struct cmd_context *ctx, __u32 loc);
|
|
|
|
/* Module EEPROM parsing code */
|
|
-void sff8079_show_all(const __u8 *id);
|
|
+void sff8079_show_all_ioctl(const __u8 *id);
|
|
+void sff8079_show_all_nl(const __u8 *id);
|
|
|
|
/* Optics diagnostics */
|
|
void sff8472_show_all(const __u8 *id);
|
|
diff --git a/netlink/module-eeprom.c b/netlink/module-eeprom.c
|
|
index 18b1abb..101d594 100644
|
|
--- a/netlink/module-eeprom.c
|
|
+++ b/netlink/module-eeprom.c
|
|
@@ -323,7 +323,7 @@ static void decoder_print(void)
|
|
|
|
switch (module_id) {
|
|
case SFF8024_ID_SFP:
|
|
- sff8079_show_all(page_zero->data);
|
|
+ sff8079_show_all_nl(page_zero->data);
|
|
break;
|
|
case SFF8024_ID_QSFP:
|
|
case SFF8024_ID_QSFP28:
|
|
diff --git a/sfpid.c b/sfpid.c
|
|
index da2b3f4..c214820 100644
|
|
--- a/sfpid.c
|
|
+++ b/sfpid.c
|
|
@@ -396,7 +396,7 @@ static void sff8079_show_options(const __u8 *id)
|
|
printf("%s Power level 3 requirement\n", pfx);
|
|
}
|
|
|
|
-void sff8079_show_all(const __u8 *id)
|
|
+static void sff8079_show_all_common(const __u8 *id)
|
|
{
|
|
sff8079_show_identifier(id);
|
|
if (((id[0] == 0x02) || (id[0] == 0x03)) && (id[1] == 0x04)) {
|
|
@@ -439,3 +439,13 @@ void sff8079_show_all(const __u8 *id)
|
|
sff8079_show_ascii(id, 84, 91, "Date code");
|
|
}
|
|
}
|
|
+
|
|
+void sff8079_show_all_ioctl(const __u8 *id)
|
|
+{
|
|
+ sff8079_show_all_common(id);
|
|
+}
|
|
+
|
|
+void sff8079_show_all_nl(const __u8 *id)
|
|
+{
|
|
+ sff8079_show_all_common(id);
|
|
+}
|
|
--
|
|
2.30.0
|
|
|