Skip to content

Commit

Permalink
[Cloudlight] QSFP-DD FW upgrade doesn't work (sonic-net#257)
Browse files Browse the repository at this point in the history
- Description
Waiting a delay in "run_fw_image" to ensure it is really executed.
Return a special package when get none in "get_module_fw_info".

- Motivation and Context
"run_fw_image" will be executed after a delay which according to run cmd, waiting the delay in "run_fw_image" to avoid aother cmd sent before it really executing.
CDB cmds will maybe cause several seconds NACK or stretching on i2c bus depend on implementation of module vendor, handling this situation for compatible with different implementation.
  • Loading branch information
CliveNi committed Sep 1, 2022
1 parent fc05712 commit af76464
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sonic_platform_base/sonic_xcvr/api/public/cmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,10 @@ def get_module_fw_info(self):

# get fw info (CMD 0100h)
rpllen, rpl_chkcode, rpl = self.cdb.get_fw_info()
# Interface NACK or timeout
if (rpllen is None) or (rpl_chkcode is None):
return {'status': False, 'info': "Interface fail", 'result': 0} # Return result 0 for distinguishing CDB is maybe in busy or failure.

# password issue
if self.cdb.cdb_chkcode(rpl) != rpl_chkcode:
string = 'Get module FW info: Need to enter password\n'
Expand Down
2 changes: 2 additions & 0 deletions sonic_platform_base/sonic_xcvr/api/public/cmisCDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ def run_fw_image(self, mode = 0x01):
cmd[137-INIT_OFFSET] = mode
cmd[138-INIT_OFFSET] = 2 # Delay to Reset 512 ms
cmd[133-INIT_OFFSET] = self.cdb_chkcode(cmd)
delay = int.from_bytes(cmd[138-INIT_OFFSET:138+2-INIT_OFFSET], byteorder='big') + 50 # Add few ms on setting time.
self.write_cdb(cmd)
status = self.cdb1_chkstatus()
if (status != 0x1):
Expand All @@ -444,6 +445,7 @@ def run_fw_image(self, mode = 0x01):
else:
txt = 'Run firmware status: Success'
logger.info(txt)
time.sleep(delay/1000) # Wait "delay time" to avoid other cmd sent before "run_fw_image" start.
return status

# Commit FW image
Expand Down

0 comments on commit af76464

Please sign in to comment.