Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mellanox] fix sfp lpmode set failure caused by extra nv port #2671

Merged
merged 2 commits into from
Mar 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@
PMAOS_ENABLE = 1
PMAOS_DISABLE = 2

def get_port_admin_status_by_log_port(log_port):
PORT_TYPE_NVE = 8
PORT_TYPE_OFFSET = 28
PORT_TYPE_MASK = 0xF0000000
NVE_MASK = PORT_TYPE_MASK & (PORT_TYPE_NVE << PORT_TYPE_OFFSET)

def is_nve(port):
return (port & NVE_MASK) != 0

def is_port_admin_status_up(log_port):
oper_state_p = new_sx_port_oper_state_t_p()
admin_state_p = new_sx_port_admin_state_t_p()
module_state_p = new_sx_port_module_state_t_p()
Expand Down Expand Up @@ -48,9 +56,10 @@ def get_log_ports(handle, sfp_module):
log_port_list = []
for i in range(0, port_cnt):
port_attributes = sx_port_attributes_t_arr_getitem(port_attributes_list, i)
if port_attributes.port_mapping.module_port == sfp_module:
if get_port_admin_status_by_log_port(port_attributes.log_port):
log_port_list.append(port_attributes.log_port)
if is_nve(int(port_attributes.log_port)) == False \
and port_attributes.port_mapping.module_port == sfp_module \
and is_port_admin_status_up(port_attributes.log_port):
log_port_list.append(port_attributes.log_port)

return log_port_list

Expand Down