Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Sun <stephens@nvidia.com>
  • Loading branch information
stephenxs authored and keboliu committed Feb 24, 2022
1 parent 88b886b commit 495f3e9
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 103 deletions.
12 changes: 12 additions & 0 deletions device/mellanox/x86_64-nvidia_sn2201-r0/platform_components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"chassis": {
"SN2201": {
"component": {
"ONIE": { },
"SSD": { },
"CPLD1": { },
"CPLD2": { }
}
}
}
}
5 changes: 3 additions & 2 deletions platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def initialize_sfp(self):
sfp_count = self.get_num_sfps()
for index in range(sfp_count):
if self.RJ45_port_list and index in self.RJ45_port_list:
sfp_module = RJ45Port(index) #SFP(index, RJ45_TYPE)
sfp_module = RJ45Port(index)
else:
sfp_module = SFP(index)
self._sfp_list.append(sfp_module)
Expand All @@ -273,7 +273,7 @@ def initialize_sfp(self):
for index in range(len(self._sfp_list)):
if self._sfp_list[index] is None:
if self.RJ45_port_list and index in self.RJ45_port_list:
self._sfp_list[index] = RJ45Port(index) # SFP(index, RJ45_TYPE)
self._sfp_list[index] = RJ45Port(index)
else:
self._sfp_list[index] = SFP(index)
self.sfp_initialized_count = len(self._sfp_list)
Expand Down Expand Up @@ -536,6 +536,7 @@ def initialize_components(self):
self._component_list.append(ComponentSSD())
# Upgrading BIOS is not supported on SN2201
if DeviceDataManager.get_platform_name() not in ['x86_64-nvidia_sn2201-r0']:
logger.log_notice("Updating BIOS is not supported on SN2201")
self._component_list.append(ComponentBIOS())
self._component_list.extend(ComponentCPLD.get_component_list())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ class ONIEUpdater(object):

ONIE_IMAGE_INFO_COMMAND = '/bin/bash {} -q -i'

# Upgrading fireware from ONIE is not supported from the beginning on some platforms, like SN2700.
# There is a logic to check the ONIE version in order to know whether it is supported.
# If it is not supported, we will not proceed and print some error message.
# For SN2201, upgrading fireware from ONIE is supported from day one so we do not need to check it.
PLATFORM_ALWAYS_SUPPORT_UPGRADE = ['x86_64-nvidia_sn2201-r0']

