-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Design document for L2 ACL table support #1165
Open
ArthiGovindaraj
wants to merge
1
commit into
sonic-net:master
Choose a base branch
from
ArthiGovindaraj:acl_l2_table_support_doc
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
# L2 ACL table support | ||
|
||
# Table of Contents | ||
|
||
#### Revision | ||
| Rev | Date | Author | Change Description | | ||
|:---:|:-------:|:------------------:|:------------------:| | ||
| 0.1 | 2022-12 | Arthi Govindaraj | Initial Version | | ||
|
||
## Overview | ||
In current design of orchagent, there is no support for L2 ACL table with match fields in Ethernet and Vlan header like source mac, destination mac, outer vlan priority/PCP and outer vlan CFI/DEI. So if a user wants to filter based on these fields then the support does not exist. | ||
|
||
## High Level Design | ||
|
||
**Requirement :** New table of type L2 with L2 match fields and default actions needs to be defined. | ||
For this, we need to define CONFIG DB schema for the new L2 fields. In orchagent, we need to define SAI table attributes for the L2 table and add definitions for L2 fields in ACL entry qualifier validations. Also acl-loader needs to be updated to support the same in CLICK command. | ||
|
||
**Proposed L2 table :** | ||
|
||
Table of type "L2" | ||
###### **Table 1: Matches allowed in the table of the type "L2"** | ||
|
||
Keyword for the match criteria | Type | Description | ||
-------------------------------|------|------------ | ||
ETHER_TYPE | uint16_t | Hexadecimal integer [0..FFFF] | ||
IP_TYPE | string | One of: "IPv4"/"NON_IPv4"/"ARP" | ||
SRC_MAC | string | MAC address format (MAC value/ MAC mask) | ||
DST_MAC | string | MAC address format (MAC value/ MAC mask) | ||
VLAN | uint16_t | Decimal values from 1-4094 | ||
VLAN_PCP | uint8_t | Decimal value or value/mask [0..7 (or) 0..7/0..7] | ||
VLAN_DEI | uint8_t | Decimal value of 0 or 1 [0..1] | ||
|
||
###### **Table 2: Actions allowed in the table of the type "L2"** | ||
Keyword for the action type | Type | Description | ||
-------------------------------|------|------------ | ||
PACKET_ACTION | string | Packet action value: "FORWARD" or "DROP" | ||
REDIRECT_ACTION | string | Redirect ip next : Next hop ip address | ||
|
||
|
||
### CONFIG_DB schema definitions : | ||
|
||
**L2 table type defined in ACL_TABLE:** | ||
``` | ||
In table, ACL_TABLE field:type new value "L2" is defined along with existing types "L3 or L3V6" | ||
``` | ||
**New L2 fields are added to the ACL_RULE table:** | ||
``` | ||
key: ACL_RULE:table_name:rule_name ; key of the rule entry in the table, | ||
;field = value | ||
/* New fields */ | ||
SRC_MAC = mac address ; options of the source mac | ||
; address/mask field | ||
DST_MAC = mac address ; options of the destination mac | ||
; address/mask field | ||
VLAN_PCP = 1*3DIGIT (or) 1*3DIGIT/1*3DIGIT ; Outer VLAN pcp/priority field value (0-7) or value/mask (0-7/0-7) | ||
VLAN_DEI = 1*1DIGIT ; Outer VLAN DEI/CFI field value:0 or 1 | ||
/* Existing fields */ | ||
ETHER_TYPE = h16 ; Ethernet type field | ||
VLAN_ID = h16 ; vlan id field ranging from 1-4094 | ||
IP_TYPE = ip_types ; options of the l2_protocol_type | ||
; field. | ||
;value annotations | ||
ip_types = any | ip | ipv4 | ipv4any | non_ipv4 | ipv6any | non_ipv6 | ||
``` | ||
|
||
**Example:** | ||
``` | ||
{ | ||
"ACL_TABLE": { | ||
"DATAACL": { | ||
"STAGE": "INGRESS", | ||
"TYPE" : "L2", | ||
"PORTS": [ | ||
"Ethernet0", | ||
"PortChannel1" | ||
] | ||
} | ||
}, | ||
"ACL_RULE": { | ||
"DATAACL|RULE0": { | ||
"SRC_MAC": "00:00:00:11:11:11/00:00:00:ff:ff:ff", | ||
"DST_MAC": "00:00:00:22:22:22/00:00:00:ff:ff:ff", | ||
"ETHER_TYPE": "0x0800", | ||
"VLAN_ID": "100", | ||
"VLAN_PCP": "5/7", | ||
"VLAN_DEI": "1", | ||
"PRIORITY": "5", | ||
"PACKET_ACTION": "DROP" | ||
} | ||
} | ||
} | ||
``` | ||
### orchagent changes | ||
|
||
- Need to define new predefined ACLTableType "L2" with L2 fields and default actions packet_action and redirect. | ||
- validateAddMatch() function needs to be updated to handle L2 fields | ||
SAI_ACL_ENTRY_ATTR_FIELD_SRC_MAC | ||
SAI_ACL_ENTRY_ATTR_FIELD_DST_MAC | ||
SAI_ACL_ENTRY_ATTR_FIELD_OUTER_VLAN_PRI | ||
SAI_ACL_ENTRY_ATTR_FIELD_OUTER_VLAN_CFI | ||
|
||
### acl-loader | ||
|
||
##### ACL loader table configuration: | ||
``` | ||
config acl add table -s <stage> -p <ports> <table_name> <table_type> | ||
``` | ||
table_type needs to be passed as "L2" to create new L2 table. | ||
``` | ||
Example : config acl add table -s ingress -p Ethernet0 L2_TABLE L2 | ||
``` | ||
##### ACL loader rule configuration: | ||
**Default rule:** | ||
If user configures table type as L2, then the table is identified as L2 table and default rule is added with match field ip_type="any" and packet action as drop. This ensures that packet of any type matching the given incoming port will be dropped. | ||
|
||
**config acl update full/incremental <json file>** | ||
For adding rules to the L2 table, fields src mac, dst mac, ether type, vlan, ip type are pre-defined in openconfig acl. | ||
Whereas fields vlan pcp and vlan dei are not defined in existing openconfig. | ||
So these 2 fields are not being supported in open config format in command "config acl update". To update these fields, we need to load the configs directly to config db. | ||
|
||
Ether type, vlan and ip type will be used as in other existing L3/L3V6 tables. | ||
For new fields: | ||
"source-mac": "MAC ADDRESS", | ||
"source-mac-mask": "MAC ADDRESS", | ||
"destination-mac": "MAC ADDRESS", | ||
"destination-mac-mask": "MAC ADDRESS" | ||
|
||
The source mac and mask needs to be combined as source-mac/source-mac-mask for configuring SRC_MAC in CONFIG DB. | ||
Similarly destination mac and mask needs to combined as destination-mac/destination-mac-mask for configuring DST_MAC in CONFIG_DB. | ||
This conversion and the fields updation in the CONFIG DB needs to be handled by acl-loader. | ||
|
||
Other new fields like "vlan-pcp" and "vlan-dei" are not supported in update command. Since openconfig acl doesnt support these fields. | ||
|
||
### VS test | ||
VS test cases update to check for L2 table creation with match fields and actions. | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please consider add ethernet type match
Ethernet II
IEEE 802.3 CSMA/CD
IEEE 802.3 CSMA/CD LLC
IEEE 802.3 with SNAP