Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read ID register for optoe1 to find pageable bit in optoe driver #308

Merged
merged 7 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions patch/driver-support-optoe-oneaddr-pageable.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
From cb4523bb02cb6228e3e8e5f3333e6af9a1b15466 Mon Sep 17 00:00:00 2001
From: Mihir Patel <patelmi@microsoft.com>
Date: Fri, 10 Mar 2023 06:52:27 +0000
Subject: [PATCH] Read ID register to find pageable bit in optoe driver

The current optoe driver looks at bit 2 for all optoe1
(dev_class as ONE_ADDR) transceivers to detect if it's pageable or not.
However, for QSFP28 w/ CMIS optics, some platforms use it as optoe1
and not optoe3. With CMIS, the pageable bit has now changed to bit 7 for
the same register. This causes incorrect behavior when the driver checks
for pageability on QSFP28 w/ CMIS transceiver and hence, we need to
read the transceiver ID to see if the transceiver is CMIS based and then
find the relevant pageable bit.

Test result summary
Tested the changes on a switch with a 100G CMIS and non-CMIS transceiver

No significant time difference is seen related to EEPROM read after adding
the current changes. Below stats were taken for a 100G CMIS based
transceiver with making it as optoe3 v/s optoe1

Test stats (average time taken after 3 dumps)
Time to dump first 4096B from EEPROM with transceiver as optoe3 - 914ms
Time to dump first 4096B from EEPROM with transceiver as optoe1 - 911ms

Signed-off-by: Mihir Patel <patelmi@microsoft.com>
---
drivers/misc/eeprom/optoe.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/eeprom/optoe.c b/drivers/misc/eeprom/optoe.c
index 62294392c..f34bfe88b 100644
--- a/drivers/misc/eeprom/optoe.c
+++ b/drivers/misc/eeprom/optoe.c
@@ -630,7 +630,25 @@ static ssize_t optoe_page_legal(struct optoe_data *optoe,
return status; /* error out (no module?) */

if (optoe->dev_class == ONE_ADDR) {
- not_pageable = QSFP_NOT_PAGEABLE;
+ u8 idRegVal;
+
+ status = optoe_eeprom_read(optoe, client, &idRegVal,
+ OPTOE_ID_REG, 1);
+ if (status < 0)
+ return status; /* error out (no module?) */
+
+ /*
+ * For QSFP28 with CMIS optic, if userspace has dev_class as ONE_ADDR,
+ * the driver looks at the incorrect bit to find if it is pageable.
+ * Below check ensures we read the appropriate bit for such QSFP28 CMIS
+ * compliant optics with dev_class as ONE_ADDR
+ * The ID values below are based on the SFF-8024 spec (Page 0, byte 0)
+ * for CMIS optics
+ */
+ if (idRegVal == 0x18 || idRegVal == 0x19 || idRegVal == 0x1e)
+ not_pageable = CMIS_NOT_PAGEABLE;
+ else
+ not_pageable = QSFP_NOT_PAGEABLE;
} else {
not_pageable = CMIS_NOT_PAGEABLE;
}
--
2.25.1

1 change: 1 addition & 0 deletions patch/series
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ driver-support-optoe-chunk-offset-fix.patch
driver-support-optoe-QSFP_DD.patch
driver-support-optoe-write-max.patch
driver-support-optoe-twoaddr-a2h-access.patch
driver-support-optoe-oneaddr-pageable.patch
driver-net-tg3-add-param-short-preamble-and-reset.patch
0004-dt-bindings-hwmon-Add-missing-documentation-for-lm75.patch
0005-dt-bindings-hwmon-Add-tmp75b-to-lm75.txt.patch
Expand Down