From 8894dc7b6690a2b64672913694f9769ac86ae9c9 Mon Sep 17 00:00:00 2001 From: "Dante (Kuo-Jung) Su" Date: Tue, 17 May 2022 05:53:31 +0800 Subject: [PATCH] vslib: add support for read-only port capabilities (#1038) * vslib: add support for read-only port capabilities Signed-off-by: Dante Su * vslib: Drop LT capability query Signed-off-by: Dante Su --- vslib/SwitchStateBase.cpp | 21 +++++++++++++++++++++ vslib/SwitchStateBase.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/vslib/SwitchStateBase.cpp b/vslib/SwitchStateBase.cpp index e977c0335bec..1986c08d4f3e 100644 --- a/vslib/SwitchStateBase.cpp +++ b/vslib/SwitchStateBase.cpp @@ -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(); @@ -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()); @@ -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; } } diff --git a/vslib/SwitchStateBase.h b/vslib/SwitchStateBase.h index 76f2527c88e1..c2e64d50c44a 100644 --- a/vslib/SwitchStateBase.h +++ b/vslib/SwitchStateBase.h @@ -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();