Skip to content

Commit

Permalink
vslib: add support for read-only port capabilities (sonic-net#1038)
Browse files Browse the repository at this point in the history
* vslib: add support for read-only port capabilities

Signed-off-by: Dante Su <[email protected]>

* vslib: Drop LT capability query

Signed-off-by: Dante Su <[email protected]>
  • Loading branch information
ds952811 authored May 16, 2022
1 parent 1b80b57 commit f393723
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
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

0 comments on commit f393723

Please sign in to comment.