@@ -173,7 +173,7 @@ static map<sai_queue_type_t, string> sai_queue_type_string_map =
173173 {SAI_QUEUE_TYPE_UNICAST_VOQ, " SAI_QUEUE_TYPE_UNICAST_VOQ" },
174174};
175175
176- const vector<sai_port_attr_t > port_serdes_attr_ids =
176+ const vector<sai_port_attr_t > port_attr_ids =
177177{
178178 SAI_PORT_ATTR_RX_SIGNAL_DETECT, // RX signal detection per lane
179179 SAI_PORT_ATTR_FEC_ALIGNMENT_LOCK, // FEC alignment lock status per lane
@@ -569,7 +569,7 @@ PortsOrch::PortsOrch(DBConnector *db, DBConnector *stateDb, vector<table_name_wi
569569 m_portStateTable(stateDb, STATE_PORT_TABLE_NAME),
570570 m_portOpErrTable(stateDb, STATE_PORT_OPER_ERR_TABLE_NAME),
571571 port_stat_manager(PORT_STAT_COUNTER_FLEX_COUNTER_GROUP, StatsMode::READ, PORT_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS, false ),
572- port_serdes_attr_manager(PORT_SERDES_ATTR_FLEX_COUNTER_GROUP , StatsMode::READ, PORT_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS, false ),
572+ port_attr_manager(PORT_ATTR_FLEX_COUNTER_GROUP , StatsMode::READ, PORT_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS, false ),
573573 gb_port_stat_manager(true ,
574574 PORT_STAT_COUNTER_FLEX_COUNTER_GROUP, StatsMode::READ,
575575 PORT_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS, false ),
@@ -582,7 +582,7 @@ PortsOrch::PortsOrch(DBConnector *db, DBConnector *stateDb, vector<table_name_wi
582582 wred_queue_stat_manager(WRED_QUEUE_STAT_COUNTER_FLEX_COUNTER_GROUP, StatsMode::READ, QUEUE_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS, false ),
583583 counter_managers({
584584 ref (port_stat_manager),
585- ref (port_serdes_attr_manager ),
585+ ref (port_attr_manager ),
586586 ref (port_buffer_drop_stat_manager),
587587 ref (queue_stat_manager),
588588 ref (queue_watermark_manager),
@@ -3810,15 +3810,15 @@ bool PortsOrch::initPort(const PortConfig &port)
38103810 gb_port_stat_manager.setCounterIdList (p.m_line_side_id ,
38113811 CounterType::PORT, gbport_counter_stats, p.m_switch_id );
38123812 }
3813- if (flex_counters_orch->getPortSerdesAttrCountersState ())
3813+ if (flex_counters_orch->getPortAttrCountersState ())
38143814 {
3815- if (p.m_type == Port::Type::PHY && supportsPortSerdesAttr (p.m_port_id , p.m_alias .c_str ()))
3815+ if (p.m_type == Port::Type::PHY && supportsPortAttr (p.m_port_id , p.m_alias .c_str ()))
38163816 {
38173817 if (!m_supported_serdes_attrs.empty ())
38183818 {
38193819 auto port_attr_stats = generateCounterStats (m_supported_serdes_attrs, sai_serialize_port_attr);
3820- port_serdes_attr_manager .setCounterIdList (p.m_port_id ,
3821- CounterType::PORT_SERDES_ATTR , port_attr_stats);
3820+ port_attr_manager .setCounterIdList (p.m_port_id ,
3821+ CounterType::PORT_ATTR , port_attr_stats);
38223822 }
38233823 }
38243824 }
@@ -3906,11 +3906,11 @@ void PortsOrch::deInitPort(string alias, sai_object_id_t port_id)
39063906 {
39073907 wred_port_stat_manager.clearCounterIdList (p.m_port_id );
39083908 }
3909- if (p.m_type == Port::Type::PHY && supportsPortSerdesAttr (p.m_port_id , p.m_alias .c_str ()))
3909+ if (p.m_type == Port::Type::PHY && supportsPortAttr (p.m_port_id , p.m_alias .c_str ()))
39103910 {
39113911 if (!m_supported_serdes_attrs.empty ())
39123912 {
3913- port_serdes_attr_manager .clearCounterIdList (p.m_port_id );
3913+ port_attr_manager .clearCounterIdList (p.m_port_id );
39143914 }
39153915 }
39163916
@@ -8389,14 +8389,14 @@ void PortsOrch::generatePortBufferDropCounterMap()
83898389 m_isPortBufferDropCounterMapGenerated = true ;
83908390}
83918391
8392- void PortsOrch::queryPortSerdesAttrCapabilities ()
8392+ void PortsOrch::queryPortAttrCapabilities ()
83938393{
83948394 if (m_serdes_attr_capability_checked)
83958395 {
83968396 return ;
83978397 }
83988398
8399- for (const auto & attr_id : port_serdes_attr_ids )
8399+ for (const auto & attr_id : port_attr_ids )
84008400 {
84018401 sai_attr_capability_t capability;
84028402
@@ -8414,20 +8414,22 @@ void PortsOrch::queryPortSerdesAttrCapabilities()
84148414 if (status == SAI_STATUS_SUCCESS && capability.get_implemented )
84158415 {
84168416 m_supported_serdes_attrs.push_back (attr_id);
8417- SWSS_LOG_NOTICE (" PORT_SERDES_ATTR : Attribute %s is SUPPORTED for GET" ,
8417+ SWSS_LOG_NOTICE (" PORT_ATTR : Attribute %s is SUPPORTED for GET" ,
84188418 attr_name);
84198419 }
84208420 else
84218421 {
8422- SWSS_LOG_NOTICE (" PORT_SERDES_ATTR : Attribute %s is NOT supported (status=%d, get_implemented=%d)" ,
8422+ SWSS_LOG_NOTICE (" PORT_ATTR : Attribute %s is NOT supported (status=%d, get_implemented=%d)" ,
84238423 attr_name, status, capability.get_implemented );
84248424 }
8425+ // TODO: remove the next line once brcm support attribute query capability
8426+ m_supported_serdes_attrs.push_back (attr_id);
84258427 }
84268428
84278429 m_serdes_attr_capability_checked = true ;
84288430}
84298431
8430- bool PortsOrch::supportsPortSerdesAttr (sai_object_id_t port_id, const char * port_name)
8432+ bool PortsOrch::supportsPortAttr (sai_object_id_t port_id, const char * port_name)
84318433{
84328434 // Verify port supports ALL SERDES attributes
84338435 // Query with count=0 to check if attribute is supported (expect BUFFER_OVERFLOW)
@@ -8441,11 +8443,11 @@ bool PortsOrch::supportsPortSerdesAttr(sai_object_id_t port_id, const char* port
84418443 sai_status_t status = sai_port_api->get_port_attribute (port_id, 1 , &test_attr);
84428444 if (status != SAI_STATUS_BUFFER_OVERFLOW)
84438445 {
8444- SWSS_LOG_ERROR (" PORT_SERDES_ATTR : Port %s does not support RX_SIGNAL_DETECT attribute (status=%d)" ,
8446+ SWSS_LOG_ERROR (" PORT_ATTR : Port %s does not support RX_SIGNAL_DETECT attribute (status=%d)" ,
84458447 port_name, status);
84468448 return false ;
84478449 }
8448- SWSS_LOG_DEBUG (" PORT_SERDES_ATTR : Port %s supports RX_SIGNAL_DETECT attribute (count=%d)" ,
8450+ SWSS_LOG_DEBUG (" PORT_ATTR : Port %s supports RX_SIGNAL_DETECT attribute (count=%d)" ,
84498451 port_name, test_attr.value .portlanelatchstatuslist .count );
84508452
84518453 // Check FEC_ALIGNMENT_LOCK
@@ -8456,11 +8458,11 @@ bool PortsOrch::supportsPortSerdesAttr(sai_object_id_t port_id, const char* port
84568458 status = sai_port_api->get_port_attribute (port_id, 1 , &test_attr);
84578459 if (status != SAI_STATUS_BUFFER_OVERFLOW)
84588460 {
8459- SWSS_LOG_ERROR (" PORT_SERDES_ATTR : Port %s does not support FEC_ALIGNMENT_LOCK attribute (status=%d)" ,
8461+ SWSS_LOG_ERROR (" PORT_ATTR : Port %s does not support FEC_ALIGNMENT_LOCK attribute (status=%d)" ,
84608462 port_name, status);
84618463 return false ;
84628464 }
8463- SWSS_LOG_DEBUG (" PORT_SERDES_ATTR : Port %s supports FEC_ALIGNMENT_LOCK attribute (count=%d)" ,
8465+ SWSS_LOG_DEBUG (" PORT_ATTR : Port %s supports FEC_ALIGNMENT_LOCK attribute (count=%d)" ,
84648466 port_name, test_attr.value .portlanelatchstatuslist .count );
84658467
84668468 // Check RX_SNR
@@ -8471,51 +8473,51 @@ bool PortsOrch::supportsPortSerdesAttr(sai_object_id_t port_id, const char* port
84718473 status = sai_port_api->get_port_attribute (port_id, 1 , &test_attr);
84728474 if (status != SAI_STATUS_BUFFER_OVERFLOW)
84738475 {
8474- SWSS_LOG_ERROR (" PORT_SERDES_ATTR : Port %s does not support RX_SNR attribute (status=%d)" ,
8476+ SWSS_LOG_ERROR (" PORT_ATTR : Port %s does not support RX_SNR attribute (status=%d)" ,
84758477 port_name, status);
84768478 return false ;
84778479 }
8478- SWSS_LOG_DEBUG (" PORT_SERDES_ATTR : Port %s supports RX_SNR attribute (count=%d)" ,
8480+ SWSS_LOG_DEBUG (" PORT_ATTR : Port %s supports RX_SNR attribute (count=%d)" ,
84798481 port_name, test_attr.value .portsnrlist .count );
84808482 return true ;
84818483}
84828484
8483- void PortsOrch::generatePortSerdesAttrCounterMap ()
8485+ void PortsOrch::generatePortAttrCounterMap ()
84848486{
8485- if (m_isPortSerdesAttrCounterMapGenerated )
8487+ if (m_isPortAttrCounterMapGenerated )
84868488 {
84878489 return ;
84888490 }
84898491
8490- queryPortSerdesAttrCapabilities ();
8492+ queryPortAttrCapabilities ();
84918493
84928494 if (m_supported_serdes_attrs.empty ())
84938495 {
8494- SWSS_LOG_WARN (" PORT_SERDES_ATTR : No SERDES attributes supported on this platform" );
8495- m_isPortSerdesAttrCounterMapGenerated = true ;
8496+ SWSS_LOG_WARN (" PORT_ATTR : No SERDES attributes supported on this platform" );
8497+ m_isPortAttrCounterMapGenerated = true ;
84968498 return ;
84978499 }
84988500
84998501 auto port_attr_stats = generateCounterStats (m_supported_serdes_attrs, sai_serialize_port_attr);
85008502
85018503 for (const auto & it: m_portList)
85028504 {
8503- if (it.second .m_type == Port::Type::PHY && supportsPortSerdesAttr (it.second .m_port_id , it.second .m_alias .c_str ()))
8505+ if (it.second .m_type == Port::Type::PHY && supportsPortAttr (it.second .m_port_id , it.second .m_alias .c_str ()))
85048506 {
8505- SWSS_LOG_DEBUG (" PORT_SERDES_ATTR : Setting counter ID list for port %s" ,
8507+ SWSS_LOG_DEBUG (" PORT_ATTR : Setting counter ID list for port %s" ,
85068508 it.second .m_alias .c_str ());
85078509
8508- port_serdes_attr_manager .setCounterIdList (it.second .m_port_id ,
8509- CounterType::PORT_SERDES_ATTR , port_attr_stats);
8510+ port_attr_manager .setCounterIdList (it.second .m_port_id ,
8511+ CounterType::PORT_ATTR , port_attr_stats);
85108512 }
85118513 }
85128514
8513- m_isPortSerdesAttrCounterMapGenerated = true ;
8515+ m_isPortAttrCounterMapGenerated = true ;
85148516}
85158517
8516- void PortsOrch::clearPortSerdesAttrCounterMap ()
8518+ void PortsOrch::clearPortAttrCounterMap ()
85178519{
8518- if (!m_isPortSerdesAttrCounterMapGenerated )
8520+ if (!m_isPortAttrCounterMapGenerated )
85198521 {
85208522 return ;
85218523 }
@@ -8528,17 +8530,17 @@ void PortsOrch::clearPortSerdesAttrCounterMap()
85288530 continue ;
85298531 }
85308532
8531- SWSS_LOG_DEBUG (" PORT_SERDES_ATTR : Clearing counter ID list for port %s" , it.second .m_alias .c_str ());
8533+ SWSS_LOG_DEBUG (" PORT_ATTR : Clearing counter ID list for port %s" , it.second .m_alias .c_str ());
85328534
8533- port_serdes_attr_manager .clearCounterIdList (it.second .m_port_id );
8535+ port_attr_manager .clearCounterIdList (it.second .m_port_id );
85348536 }
85358537
8536- m_isPortSerdesAttrCounterMapGenerated = false ;
8538+ m_isPortAttrCounterMapGenerated = false ;
85378539}
85388540
8539- const std::vector<sai_port_attr_t >& PortsOrch::getPortSerdesAttrIds () const
8541+ const std::vector<sai_port_attr_t >& PortsOrch::getPortAttrIds () const
85408542{
8541- return port_serdes_attr_ids ;
8543+ return port_attr_ids ;
85428544}
85438545
85448546/* ***
0 commit comments