ethtool/backport-cmis-Rename-CMIS-parsing-functions.patch
Jiantao Xiao 63c347cf61 ethtool: Add support for more CMIS transceiver modules
This commit adds a framework to support querying CMIS module information

category: Feature
bugzilla: https://gitee.com/src-openeuler/ethtool/issues/I9VV62
2024-06-07 11:08:12 +08:00

99 lines
3.1 KiB
Diff

From 02055157bf85134de4551e496e3fb39930f68731 Mon Sep 17 00:00:00 2001
From: Ido Schimmel <idosch@nvidia.com>
Date: Tue, 12 Oct 2021 16:25:12 +0300
Subject: [PATCH 07/26] cmis: Rename CMIS parsing functions
Currently, there are two CMIS parsing functions. qsfp_dd_show_all() and
cmis_show_all(). The former is called from the IOCTL path with a buffer
containing EEPROM contents and the latter is called from the netlink
path with pointer to individual EEPROM pages.
Rename them with '_ioctl' and '_nl' suffixes to make the distinction
clear.
In subsequent patches, these two functions will only differ in the way
they initialize the CMIS memory map for parsing, while the parsing code
itself will be shared between the two.
commit: 795f420
Reference: https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/commit/?id=795f42092f20
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
cmis.c | 6 +++---
cmis.h | 6 +++---
netlink/module-eeprom.c | 2 +-
qsfp.c | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/cmis.c b/cmis.c
index 591cc72..68c5b2d 100644
--- a/cmis.c
+++ b/cmis.c
@@ -326,7 +326,7 @@ static void cmis_show_vendor_info(const __u8 *id)
"CLEI code");
}
-void qsfp_dd_show_all(const __u8 *id)
+void cmis_show_all_ioctl(const __u8 *id)
{
cmis_show_identifier(id);
cmis_show_power_info(id);
@@ -340,8 +340,8 @@ void qsfp_dd_show_all(const __u8 *id)
cmis_show_rev_compliance(id);
}
-void cmis_show_all(const struct ethtool_module_eeprom *page_zero,
- const struct ethtool_module_eeprom *page_one)
+void cmis_show_all_nl(const struct ethtool_module_eeprom *page_zero,
+ const struct ethtool_module_eeprom *page_one)
{
const __u8 *page_zero_data = page_zero->data;
diff --git a/cmis.h b/cmis.h
index e3012cc..734b90f 100644
--- a/cmis.h
+++ b/cmis.h
@@ -120,9 +120,9 @@
#define YESNO(x) (((x) != 0) ? "Yes" : "No")
#define ONOFF(x) (((x) != 0) ? "On" : "Off")
-void qsfp_dd_show_all(const __u8 *id);
+void cmis_show_all_ioctl(const __u8 *id);
-void cmis_show_all(const struct ethtool_module_eeprom *page_zero,
- const struct ethtool_module_eeprom *page_one);
+void cmis_show_all_nl(const struct ethtool_module_eeprom *page_zero,
+ const struct ethtool_module_eeprom *page_one);
#endif /* CMIS_H__ */
diff --git a/netlink/module-eeprom.c b/netlink/module-eeprom.c
index 48cd2cc..fc4ef1a 100644
--- a/netlink/module-eeprom.c
+++ b/netlink/module-eeprom.c
@@ -332,7 +332,7 @@ static void decoder_print(void)
break;
case SFF8024_ID_QSFP_DD:
case SFF8024_ID_DSFP:
- cmis_show_all(page_zero, page_one);
+ cmis_show_all_nl(page_zero, page_one);
break;
default:
dump_hex(stdout, page_zero->data, page_zero->length, page_zero->offset);
diff --git a/qsfp.c b/qsfp.c
index 3f37f10..27fdd3b 100644
--- a/qsfp.c
+++ b/qsfp.c
@@ -856,7 +856,7 @@ static void sff8636_show_page_zero(const __u8 *id)
void sff8636_show_all(const __u8 *id, __u32 eeprom_len)
{
if (id[SFF8636_ID_OFFSET] == SFF8024_ID_QSFP_DD) {
- qsfp_dd_show_all(id);
+ cmis_show_all_ioctl(id);
return;
}
--
2.30.0