Skip to content

Commit 2ddf419

Browse files
authored
Use priority attribute matching acl counter using acl entry (#1029)
1 parent 8037c7d commit 2ddf419

File tree

3 files changed

+87
-3
lines changed

3 files changed

+87
-3
lines changed

syncd/BestCandidateFinder.cpp

+26-3
Original file line numberDiff line numberDiff line change
@@ -283,17 +283,34 @@ std::shared_ptr<SaiObj> BestCandidateFinder::findCurrentBestMatchForAclCounter(
283283
if (tmpAclEntryActionCounterAttr->getOid() != temporaryObj->getVid())
284284
continue; // not the counter we are looking for
285285

286+
// try use priority attribute first since it should be unique
287+
// TODO we should use HASH from all non OID attribute here to have
288+
// better chance for finding best candidate, this could be also
289+
// used in pre match logic
290+
291+
std::vector<std::shared_ptr<const SaiAttr>> values;
292+
293+
if (tmpAclEntry->hasAttr(SAI_ACL_ENTRY_ATTR_PRIORITY))
294+
{
295+
values.push_back(tmpAclEntry->getSaiAttr(SAI_ACL_ENTRY_ATTR_PRIORITY));
296+
}
297+
286298
for (auto&attr: tmpAclEntry->getAllAttributes())
287299
{
288-
auto*meta = attr.second->getAttrMetadata();
300+
values.push_back(attr.second);
301+
}
289302

290-
if (!meta->isaclfield)
303+
for (auto&attr: values)
304+
{
305+
auto*meta = attr->getAttrMetadata();
306+
307+
if (!meta->isaclfield && meta->attrid != SAI_ACL_ENTRY_ATTR_PRIORITY)
291308
continue; // looking only for acl fields
292309

293310
if (meta->isoidattribute)
294311
continue; // only non oid fields
295312

296-
auto tmpValue = attr.second->getStrAttrValue();
313+
auto tmpValue = attr->getStrAttrValue();
297314

298315
const auto curAclEntries = m_currentView.getObjectsByObjectType(SAI_OBJECT_TYPE_ACL_ENTRY);
299316

@@ -1694,6 +1711,8 @@ std::shared_ptr<SaiObj> BestCandidateFinder::findCurrentBestMatchForGenericObjec
16941711

16951712
for (const auto &currentObj: notProcessedObjects)
16961713
{
1714+
SWSS_LOG_INFO("* examing current obj: %s", currentObj->m_str_object_id.c_str());
1715+
16971716
sai_object_compare_info_t soci = { 0, currentObj };
16981717

16991718
bool has_different_create_only_attr = false;
@@ -1862,6 +1881,10 @@ std::shared_ptr<SaiObj> BestCandidateFinder::findCurrentBestMatchForGenericObjec
18621881
continue;
18631882
}
18641883

1884+
SWSS_LOG_INFO("* current obj: %s has equal %lu attributes",
1885+
currentObj->m_str_object_id.c_str(),
1886+
soci.equal_attributes);
1887+
18651888
candidateObjects.push_back(soci);
18661889
}
18671890

tests/BCM56971B0.pl

+13
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@ sub test_brcm_acl_limit
1515
play "acl_limit.rec";
1616
}
1717

18+
sub test_brcm_acl_prio
19+
{
20+
fresh_start("-b", "$utils::DIR/break.ini", "-p", "$utils::DIR/vsprofile.ini");
21+
22+
play "acl_prio.rec";
23+
play "acl_prio.rec", 0;
24+
play "acl_prio.rec", 0;
25+
play "acl_prio.rec", 0;
26+
play "acl_prio.rec", 0;
27+
play "acl_prio.rec", 0;
28+
}
29+
30+
test_brcm_acl_prio;
1831
test_brcm_acl_limit;
1932

2033
kill_syncd;

0 commit comments

Comments
 (0)