|
| 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 | + |
0 commit comments