Skip to content

Commit 9f028ed

Browse files
keboliutiantianlv
authored andcommitted
[Mellanox] fix sfp lpmode set failure caused by extra nv port (sonic-net#2671)
* fix lpmode set failure issue by skipping nvport
1 parent c9fcdb1 commit 9f028ed

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@
1818
PMAOS_ENABLE = 1
1919
PMAOS_DISABLE = 2
2020

21-
def get_port_admin_status_by_log_port(log_port):
21+
PORT_TYPE_NVE = 8
22+
PORT_TYPE_OFFSET = 28
23+
PORT_TYPE_MASK = 0xF0000000
24+
NVE_MASK = PORT_TYPE_MASK & (PORT_TYPE_NVE << PORT_TYPE_OFFSET)
25+
26+
def is_nve(port):
27+
return (port & NVE_MASK) != 0
28+
29+
def is_port_admin_status_up(log_port):
2230
oper_state_p = new_sx_port_oper_state_t_p()
2331
admin_state_p = new_sx_port_admin_state_t_p()
2432
module_state_p = new_sx_port_module_state_t_p()
@@ -48,9 +56,10 @@ def get_log_ports(handle, sfp_module):
4856
log_port_list = []
4957
for i in range(0, port_cnt):
5058
port_attributes = sx_port_attributes_t_arr_getitem(port_attributes_list, i)
51-
if port_attributes.port_mapping.module_port == sfp_module:
52-
if get_port_admin_status_by_log_port(port_attributes.log_port):
53-
log_port_list.append(port_attributes.log_port)
59+
if is_nve(int(port_attributes.log_port)) == False \
60+
and port_attributes.port_mapping.module_port == sfp_module \
61+
and is_port_admin_status_up(port_attributes.log_port):
62+
log_port_list.append(port_attributes.log_port)
5463

5564
return log_port_list
5665

0 commit comments

Comments
 (0)