From 7105a2285d66c1377f52ec210138e526c3fee486 Mon Sep 17 00:00:00 2001 From: xinyu Date: Wed, 21 Aug 2024 12:30:58 +0800 Subject: [PATCH] [CMIS] Log errors for all set loopback mode rejection cases Signed-off-by: xinyu --- sonic_platform_base/sonic_xcvr/api/public/cmis.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sonic_platform_base/sonic_xcvr/api/public/cmis.py b/sonic_platform_base/sonic_xcvr/api/public/cmis.py index 8ca244a02..2dd8acb6f 100644 --- a/sonic_platform_base/sonic_xcvr/api/public/cmis.py +++ b/sonic_platform_base/sonic_xcvr/api/public/cmis.py @@ -1136,6 +1136,7 @@ def set_loopback_mode(self, loopback_mode, lane_mask = 0xff): ''' loopback_capability = self.get_loopback_capability() if loopback_capability is None: + logger.info('Failed to get loopback capabilities') return False host_input_val = self.xcvr_eeprom.read(consts.HOST_INPUT_LOOPBACK) @@ -1150,6 +1151,8 @@ def set_loopback_mode(self, loopback_mode, lane_mask = 0xff): if lane_mask != 0xff: if any([loopback_capability['per_lane_host_loopback_supported'] is False and 'host' in loopback_mode, loopback_capability['per_lane_media_loopback_supported'] is False and 'media' in loopback_mode]): + txt = f'Per-lane {loopback_mode} loopback is not supported, lane_mask:{lane_mask:02x}\n' + logger.error(txt) return False if 'none' in loopback_mode: @@ -1175,6 +1178,10 @@ def set_loopback_mode(self, loopback_mode, lane_mask = 0xff): if loopback_capability['simultaneous_host_media_loopback_supported'] is False: if any(['host' in loopback_mode and (media_input_val or media_output_val), 'media' in loopback_mode and (host_input_val or host_output_val)]): + txt = 'Simultaneous host media loopback is not supported\n' + txt += f'host_input_val:{host_input_val:02x}, host_output_val:{host_output_val:02x}, ' + txt += f'media_input_val:{media_input_val:02x}, media_output_val:{media_output_val:02x}\n' + logger.error(txt) return False if loopback_mode == 'host-side-input' and host_input_support: @@ -1189,6 +1196,12 @@ def set_loopback_mode(self, loopback_mode, lane_mask = 0xff): if loopback_mode == 'media-side-output' and media_output_support: return self.xcvr_eeprom.write(consts.MEDIA_OUTPUT_LOOPBACK, media_output_val | lane_mask) + txt = f'Failed to set {loopback_mode} loopback, lane_mask:{lane_mask:02x}\n' + txt += f'host_input_support:{host_input_support}, host_output_support:{host_output_support}, ' + txt += f'media_input_support:{media_input_support}, media_output_support:{media_output_support}\n' + txt += f'host_input_val:{host_input_val:02x}, host_output_val:{host_output_val:02x}, ' + txt += f'media_input_val:{media_input_val:02x}, media_output_val:{media_output_val:02x}\n' + logger.error(txt) return False def get_vdm(self, field_option=None):