Skip to content

Commit 2ebd786

Browse files
[sfp-refactor] Add initial support for SFF-8636 in sonic_xcvr (#218)
QSFP28 pluggable transceiver support based upon SFP refactor changes
1 parent 221fb8a commit 2ebd786

File tree

12 files changed

+973
-25
lines changed

12 files changed

+973
-25
lines changed

sonic_platform_base/sonic_xcvr/api/public/sff8436.py

+52-7
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ def get_transceiver_bulk_status(self):
8383
return None
8484

8585
bulk_status = {
86-
"rx_los": all(rx_los),
87-
"tx_fault": all(tx_fault),
86+
"rx_los": all(rx_los) if self.get_rx_los_support() else 'N/A',
87+
"tx_fault": all(tx_fault) if self.get_tx_fault_support() else 'N/A',
8888
"tx_disable": all(tx_disable),
8989
"tx_disabled_channel": tx_disabled_channel,
9090
"temperature": temp,
@@ -111,10 +111,10 @@ def get_transceiver_threshold_info(self):
111111
'txbiaslowalarm', 'txbiaslowwarning'
112112
]
113113
threshold_info_dict = dict.fromkeys(threshold_info_keys, 'N/A')
114-
flat_mem = self.is_flat_memory()
115-
if flat_mem is None:
114+
thresh_support = self.get_transceiver_thresholds_support()
115+
if thresh_support is None:
116116
return None
117-
if flat_mem:
117+
if not thresh_support:
118118
return threshold_info_dict
119119

120120
temp_thresholds = self.xcvr_eeprom.read(consts.TEMP_THRESHOLDS_FIELD)
@@ -161,18 +161,33 @@ def get_rx_los(self):
161161
return [bool(rx_los & (1 << i)) for i in range(self.NUM_CHANNELS)]
162162

163163
def get_tx_fault(self):
164+
tx_fault_support = self.get_tx_fault_support()
165+
if tx_fault_support is None:
166+
return None
167+
if not tx_fault_support:
168+
return ["N/A" for _ in range(self.NUM_CHANNELS)]
164169
tx_fault = self.xcvr_eeprom.read(consts.TX_FAULT_FIELD)
165170
if tx_fault is None:
166171
return None
167172
return [bool(tx_fault & (1 << i)) for i in range(self.NUM_CHANNELS)]
168173

169174
def get_tx_disable(self):
175+
tx_disable_support = self.get_tx_disable_support()
176+
if tx_disable_support is None:
177+
return None
178+
if not tx_disable_support:
179+
return ["N/A" for _ in range(self.NUM_CHANNELS)]
170180
tx_disable = self.xcvr_eeprom.read(consts.TX_DISABLE_FIELD)
171181
if tx_disable is None:
172182
return None
173183
return [bool(tx_disable & (1 << i)) for i in range(self.NUM_CHANNELS)]
174184

175185
def get_tx_disable_channel(self):
186+
tx_disable_support = self.get_tx_disable_support()
187+
if tx_disable_support is None:
188+
return None
189+
if not tx_disable_support:
190+
return 'N/A'
176191
return self.xcvr_eeprom.read(consts.TX_DISABLE_FIELD)
177192

178193
def get_module_temperature(self):
@@ -208,7 +223,7 @@ def tx_disable(self, tx_disable):
208223

209224
def tx_disable_channel(self, channel, disable):
210225
channel_state = self.get_tx_disable_channel()
211-
if channel_state is None:
226+
if channel_state is None or channel_state == "N/A":
212227
return False
213228

214229
for i in range(self.NUM_CHANNELS):
@@ -225,18 +240,24 @@ def tx_disable_channel(self, channel, disable):
225240
def get_power_override(self):
226241
return self.xcvr_eeprom.read(consts.POWER_OVERRIDE_FIELD)
227242

243+
def get_power_set(self):
244+
return self.xcvr_eeprom.read(consts.POWER_SET_FIELD)
245+
228246
def set_power_override(self, power_override, power_set):
229247
ret = self.xcvr_eeprom.write(consts.POWER_OVERRIDE_FIELD, power_override)
230248
if power_override:
231249
ret &= self.xcvr_eeprom.write(consts.POWER_SET_FIELD, power_set)
232-
return ret
250+
return ret
233251

234252
def is_flat_memory(self):
235253
return self.xcvr_eeprom.read(consts.FLAT_MEM_FIELD)
236254

237255
def get_tx_power_support(self):
238256
return False
239257

258+
def get_rx_power_support(self):
259+
return True
260+
240261
def is_copper(self):
241262
eth_compliance = self.xcvr_eeprom.read(consts.ETHERNET_10_40G_COMPLIANCE_FIELD)
242263
if eth_compliance is None:
@@ -248,3 +269,27 @@ def get_temperature_support(self):
248269

249270
def get_voltage_support(self):
250271
return True
272+
273+
def get_rx_los_support(self):
274+
return True
275+
276+
def get_tx_bias_support(self):
277+
return True
278+
279+
def get_tx_fault_support(self):
280+
return self.xcvr_eeprom.read(consts.TX_FAULT_SUPPORT_FIELD)
281+
282+
def get_tx_disable_support(self):
283+
return self.xcvr_eeprom.read(consts.TX_DISABLE_SUPPORT_FIELD)
284+
285+
def get_transceiver_thresholds_support(self):
286+
return not self.is_flat_memory()
287+
288+
def get_lpmode_support(self):
289+
power_class = self.xcvr_eeprom.read(consts.POWER_CLASS_FIELD)
290+
if power_class is None:
291+
return False
292+
return "Power Class 1" not in power_class
293+
294+
def get_power_override_support(self):
295+
return not self.is_copper()

0 commit comments

Comments
 (0)