Skip to content

Commit c060f9c

Browse files
rpmarvellbaorliu
authored andcommitted
sonic-swss: Code changes for WRED and ECN statistics (sonic-net#2750)
*sonic-swss: Code changes for WRED and ECN statistics (sonic-net#2750) New flex counter group for per-Queue WRED and ECN statistics New flex counter group for per-Port WRED and ECN statistics Why I did it Implemented as per the HLD : https://github.com/sonic-net/SONiC/blob/master/doc/qos/ECN_and_WRED_statistics_HLD.md How I verified it Verfied it using Marvell DUT and SWSS unit tests. Details if related Two new flex counters added for per-Queue and per-Port WRED ECN statistics. Build dependency on sonic-swss-common pull request : sonic-net/sonic-swss-common#777 Signed-off-by: Baorong Liu <96146196+baorliu@users.noreply.github.com>
1 parent 4a597fe commit c060f9c

5 files changed

Lines changed: 406 additions & 3 deletions

File tree

orchagent/flexcounterorch.cpp

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ extern sai_object_id_t gSwitchId;
4444
#define FLOW_CNT_TRAP_KEY "FLOW_CNT_TRAP"
4545
#define FLOW_CNT_ROUTE_KEY "FLOW_CNT_ROUTE"
4646
#define ENI_KEY "ENI"
47+
#define WRED_QUEUE_KEY "WRED_ECN_QUEUE"
48+
#define WRED_PORT_KEY "WRED_ECN_PORT"
4749

4850
unordered_map<string, string> flexCounterGroupMap =
4951
{
@@ -66,7 +68,9 @@ unordered_map<string, string> flexCounterGroupMap =
6668
{"MACSEC_SA", COUNTERS_MACSEC_SA_GROUP},
6769
{"MACSEC_SA_ATTR", COUNTERS_MACSEC_SA_ATTR_GROUP},
6870
{"MACSEC_FLOW", COUNTERS_MACSEC_FLOW_GROUP},
69-
{"ENI", ENI_STAT_COUNTER_FLEX_COUNTER_GROUP}
71+
{"ENI", ENI_STAT_COUNTER_FLEX_COUNTER_GROUP},
72+
{"WRED_ECN_PORT", WRED_PORT_STAT_COUNTER_FLEX_COUNTER_GROUP},
73+
{"WRED_ECN_QUEUE", WRED_QUEUE_STAT_COUNTER_FLEX_COUNTER_GROUP},
7074
};
7175

7276

@@ -208,6 +212,17 @@ void FlexCounterOrch::doTask(Consumer &consumer)
208212
m_pg_watermark_enabled = true;
209213
gPortsOrch->addPriorityGroupWatermarkFlexCounters(getPgConfigurations());
210214
}
215+
else if(key == WRED_PORT_KEY)
216+
{
217+
gPortsOrch->generateWredPortCounterMap();
218+
m_wred_port_counter_enabled = true;
219+
}
220+
else if(key == WRED_QUEUE_KEY)
221+
{
222+
gPortsOrch->generateQueueMap(getQueueConfigurations());
223+
m_wred_queue_counter_enabled = true;
224+
gPortsOrch->addWredQueueFlexCounters(getQueueConfigurations());
225+
}
211226
}
212227
if(gIntfsOrch && (key == RIF_KEY) && (value == "enable"))
213228
{
@@ -334,6 +349,16 @@ bool FlexCounterOrch::getPgWatermarkCountersState() const
334349
return m_pg_watermark_enabled;
335350
}
336351

352+
bool FlexCounterOrch::getWredQueueCountersState() const
353+
{
354+
return m_wred_queue_counter_enabled;
355+
}
356+
357+
bool FlexCounterOrch::getWredPortCountersState() const
358+
{
359+
return m_wred_port_counter_enabled;
360+
}
361+
337362
bool FlexCounterOrch::bake()
338363
{
339364
/*

orchagent/flexcounterorch.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ class FlexCounterOrch: public Orch
5454
std::map<std::string, FlexCounterPgStates> getPgConfigurations();
5555
bool getHostIfTrapCounterState() const {return m_hostif_trap_counter_enabled;}
5656
bool getRouteFlowCountersState() const {return m_route_flow_counter_enabled;}
57+
bool getWredQueueCountersState() const;
58+
bool getWredPortCountersState() const;
5759
bool bake() override;
5860

5961
private:
@@ -66,6 +68,8 @@ class FlexCounterOrch: public Orch
6668
bool m_hostif_trap_counter_enabled = false;
6769
bool m_route_flow_counter_enabled = false;
6870
bool m_delayTimerExpired = false;
71+
bool m_wred_queue_counter_enabled = false;
72+
bool m_wred_port_counter_enabled = false;
6973
Table m_bufferQueueConfigTable;
7074
Table m_bufferPgConfigTable;
7175
Table m_deviceMetadataConfigTable;

0 commit comments

Comments
 (0)