You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[xcvrd][y_cable] refactor xcvrd to listen to port probe without locks; fix the get_firmware_version API to sync with download_firmware (sonic-net#216)
Signed-off-by: vaibhav-dahiya [email protected]
Description
This PR refactors the listening of port probes from linkmgr to xcvrd as so that xcvrd does not see timeout messages like these below
Sep 27 22:24:37.490921 SONIC WARNING mux#linkmgrd: link_manager/LinkManagerStateMachine.cpp:815 handleMuxWaitTimeout: Ethernet120: xcvrd timed out responding to linkmgrd, current state: (P: Unknown, M: Wait, L: Down)
Refactoring to a separate listener thread mode as well as removing the lock(safe because read/write transaction via eeprom for port probe) seems to handle this, and does not have the logs like this one above.
as the read write eeprom also has a mutex lock in the platform api call, optoe implementation.
https://github.com/Azure/sonic-linux-kernel/blob/889d76e36b3f012d3782a1c5e1587c32e4d1ed11/patch/driver-support-optoe.patch#L717
Motivation and Context
refactor xcvrd for listening to port probes, disable calling the get_firmware_api() while a download is in progress.
Signed-off-by: vaibhav-dahiya <[email protected]>
"Error: Could not get port instance for read side for Y cable port {}".format(physical_port))
241
+
"Error: Could not get port instance for read side for Y cable port {} {}".format(physical_port, threading.currentThread().getName()))
242
242
return-1
243
243
244
-
withy_cable_port_locks[physical_port]:
245
-
try:
246
-
update_status=port_instance.toggle_mux_to_tor_a()
247
-
exceptExceptionase:
248
-
update_status=-1
249
-
helper_logger.log_warning("Failed to execute the toggle mux ToR A API for port {} due to {}".format(physical_port,repr(e)))
244
+
try:
245
+
update_status=port_instance.toggle_mux_to_tor_a()
246
+
exceptExceptionase:
247
+
update_status=-1
248
+
helper_logger.log_warning("Failed to execute the toggle mux ToR A API for port {} due to {} {}".format(physical_port, repr(e) , threading.currentThread().getName()))
250
249
251
-
helper_logger.log_debug("Y_CABLE_DEBUG: Status of toggling mux to ToR A for port {} {}".format(physical_port, update_status))
250
+
helper_logger.log_debug("Y_CABLE_DEBUG: Status of toggling mux to ToR A for port {} status {} {}".format(physical_port, update_status, threading.currentThread().getName()))
helper_logger.log_error("Error: Could not get port instance for read side for Y cable port {}".format(physical_port))
262
+
helper_logger.log_error("Error: Could not get port instance for read side for Y cable port {} {}".format(physical_port, threading.currentThread().getName()))
264
263
return-1
265
264
266
-
withy_cable_port_locks[physical_port]:
267
-
try:
268
-
update_status=port_instance.toggle_mux_to_tor_b()
269
-
exceptExceptionase:
270
-
update_status=-1
271
-
helper_logger.log_warning("Failed to execute the toggle mux ToR B API for port {} due to {}".format(physical_port,repr(e)))
265
+
try:
266
+
update_status=port_instance.toggle_mux_to_tor_b()
267
+
exceptExceptionase:
268
+
update_status=-1
269
+
helper_logger.log_warning("Failed to execute the toggle mux ToR B API for port {} due to {} {}".format(physical_port,repr(e), threading.currentThread().getName()))
272
270
273
-
helper_logger.log_debug("Y_CABLE_DEBUG: Status of toggling mux to ToR B for port {} {}".format(physical_port, update_status))
271
+
helper_logger.log_debug("Y_CABLE_DEBUG: Status of toggling mux to ToR B for port {} {} {}".format(physical_port, update_status, threading.currentThread().getName()))
274
272
ifupdate_statusisTrue:
275
273
return2
276
274
else:
@@ -346,12 +344,11 @@ def update_appdb_port_mux_cable_response_table(logical_port_name, asic_index, ap
346
344
return
347
345
348
346
active_side=None
349
-
withy_cable_port_locks[physical_port]:
350
-
try:
351
-
active_side=port_instance.get_mux_direction()
352
-
exceptExceptionase:
353
-
active_side=-1
354
-
helper_logger.log_warning("Failed to execute the get_mux_direction for port {} due to {}".format(physical_port,repr(e)))
347
+
try:
348
+
active_side=port_instance.get_mux_direction()
349
+
exceptExceptionase:
350
+
active_side=-1
351
+
helper_logger.log_warning("Failed to execute the get_mux_direction for port {} due to {}".format(physical_port,repr(e)))
helper_logger.log_debug("download thread finished port {} physical_port {}".format(port, physical_port))
1457
1463
1458
-
1459
1464
# Thread wrapper class to update y_cable status periodically
1460
1465
classYCableTableUpdateTask(object):
1461
1466
def__init__(self):
@@ -1530,7 +1535,7 @@ def task_worker(self):
1530
1535
ifnotport:
1531
1536
break
1532
1537
1533
-
helper_logger.log_debug("Y_CABLE_DEBUG: received an event for port transition {}".format(port))
1538
+
helper_logger.log_debug("Y_CABLE_DEBUG: received an event for port transition {} {}".format(port, threading.currentThread().getName()))
1534
1539
1535
1540
# entering this section signifies a start for xcvrd state
1536
1541
# change request from swss so initiate recording in mux_metrics table
@@ -1563,9 +1568,9 @@ def task_worker(self):
1563
1568
port, old_status, new_status))
1564
1569
new_status='unknown'
1565
1570
1566
-
helper_logger.log_debug("Y_CABLE_DEBUG: xcvrd successful to transition port {} from {} to {} and write back to the DB".format(port, old_status, new_status))
1567
-
helper_logger.log_info("Got a change event for toggle the mux-direction active side for port {} state from {} to {}".format(
1568
-
port, old_status, new_status))
1571
+
helper_logger.log_debug("Y_CABLE_DEBUG: xcvrd successful to transition port {} from {} to {} and write back to the DB {}".format(port, old_status, new_status, threading.currentThread().getName()))
1572
+
helper_logger.log_notice("Got a change event for toggle the mux-direction active side for port {} state from {} to {} {}".format(
0 commit comments