Skip to content

Commit 43aa19c

Browse files
vharish02lguohan
authored andcommitted
[dell/Z9100] Fix for optics not detected in fanout mode (#2496)
* [dell/Z9100] Fix for optics not detected in fanout mode This commit fixes the issue of optics not detected error while running sfputil show eeprom command. The root casuse was the value of port index from port_config.ini for fan out scenario. The port index should be starting from 0 and not 1. Platform cpld registers are assuming the port numbers to start from 0 (lowermost bit), sfputils.py uses this port number in get_presence function. Since the indexing passed is wrong the optics was not detected and gave SFP EEPROM not detected message. Signed-off-by: Harish Venkatraman <[email protected]> * [dell/z9100] Fix for optics not detected in fanout mode This commit fixes the issue of optics not detected error while running sfputil show eeprom command. The root cause was wrong port_index in fan out scenarios. Earlier fix of changing the port_config.ini is reverted and changes made in z9100 platform specific sfputil.py file. The port number is decrement and tested for both 100G and 50G fanout cases. Tested for the following show commands and test was succesful show interfaces status, show interfaces transceiver eeprom, show interfaces transceiver lpmode, show interface tranceiver presence. Signed-off-by: Harish Venkatraman <[email protected]>
1 parent 2dd769b commit 43aa19c

File tree

1 file changed

+68
-109
lines changed
  • device/dell/x86_64-dell_z9100_c2538-r0/plugins

1 file changed

+68
-109
lines changed

device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py

+68-109
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
class SfpUtil(SfpUtilBase):
1717
"""Platform-specific SfpUtil class"""
1818

19-
PORT_START = 0
20-
PORT_END = 31
19+
PORT_START = 1
20+
PORT_END = 32
2121
PORTS_IN_BLOCK = 32
22-
IOM_1_PORT_START = 0
23-
IOM_1_PORT_END = 11
24-
IOM_2_PORT_START = 12
25-
IOM_2_PORT_END = 21
26-
IOM_3_PORT_START = 22
27-
IOM_3_PORT_END = 31
22+
IOM_1_PORT_START = 1
23+
IOM_1_PORT_END = 12
24+
IOM_2_PORT_START = 13
25+
IOM_2_PORT_END = 22
26+
IOM_3_PORT_START = 23
27+
IOM_3_PORT_END = 32
2828

2929
BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{0}-003e/"
3030
OIR_FD_PATH = "/sys/devices/platform/dell_ich.0/sci_int_gpio_sus6"
@@ -33,38 +33,39 @@ class SfpUtil(SfpUtilBase):
3333
epoll = -1
3434
_port_to_eeprom_mapping = {}
3535
_port_to_i2c_mapping = {
36-
0: [9, 18],
37-
1: [9, 19],
38-
2: [9, 20],
39-
3: [9, 21],
40-
4: [9, 22],
41-
5: [9, 23],
42-
6: [9, 24],
43-
7: [9, 25],
44-
8: [8, 26],
45-
9: [8, 27],
46-
10: [8, 28],
47-
11: [8, 29],
48-
12: [8, 31], # reordered
49-
13: [8, 30],
50-
14: [8, 33], # reordered
51-
15: [8, 32],
52-
16: [7, 34],
53-
17: [7, 35],
54-
18: [7, 36],
55-
19: [7, 37],
56-
20: [7, 38],
57-
21: [7, 39],
58-
22: [7, 40],
59-
23: [7, 41],
60-
24: [6, 42],
61-
25: [6, 43],
62-
26: [6, 44],
63-
27: [6, 45],
64-
28: [6, 46],
65-
29: [6, 47],
66-
30: [6, 48],
67-
31: [6, 49]
36+
0: [0, 00], # Dummy Entry
37+
1: [9, 18],
38+
2: [9, 19],
39+
3: [9, 20],
40+
4: [9, 21],
41+
5: [9, 22],
42+
6: [9, 23],
43+
7: [9, 24],
44+
8: [9, 25],
45+
9: [8, 26],
46+
10: [8, 27],
47+
11: [8, 28],
48+
12: [8, 29],
49+
13: [8, 31], # reordered
50+
14: [8, 30],
51+
15: [8, 33], # reordered
52+
16: [8, 32],
53+
17: [7, 34],
54+
18: [7, 35],
55+
19: [7, 36],
56+
20: [7, 37],
57+
21: [7, 38],
58+
22: [7, 39],
59+
23: [7, 40],
60+
24: [7, 41],
61+
25: [6, 42],
62+
26: [6, 43],
63+
27: [6, 44],
64+
28: [6, 45],
65+
29: [6, 46],
66+
30: [6, 47],
67+
31: [6, 48],
68+
32: [6, 49]
6869
}
6970

7071
@property
@@ -127,13 +128,10 @@ def __del__(self):
127128
self.epoll.close()
128129
self.oir_fd.close()
129130

130-
def get_presence(self, port_num):
131-
132-
global i2c_line
133-
131+
def normalize_port(self, port_num):
134132
# Check for invalid port_num
135133
if port_num < self.port_start or port_num > self.port_end:
136-
return False
134+
return -1, -1
137135
# port_num and i2c match
138136
if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end:
139137
i2c_line = 14
@@ -144,6 +142,24 @@ def get_presence(self, port_num):
144142
port_num <= self.iom3_port_end):
145143
i2c_line = 16
146144

