Skip to content

Commit

Permalink
Add SAI appliance object, local region ID field
Browse files Browse the repository at this point in the history
  • Loading branch information
mukeshmv committed Aug 23, 2024
1 parent 173f1c7 commit 67a04f1
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dash-pipeline/SAI/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ all: copysrc
./sai_api_gen.py \
/bmv2/dash_pipeline.bmv2/dash_pipeline_p4rt.json \
--ir /bmv2/dash_pipeline.bmv2/dash_pipeline_ir.json \
--ignore-tables=appliance,eni_meter,slb_decap \
--ignore-tables=underlay_mac,eni_meter,slb_decap \
--sai-spec-dir=/SAI/specs \
dash

Expand Down
35 changes: 35 additions & 0 deletions dash-pipeline/SAI/specs/dash_appliance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
!!python/object:utils.sai_spec.sai_api_group.SaiApiGroup
name: dash_appliance
description: DASH appliance
api_type: overlay
sai_apis:
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: dash_appliance
description: DASH appliance
is_object: true
enums: []
structs: []
attributes:
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_DASH_APPLIANCE_ATTR_LOCAL_REGION_ID
description: Action parameter local region id
type: sai_uint8_t
attr_value_field: u8
default: '0'
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: 42701762
actions:
default: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: default
id: 21793905
attr_param_id: {}
3 changes: 3 additions & 0 deletions dash-pipeline/SAI/specs/sai_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ api_types:
- SAI_API_DASH_VIP
- SAI_API_DASH_TUNNEL
- SAI_API_DASH_FLOW
- SAI_API_DASH_APPLIANCE
object_types:
- SAI_OBJECT_TYPE_DASH_ACL_GROUP
- SAI_OBJECT_TYPE_DASH_ACL_RULE
Expand All @@ -39,6 +40,7 @@ object_types:
- SAI_OBJECT_TYPE_FLOW_ENTRY_BULK_GET_SESSION_FILTER
- SAI_OBJECT_TYPE_FLOW_ENTRY_BULK_GET_SESSION
- SAI_OBJECT_TYPE_METER_BUCKET_ENTRY
- SAI_OBJECT_TYPE_DASH_APPLIANCE
object_entries:
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
name: direction_lookup_entry
Expand Down Expand Up @@ -489,3 +491,4 @@ api_groups:
- !inc '/SAI/specs/dash_vip.yaml'
- !inc '/SAI/specs/dash_tunnel.yaml'
- !inc '/SAI/specs/dash_flow.yaml'
- !inc '/SAI/specs/dash_appliance.yaml'
1 change: 1 addition & 0 deletions dash-pipeline/bmv2/dash_metadata.p4
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ struct metadata_t {
overlay_rewrite_data_t overlay_data;
bit<16> dash_tunnel_id;
bit<32> meter_class;
bit<8> local_region_id;
}

#endif /* _SIRIUS_METADATA_P4_ */
28 changes: 23 additions & 5 deletions dash-pipeline/bmv2/dash_pipeline.p4
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,38 @@ control dash_ingress(
const default_action = deny;
}

action set_appliance(EthernetAddress neighbor_mac,
EthernetAddress mac) {
action set_appliance(bit<8> local_region_id) {
meta.local_region_id = local_region_id;
}

@SaiTable[name = "dash_appliance", api = "dash_appliance", order = 0, isobject="true"]
table appliance {
key = {
meta.appliance_id : exact @SaiVal[type="sai_object_id_t"];
}

actions = {
set_appliance;
@defaultonly deny;
}
const default_action = deny;
}

action set_underlay_mac(EthernetAddress neighbor_mac,
EthernetAddress mac) {
meta.encap_data.underlay_dmac = neighbor_mac;
meta.encap_data.underlay_smac = mac;
}

/* This table API should be implemented manually using underlay SAI */
@SaiTable[ignored = "true"]
table appliance {
table underlay_mac {
key = {
meta.appliance_id : ternary;
meta.appliance_id : exact;
}

actions = {
set_appliance;
set_underlay_mac;
}
}

Expand Down Expand Up @@ -283,6 +300,7 @@ control dash_ingress(
direction_lookup_stage.apply(hdr, meta);

appliance.apply();
underlay_mac.apply();

/* Outer header processing */
eni_lookup_stage.apply(hdr, meta);
Expand Down

0 comments on commit 67a04f1

Please sign in to comment.