Skip to content

[dash-p4] Add ENI mode and trusted vni stage #672

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

Merged
merged 7 commits into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion dash-pipeline/SAI/specs/dash_direction_lookup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ sai_apis:
name: SAI_DIRECTION_LOOKUP_ENTRY_ACTION_SET_OUTBOUND_DIRECTION
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will be great to update the title to cover all changes in this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated

description: ''
value: '0'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: SAI_DIRECTION_LOOKUP_ENTRY_ACTION_SET_INBOUND_DIRECTION
description: ''
value: '1'
structs:
- !!python/object:utils.sai_spec.sai_struct.SaiStruct
name: sai_direction_lookup_entry_t
Expand Down Expand Up @@ -57,7 +61,8 @@ sai_apis:
flags: CREATE_AND_SET
object_name: null
allow_null: false
valid_only: null
valid_only: SAI_DIRECTION_LOOKUP_ENTRY_ATTR_ACTION == SAI_DIRECTION_LOOKUP_ENTRY_ACTION_SET_OUTBOUND_DIRECTION
or SAI_DIRECTION_LOOKUP_ENTRY_ATTR_ACTION == SAI_DIRECTION_LOOKUP_ENTRY_ACTION_SET_INBOUND_DIRECTION
is_vlan: false
deprecated: false
stats: []
Expand Down Expand Up @@ -87,3 +92,13 @@ sai_apis:
bitwidth: 8
ip_is_v6_field_id: 0
skipattr: null
SAI_DIRECTION_LOOKUP_ENTRY_ACTION_SET_INBOUND_DIRECTION: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_DIRECTION_LOOKUP_ENTRY_ACTION_SET_INBOUND_DIRECTION
id: 30583207
attr_params:
SAI_DIRECTION_LOOKUP_ENTRY_ATTR_DASH_ENI_MAC_OVERRIDE_TYPE: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaActionParam
id: 1
field: s32
bitwidth: 8
ip_is_v6_field_id: 0
skipattr: null
32 changes: 32 additions & 0 deletions dash-pipeline/SAI/specs/dash_eni.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,19 @@ sai_apis:
valid_only: null
is_vlan: false
deprecated: false
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_ENI_ATTR_DASH_ENI_MODE
description: Action parameter DASH ENI mode
type: sai_dash_eni_mode_t
attr_value_field: s32
default: SAI_DASH_ENI_MODE_VM
isresourcetype: false
flags: CREATE_ONLY
object_name: null
allow_null: false
valid_only: null
is_vlan: false
deprecated: false
stats:
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_ENI_STAT_RX_BYTES
Expand Down Expand Up @@ -1695,6 +1708,19 @@ sai_apis:
valid_only: null
is_vlan: false
deprecated: false
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_ENI_STAT_ENI_TRUSTED_VNI_ENTRY_MISS_DROP_PACKETS
description: DASH ENI ENI_TRUSTED_VNI_ENTRY_MISS_DROP_PACKETS stat count
type: sai_uint64_t
attr_value_field: u64
default: null
isresourcetype: false
flags: READ_ONLY
object_name: null
allow_null: false
valid_only: null
is_vlan: false
deprecated: false
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
tables:
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaTable
Expand Down Expand Up @@ -1973,3 +1999,9 @@ sai_apis:
bitwidth: 16
ip_is_v6_field_id: 0
skipattr: null
SAI_ENI_ATTR_DASH_ENI_MODE: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaActionParam
id: 44
field: s32
bitwidth: 8
ip_is_v6_field_id: 0
skipattr: null
149 changes: 149 additions & 0 deletions dash-pipeline/SAI/specs/dash_trusted_vni.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
!!python/object:utils.sai_spec.sai_api_group.SaiApiGroup
name: dash_trusted_vni
description: DASH trusted VNI
api_type: overlay
sai_apis:
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: global_trusted_vni_entry
description: global trusted VNI entry
is_object: false
enums:
- !!python/object:utils.sai_spec.sai_enum.SaiEnum
name: sai_global_trusted_vni_entry_action_t
description: 'Attribute data for #SAI_GLOBAL_TRUSTED_VNI_ENTRY_ATTR_ACTION'
members:
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: SAI_GLOBAL_TRUSTED_VNI_ENTRY_ACTION_PERMIT
description: ''
value: '0'
structs:
- !!python/object:utils.sai_spec.sai_struct.SaiStruct
name: sai_global_trusted_vni_entry_t
description: Entry for global_trusted_vni_entry
members:
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
name: switch_id
description: Switch ID
type: sai_object_id_t
objects: SAI_OBJECT_TYPE_SWITCH
valid_only: null
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
name: vni_range
description: Range matched key vni_range
type: sai_u32_range_t
objects: null
valid_only: null
attributes:
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_GLOBAL_TRUSTED_VNI_ENTRY_ATTR_ACTION
description: Action
type: sai_global_trusted_vni_entry_action_t
attr_value_field: null
default: SAI_GLOBAL_TRUSTED_VNI_ENTRY_ACTION_PERMIT
isresourcetype: false
flags: CREATE_AND_SET
object_name: null
allow_null: false
valid_only: null
is_vlan: false
deprecated: false
stats: []
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
tables:
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaTable
id: 45800410
single_match_priority: true
stage: null
keys:
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaKey
name: vni_range
id: 1
match_type: range
field: u32range
bitwidth: 24
ip_is_v6_field_id: 0
is_object_key: false
actions:
SAI_GLOBAL_TRUSTED_VNI_ENTRY_ACTION_PERMIT: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_GLOBAL_TRUSTED_VNI_ENTRY_ACTION_PERMIT
id: 29028174
attr_params: {}
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: eni_trusted_vni_entry
description: ENI trusted VNI entry
is_object: false
enums:
- !!python/object:utils.sai_spec.sai_enum.SaiEnum
name: sai_eni_trusted_vni_entry_action_t
description: 'Attribute data for #SAI_ENI_TRUSTED_VNI_ENTRY_ATTR_ACTION'
members:
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: SAI_ENI_TRUSTED_VNI_ENTRY_ACTION_PERMIT
description: ''
value: '0'
structs:
- !!python/object:utils.sai_spec.sai_struct.SaiStruct
name: sai_eni_trusted_vni_entry_t
description: Entry for eni_trusted_vni_entry
members:
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
name: switch_id
description: Switch ID
type: sai_object_id_t
objects: SAI_OBJECT_TYPE_SWITCH
valid_only: null
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
name: eni_id
description: Exact matched key eni_id
type: sai_object_id_t
objects: SAI_OBJECT_TYPE_ENI
valid_only: null
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
name: vni_range
description: Range matched key vni_range
type: sai_u32_range_t
objects: null
valid_only: null
attributes:
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_ENI_TRUSTED_VNI_ENTRY_ATTR_ACTION
description: Action
type: sai_eni_trusted_vni_entry_action_t
attr_value_field: null
default: SAI_ENI_TRUSTED_VNI_ENTRY_ACTION_PERMIT
isresourcetype: false
flags: CREATE_AND_SET
object_name: null
allow_null: false
valid_only: null
is_vlan: false
deprecated: false
stats: []
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
tables:
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaTable
id: 49840895
single_match_priority: true
stage: null
keys:
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaKey
name: eni_id
id: 1
match_type: exact
field: u16
bitwidth: 16
ip_is_v6_field_id: 0
is_object_key: false
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaKey
name: vni_range
id: 2
match_type: range
field: u32range
bitwidth: 24
ip_is_v6_field_id: 0
is_object_key: false
actions:
SAI_ENI_TRUSTED_VNI_ENTRY_ACTION_PERMIT: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_ENI_TRUSTED_VNI_ENTRY_ACTION_PERMIT
id: 29028174
attr_params: {}
28 changes: 28 additions & 0 deletions dash-pipeline/SAI/specs/sai_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ api_types:
- SAI_API_DASH_FLOW
- SAI_API_DASH_APPLIANCE
- SAI_API_DASH_OUTBOUND_PORT_MAP
- SAI_API_DASH_TRUSTED_VNI
object_types:
- SAI_OBJECT_TYPE_DASH_ACL_GROUP
- SAI_OBJECT_TYPE_DASH_ACL_RULE
Expand Down Expand Up @@ -46,6 +47,8 @@ object_types:
- SAI_OBJECT_TYPE_DASH_TUNNEL_NEXT_HOP
- SAI_OBJECT_TYPE_OUTBOUND_PORT_MAP
- SAI_OBJECT_TYPE_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY
- SAI_OBJECT_TYPE_GLOBAL_TRUSTED_VNI_ENTRY
- SAI_OBJECT_TYPE_ENI_TRUSTED_VNI_ENTRY
object_entries:
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
name: direction_lookup_entry
Expand Down Expand Up @@ -113,6 +116,18 @@ object_entries:
type: sai_outbound_port_map_port_range_entry_t
objects: null
valid_only: object_type == SAI_OBJECT_TYPE_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY,
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
name: global_trusted_vni_entry
description: Object entry for DASH API global_trusted_vni_entry
type: sai_global_trusted_vni_entry_t
objects: null
valid_only: object_type == SAI_OBJECT_TYPE_GLOBAL_TRUSTED_VNI_ENTRY,
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
name: eni_trusted_vni_entry
description: Object entry for DASH API eni_trusted_vni_entry
type: sai_eni_trusted_vni_entry_t
objects: null
valid_only: object_type == SAI_OBJECT_TYPE_ENI_TRUSTED_VNI_ENTRY,
enums:
- !!python/object:utils.sai_spec.sai_enum.SaiEnum
name: sai_dash_direction_t
Expand Down Expand Up @@ -478,6 +493,18 @@ enums:
name: FLOW_PENDING_RESIMULATION
description: ''
value: '4'
- !!python/object:utils.sai_spec.sai_enum.SaiEnum
name: sai_dash_eni_mode_t
description: ''
members:
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: VM
description: ''
value: '0'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: FNIC
description: ''
value: '1'
port_extenstion: !!python/object:utils.sai_spec.sai_api_extension.SaiApiExtension
attributes: []
stats:
Expand Down Expand Up @@ -576,3 +603,4 @@ api_groups:
- !inc 'dash_flow.yaml'
- !inc 'dash_appliance.yaml'
- !inc 'dash_outbound_port_map.yaml'
- !inc 'dash_trusted_vni.yaml'
1 change: 1 addition & 0 deletions dash-pipeline/bmv2/dash_counters.p4
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,6 @@ DEFINE_ENI_PACKET_COUNTER(outbound_routing_group_miss_drop)
DEFINE_ENI_PACKET_COUNTER(outbound_routing_group_disabled_drop)
DEFINE_ENI_PACKET_COUNTER(outbound_port_map_miss_drop)
DEFINE_ENI_PACKET_COUNTER(outbound_port_map_port_range_entry_miss_drop)
DEFINE_ENI_PACKET_COUNTER(eni_trusted_vni_entry_miss_drop)

#endif // __DASH_COUNTERS__
10 changes: 10 additions & 0 deletions dash-pipeline/bmv2/dash_metadata.p4
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ enum bit<8> dash_eni_mac_type_t {
DST_MAC = 1
};

enum bit<8> dash_eni_mode_t {
VM = 0,
FNIC = 1
};

struct conntrack_data_t {
bool allow_in;
bool allow_out;
Expand Down Expand Up @@ -64,6 +69,7 @@ struct eni_data_t {
dash_tunnel_dscp_mode_t dscp_mode;
outbound_routing_group_data_t outbound_routing_group_data;
IPv4Address vip;
dash_eni_mode_t eni_mode;
}

struct port_map_context_t {
Expand Down Expand Up @@ -257,4 +263,8 @@ struct metadata_t {
EthernetAddress cpu_mac;
}

action deny(inout metadata_t meta) {
meta.dropped = true;
}

#endif /* _SIRIUS_METADATA_P4_ */
Loading