|
|
89ea86 |
From bda06d81f41bb1cde16a319728d479cda4b9f295 Mon Sep 17 00:00:00 2001
|
|
|
89ea86 |
From: Ido Schimmel <idosch@nvidia.com>
|
|
|
89ea86 |
Date: Tue, 12 Oct 2021 16:25:24 +0300
|
|
|
89ea86 |
Subject: [PATCH 25/35] sff-8079: Request specific pages for parsing in netlink
|
|
|
89ea86 |
path
|
|
|
89ea86 |
|
|
|
89ea86 |
Convert the SFF-8079 code to request the required EEPROM contents in the
|
|
|
89ea86 |
netlink path as was done for CMIS and SFF-8636. It will allow us to
|
|
|
89ea86 |
remove standard-specific code from the netlink code (i.e.,
|
|
|
89ea86 |
netlink/module-eeprom.c).
|
|
|
89ea86 |
|
|
|
89ea86 |
In addition, in the future, it will allow the netlink path to support
|
|
|
89ea86 |
parsing of SFF-8472.
|
|
|
89ea86 |
|
|
|
89ea86 |
Tested by making sure that the output of 'ethtool -m' does not change
|
|
|
89ea86 |
before and after the patch.
|
|
|
89ea86 |
|
|
|
89ea86 |
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
|
|
|
89ea86 |
---
|
|
|
89ea86 |
internal.h | 2 +-
|
|
|
89ea86 |
netlink/module-eeprom.c | 2 +-
|
|
|
89ea86 |
sfpid.c | 20 ++++++++++++++++++--
|
|
|
89ea86 |
3 files changed, 20 insertions(+), 4 deletions(-)
|
|
|
89ea86 |
|
|
|
89ea86 |
diff --git a/internal.h b/internal.h
|
|
|
89ea86 |
index 2407d3c223fa..0d9d816ab563 100644
|
|
|
89ea86 |
--- a/internal.h
|
|
|
89ea86 |
+++ b/internal.h
|
|
|
89ea86 |
@@ -385,7 +385,7 @@ int rxclass_rule_del(struct cmd_context *ctx, __u32 loc);
|
|
|
89ea86 |
|
|
|
89ea86 |
/* Module EEPROM parsing code */
|
|
|
89ea86 |
void sff8079_show_all_ioctl(const __u8 *id);
|
|
|
89ea86 |
-void sff8079_show_all_nl(const __u8 *id);
|
|
|
89ea86 |
+int sff8079_show_all_nl(struct cmd_context *ctx);
|
|
|
89ea86 |
|
|
|
89ea86 |
/* Optics diagnostics */
|
|
|
89ea86 |
void sff8472_show_all(const __u8 *id);
|
|
|
89ea86 |
diff --git a/netlink/module-eeprom.c b/netlink/module-eeprom.c
|
|
|
89ea86 |
index f04f8e134223..6d76b8a96461 100644
|
|
|
89ea86 |
--- a/netlink/module-eeprom.c
|
|
|
89ea86 |
+++ b/netlink/module-eeprom.c
|
|
|
89ea86 |
@@ -321,7 +321,7 @@ static void decoder_print(struct cmd_context *ctx)
|
|
|
89ea86 |
|
|
|
89ea86 |
switch (module_id) {
|
|
|
89ea86 |
case SFF8024_ID_SFP:
|
|
|
89ea86 |
- sff8079_show_all_nl(page_zero->data);
|
|
|
89ea86 |
+ sff8079_show_all_nl(ctx);
|
|
|
89ea86 |
break;
|
|
|
89ea86 |
case SFF8024_ID_QSFP:
|
|
|
89ea86 |
case SFF8024_ID_QSFP28:
|
|
|
89ea86 |
diff --git a/sfpid.c b/sfpid.c
|
|
|
89ea86 |
index c214820226d1..621d1e86c278 100644
|
|
|
89ea86 |
--- a/sfpid.c
|
|
|
89ea86 |
+++ b/sfpid.c
|
|
|
89ea86 |
@@ -8,8 +8,13 @@
|
|
|
89ea86 |
*/
|
|
|
89ea86 |
|
|
|
89ea86 |
#include <stdio.h>
|
|
|
89ea86 |
+#include <errno.h>
|
|
|
89ea86 |
#include "internal.h"
|
|
|
89ea86 |
#include "sff-common.h"
|
|
|
89ea86 |
+#include "netlink/extapi.h"
|
|
|
89ea86 |
+
|
|
|
89ea86 |
+#define SFF8079_PAGE_SIZE 0x80
|
|
|
89ea86 |
+#define SFF8079_I2C_ADDRESS_LOW 0x50
|
|
|
89ea86 |
|
|
|
89ea86 |
static void sff8079_show_identifier(const __u8 *id)
|
|
|
89ea86 |
{
|
|
|
89ea86 |
@@ -445,7 +450,18 @@ void sff8079_show_all_ioctl(const __u8 *id)
|
|
|
89ea86 |
sff8079_show_all_common(id);
|
|
|
89ea86 |
}
|
|
|
89ea86 |
|
|
|
89ea86 |
-void sff8079_show_all_nl(const __u8 *id)
|
|
|
89ea86 |
+int sff8079_show_all_nl(struct cmd_context *ctx)
|
|
|
89ea86 |
{
|
|
|
89ea86 |
- sff8079_show_all_common(id);
|
|
|
89ea86 |
+ struct ethtool_module_eeprom request = {
|
|
|
89ea86 |
+ .length = SFF8079_PAGE_SIZE,
|
|
|
89ea86 |
+ .i2c_address = SFF8079_I2C_ADDRESS_LOW,
|
|
|
89ea86 |
+ };
|
|
|
89ea86 |
+ int ret;
|
|
|
89ea86 |
+
|
|
|
89ea86 |
+ ret = nl_get_eeprom_page(ctx, &request);
|
|
|
89ea86 |
+ if (ret < 0)
|
|
|
89ea86 |
+ return ret;
|
|
|
89ea86 |
+ sff8079_show_all_common(request.data);
|
|
|
89ea86 |
+
|
|
|
89ea86 |
+ return 0;
|
|
|
89ea86 |
}
|
|
|
89ea86 |
--
|
|
|
89ea86 |
2.35.1
|
|
|
89ea86 |
|