Skip to content

Commit

Permalink
[orchagent]: Skip installing ACL counter when ACL mirror rule is inac…
Browse files Browse the repository at this point in the history
…tive (#3223)

* [orchagent]: Resolving issue #18844
* Don't install counters when session rule is inactive.
Mirror session is not activated and thus, the ACL rule is not created in sairedis/SAI (there is no next hop for the mirror destination IP).
However, orchagent creates and registers the ACL counter with the flexcounter (FC) and the counter is being polled every polling interval.
Since the ACL counter is not attached to any ACL rule, the BCM SAI introduces print errors in syslog.
  • Loading branch information
fountzou authored Sep 24, 2024
1 parent 008f286 commit 69cf087
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
23 changes: 22 additions & 1 deletion orchagent/aclorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2024,6 +2024,23 @@ bool AclRuleMirror::validate()
return true;
}

bool AclRuleMirror::createCounter()
{
SWSS_LOG_ENTER();

bool state = false;

m_pMirrorOrch->getSessionStatus(m_sessionName, state);

// If the mirror session is active, create the ACL counter
if(state)
{
return AclRule::createCounter();
}

return true;
}

bool AclRuleMirror::createRule()
{
SWSS_LOG_ENTER();
Expand Down Expand Up @@ -2153,7 +2170,11 @@ void AclRuleMirror::onUpdate(SubjectType type, void *cntx)
if (update->active)
{
SWSS_LOG_INFO("Activating mirroring ACL %s for session %s", m_id.c_str(), m_sessionName.c_str());
activate();
// During mirror session activation, the newly created counter needs to be registered to the FC.
if(activate() && hasCounter())
{
m_pAclOrch->registerFlexCounter(*this);
}
}
else
{
Expand Down
1 change: 1 addition & 0 deletions orchagent/aclorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ class AclRuleMirror: public AclRule
AclRuleMirror(AclOrch *m_pAclOrch, MirrorOrch *m_pMirrorOrch, string rule, string table);
bool validateAddAction(string attr_name, string attr_value);
bool validate();
bool createCounter();
bool createRule();
bool removeRule();
void onUpdate(SubjectType, void *) override;
Expand Down

0 comments on commit 69cf087

Please sign in to comment.