145+
# Rationalize port settings
146+
if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end:
147+
port_num = port_num - 1
148+
elif port_num >= self.iom2_port_start and port_num <= self.iom2_port_end:
149+
port_num = (port_num - 1) % 12
150+
elif (port_num >= self.iom3_port_start and
151+
port_num <= self.iom3_port_end):
152+
port_num = (port_num - 1) % 22
153+
154+
return i2c_line, port_num
155+
156+
157+
def get_presence(self, port_num):
158+
159+
i2c_line, port_num = self.normalize_port(port_num)
160+
if port_num == -1:
161+
return False
162+
147163
try:
148164
qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_modprs"
149165
reg_file = open(qsfp_path, "r")
@@ -161,13 +177,6 @@ def get_presence(self, port_num):
161177
# content is a string containing the hex representation of the register
162178
reg_value = int(content, 16)
163179

164-
# Rationalize port settings
165-
if port_num >= self.iom2_port_start and port_num <= self.iom2_port_end:
166-
port_num = port_num % 12
167-
elif (port_num >= self.iom3_port_start and
168-
port_num <= self.iom3_port_end):
169-
port_num = port_num % 22
170-
171180
# Mask off the bit corresponding to our port
172181
mask = (1 << port_num)
173182

@@ -179,20 +188,10 @@ def get_presence(self, port_num):
179188

180189
def get_low_power_mode(self, port_num):
181190

182-
# Check for invalid port_num
183-
if port_num < self.port_start or port_num > self.port_end:
191+
i2c_line, port_num = self.normalize_port(port_num)
192+
if port_num == -1:
184193
return False
185194

186-
# port_num and i2c match
187-
if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end:
188-
i2c_line = 14
189-
elif (port_num >= self.iom2_port_start and
190-
port_num <= self.iom2_port_end):
191-
i2c_line = 15
192-
elif (port_num >= self.iom3_port_start and
193-
port_num <= self.iom3_port_end):
194-
i2c_line = 16
195-
196195
try:
197196
qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_lpmode"
198197
reg_file = open(qsfp_path, "r")
@@ -210,13 +209,6 @@ def get_low_power_mode(self, port_num):
210209
# content is a string containing the hex representation of the register
211210
reg_value = int(content, 16)
212211

213-
# Rationalize port settings
214-
if port_num >= self.iom2_port_start and port_num <= self.iom2_port_end:
215-
port_num = port_num % 12
216-
elif (port_num >= self.iom3_port_start and
217-
port_num <= self.iom3_port_end):
218-
port_num = port_num % 22
219-
220212
# Mask off the bit corresponding to our port
221213
mask = (1 << port_num)
222214

@@ -228,24 +220,15 @@ def get_low_power_mode(self, port_num):
228220

229221
def set_low_power_mode(self, port_num, lpmode):
230222

231-
# Check for invalid port_num
232-
if port_num < self.port_start or port_num > self.port_end:
223+
i2c_line, port_num = self.normalize_port(port_num)
224+
if port_num == -1:
233225
return False
234226

235-
# port_num and i2c match
236-
if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end:
237-
i2c_line = 14
238-
elif (port_num >= self.iom2_port_start and
239-
port_num <= self.iom2_port_end):
240-
i2c_line = 15
241-
elif (port_num >= self.iom3_port_start and
242-
port_num <= self.iom3_port_end):
243-
i2c_line = 16
244-
245227
try:
246228
qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_lpmode"
247229
reg_file = open(qsfp_path, "r+")
248230

231+
249232
except IOError as e:
250233
print "Error: unable to open file: %s" % str(e)
251234
return False
@@ -259,13 +242,6 @@ def set_low_power_mode(self, port_num, lpmode):
259242
# content is a string containing the hex representation of the register
260243
reg_value = int(content, 16)
261244

262-
# Rationalize port settings
263-
if port_num >= self.iom2_port_start and port_num <= self.iom2_port_end:
264-
port_num = port_num % 12
265-
elif (port_num >= self.iom3_port_start and
266-
port_num <= self.iom3_port_end):
267-
port_num = port_num % 22
268-
269245
# Mask off the bit corresponding to our port
270246
mask = (1 << port_num)
271247
# LPMode is active high; set or clear the bit accordingly
@@ -285,20 +261,10 @@ def set_low_power_mode(self, port_num, lpmode):
285261

286262
def reset(self, port_num):
287263

288-
# Check for invalid port_num
289-
if port_num < self.port_start or port_num > self.port_end:
264+
i2c_line, port_num = self.normalize_port(port_num)
265+
if port_num == -1:
290266
return False
291267

292-
# port_num and i2c match
293-
if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end:
294-
i2c_line = 14
295-
elif (port_num >= self.iom2_port_start and
296-
port_num <= self.iom2_port_end):
297-
i2c_line = 15
298-
elif (port_num >= self.iom3_port_start and
299-
port_num <= self.iom3_port_end):
300-
i2c_line = 16
301-
302268
try:
303269
qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_lpmode"
304270
reg_file = open(qsfp_path, "r+")
@@ -312,13 +278,6 @@ def reset(self, port_num):
312278
# File content is a string containing the hex representation of th
313279
reg_value = int(content, 16)
314280

315-
# Rationalize port settings
316-
if port_num >= self.iom2_port_start and port_num <= self.iom2_port_end:
317-
port_num = port_num % 12
318-
elif (port_num >= self.iom3_port_start and
319-
port_num <= self.iom3_port_end):
320-
port_num = port_num % 22
321-
322281
# Mask off the bit corresponding to our port
323282
mask = (1 << port_num)
324283

0 commit comments

Comments
 (0)