Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling Sflow trap group in CoPP #1256

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions orchagent/copporch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,14 +451,13 @@ bool CoppOrch::removeGenetlinkHostIf(string trap_group_name)
return true;
}

task_process_status CoppOrch::processCoppRule(Consumer& consumer)
task_process_status CoppOrch::processCoppRule(Consumer& consumer, SyncMap::iterator it)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this function only need the "tuple" as input, why we don't change it to:
task_process_status CoppOrch::processCoppRule(KeyOpFieldsValuesTuple tuple)

to make it clearer?

{
SWSS_LOG_ENTER();

sai_status_t sai_status;
vector<string> trap_id_list;
string queue_ind;
auto it = consumer.m_toSync.begin();
KeyOpFieldsValuesTuple tuple = it->second;
string trap_group_name = kfvKey(tuple);
string op = kfvOp(tuple);
Expand Down Expand Up @@ -832,7 +831,7 @@ void CoppOrch::doTask(Consumer &consumer)

try
{
task_status = processCoppRule(consumer);
task_status = processCoppRule(consumer, it);
}
catch(const out_of_range& e)
{
Expand All @@ -859,7 +858,6 @@ void CoppOrch::doTask(Consumer &consumer)
SWSS_LOG_ERROR("Processing copp task item failed, exiting. ");
return;
case task_process_status::task_need_retry:
SWSS_LOG_ERROR("Processing copp task item failed, will retry.");
it++;
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion orchagent/copporch.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class CoppOrch : public Orch
void initDefaultTrapGroup();
void initDefaultTrapIds();

task_process_status processCoppRule(Consumer& consumer);
task_process_status processCoppRule(Consumer& consumer, SyncMap::iterator it);
bool isValidList(std::vector<std::string> &trap_id_list, std::vector<std::string> &all_items) const;
void getTrapIdList(std::vector<std::string> &trap_id_name_list, std::vector<sai_hostif_trap_type_t> &trap_id_list) const;
bool applyTrapIds(sai_object_id_t trap_group, std::vector<std::string> &trap_id_name_list, std::vector<sai_attribute_t> &trap_id_attribs);
Expand Down
18 changes: 17 additions & 1 deletion swssconfig/sample/00-copp.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,21 @@
"red_action":"drop"
},
"OP": "SET"
}
},
{
"COPP_TABLE:trap.group.sflow": {
"trap_ids": "sample_packet",
"trap_action":"trap",
"trap_priority":"1",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is taking the same priority as the ip2me? I would think we should make it lower than that, so maybe raise ip2me to "2", and keep this to "1". to keep consistent with the queue, we can make ip2me to queue 2, and sflow to queue 1.

"queue": "2",
"meter_type":"packets",
"mode":"sr_tcm",
"cir":"5000",
"cbs":"5000",
"red_action":"drop",
"genetlink_name":"psample",
"genetlink_mcgrp_name":"packets"
},
"OP": "SET"
}
]