[action] [PR:463] [optoe] Reset page select byte to 0 before upper memory access on page 0h#464
Merged
mssonicbld merged 1 commit intosonic-net:202411from Feb 14, 2025
Conversation
…e 0h **Description** The optoe kernel driver currently assumes that the page select byte (page 0, byte 127) is set to 0h before accessing the upper memory on page 0h. This assumption causes failures when accessing the module's EEPROM in multiple scenarios. On the contrary, the driver currently sets the page select byte if the intended page to be accessed is > 0 as evident from the below code https://github.com/opencomputeproject/oom/blob/c32499a89dff005e7ff2acb48b33f55543ce5140/optoe/optoe.c#L344-L353 **Impact** If the optoe driver accesses any page except page 0h and the code for restoring the page select byte to 0h fails, subsequent attempts to access the upper memory of page 0h will fail because the page select byte from the previous transaction remains unchanged. https://github.com/opencomputeproject/oom/blob/c32499a89dff005e7ff2acb48b33f55543ce5140/optoe/optoe.c#L373-L392 **Steps to recreate the failure scenario** One way to recreate this issue is: 1. Initiate CDB firmware download operation on a module supporting CDB foreground mode only 2. Kill the process which is downloading the FW 3. Dump the page select byte and ensure it displays a non-zero value 4. Execute sfputil show fwversion EthernetXX CLI and you will observe a traceback. The traceback occurs because the vendor name is read with garbage content, as the page select byte is set to 0x9F instead of 0x0. **Fix** Before optoe accesses any address from upper page 0h, the page select byte is now set to 0. This fix is done only for non-SFP modules to limit the scope of impact. SFP modules require additional handling since the page select byte is on page A2h and NOT A0h unlike non-SFP modules which do not have the concept of A0h and A2h page. **Testing** The fix has been tested on a non-SFP module and it was ensured that the sfputil show fwversion EthernetXX CLI command executes successfully without any traceback. **Logs for testing the fix** ``` root@dut:/home/admin# sfputil firmware download Ethernet496 FIRMWARE_FILE.bin CDB: Starting firmware download Downloading ... [#-----------------------------------] 4% 00:08:07^C Aborted! root@dut:/home/admin# i2cget -f -y 103 0x50 0x7f 0x9f root@dut:/home/admin# sfputil show fwversion Ethernet496 Image A Version: 1.2.3 Image B Version: N/A Factory Image Version: 0.0.0 Running Image: A Committed Image: A Active Firmware: 1.2.3 Inactive Firmware: 170.170.0 root@dut:/home/admin# ``` **Logs for the failure scenario** ``` Initiate CDB firmware download operation on a module supporting CDB foreground mode only Kill the process which is downloading the FW root@dut:/home/admin# sfputil firmware download Ethernet496 FIRMWARE_FILE.bin CDB: Starting firmware download Downloading ... [##----------------------------------] 6% 00:07:57^C Aborted! root@dut:/home/admin# Dump the page select byte and ensure it displays a non-zero value root@dut:/home/admin# i2cget -f -y 103 0x50 0x7f 0x9f Execute sfputil show fwversion EthernetXX CLI and you will observe a traceback. The traceback is seen since the vendor name is being read with garbage content since the page select byte is set to 0x9F and NOT 0x0. root@dut:/home/admin# sfputil show fwversion Ethernet496 Traceback (most recent call last): File "/usr/local/bin/sfputil", line 8, in <module> sys.exit(cli()) ^^^^^ File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 764, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 717, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/sfputil/main.py", line 1215, in fwversion show_firmware_version(physical_port) File "/usr/local/lib/python3.11/dist-packages/sfputil/main.py", line 1185, in show_firmware_version api = sfp.get_xcvr_api() ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/sonic_platform_base/sfp_base.py", line 480, in get_xcvr_api self.refresh_xcvr_api() File "/usr/local/lib/python3.11/dist-packages/sonic_platform_base/sfp_base.py", line 470, in refresh_xcvr_api self._xcvr_api = self._xcvr_api_factory.create_xcvr_api() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py", line 79, in create_xcvr_api vendor_name = self._get_vendor_name() ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py", line 64, in _get_vendor_name vendor_name = name_data.decode() ^^^^^^^^^^^^^^^^^^ UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 2: invalid start byte Invalid vendor name content: 80: 01 04 00 80 04 ff 00 00 00 00 77 00 00 00 00 00 ??.??.....w..... 90: 49 ``` MSFT ADO - 31376026 Signed-off-by: Mihir Patel <patelmi@microsoft.com>
Author
|
Original PR: #463 |
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…e 0h (sonic-net#464) (#8) ```<br>* 558827d - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-02-15) [Sonic Automation] * a5e9588 - (origin/202411) [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…e 0h (sonic-net#464) (#9) ```<br>* 34deba7 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-02-16) [Sonic Automation] * a5e9588 - (origin/202411) [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…e 0h (sonic-net#464) (#10) ```<br>* 01b246e - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-02-17) [Sonic Automation] * a5e9588 - (origin/202411) [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…e 0h (sonic-net#464) (#11) ```<br>* 38e6f4c - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-02-18) [Sonic Automation] * a5e9588 - (origin/202411) [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…e 0h (sonic-net#464) (#12) ```<br>* f90138f - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-02-19) [Sonic Automation] * a5e9588 - (origin/202411) [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…e 0h (sonic-net#464) (#13) ```<br>* f226564 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-02-20) [Sonic Automation] * a5e9588 - (origin/202411) [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…e 0h (sonic-net#464) (#14) ```<br>* 466f61a - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-02-21) [Sonic Automation] * a5e9588 - (origin/202411) [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…e 0h (sonic-net#464) (#15) ```<br>* cde500b - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-02-22) [Sonic Automation] * a5e9588 - (origin/202411) [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…e 0h (sonic-net#464) (#16) ```<br>* 981ff64 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-02-23) [Sonic Automation] * a5e9588 - (origin/202411) [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…e 0h (sonic-net#464) (#17) ```<br>* 3daa06b - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-02-24) [Sonic Automation] * a5e9588 - (origin/202411) [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…e 0h (sonic-net#464) (#18) ```<br>* 0045401 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-02-25) [Sonic Automation] * a5e9588 - (origin/202411) [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…e 0h (sonic-net#464) (#19) ```<br>* e44923a - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-02-26) [Sonic Automation] * a5e9588 - (origin/202411) [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#20) ```<br>* f712bfd - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-02-27) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#21) ```<br>* bd3eb7f - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-02-28) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#22) ```<br>* 6c640cd - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-02-28) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#23) ```<br>* b1b57f4 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-02-28) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#24) ```<br>* f9ee9d3 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-03-01) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#25) ```<br>* 097124f - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-03-02) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#26) ```<br>* 58b244a - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-03-03) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#27) ```<br>* dfdf611 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-03-04) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#28) ```<br>* eed71db - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-03-05) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#29) ```<br>* 3afc515 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-03-06) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#30) ```<br>* 4640068 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-03-07) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#31) ```<br>* 46caa96 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-03-08) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#32) ```<br>* 8811888 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-03-09) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#33) ```<br>* a9e062e - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-03-10) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#34) ```<br>* 4a3b2e3 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-03-11) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#35) ```<br>* 9d26cb7 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-03-12) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#36) ```<br>* b29084b - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-03-13) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#37) ```<br>* 9e07357 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-03-14) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#38) ```<br>* f665ef8 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-03-15) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
…2412 (#39) ```<br>* 2fc0587 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-03-16) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
vivekrnv
pushed a commit
to vivekrnv/sonic-linux-kernel
that referenced
this pull request
Mar 24, 2025
```<br>* 1ef7aa2 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-linux-kernel into 202412 (2025-03-17) [Sonic Automation] * 8bd11c2 - (origin/202411) Revert "[optoe] Reset page select byte to 0 before upper memory access on page 0h" (sonic-net#468) (2025-02-26) [mssonicbld] * a5e9588 - [optoe] Reset page select byte to 0 before upper memory access on page 0h (sonic-net#464) (2025-02-15) [mssonicbld]<br>```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The optoe kernel driver currently assumes that the page select byte (page 0, byte 127) is set to 0h before accessing the upper memory on page 0h.
This assumption causes failures when accessing the module's EEPROM in multiple scenarios.
On the contrary, the driver currently sets the page select byte if the intended page to be accessed is > 0 as evident from the below code
https://github.com/opencomputeproject/oom/blob/c32499a89dff005e7ff2acb48b33f55543ce5140/optoe/optoe.c#L344-L353
Impact
If the optoe driver accesses any page except page 0h and the code for restoring the page select byte to 0h fails, subsequent attempts to
access the upper memory of page 0h will fail because the page select byte from the previous transaction remains unchanged.
https://github.com/opencomputeproject/oom/blob/c32499a89dff005e7ff2acb48b33f55543ce5140/optoe/optoe.c#L373-L392
Steps to recreate the failure scenario
One way to recreate this issue is:
with garbage content, as the page select byte is set to 0x9F instead of 0x0.
Fix
Before optoe accesses any address from upper page 0h, the page select byte is now set to 0.
This fix is done only for non-SFP modules to limit the scope of impact. SFP modules require additional handling since the page select byte
is on page A2h and NOT A0h unlike non-SFP modules which do not have the concept of A0h and A2h page.
Testing
The fix has been tested on a non-SFP module and it was ensured that the sfputil show fwversion EthernetXX CLI command executes successfully without any traceback.
Logs for testing the fix
Logs for the failure scenario
MSFT ADO - 31376026
Signed-off-by: Mihir Patel patelmi@microsoft.com