From 56afe8ac78678e8a53a75c78d6e8a4f0495145e9 Mon Sep 17 00:00:00 2001 From: xinyu Date: Sun, 31 Jul 2022 00:42:03 +0800 Subject: [PATCH 1/2] [Credo][Ycable] fix incorrect uart statistics Signed-off-by: xinyu --- sonic_y_cable/credo/y_cable_credo.py | 38 ++++++++++++++++------------ 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/sonic_y_cable/credo/y_cable_credo.py b/sonic_y_cable/credo/y_cable_credo.py index 7b5535b7d..e74e195b2 100644 --- a/sonic_y_cable/credo/y_cable_credo.py +++ b/sonic_y_cable/credo/y_cable_credo.py @@ -3153,8 +3153,7 @@ def get_uart_stat(self): """ if self.platform_chassis is not None: - cnt = {} - uartPort = {} + result = {} for option in range(2): @@ -3168,20 +3167,27 @@ def get_uart_stat(self): addr = 128 - for idx in range(1, 3): - cnt['TxPktCnt'] = (self.read_mmap(YCable.MIS_PAGE_FC, addr + 3) << 24) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 2) << 16) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 1) << 8) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 0) << 0) - addr += 4 - cnt['RxPktCnt'] = (self.read_mmap(YCable.MIS_PAGE_FC, addr + 3) << 24) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 2) << 16) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 1) << 8) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 0) << 0) - addr += 4 - cnt['AckCnt'] = (self.read_mmap(YCable.MIS_PAGE_FC, addr + 3) << 24) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 2) << 16) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 1) << 8) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 0) << 0) - addr += 4 - cnt['NackCnt'] = (self.read_mmap(YCable.MIS_PAGE_FC, addr + 3) << 24) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 2) << 16) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 1) << 8) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 0) << 0) - addr += 4 - cnt['TxRetryCnt'] = (self.read_mmap(YCable.MIS_PAGE_FC, addr + 3) << 24) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 2) << 16) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 1) << 8) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 0) << 0) - addr += 4 - cnt['TxAbortCnt'] = (self.read_mmap(YCable.MIS_PAGE_FC, addr + 3) << 24) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 2) << 16) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 1) << 8) | (self.read_mmap(YCable.MIS_PAGE_FC, addr + 0) << 0) - addr += 4 - uartPort['UART%d' % idx] = cnt + data = self.read_mmap(YCable.MIS_PAGE_FC, 128, 48) + + uartPort = {} + cnt = {} + cnt['TxPktCnt'] = struct.unpack_from(' Date: Tue, 2 Aug 2022 23:36:21 +0800 Subject: [PATCH 2/2] [Credo][Ycable] update get_uart_stat() to show RxErrorCnt Signed-off-by: xinyu --- sonic_y_cable/credo/y_cable_credo.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/sonic_y_cable/credo/y_cable_credo.py b/sonic_y_cable/credo/y_cable_credo.py index e74e195b2..77d4f1152 100644 --- a/sonic_y_cable/credo/y_cable_credo.py +++ b/sonic_y_cable/credo/y_cable_credo.py @@ -3165,9 +3165,8 @@ def get_uart_stat(self): self.log_error('Dump Uart statstics error (error code:0x%04X)' % (status)) return result - addr = 128 - - data = self.read_mmap(YCable.MIS_PAGE_FC, 128, 48) + data = self.read_mmap(YCable.MIS_PAGE_FC, 128, 64) + ver = self.read_mmap(YCable.MIS_PAGE_VSC, 130, 1) uartPort = {} cnt = {} @@ -3176,7 +3175,11 @@ def get_uart_stat(self): cnt['AckCnt'] = struct.unpack_from('