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

vslib: add support for read-only port capabilities #1038

Merged
merged 2 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
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
21 changes: 21 additions & 0 deletions vslib/SwitchStateBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,23 @@ sai_status_t SwitchStateBase::set_port_list()
return set(SAI_OBJECT_TYPE_SWITCH, m_switch_id, &attr);
}

sai_status_t SwitchStateBase::set_port_capabilities()
{
SWSS_LOG_ENTER();

SWSS_LOG_NOTICE("set port capabilities");

sai_attribute_t attr;

for (auto &port_id: m_port_list)
{
attr.id = SAI_PORT_ATTR_SUPPORTED_AUTO_NEG_MODE;
attr.value.booldata = true;
CHECK_STATUS(set(SAI_OBJECT_TYPE_PORT, port_id, &attr));
}
return SAI_STATUS_SUCCESS;
}

sai_status_t SwitchStateBase::create_default_virtual_router()
{
SWSS_LOG_ENTER();
Expand Down Expand Up @@ -1597,6 +1614,7 @@ sai_status_t SwitchStateBase::initialize_default_objects(
CHECK_STATUS(create_ports());
CHECK_STATUS(create_port_serdes());
CHECK_STATUS(set_port_list());
CHECK_STATUS(set_port_capabilities());
CHECK_STATUS(create_bridge_ports());
CHECK_STATUS(create_vlan_members());
CHECK_STATUS(set_acl_entry_min_prio());
Expand Down Expand Up @@ -2289,6 +2307,9 @@ sai_status_t SwitchStateBase::refresh_read_only(

case SAI_PORT_ATTR_PORT_SERDES_ID:
return refresh_port_serdes_id(object_id);

case SAI_PORT_ATTR_SUPPORTED_AUTO_NEG_MODE:
return SAI_STATUS_SUCCESS;
}
}

Expand Down
2 changes: 2 additions & 0 deletions vslib/SwitchStateBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ namespace saivs

virtual sai_status_t set_port_list();

virtual sai_status_t set_port_capabilities();

virtual sai_status_t create_fabric_ports();

virtual sai_status_t set_fabric_port_list();
Expand Down