Skip to content

Commit

Permalink
code fix for copper cable modules with flat memory (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
qinchuanares authored Dec 1, 2021
1 parent c2aac75 commit fb7ba41
Show file tree
Hide file tree
Showing 7 changed files with 852 additions and 319 deletions.
357 changes: 190 additions & 167 deletions sonic_platform_base/sonic_xcvr/api/public/cmis.py

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions sonic_platform_base/sonic_xcvr/codes/public/sff8024.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,26 +345,26 @@ class Sff8024(XcvrCodes):
}

PASSIVE_COPPER_MEDIA_INTERFACE = {
'00': 'Undefined',
'01': 'Copper cable',
'02': 'Passive Loopback module'
0: 'Undefined',
1: 'Copper cable',
2: 'Passive Loopback module'
}

ACTIVE_CABLE_MEDIA_INTERFACE = {
'00': 'Undefined',
'01': 'Active Cable assembly with BER < 10^-12',
'02': 'Active Cable assembly with BER < 5x10^-5',
'03': 'Active Cable assembly with BER < 2.6x10^-4',
'04': 'Active Cable assembly with BER < 10^-6',
'bf': 'Active Loopback module'
0: 'Undefined',
1: 'Active Cable assembly with BER < 10^-12',
2: 'Active Cable assembly with BER < 5x10^-5',
3: 'Active Cable assembly with BER < 2.6x10^-4',
4: 'Active Cable assembly with BER < 10^-6',
191: 'Active Loopback module'
}

BASE_T_MEDIA_INTERFACE = {
'00': 'Undefined',
'01': '1000BASE-T (Clause 40)',
'02': '2.5GBASE-T (Clause 126)',
'03': '5GBASE-T (Clause 126)',
'04': '10GBASE-T (Clause 55)'
0: 'Undefined',
1: '1000BASE-T (Clause 40)',
2: '2.5GBASE-T (Clause 126)',
3: '5GBASE-T (Clause 126)',
4: '10GBASE-T (Clause 55)'
}

# TODO: Add other codes
13 changes: 12 additions & 1 deletion sonic_platform_base/sonic_xcvr/fields/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
MODULE_MONITORS_FIELD = "Module Monitors"

RX_LOS_FIELD = "RxLOS"
RX_LOS_SUPPORT = "RxLOSSupported"
RX_POWER_FIELD = "RxPower"
RX_POWER_SUPPORT_FIELD = "RxPowerSupported"
RX_POWER_THRESHOLDS_FIELD = "RxPowerThresholds"
RX_POWER_HIGH_ALARM_FIELD = "RxPowerHighAlarm"
RX_POWER_LOW_ALARM_FIELD = "RxPowerLowAlarm"
Expand All @@ -41,6 +43,8 @@
THRESHOLDS_FIELD = "Thresholds"

TX_BIAS_FIELD = "TxBias"
TX_BIAS_SUPPORT_FIELD = "TxBiasSupported"
TX_BIAS_SCALE = "TxBiasScalingFactor"
TX_BIAS_THRESHOLDS_FIELD = "TxBiasThresholds"
TX_BIAS_HIGH_ALARM_FIELD = "TxHighAlarm"
TX_BIAS_LOW_ALARM_FIELD = "TxLowAlarm"
Expand Down Expand Up @@ -238,7 +242,9 @@
TX_OUTPUT_STATUS = "TxOutputStatus"
RX_OUTPUT_STATUS = "RxOutputStatus"
TX_LOS_FIELD = "TxLOS"
TX_LOS_SUPPORT_FIELD = "TxLOSSupported"
TX_CDR_LOL = "TxCDRLOL"
TX_CDR_LOL_SUPPORT_FIELD = "TxCDRLOLSupported"
TX_POWER_HIGH_ALARM_FLAG = "TxPowerHighAlarmFlag"
TX_POWER_LOW_ALARM_FLAG = "TxPowerLowAlarmFlag"
TX_POWER_HIGH_WARN_FLAG = "TxPowerHighWarnFlag"
Expand All @@ -253,6 +259,7 @@
RX_POWER_LOW_WARN_FLAG = "RxPowerLowWarnFlag"

RX_CDR_LOL = "RxCDRLOL"
RX_CDR_LOL_SUPPORT_FIELD = "RxCDRLOLSupported"
CONFIG_LANE_STATUS = "ConfigStatusLane"
DPINIT_PENDING = "DPInitPending"
TUNING_IN_PROGRESS = "TxTuningInProgress"
Expand All @@ -265,7 +272,10 @@

