Skip to content

Commit

Permalink
sonic-swss: Code changes for WRED and ECN statistics
Browse files Browse the repository at this point in the history
* 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: rpmarvell <[email protected]>
  • Loading branch information
rpmarvell committed May 4, 2023
1 parent 6e25014 commit 5438892
Show file tree
Hide file tree
Showing 5 changed files with 396 additions and 0 deletions.
26 changes: 26 additions & 0 deletions orchagent/flexcounterorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ extern FlowCounterRouteOrch *gFlowCounterRouteOrch;
#define TUNNEL_KEY "TUNNEL"
#define FLOW_CNT_TRAP_KEY "FLOW_CNT_TRAP"
#define FLOW_CNT_ROUTE_KEY "FLOW_CNT_ROUTE"
#define WRED_QUEUE_KEY "WRED_ECN_QUEUE"
#define WRED_PORT_KEY "WRED_ECN_PORT"

unordered_map<string, string> flexCounterGroupMap =
{
Expand All @@ -59,6 +61,8 @@ unordered_map<string, string> flexCounterGroupMap =
{"MACSEC_SA", COUNTERS_MACSEC_SA_GROUP},
{"MACSEC_SA_ATTR", COUNTERS_MACSEC_SA_ATTR_GROUP},
{"MACSEC_FLOW", COUNTERS_MACSEC_FLOW_GROUP},
{"WRED_ECN_PORT", WRED_PORT_STAT_COUNTER_FLEX_COUNTER_GROUP},
{"WRED_ECN_QUEUE", WRED_QUEUE_STAT_COUNTER_FLEX_COUNTER_GROUP},
};


Expand Down Expand Up @@ -184,6 +188,17 @@ void FlexCounterOrch::doTask(Consumer &consumer)
m_pg_watermark_enabled = true;
gPortsOrch->addPriorityGroupWatermarkFlexCounters(getPgConfigurations());
}
else if(key == WRED_PORT_KEY)
{
gPortsOrch->generateWredPortCounterMap();
m_wred_port_counter_enabled = true;
}
else if(key == WRED_QUEUE_KEY)
{
gPortsOrch->generateQueueMap(getQueueConfigurations());
m_wred_queue_counter_enabled = true;
gPortsOrch->addWredQueueFlexCounters(getQueueConfigurations());
}
}
if(gIntfsOrch && (key == RIF_KEY) && (value == "enable"))
{
Expand Down Expand Up @@ -286,6 +301,17 @@ bool FlexCounterOrch::getPgWatermarkCountersState() const
return m_pg_watermark_enabled;
}

bool FlexCounterOrch::getWredQueueCountersState() const
{
return m_wred_queue_counter_enabled;
}

bool FlexCounterOrch::getWredPortCountersState() const
{
return m_wred_port_counter_enabled;
}


bool FlexCounterOrch::bake()
{
/*
Expand Down
4 changes: 4 additions & 0 deletions orchagent/flexcounterorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class FlexCounterOrch: public Orch
std::map<std::string, FlexCounterPgStates> getPgConfigurations();
bool getHostIfTrapCounterState() const {return m_hostif_trap_counter_enabled;}
bool getRouteFlowCountersState() const {return m_route_flow_counter_enabled;}
bool getWredQueueCountersState() const;
bool getWredPortCountersState() const;
bool bake() override;

private:
Expand All @@ -65,6 +67,8 @@ class FlexCounterOrch: public Orch
bool m_pg_watermark_enabled = false;
bool m_hostif_trap_counter_enabled = false;
bool m_route_flow_counter_enabled = false;
bool m_wred_queue_counter_enabled = false;
bool m_wred_port_counter_enabled = false;
Table m_flexCounterConfigTable;
Table m_bufferQueueConfigTable;
Table m_bufferPgConfigTable;
Expand Down
Loading

0 comments on commit 5438892

Please sign in to comment.