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 Dec 4, 2024
1 parent d264a8a commit 71f837a
Show file tree
Hide file tree
Showing 5 changed files with 371 additions and 3 deletions.
27 changes: 26 additions & 1 deletion orchagent/flexcounterorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ extern sai_object_id_t gSwitchId;
#define FLOW_CNT_TRAP_KEY "FLOW_CNT_TRAP"
#define FLOW_CNT_ROUTE_KEY "FLOW_CNT_ROUTE"
#define ENI_KEY "ENI"
#define WRED_QUEUE_KEY "WRED_ECN_QUEUE"
#define WRED_PORT_KEY "WRED_ECN_PORT"

unordered_map<string, string> flexCounterGroupMap =
{
Expand All @@ -63,7 +65,9 @@ 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},
{"ENI", ENI_STAT_COUNTER_FLEX_COUNTER_GROUP}
{"ENI", ENI_STAT_COUNTER_FLEX_COUNTER_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 @@ -187,6 +191,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 @@ -292,6 +307,16 @@ 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 @@ -52,6 +52,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 @@ -63,6 +65,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 71f837a

Please sign in to comment.