@@ -3510,6 +3510,11 @@ bool PortsOrch::initPort(const PortConfig &port)
35103510 m_recircPortRole[alias] = role;
35113511 }
35123512
3513+ if (p.m_host_tx_queue_configured )
3514+ {
3515+ createPortBufferQueueCounters (p, to_string (p.m_host_tx_queue ), false );
3516+ }
3517+
35133518 SWSS_LOG_NOTICE (" Initialized port %s" , alias.c_str ());
35143519 }
35153520 else
@@ -3540,6 +3545,11 @@ void PortsOrch::deInitPort(string alias, sai_object_id_t port_id)
35403545 return ;
35413546 }
35423547
3548+ if (p.m_host_tx_queue_configured )
3549+ {
3550+ removePortBufferQueueCounters (p, to_string (p.m_host_tx_queue ), false );
3551+ }
3552+
35433553 /* remove port from flex_counter_table for updating counters */
35443554 auto flex_counters_orch = gDirectory .get <FlexCounterOrch*>();
35453555 if ((flex_counters_orch->getPortCountersState ()))
@@ -5951,6 +5961,9 @@ bool PortsOrch::addHostIntfs(Port &port, string alias, sai_object_id_t &host_int
59515961 attr.id = SAI_HOSTIF_ATTR_QUEUE;
59525962 attr.value .u32 = DEFAULT_HOSTIF_TX_QUEUE;
59535963 attrs.push_back (attr);
5964+
5965+ port.m_host_tx_queue = DEFAULT_HOSTIF_TX_QUEUE;
5966+ port.m_host_tx_queue_configured = true ;
59545967 }
59555968
59565969 sai_status_t status = sai_hostif_api->create_hostif (&host_intfs_id, gSwitchId , (uint32_t )attrs.size (), attrs.data ());
@@ -7258,6 +7271,10 @@ void PortsOrch::generateQueueMap(map<string, FlexCounterQueueStates> queuesState
72587271 {
72597272 flexCounterQueueState.enableQueueCounters (0 , maxQueueNumber - 1 );
72607273 }
7274+ else if (it.second .m_host_tx_queue_configured && it.second .m_host_tx_queue <= maxQueueNumber)
7275+ {
7276+ flexCounterQueueState.enableQueueCounters (it.second .m_host_tx_queue , it.second .m_host_tx_queue );
7277+ }
72617278 queuesStateVector.insert (make_pair (it.second .m_alias , flexCounterQueueState));
72627279 }
72637280 generateQueueMapPerPort (it.second , queuesStateVector.at (it.second .m_alias ), false );
@@ -7396,6 +7413,10 @@ void PortsOrch::addQueueFlexCounters(map<string, FlexCounterQueueStates> queuesS
73967413 {
73977414 flexCounterQueueState.enableQueueCounters (0 , maxQueueNumber - 1 );
73987415 }
7416+ else if (it.second .m_host_tx_queue_configured && it.second .m_host_tx_queue <= maxQueueNumber)
7417+ {
7418+ flexCounterQueueState.enableQueueCounters (it.second .m_host_tx_queue , it.second .m_host_tx_queue );
7419+ }
73997420 queuesStateVector.insert (make_pair (it.second .m_alias , flexCounterQueueState));
74007421 }
74017422 addQueueFlexCountersPerPort (it.second , queuesStateVector.at (it.second .m_alias ));
@@ -7477,6 +7498,10 @@ void PortsOrch::addQueueWatermarkFlexCounters(map<string, FlexCounterQueueStates
74777498 {
74787499 flexCounterQueueState.enableQueueCounters (0 , maxQueueNumber - 1 );
74797500 }
7501+ else if (it.second .m_host_tx_queue_configured && it.second .m_host_tx_queue <= maxQueueNumber)
7502+ {
7503+ flexCounterQueueState.enableQueueCounters (it.second .m_host_tx_queue , it.second .m_host_tx_queue );
7504+ }
74807505 queuesStateVector.insert (make_pair (it.second .m_alias , flexCounterQueueState));
74817506 }
74827507 addQueueWatermarkFlexCountersPerPort (it.second , queuesStateVector.at (it.second .m_alias ));
@@ -7524,7 +7549,7 @@ void PortsOrch::addQueueWatermarkFlexCountersPerPortPerQueueIndex(const Port& po
75247549 startFlexCounterPolling (gSwitchId , key, counters_str, QUEUE_COUNTER_ID_LIST);
75257550}
75267551
7527- void PortsOrch::createPortBufferQueueCounters (const Port &port, string queues)
7552+ void PortsOrch::createPortBufferQueueCounters (const Port &port, string queues, bool skip_host_tx_queue )
75287553{
75297554 SWSS_LOG_ENTER ();
75307555
@@ -7544,6 +7569,11 @@ void PortsOrch::createPortBufferQueueCounters(const Port &port, string queues)
75447569
75457570 for (auto queueIndex = startIndex; queueIndex <= endIndex; queueIndex++)
75467571 {
7572+ if (queueIndex == (uint32_t )port.m_host_tx_queue && skip_host_tx_queue)
7573+ {
7574+ continue ;
7575+ }
7576+
75477577 std::ostringstream name;
75487578 name << port.m_alias << " :" << queueIndex;
75497579
@@ -7581,7 +7611,7 @@ void PortsOrch::createPortBufferQueueCounters(const Port &port, string queues)
75817611 CounterCheckOrch::getInstance ().addPort (port);
75827612}
75837613
7584- void PortsOrch::removePortBufferQueueCounters (const Port &port, string queues)
7614+ void PortsOrch::removePortBufferQueueCounters (const Port &port, string queues, bool skip_host_tx_queue )
75857615{
75867616 SWSS_LOG_ENTER ();
75877617
@@ -7597,6 +7627,11 @@ void PortsOrch::removePortBufferQueueCounters(const Port &port, string queues)
75977627
75987628 for (auto queueIndex = startIndex; queueIndex <= endIndex; queueIndex++)
75997629 {
7630+ if (queueIndex == (uint32_t )port.m_host_tx_queue && skip_host_tx_queue)
7631+ {
7632+ continue ;
7633+ }
7634+
76007635 std::ostringstream name;
76017636 name << port.m_alias << " :" << queueIndex;
76027637 const auto id = sai_serialize_object_id (port.m_queue_ids [queueIndex]);
0 commit comments