Skip to content

Commit 9d2ba33

Browse files
committed
[Credo][Ycable] update get_uart_stat() to show RxErrorCnt
Signed-off-by: xinyu <[email protected]>
1 parent 56afe8a commit 9d2ba33

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

sonic_y_cable/credo/y_cable_credo.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3165,9 +3165,8 @@ def get_uart_stat(self):
31653165
self.log_error('Dump Uart statstics error (error code:0x%04X)' % (status))
31663166
return result
31673167

3168-
addr = 128
3169-
3170-
data = self.read_mmap(YCable.MIS_PAGE_FC, 128, 48)
3168+
data = self.read_mmap(YCable.MIS_PAGE_FC, 128, 64)
3169+
ver = self.read_mmap(YCable.MIS_PAGE_VSC, 130, 1)
31713170

31723171
uartPort = {}
31733172
cnt = {}
@@ -3176,7 +3175,11 @@ def get_uart_stat(self):
31763175
cnt['AckCnt'] = struct.unpack_from('<I', data[ 8 : 12])[0]
31773176
cnt['NackCnt'] = struct.unpack_from('<I', data[ 12 : 16])[0]
31783177
cnt['TxRetryCnt'] = struct.unpack_from('<I', data[ 16 : 20])[0]
3179-
cnt['TxAbortCnt'] = struct.unpack_from('<I', data[ 20 : 24])[0]
3178+
cnt['TxAbortCnt'] = struct.unpack_from('<I', data[ 20 : 24])[0]
3179+
3180+
if ver == 1:
3181+
cnt['RxErrorCnt'] = struct.unpack_from('<I', data[ 48 : 52])[0]
3182+
31803183
uartPort['UART1'] = cnt
31813184

31823185
cnt = {}
@@ -3186,13 +3189,17 @@ def get_uart_stat(self):
31863189
cnt['NackCnt'] = struct.unpack_from('<I', data[ 36 : 40])[0]
31873190
cnt['TxRetryCnt'] = struct.unpack_from('<I', data[ 40 : 44])[0]
31883191
cnt['TxAbortCnt'] = struct.unpack_from('<I', data[ 44 : 48])[0]
3192+
3193+
if ver == 1:
3194+
cnt['RxErrorCnt'] = struct.unpack_from('<I', data[ 52 : 56])[0]
3195+
31893196
uartPort['UART2'] = cnt
31903197

31913198
if option == 0: result['Local'] = uartPort
31923199
else: result['Remote'] = uartPort
31933200

31943201
else:
3195-
self.log_error("platform_chassis is not loaded, failed to get Uart statstics")
3202+
self.log_error("platform_chassis is not loaded, failed to get Uart statistics")
31963203

31973204
return result
31983205

0 commit comments

Comments
 (0)