Skip to content

[aclorch]: Support SET_PACKET_COLOR ACL action#4717

Open
AnantKishorSharma wants to merge 1 commit into
sonic-net:masterfrom
AnantKishorSharma:acl-set-packet-color-action
Open

[aclorch]: Support SET_PACKET_COLOR ACL action#4717
AnantKishorSharma wants to merge 1 commit into
sonic-net:masterfrom
AnantKishorSharma:acl-set-packet-color-action

Conversation

@AnantKishorSharma

@AnantKishorSharma AnantKishorSharma commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

What I did

Add PACKET_COLOR_ACTION (GREEN/YELLOW/RED) to the generic CONFIG_DB AclOrch pipeline, mapping it to SAI_ACL_ENTRY_ATTR_ACTION_SET_PACKET_COLOR. SAI_ACL_ENTRY_ATTR_ACTION_SET_PACKET_COLOR was only reachable via the P4Orch/P4RT path; the standard CONFIG_DB AclOrch pipeline had no mapping.

Details

  • aclL3ActionLookup: map PACKET_COLOR_ACTION -> SAI_ACL_ENTRY_ATTR_ACTION_SET_PACKET_COLOR
  • aclPacketColorLookup: GREEN/YELLOW/RED -> SAI_PACKET_COLOR_* (value is case-insensitive)
  • AclRulePacket::validateAddAction: parse the color value, reject invalid values
  • AclRulePacket::validate: SET_PACKET_COLOR is a composable QoS marking (a drop-precedence color consumed downstream by a color-aware policer/WRED), so a rule may set the color and still carry a single forwarding/terminating action (e.g. PACKET_ACTION) plus a counter — only the non-color actions are capped at one. This is consistent with the composable SET_POLICER ([aclorch] acl set policer action #4666) and SET_TC ([aclorch]: Support SET_TC (traffic class) ACL rule action #4726) actions; SAI applies SET_PACKET_COLOR as an independent CREATE_AND_SET action.
  • queryAclActionCapability: query the enum-value capability so the action is capability-gated (platforms that don't advertise it simply reject the table — no behavior change for anyone else)

How I verified

  • Unit tests: AclRuleSetPacketColorAction (positive — programs the right sai_packet_color_t, rejects invalid color), AclTableSetPacketColorActionNotSupported (negative — table rejected when the platform does not advertise the action), and AclRuleSetPacketColorActionComposeForward (PACKET_ACTION=FORWARD + PACKET_COLOR_ACTION in one rule is created and programs both SAI actions). Full swss mock unit-test suite passes (914/914).
  • Hardware (Broadcom TH5): a rule with GREEN/YELLOW/RED programs SAI_ACL_ENTRY_ATTR_ACTION_SET_PACKET_COLOR in ASIC_DB and the corresponding field-processor action (verified via bcmcmd).

Requires the YANG model addition: sonic-net/sonic-buildimage#28151

HLD: sonic-net/SONiC#2429

Fixes #4716

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@AnantKishorSharma AnantKishorSharma marked this pull request as ready for review June 29, 2026 23:15
@prsunny prsunny requested review from Copilot and kperumalbfn June 30, 2026 18:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds support for setting packet color (GREEN/YELLOW/RED) via the generic CONFIG_DB ACL pipeline in AclOrch, mapping the new PACKET_COLOR_ACTION to SAI_ACL_ENTRY_ATTR_ACTION_SET_PACKET_COLOR and capability-gating it based on the platform’s advertised ACL action + enum-value support.

Changes:

  • Add PACKET_COLOR_ACTIONSAI_ACL_ENTRY_ATTR_ACTION_SET_PACKET_COLOR mapping plus value lookup (GREEN/YELLOW/REDSAI_PACKET_COLOR_*) and rule-time validation.
  • Extend ACL capability querying to include enum-value capability checks for the new action.
  • Add mock unit tests covering supported/unsupported platforms and invalid color handling; document the new schema field.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tests/mock_tests/aclorch_ut.cpp Adds unit tests for SET_PACKET_COLOR action programming and capability gating.
orchagent/aclorch.h Introduces PACKET_COLOR_ACTION action name and packet color string constants/types.
orchagent/aclorch.cpp Implements action parsing/mapping + capability querying for SET_PACKET_COLOR.
doc/swss-schema.md Documents packet_color_action in the ACL rule schema.

Comment thread tests/mock_tests/aclorch_ut.cpp
Comment thread doc/swss-schema.md Outdated
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@AnantKishorSharma AnantKishorSharma force-pushed the acl-set-packet-color-action branch from 3ce233b to 77248ed Compare June 30, 2026 19:27
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

Hi, there are workflow run(s) waiting for approval, you may be first-time contributor. I will notify maintainers to help approve once PR is approved. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Map PACKET_COLOR_ACTION (GREEN/YELLOW/RED) to
SAI_ACL_ENTRY_ATTR_ACTION_SET_PACKET_COLOR in the CONFIG_DB AclOrch pipeline
(previously reachable only via P4Orch). The action is capability-gated:
platforms that do not advertise it reject the table, with no other change.

SET_PACKET_COLOR is a composable QoS marking consumed downstream by a
color-aware policer/WRED, so AclRulePacket::validate() caps only the non-color
actions at one -- a rule may set the color and still carry a single
forwarding/terminating action (e.g. PACKET_ACTION) plus a counter.

Tests: positive, capability-gate, and color + PACKET_ACTION(FORWARD) compose.
Signed-off-by: Anant Kishor Sharma <anant.kishor-sharma@hpe.com>
@AnantKishorSharma AnantKishorSharma force-pushed the acl-set-packet-color-action branch from d7aaa40 to fbec30c Compare July 13, 2026 09:17
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

AnantKishorSharma added a commit to AnantKishorSharma/SONiC that referenced this pull request Jul 13, 2026
Document PACKET_COLOR_ACTION (GREEN/YELLOW/RED) in the ACL High Level Design:
it maps to SAI_ACL_ENTRY_ATTR_ACTION_SET_PACKET_COLOR in the generic CONFIG_DB
AclOrch pipeline, is capability-gated per ACL stage (ingress and/or egress),
and is a no-op on platforms whose SAI does not advertise the action. It is a
composable QoS marking (sets internal drop precedence only, not DSCP/PCP) that
may accompany a single forwarding action plus a counter.

Companion to sonic-net/sonic-swss#4717.

Signed-off-by: Anant Kishor Sharma <anant.kishor-sharma@hpe.com>
AnantKishorSharma added a commit to AnantKishorSharma/SONiC that referenced this pull request Jul 13, 2026
Document PACKET_COLOR_ACTION (GREEN/YELLOW/RED) in the ACL High Level Design:
it maps to SAI_ACL_ENTRY_ATTR_ACTION_SET_PACKET_COLOR in the generic CONFIG_DB
AclOrch pipeline, is capability-gated per ACL stage (ingress and/or egress),
and is a no-op on platforms whose SAI does not advertise the action. It is a
composable QoS marking (sets internal drop precedence only, not DSCP/PCP) that
may accompany a single forwarding action plus a counter.

Companion to sonic-net/sonic-swss#4717.

Signed-off-by: Anant Kishor Sharma <anant.kishor-sharma@hpe.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[acl] PACKET_COLOR_ACTION (SAI_ACL_ENTRY_ATTR_ACTION_SET_PACKET_COLOR) not supported in the generic CONFIG_DB ACL pipeline

3 participants