CTRLS_ADVT_FIELD = "Supported Controls Advertisement"
FLAGS_ADVT_FIELD = "Supported Flags Advertisement"

PAGE_SUPPORT_ADVT_FIELD = "Supported Pages Advertisement"
TX_FLAGS_ADVT_FIELD = "Supported TX Flags Advertisement"
RX_FLAGS_ADVT_FIELD = "Supported RX Flags Advertisement"
LANE_MON_ADVT_FIELD = "Supported Lane Monitor Advertisement"
LANE_DATAPATH_CTRL_FIELD = "Lane Control and Data Path Control"
LANE_DATAPATH_STATUS_FIELD = "Lane Status and Data Path Status"
LEN_MULT_FIELD = "LengthMultiplier"
Expand All @@ -289,6 +299,7 @@
## Media Lane Link Performance Monitoring
# PM
TRANS_PM_FIELD = "TransceiverPm"
VDM_SUPPORTED = "VdmSupported"
VDM_SUPPORTED_PAGE = "VdmSupportedPage"
VDM_CONTROL = "VdmControl"
MEDIA_LANE_FEC_PM = "Media Lane FEC Performance Monitoring"
Expand Down
22 changes: 19 additions & 3 deletions sonic_platform_base/sonic_xcvr/mem_maps/public/cmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,30 @@ def __init__(self, codes):
)

self.MODULE_CHAR_ADVT = RegGroupField(consts.MODULE_CHAR_ADVT_FIELD,
NumberRegField(consts.PAGE_SUPPORT_ADVT_FIELD, self.getaddr(0x1, 142),
RegBitField(consts.VDM_SUPPORTED, 6),
),
NumberRegField(consts.CTRLS_ADVT_FIELD, self.getaddr(0x1, 155),
RegBitField(consts.TX_DISABLE_SUPPORT_FIELD, 1),
size=2, format="<H"
),
NumberRegField(consts.FLAGS_ADVT_FIELD, self.getaddr(0x1, 157),
NumberRegField(consts.TX_FLAGS_ADVT_FIELD, self.getaddr(0x1, 157),
RegBitField(consts.TX_FAULT_SUPPORT_FIELD, 0),
size=2, format="<H"
)
RegBitField(consts.TX_LOS_SUPPORT_FIELD, 1),
RegBitField(consts.TX_CDR_LOL_SUPPORT_FIELD, 2),
),
NumberRegField(consts.RX_FLAGS_ADVT_FIELD, self.getaddr(0x1, 158),
RegBitField(consts.RX_LOS_SUPPORT, 1),
RegBitField(consts.RX_CDR_LOL_SUPPORT_FIELD, 2),
),
NumberRegField(consts.LANE_MON_ADVT_FIELD, self.getaddr(0x1, 160),
RegBitField(consts.RX_POWER_SUPPORT_FIELD, 2),
RegBitField(consts.TX_POWER_SUPPORT_FIELD, 1),
RegBitField(consts.TX_BIAS_SUPPORT_FIELD, 0),
),
NumberRegField(consts.TX_BIAS_SCALE, self.getaddr(0x1, 160),
*(RegBitField("Bit%d" % (bit), bit) for bit in range (3, 5))
),
)

self.THRESHOLDS = RegGroupField(consts.THRESHOLDS_FIELD,
Expand Down
16 changes: 16 additions & 0 deletions sonic_platform_base/sonic_xcvr/sfp_optoe_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@ def get_transceiver_threshold_info(self):
api = self.get_xcvr_api()
return api.get_transceiver_threshold_info() if api is not None else None

def get_transceiver_status(self):
api = self.get_xcvr_api()
return api.get_transceiver_status() if api is not None else None

def get_transceiver_loopback(self):
api = self.get_xcvr_api()
return api.get_transceiver_loopback() if api is not None else None

def is_coherent_module(self):
api = self.get_xcvr_api()
return api.is_coherent_module() if api is not None else None

def get_transceiver_pm(self):
api = self.get_xcvr_api()
return api.get_transceiver_pm() if api is not None else None

def get_rx_los(self):
api = self.get_xcvr_api()
if api is not None:
Expand Down
Loading

0 comments on commit fb7ba41

Please sign in to comment.