@@ -76,6 +76,7 @@ PortsOrch::PortsOrch(DBConnector *db, vector<string> tableNames) :
76
76
m_queueTable = unique_ptr<Table>(new Table (m_counter_db.get (), COUNTERS_QUEUE_NAME_MAP));
77
77
m_queuePortTable = unique_ptr<Table>(new Table (m_counter_db.get (), COUNTERS_QUEUE_PORT_MAP));
78
78
m_queueIndexTable = unique_ptr<Table>(new Table (m_counter_db.get (), COUNTERS_QUEUE_INDEX_MAP));
79
+ m_queueTypeTable = unique_ptr<Table>(new Table (m_counter_db.get (), COUNTERS_QUEUE_TYPE_MAP));
79
80
80
81
m_flex_db = shared_ptr<DBConnector>(new DBConnector (PFC_WD_DB, DBConnector::DEFAULT_UNIXSOCKET, 0 ));
81
82
m_flexCounterTable = unique_ptr<ProducerStateTable>(new ProducerStateTable (m_flex_db.get (), PFC_WD_STATE_TABLE));
@@ -645,6 +646,39 @@ bool PortsOrch::getPortSpeed(sai_object_id_t port_id, sai_uint32_t &speed)
645
646
return status == SAI_STATUS_SUCCESS;
646
647
}
647
648
649
+ bool PortsOrch::getQueueType (sai_object_id_t queue_id, string &type)
650
+ {
651
+ SWSS_LOG_ENTER ();
652
+
653
+ sai_attribute_t attr;
654
+ attr.id = SAI_QUEUE_ATTR_TYPE;
655
+
656
+ sai_status_t status = sai_queue_api->get_queue_attribute (queue_id, 1 , &attr);
657
+ if (status != SAI_STATUS_SUCCESS)
658
+ {
659
+ SWSS_LOG_ERROR (" Failed to get queue type for queue %lu rv:%d" , queue_id, status);
660
+ return false ;
661
+ }
662
+
663
+ switch (attr.value .s32 )
664
+ {
665
+ case SAI_QUEUE_TYPE_ALL:
666
+ type = " SAI_QUEUE_TYPE_ALL" ;
667
+ break ;
668
+ case SAI_QUEUE_TYPE_UNICAST:
669
+ type = " SAI_QUEUE_TYPE_UNICAST" ;
670
+ break ;
671
+ case SAI_QUEUE_TYPE_MULTICAST:
672
+ type = " SAI_QUEUE_TYPE_MULTICAST" ;
673
+ break ;
674
+ default :
675
+ SWSS_LOG_ERROR (" Got unsupported queue type %d for %lu queue" , attr.value .s32 , queue_id);
676
+ throw runtime_error (" Got unsupported queue type" );
677
+ }
678
+
679
+ return true ;
680
+ }
681
+
648
682
bool PortsOrch::setHostIntfsOperStatus (sai_object_id_t port_id, bool up)
649
683
{
650
684
SWSS_LOG_ENTER ();
@@ -1504,6 +1538,7 @@ void PortsOrch::initializeQueues(Port &port)
1504
1538
vector<FieldValueTuple> queueVector;
1505
1539
vector<FieldValueTuple> queuePortVector;
1506
1540
vector<FieldValueTuple> queueIndexVector;
1541
+ vector<FieldValueTuple> queueTypeVector;
1507
1542
1508
1543
for (size_t queueIndex = 0 ; queueIndex < port.m_queue_ids .size (); ++queueIndex)
1509
1544
{
@@ -1522,6 +1557,16 @@ void PortsOrch::initializeQueues(Port &port)
1522
1557
to_string (queueIndex));
1523
1558
queueIndexVector.push_back (queueIndexTuple);
1524
1559
1560
+
1561
+ string queueType;
1562
+ if (getQueueType (port.m_queue_ids [queueIndex], queueType))
1563
+ {
1564
+ FieldValueTuple queueTypeTuple (
1565
+ sai_serialize_object_id (port.m_queue_ids [queueIndex]),
1566
+ queueType);
1567
+ queueTypeVector.push_back (queueTypeTuple);
1568
+ }
1569
+
1525
1570
string key = sai_serialize_object_id (port.m_queue_ids [queueIndex]) + " :" + FLEX_STAT_COUNTER_POLL_MSECS;
1526
1571
1527
1572
std::string delimiter = " " ;
@@ -1541,6 +1586,7 @@ void PortsOrch::initializeQueues(Port &port)
1541
1586
m_queueTable->set (" " , queueVector);
1542
1587
m_queuePortTable->set (" " , queuePortVector);
1543
1588
m_queueIndexTable->set (" " , queueIndexVector);
1589
+ m_queueTypeTable->set (" " , queueTypeVector);
1544
1590
}
1545
1591
1546
1592
void PortsOrch::initializePriorityGroups (Port &port)
0 commit comments