@@ -390,30 +390,31 @@ void deleteTtlCounters(cfg::SwitchConfig* config) {
390390
391391void addTtlAclEntry (
392392 cfg::SwitchConfig* config,
393- const std::string& aclTableName) {
393+ const std::string& aclTableName,
394+ bool aclByteCounterSupported) {
394395 cfg::Ttl ttl;
395396 std::tie (*ttl.value (), *ttl.mask ()) = std::make_tuple (0x80 , 0x80 );
396397 auto ttlCounterName = getQueuePerHostTtlCounterName ();
397- std::vector<cfg::CounterType> counterTypes{
398- cfg::CounterType::PACKETS , cfg::CounterType::BYTES };
398+ std::vector<cfg::CounterType> counterTypes{cfg::CounterType::PACKETS };
399+ if (aclByteCounterSupported) {
400+ counterTypes.push_back (cfg::CounterType::BYTES );
401+ }
399402 utility::addTrafficCounter (config, ttlCounterName, counterTypes);
400403
401404 cfg::AclEntry ttlAcl{};
402405 ttlAcl.name () = getQueuePerHostTtlAclName ();
403406 ttlAcl.ttl () = ttl;
404407 ttlAcl.actionType () = cfg::AclActionType::PERMIT ;
405408 utility::addAclEntry (config, ttlAcl, aclTableName);
406- std::vector<cfg::CounterType> setCounterTypes{
407- cfg::CounterType::PACKETS , cfg::CounterType::BYTES };
408-
409409 utility::addAclStat (
410- config, getQueuePerHostTtlAclName (), ttlCounterName, setCounterTypes );
410+ config, getQueuePerHostTtlAclName (), ttlCounterName, counterTypes );
411411}
412412
413413// Utility to add TTL ACL table to a multi acl table group
414414void addTtlAclTable (
415415 cfg::SwitchConfig* config,
416416 int16_t priority,
417+ bool aclByteCounterSupported,
417418 bool addExtraQualifier) {
418419 std::vector<cfg::AclTableQualifier> qualifiers = {
419420 cfg::AclTableQualifier::TTL , cfg::AclTableQualifier::DSCP };
@@ -432,7 +433,7 @@ void addTtlAclTable(
432433 cfg::AclTableActionType::COUNTER },
433434 qualifiers);
434435
435- addTtlAclEntry (config, getTtlAclTableName ());
436+ addTtlAclEntry (config, getTtlAclTableName (), aclByteCounterSupported );
436437}
437438
438439void deleteQueuePerHostMatchers (cfg::SwitchConfig* config) {
0 commit comments