Skip to content

Commit 8c1be63

Browse files
committed
sonic-swss: Code changes for WRED and ECN statistics
* New flex counter group for per-Queue WRED and ECN statistics * New flex counter group for per-Port WRED and ECN statistics Signed-off-by: [email protected] <!-- Please make sure you have read and understood the contribution guildlines: https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md 1. Make sure your commit includes a signature generted with `git commit -s` 2. Make sure your commit title follows the correct format: [component]: description 3. Make sure your commit message contains enough details about the change and related tests 4. Make sure your pull request adds related reviewers, asignees, labels Please also provide the following information in this pull request: --> **What I did** WRED and ECN statistics support **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 Expected order of dependent pull-request to be committed : 1) sonic-swss common pull request : sonic-net/sonic-swss-common#777 2) sonic-yang-model pull requests : sonic-net/sonic-buildimage#14758 3) sonic-sairedis pull request : sonic-net/sonic-sairedis#1234 4) sonic-swss : pull request : sonic-net/sonic-swss#2750 5) sonic-utilities pull request : sonic-net/sonic-utilities#2807
1 parent bdc4fe0 commit 8c1be63

File tree

5 files changed

+406
-3
lines changed

5 files changed

+406
-3
lines changed

orchagent/flexcounterorch.cpp

+26-1
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

+4
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)