Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reset active application mode when shutdown interface #12

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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