Skip to content

Commit

Permalink
reset active applicatio mode when shutdown interface
Browse files Browse the repository at this point in the history
  • Loading branch information
chiourung committed Oct 17, 2024
1 parent 0a10010 commit 5c6eccb
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions sonic-xcvrd/xcvrd/xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,27 @@ def post_port_active_apsel_to_db(self, api, lport, host_lanes_mask):
intf_tbl.set(lport, fvs)
self.log_notice("{}: updated TRANSCEIVER_INFO_TABLE {}".format(lport, tuple_list))

def reset_active_apsel_to_db(self, lport, host_lanes_mask):
tuple_list = []
for lane in range(self.CMIS_MAX_HOST_LANES):
if ((1 << lane) & host_lanes_mask) == 0:
continue
tuple_list.append(('active_apsel_hostlane{}'.format(lane + 1), 'N/A'))
tuple_list.append(('host_lane_count', 'N/A'))
tuple_list.append(('media_lane_count', 'N/A'))
asic_index = self.port_mapping.get_asic_id_for_logical_port(lport)
intf_tbl = self.xcvr_table_helper.get_intf_tbl(asic_index)
if not intf_tbl:
helper_logger.log_warning("Active ApSel db update: TRANSCEIVER_INFO table not found for {}".format(lport))
return
found, _ = intf_tbl.get(lport)
if not found:
helper_logger.log_warning("Active ApSel db update: {} not found in INTF_TABLE".format(lport))
return
fvs = swsscommon.FieldValuePairs(tuple_list)
intf_tbl.set(lport, fvs)
self.log_notice("{}: updated TRANSCEIVER_INFO_TABLE {}".format(lport, tuple_list))

def wait_for_port_config_done(self, namespace):
# Connect to APPL_DB and subscribe to PORT table notifications
appl_db = daemon_base.db_connect("APPL_DB", namespace=namespace)
Expand Down Expand Up @@ -1419,6 +1440,7 @@ def task_worker(self):
self.log_notice("{} Forcing Tx laser OFF".format(lport))
# Force DataPath re-init
api.tx_disable_channel(media_lanes_mask, True)
self.reset_active_apsel_to_db(lport, host_lanes_mask)
self.port_dict[lport]['cmis_state'] = self.CMIS_STATE_READY
continue
# Configure the target output power if ZR module
Expand Down

0 comments on commit 5c6eccb

Please sign in to comment.