Skip to content

Add ACL Mirror Copy Type and Mirror Session ID match fields#2274

Open
mobinmohan wants to merge 2 commits into
opencomputeproject:masterfrom
mobinmohan:add_mirror_copy
Open

Add ACL Mirror Copy Type and Mirror Session ID match fields#2274
mobinmohan wants to merge 2 commits into
opencomputeproject:masterfrom
mobinmohan:add_mirror_copy

Conversation

@mobinmohan
Copy link
Copy Markdown

@mobinmohan mobinmohan commented Apr 10, 2026

This PR introduces two new ACL match fields to the SAI ACL headers:

  1. SAI_ACL_TABLE_ATTR_FIELD_ACL_MIRROR_COPY_TYPE: Allows ACL rules to match packets based on whether they are mirror copies and their specific type (Ingress, Egress, or Ingress Or Egress).

  2. SAI_ACL_TABLE_ATTR_FIELD_ACL_MIRROR_SESSION_ID: Allows ACL rules to match based on a specific mirror session ID.

@mobinmohan mobinmohan force-pushed the add_mirror_copy branch 2 times, most recently from cd28e05 to 0ae367c Compare April 10, 2026 23:08
@JaiOCP
Copy link
Copy Markdown
Contributor

JaiOCP commented Apr 13, 2026

_ No description provided. _

Pleas provide description of the PR

@JaiOCP
Copy link
Copy Markdown
Contributor

JaiOCP commented Apr 13, 2026

@mobinmohan Is it an ingress mirror or egress mirror copy match condition.

@mobinmohan
Copy link
Copy Markdown
Author

@mobinmohan Is it an ingress mirror or egress mirror copy match condition.

The attribute was to match both ingress and egress mirror copies. However, I can change the type from bool to sai_acl_mirror_copy_type_t to allow selective matching, if the underlying hardware supports it. Please let me know your recommendation.

+/**
+ * @brief Mirror copy type for ACL matching
+ */
+typedef enum _sai_acl_mirror_copy_type_t
+{
+    SAI_ACL_MIRROR_COPY_TYPE_NONE,
+    SAI_ACL_MIRROR_COPY_TYPE_INGRESS,
+    SAI_ACL_MIRROR_COPY_TYPE_EGRESS,
+    SAI_ACL_MIRROR_COPY_TYPE_ANY
+} sai_acl_mirror_copy_type_t;
+
+

@JaiOCP
Copy link
Copy Markdown
Contributor

JaiOCP commented Apr 14, 2026

@mobinmohan Is it an ingress mirror or egress mirror copy match condition.

The attribute was to match both ingress and egress mirror copies. However, I can change the type from bool to sai_acl_mirror_copy_type_t to allow selective matching, if the underlying hardware supports it. Please let me know your recommendation.

+/**
+ * @brief Mirror copy type for ACL matching
+ */
+typedef enum _sai_acl_mirror_copy_type_t
+{
+    SAI_ACL_MIRROR_COPY_TYPE_NONE,
+    SAI_ACL_MIRROR_COPY_TYPE_INGRESS,
+    SAI_ACL_MIRROR_COPY_TYPE_EGRESS,
+    SAI_ACL_MIRROR_COPY_TYPE_ANY
+} sai_acl_mirror_copy_type_t;
+
+

I don't think we need to have type_t.
If the ACL table stage is ingress then the match action would apply to ingress mirror.
If the ACL table stage is egress then the match action would apply to egress mirror.

Typically there is no case where ingress mirror copy needs an egress ACL rule for match action as the mirror copy is taken out to the mirror port directly but I am not very sure about it. Is that a use case for you?

Comment thread inc/saiacl.h Outdated
@mobinmohan
Copy link
Copy Markdown
Author

_ No description provided. _

Pleas provide description of the PR

Added description.

@mobinmohan mobinmohan closed this Apr 23, 2026
@mobinmohan mobinmohan reopened this Apr 23, 2026
@mobinmohan
Copy link
Copy Markdown
Author

@mobinmohan Is it an ingress mirror or egress mirror copy match condition.

The attribute was to match both ingress and egress mirror copies. However, I can change the type from bool to sai_acl_mirror_copy_type_t to allow selective matching, if the underlying hardware supports it. Please let me know your recommendation.

+/**
+ * @brief Mirror copy type for ACL matching
+ */
+typedef enum _sai_acl_mirror_copy_type_t
+{
+    SAI_ACL_MIRROR_COPY_TYPE_NONE,
+    SAI_ACL_MIRROR_COPY_TYPE_INGRESS,
+    SAI_ACL_MIRROR_COPY_TYPE_EGRESS,
+    SAI_ACL_MIRROR_COPY_TYPE_ANY
+} sai_acl_mirror_copy_type_t;
+
+

I don't think we need to have type_t. If the ACL table stage is ingress then the match action would apply to ingress mirror. If the ACL table stage is egress then the match action would apply to egress mirror.

Typically there is no case where ingress mirror copy needs an egress ACL rule for match action as the mirror copy is taken out to the mirror port directly but I am not very sure about it. Is that a use case for you?

Sounds good. We can continue with the default(bool).

@Gnanapriya27
Copy link
Copy Markdown

_sai_acl_mirror_copy_type_t

The current bool definition still leaves ambiguity on what exactly is being matched.
Interpreting this based on the stage as per ACL table,
Ingress ACL stage → match ingress-generated mirror copies only
Egress ACL stage → match egress-generated mirror copies only