BIOS_UPDATE_FILE_EXT = '.rom'
Expand Down
104 changes: 4 additions & 100 deletions platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ def __init__(self, sfp_index, sfp_type=None, slot_id=0, linecard_port_count=0, l
self.sdk_index = sfp_index

if self._sfp_type != RJ45_TYPE:
# No thermal sensors for RJ45 ports so we do not need to initiallize them.
from .thermal import initialize_sfp_thermal
self._thermal_list = initialize_sfp_thermal(sfp_index)
else: # For modular chassis
Expand Down Expand Up @@ -2378,20 +2379,18 @@ def __init__(self, sfp_index):
super(RJ45Port, self).__init__(sfp_index, RJ45_TYPE)
self._sfp_type = RJ45_TYPE

# Reuse sdk_handle

@property
def sfp_type(self):
return self._sfp_type

def get_presence(self):
"""
Retrieves the presence of the device
For RJ45 ports, it always return True
Returns:
bool: True if device is present, False if not
"""
# Reimplement it via using SDK API
return True

@property
Expand All @@ -2400,7 +2399,8 @@ def dom_supported(self):

def get_transceiver_info(self):
"""
Retrieves transceiver info of this SFP
Retrieves transceiver info of this port.
For RJ45, all fields are N/A
Returns:
A dict which contains following keys/values :
Expand Down Expand Up @@ -2445,102 +2445,6 @@ def get_transceiver_info(self):

return transceiver_info_dict

def get_transceiver_bulk_status(self):
"""
Retrieves transceiver bulk status of this SFP
Returns:
A dict which contains following keys/values :
========================================================================
keys |Value Format |Information
---------------------------|---------------|----------------------------
RX LOS |BOOLEAN |RX lost-of-signal status,
| |True if has RX los, False if not.
TX FAULT |BOOLEAN |TX fault status,
| |True if has TX fault, False if not.
Reset status |BOOLEAN |reset status,
| |True if SFP in reset, False if not.
LP mode |BOOLEAN |low power mode status,
| |True in lp mode, False if not.
TX disable |BOOLEAN |TX disable status,
| |True TX disabled, False if not.
TX disabled channel |HEX |disabled TX channles in hex,
| |bits 0 to 3 represent channel 0
| |to channel 3.
Temperature |INT |module temperature in Celsius
Voltage |INT |supply voltage in mV
TX bias |INT |TX Bias Current in mA
RX power |INT |received optical power in mW
TX power |INT |TX output power in mW
========================================================================
"""
transceiver_dom_info_dict = {}
dom_info_dict_keys = ['temperature', 'voltage',
'rx1power', 'rx2power',
'rx3power', 'rx4power',
'rx5power', 'rx6power',
'rx7power', 'rx8power',
'tx1bias', 'tx2bias',
'tx3bias', 'tx4bias',
'tx5bias', 'tx6bias',
'tx7bias', 'tx8bias',
'tx1power', 'tx2power',
'tx3power', 'tx4power',
'tx5power', 'tx6power',
'tx7power', 'tx8power'
]
transceiver_dom_info_dict = dict.fromkeys(dom_info_dict_keys, 'N/A')

return transceiver_dom_info_dict

def get_transceiver_threshold_info(self):
"""
Retrieves transceiver threshold info of this SFP
Returns:
A dict which contains following keys/values :
========================================================================
keys |Value Format |Information
---------------------------|---------------|----------------------------
temphighalarm |FLOAT |High Alarm Threshold value of temperature in Celsius.
templowalarm |FLOAT |Low Alarm Threshold value of temperature in Celsius.
temphighwarning |FLOAT |High Warning Threshold value of temperature in Celsius.
templowwarning |FLOAT |Low Warning Threshold value of temperature in Celsius.
vcchighalarm |FLOAT |High Alarm Threshold value of supply voltage in mV.
vcclowalarm |FLOAT |Low Alarm Threshold value of supply voltage in mV.
vcchighwarning |FLOAT |High Warning Threshold value of supply voltage in mV.
vcclowwarning |FLOAT |Low Warning Threshold value of supply voltage in mV.
rxpowerhighalarm |FLOAT |High Alarm Threshold value of received power in dBm.
rxpowerlowalarm |FLOAT |Low Alarm Threshold value of received power in dBm.
rxpowerhighwarning |FLOAT |High Warning Threshold value of received power in dBm.
rxpowerlowwarning |FLOAT |Low Warning Threshold value of received power in dBm.
txpowerhighalarm |FLOAT |High Alarm Threshold value of transmit power in dBm.
txpowerlowalarm |FLOAT |Low Alarm Threshold value of transmit power in dBm.
txpowerhighwarning |FLOAT |High Warning Threshold value of transmit power in dBm.
txpowerlowwarning |FLOAT |Low Warning Threshold value of transmit power in dBm.
txbiashighalarm |FLOAT |High Alarm Threshold value of tx Bias Current in mA.
txbiaslowalarm |FLOAT |Low Alarm Threshold value of tx Bias Current in mA.
txbiashighwarning |FLOAT |High Warning Threshold value of tx Bias Current in mA.
txbiaslowwarning |FLOAT |Low Warning Threshold value of tx Bias Current in mA.
========================================================================
"""
transceiver_dom_threshold_info_dict = {}

dom_info_dict_keys = ['temphighalarm', 'temphighwarning',
'templowalarm', 'templowwarning',
'vcchighalarm', 'vcchighwarning',
'vcclowalarm', 'vcclowwarning',
'rxpowerhighalarm', 'rxpowerhighwarning',
'rxpowerlowalarm', 'rxpowerlowwarning',
'txpowerhighalarm', 'txpowerhighwarning',
'txpowerlowalarm', 'txpowerlowwarning',
'txbiashighalarm', 'txbiashighwarning',
'txbiaslowalarm', 'txbiaslowwarning'
]
transceiver_dom_threshold_info_dict = dict.fromkeys(dom_info_dict_keys, 'N/A')

return transceiver_dom_threshold_info_dict

def get_reset_status(self):
return False

Expand Down
11 changes: 10 additions & 1 deletion platform/mellanox/mlnx-platform-api/sonic_platform/sfp_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,16 @@ class MockSxFd(object):
SDK_SFP_STATE_DIS: str(SFP.SFP_STATUS_BIT_REMOVED),
}

# RJ45 ports events definition
"""
RJ45 ports events definition
For RJ45, get_present always returns True.
In case an unplug / unknown event is reported for a port, error status is leveraged for representing them.
The following events will be used.
- Unknown: 2147483648 => 0x80000000
- Unplug: 1073741824 => 0x40000000
According to the error status design, the upper half (bits 16 ~ 31) are the events are encoded from bit 16 (0x0001000),
using those numbers will avoid conflict as much as possible
"""
RJ45_UNPLUG_EVENT = '1073741824'
RJ45_UNKNOWN_EVENT = '2147483648'

Expand Down

0 comments on commit 495f3e9

Please sign in to comment.