Skip to content

Commit 6847319

Browse files
mihirpat1Staphyloprgeor
authored
Read ID register for optoe1 to find pageable bit in optoe driver (sonic-net#308)
* Fixes for emmc unreliability (sonic-net#270) * Read ID register to find pageable bit in optoe driver Signed-off-by: Mihir Patel <[email protected]> * Modified comment in code to make it QSFP specific * Changed QSFP+ to QSFP28 in comment * Added performance stats related to EEPROM read --------- Signed-off-by: Mihir Patel <[email protected]> Co-authored-by: Samuel Angebault <[email protected]> Co-authored-by: Prince George <[email protected]>
1 parent 42ad073 commit 6847319

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
From cb4523bb02cb6228e3e8e5f3333e6af9a1b15466 Mon Sep 17 00:00:00 2001
2+
From: Mihir Patel <[email protected]>
3+
Date: Fri, 10 Mar 2023 06:52:27 +0000
4+
Subject: [PATCH] Read ID register to find pageable bit in optoe driver
5+
6+
The current optoe driver looks at bit 2 for all optoe1
7+
(dev_class as ONE_ADDR) transceivers to detect if it's pageable or not.
8+
However, for QSFP28 w/ CMIS optics, some platforms use it as optoe1
9+
and not optoe3. With CMIS, the pageable bit has now changed to bit 7 for
10+
the same register. This causes incorrect behavior when the driver checks
11+
for pageability on QSFP28 w/ CMIS transceiver and hence, we need to
12+
read the transceiver ID to see if the transceiver is CMIS based and then
13+
find the relevant pageable bit.
14+
15+
Test result summary
16+
Tested the changes on a switch with a 100G CMIS and non-CMIS transceiver
17+
18+
No significant time difference is seen related to EEPROM read after adding
19+
the current changes. Below stats were taken for a 100G CMIS based
20+
transceiver with making it as optoe3 v/s optoe1
21+
22+
Test stats (average time taken after 3 dumps)
23+
Time to dump first 4096B from EEPROM with transceiver as optoe3 - 914ms
24+
Time to dump first 4096B from EEPROM with transceiver as optoe1 - 911ms
25+
26+
Signed-off-by: Mihir Patel <[email protected]>
27+
---
28+
drivers/misc/eeprom/optoe.c | 20 +++++++++++++++++++-
29+
1 file changed, 19 insertions(+), 1 deletion(-)
30+
31+
diff --git a/drivers/misc/eeprom/optoe.c b/drivers/misc/eeprom/optoe.c
32+
index 62294392c..f34bfe88b 100644
33+
--- a/drivers/misc/eeprom/optoe.c
34+
+++ b/drivers/misc/eeprom/optoe.c
35+
@@ -630,7 +630,25 @@ static ssize_t optoe_page_legal(struct optoe_data *optoe,
36+
return status; /* error out (no module?) */
37+
38+
if (optoe->dev_class == ONE_ADDR) {
39+
- not_pageable = QSFP_NOT_PAGEABLE;
40+
+ u8 idRegVal;
41+
+
42+
+ status = optoe_eeprom_read(optoe, client, &idRegVal,
43+
+ OPTOE_ID_REG, 1);
44+
+ if (status < 0)
45+
+ return status; /* error out (no module?) */
46+
+
47+
+ /*
48+
+ * For QSFP28 with CMIS optic, if userspace has dev_class as ONE_ADDR,
49+
+ * the driver looks at the incorrect bit to find if it is pageable.
50+
+ * Below check ensures we read the appropriate bit for such QSFP28 CMIS
51+
+ * compliant optics with dev_class as ONE_ADDR
52+
+ * The ID values below are based on the SFF-8024 spec (Page 0, byte 0)
53+
+ * for CMIS optics
54+
+ */
55+
+ if (idRegVal == 0x18 || idRegVal == 0x19 || idRegVal == 0x1e)
56+
+ not_pageable = CMIS_NOT_PAGEABLE;
57+
+ else
58+
+ not_pageable = QSFP_NOT_PAGEABLE;
59+
} else {
60+
not_pageable = CMIS_NOT_PAGEABLE;
61+
}
62+
--
63+
2.25.1
64+

patch/series

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ driver-support-optoe-chunk-offset-fix.patch
3030
driver-support-optoe-QSFP_DD.patch
3131
driver-support-optoe-write-max.patch
3232
driver-support-optoe-twoaddr-a2h-access.patch
33+
driver-support-optoe-oneaddr-pageable.patch
3334
driver-net-tg3-add-param-short-preamble-and-reset.patch
3435
0004-dt-bindings-hwmon-Add-missing-documentation-for-lm75.patch
3536
0005-dt-bindings-hwmon-Add-tmp75b-to-lm75.txt.patch

0 commit comments

Comments
 (0)