then SAI_ACL_ENTRY_ATTR_FIELD_MIRROR_COPY=true in an egress ACL table, does it mean only egress mirror copies, not any mirrored packet ? please clarify.

Modeling this stage/direction explicitly using sai_acl_mirror_copy_type_t (as proposed in this conversation) would make the semantics unambiguous and future-proof the design, enum capability query allows the vendor to announce their capabilities.

Comment thread inc/saiacl.h Outdated
@JaiOCP
Copy link
Copy Markdown
Contributor

JaiOCP commented Apr 24, 2026

_sai_acl_mirror_copy_type_t

The current bool definition still leaves ambiguity on what exactly is being matched. Interpreting this based on the stage as per ACL table, Ingress ACL stage → match ingress-generated mirror copies only Egress ACL stage → match egress-generated mirror copies only

then SAI_ACL_ENTRY_ATTR_FIELD_MIRROR_COPY=true in an egress ACL table, does it mean only egress mirror copies, not any mirrored packet ? please clarify.

Modeling this stage/direction explicitly using sai_acl_mirror_copy_type_t (as proposed in this conversation) would make the semantics unambiguous and future-proof the design, enum capability query allows the vendor to announce their capabilities.

I agree and take my earlier statement back.
Just providing the stage is not enough. Lets use the type_t

@mobinmohan mobinmohan changed the title Add SAI_ACL_TABLE_ATTR_FIELD_MIRROR_COPY Add SAI_ACL_TABLE_ATTR_FIELD_MIRROR_COPY_TYPE Apr 27, 2026
@mobinmohan
Copy link
Copy Markdown
Author

_sai_acl_mirror_copy_type_t

The current bool definition still leaves ambiguity on what exactly is being matched. Interpreting this based on the stage as per ACL table, Ingress ACL stage → match ingress-generated mirror copies only Egress ACL stage → match egress-generated mirror copies only

then SAI_ACL_ENTRY_ATTR_FIELD_MIRROR_COPY=true in an egress ACL table, does it mean only egress mirror copies, not any mirrored packet ? please clarify.

Modeling this stage/direction explicitly using sai_acl_mirror_copy_type_t (as proposed in this conversation) would make the semantics unambiguous and future-proof the design, enum capability query allows the vendor to announce their capabilities.

I received a similar feedback during the weekly review meeting. I agree using sai_acl_mirror_copy_type_t makes the design future proof. I have updated the PR to use the enum type, though proper distinction will depend on the ASIC support.

@mobinmohan
Copy link
Copy Markdown
Author

_sai_acl_mirror_copy_type_t

The current bool definition still leaves ambiguity on what exactly is being matched. Interpreting this based on the stage as per ACL table, Ingress ACL stage → match ingress-generated mirror copies only Egress ACL stage → match egress-generated mirror copies only
then SAI_ACL_ENTRY_ATTR_FIELD_MIRROR_COPY=true in an egress ACL table, does it mean only egress mirror copies, not any mirrored packet ? please clarify.
Modeling this stage/direction explicitly using sai_acl_mirror_copy_type_t (as proposed in this conversation) would make the semantics unambiguous and future-proof the design, enum capability query allows the vendor to announce their capabilities.

I agree and take my earlier statement back. Just providing the stage is not enough. Lets use the type_t

Thanks for reviewing this during the weekly meeting. I have update the PR now.

@mobinmohan mobinmohan changed the title Add SAI_ACL_TABLE_ATTR_FIELD_MIRROR_COPY_TYPE Add SAI_ACL_TABLE_ATTR_FIELD_ACL_MIRROR_COPY_TYPE Apr 27, 2026
@tjchadaga tjchadaga added the reviewed PR is discussed in SAI Meeting label Apr 28, 2026
@tjchadaga tjchadaga requested a review from Gnanapriya27 May 5, 2026 19:28
@tjchadaga
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Comment thread inc/saiacl.h
This change introduces a new ACL match field `ACL_MIRROR_COPY_TYPE` to allow ACLs to match based on whether the packet is a mirror copy. It allows ACLs to match based on the type of mirror copy (Ingress, Egress, or Ingress or Egress).

Change-Id: I351b2aba82b10ce52425615920eb07e7fd964f96
Signed-off-by: Mobin Mohan <mobinmohan@google.com>
@mobinmohan mobinmohan changed the title Add SAI_ACL_TABLE_ATTR_FIELD_ACL_MIRROR_COPY_TYPE Add ACL Mirror Copy Type and Mirror Session ID match fields May 19, 2026
Comment thread inc/saiacl.h
Comment thread inc/saiacl.h
Comment thread inc/saiacl.h
Comment thread inc/saiacl.h Outdated
This change introduces a new ACL match field `ACL_MIRROR_SESSION_ID` to allow ACLs to match based on a specific mirror session ID.

* Added support to match on `SAI_OBJECT_TYPE_MIRROR_SESSION` objects in ACL entries.
* Added Table and Entry attributes with updated end markers.

Change-Id: Iea1a664dbe8fca6e22a9b3f9c50ecb0fc9f29b75
Signed-off-by: Mobin Mohan <mobinmohan@google.com>
Copy link
Copy Markdown

@Gnanapriya27 Gnanapriya27 left a comment

Choose a reason for hiding this comment

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

Looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewed PR is discussed in SAI Meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants