From 568a8deb10e7fbd1f8b8bfbb10c59faaa79eded4 Mon Sep 17 00:00:00 2001 From: vaibhav-dahiya Date: Tue, 16 Aug 2022 20:13:47 +0000 Subject: [PATCH 1/6] [ycable] add definitions of some new API's for Y-Cable infrastructure Signed-off-by: vaibhav-dahiya --- sonic_y_cable/y_cable_base.py | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/sonic_y_cable/y_cable_base.py b/sonic_y_cable/y_cable_base.py index 69892da36..71a9ab2d6 100644 --- a/sonic_y_cable/y_cable_base.py +++ b/sonic_y_cable/y_cable_base.py @@ -1167,3 +1167,53 @@ def debug_dump_registers(self, option=None): """ raise NotImplementedError + + def queue_info(self): + """ + This API should dump all the meaningful data from the eeprom which can + help vendor debug the queue info currently relevant to the MCU + using this API the vendor could check how many txns are currently in the queue etc + for debugging purposes + + Args: + None + + Returns: + a Dictionary: + with all the relevant key-value pairs for all the meaningful fields + for the queue inside the MCU firmware + which would help diagnose the cable for proper functioning + """ + + raise NotImplementedError + + def reset_cause(self): + """ + This API should return the reset cause for the NIC MCU. + This should help ascertain whether a reset was caused by soft reboot or + cable poweroff + + Args: + None + + Returns: + a string: + the string should be self explnatory as to what was the cause of reset + + """ + raise NotImplementedError + + def opertion_time(self): + """ + This API should return the time since the cable is powered on from NIC MCU side + This should be helpful in debugging purposes as to if/when the cable has been powered on + + Args: + None + + Returns: + a float: + the float should represent how much time the mux cable is alive/powered on + """ + + raise NotImplementedError From 255a72583547ad1f1bf10d3781c683c5b92b546f Mon Sep 17 00:00:00 2001 From: vaibhav-dahiya Date: Tue, 23 Aug 2022 23:20:54 +0000 Subject: [PATCH 2/6] add mem_read Signed-off-by: vaibhav-dahiya --- sonic_y_cable/y_cable_base.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/sonic_y_cable/y_cable_base.py b/sonic_y_cable/y_cable_base.py index 71a9ab2d6..aec841d1d 100644 --- a/sonic_y_cable/y_cable_base.py +++ b/sonic_y_cable/y_cable_base.py @@ -1203,7 +1203,7 @@ def reset_cause(self): """ raise NotImplementedError - def opertion_time(self): + def operation_time(self): """ This API should return the time since the cable is powered on from NIC MCU side This should be helpful in debugging purposes as to if/when the cable has been powered on @@ -1217,3 +1217,20 @@ def opertion_time(self): """ raise NotImplementedError + + def mem_read(self): + """ + This API should return the memory contents/as well as pointers/counters for DMA or hardware + FIFO's which could be useful for debugging the state of the MCU + + Args: + None + + Returns: + a Dictionary: + with all the relevant key-value pairs for all the meaningful fields + for the memory inside the MCU firmware + which would help diagnose the cable for proper functioning + """ + + raise NotImplementedError From 36ed693fac62817952a5db6c13de456e197243d9 Mon Sep 17 00:00:00 2001 From: vaibhav-dahiya Date: Wed, 24 Aug 2022 19:58:37 +0000 Subject: [PATCH 3/6] add some target_activate API Signed-off-by: vaibhav-dahiya --- sonic_y_cable/y_cable_base.py | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/sonic_y_cable/y_cable_base.py b/sonic_y_cable/y_cable_base.py index aec841d1d..5fdfd75d2 100644 --- a/sonic_y_cable/y_cable_base.py +++ b/sonic_y_cable/y_cable_base.py @@ -1234,3 +1234,48 @@ def mem_read(self): """ raise NotImplementedError + + def activate_target_firmware(self, target, fwfile=None, hitless=False): + """ + This routine should activate the downloaded firmware on all the target + of the Y cable of the port for which this API is called.. + This API is meant to be used in conjunction with download_firmware API, and + should be called once download_firmware API is succesful. + This means that the firmware which has been downloaded should be + activated (start being utilized by the cable) once this API is + successfully executed. + The port on which this API is called for can be referred using self.port. + + Args: + target: + One of the following predefined constants, the actual target to activate the firmware on: + TARGET_NIC -> NIC, + TARGET_TOR_A -> TORA, + TARGET_TOR_B -> TORB + fwfile (optional): + a string, a path to the file which contains the firmware image. + Note that the firmware file can be in the format of the vendor's + choosing (binary, archive, etc.). But note that it should be one file + which contains firmware for all components of the Y-cable. In case the + vendor chooses to pass this file in activate_firmware, the API should + have the logic to retreive the firmware version from this file + which has to be activated on the components of the Y-Cable + this API has been called for. + If None is passed for fwfile, the cable should activate whatever + firmware is marked to be activated next. + If provided, it should retreive the firmware version(s) from this file, ensure + they are downloaded on the cable, then activate them. + + hitless (optional): + a boolean, True, Hitless upgrade: it will backup/restore the current state + (ex. variables of link status, API attributes...etc.) before + and after firmware upgrade. + a boolean, False, Non-hitless upgrade: it will update the firmware regardless + the current status, a link flip can be observed during the upgrade. + Returns: + One of the following predefined constants: + FIRMWARE_ACTIVATE_SUCCESS + FIRMWARE_ACTIVATE_FAILURE + """ + + raise NotImplementedError From 53b82815018ce71034080ce9d58bc424f5db3cb3 Mon Sep 17 00:00:00 2001 From: vaibhav-dahiya Date: Wed, 24 Aug 2022 20:01:16 +0000 Subject: [PATCH 4/6] correct description Signed-off-by: vaibhav-dahiya --- sonic_y_cable/y_cable_base.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sonic_y_cable/y_cable_base.py b/sonic_y_cable/y_cable_base.py index 5fdfd75d2..25b14dd1c 100644 --- a/sonic_y_cable/y_cable_base.py +++ b/sonic_y_cable/y_cable_base.py @@ -1171,9 +1171,10 @@ def debug_dump_registers(self, option=None): def queue_info(self): """ This API should dump all the meaningful data from the eeprom which can - help vendor debug the queue info currently relevant to the MCU - using this API the vendor could check how many txns are currently in the queue etc - for debugging purposes + help vendor debug the queue info for the UART stats in particular + currently relevant to the MCU + using this API the vendor could check how many txns are currently waiting to be processed,proceessed + in the queue etc for debugging purposes Args: None @@ -1220,8 +1221,8 @@ def operation_time(self): def mem_read(self): """ - This API should return the memory contents/as well as pointers/counters for DMA or hardware - FIFO's which could be useful for debugging the state of the MCU + This API should return the memory contents of the cable which would be useful in debug for the + y-cable Args: None From c162d43870cba2356eb3ac831a300b8b8f645ad7 Mon Sep 17 00:00:00 2001 From: vaibhav-dahiya Date: Mon, 29 Aug 2022 18:55:22 +0000 Subject: [PATCH 5/6] add some more API's, comments Signed-off-by: vaibhav-dahiya --- sonic_y_cable/y_cable_base.py | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/sonic_y_cable/y_cable_base.py b/sonic_y_cable/y_cable_base.py index 25b14dd1c..b14a9ab64 100644 --- a/sonic_y_cable/y_cable_base.py +++ b/sonic_y_cable/y_cable_base.py @@ -1219,18 +1219,22 @@ def operation_time(self): raise NotImplementedError - def mem_read(self): + def mem_read(self, target, addr, length): """ This API should return the memory contents of the cable which would be useful in debug for the y-cable Args: - None + target: + local (TOR) or remote (NIC) MCU + addr: + the starting address of the MCU's memory space + length: + length to be read, unit: byte Returns: - a Dictionary: - with all the relevant key-value pairs for all the meaningful fields - for the memory inside the MCU firmware + a Bytearray: + the contenets of the memory inside the MCU firmware which would help diagnose the cable for proper functioning """ @@ -1280,3 +1284,16 @@ def activate_target_firmware(self, target, fwfile=None, hitless=False): """ raise NotImplementedError + + def health_check(self): + """ + This API checks the health of the cable, where it is healthy/unhealythy for RMA purposes/diagnostics. + The port on which this API is called for can be referred using self.port. + + Args: + + Returns: + a Boolean, True if the cable is healthy and False if it is not healthy. + """ + + raise NotImplementedError From 983ad0e8f3c1a0b0c9295798e952a2d6aee7e9cb Mon Sep 17 00:00:00 2001 From: vaibhav-dahiya Date: Mon, 29 Aug 2022 19:06:00 +0000 Subject: [PATCH 6/6] fix typo Signed-off-by: vaibhav-dahiya --- sonic_y_cable/y_cable_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic_y_cable/y_cable_base.py b/sonic_y_cable/y_cable_base.py index b14a9ab64..c4dc34dec 100644 --- a/sonic_y_cable/y_cable_base.py +++ b/sonic_y_cable/y_cable_base.py @@ -1234,7 +1234,7 @@ def mem_read(self, target, addr, length): Returns: a Bytearray: - the contenets of the memory inside the MCU firmware + the contents of the memory inside the MCU firmware which would help diagnose the cable for proper functioning """