Skip to content

Commit

Permalink
[dash-p4] Add attributes on ENI for reverse tunnel information. (#620)
Browse files Browse the repository at this point in the history
Per HLD update: #619. This PR adds
the reverse tunnel information on ENI.

The packet transformation requires data plane app to create the flow,
hence not included in this PR.
  • Loading branch information
r12f authored Oct 2, 2024
1 parent 6d963e5 commit 388323d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
26 changes: 26 additions & 0 deletions dash-pipeline/SAI/specs/dash_eni.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,32 @@ sai_apis:
valid_only: null
is_vlan: false
deprecated: false
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_ENI_ATTR_ENABLE_REVERSE_TUNNEL_LEARNING
description: Action parameter enable reverse tunnel learning
type: bool
attr_value_field: booldata
default: 'false'
isresourcetype: false
flags: CREATE_AND_SET
object_name: null
allow_null: false
valid_only: null
is_vlan: false
deprecated: false
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_ENI_ATTR_REVERSE_TUNNEL_SIP
description: Action parameter reverse tunnel sip
type: sai_ip_address_t
attr_value_field: ipaddr
default: 0.0.0.0
isresourcetype: false
flags: CREATE_AND_SET
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
8 changes: 8 additions & 0 deletions dash-pipeline/SAI/specs/sai_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ enums:
name: NAT_PORT
description: ''
value: '16'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: TUNNEL
description: ''
value: '32'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: REVERSE_TUNNEL
description: ''
value: '64'
- !!python/object:utils.sai_spec.sai_enum.SaiEnum
name: sai_dash_flow_enabled_key_t
description: ''
Expand Down
6 changes: 5 additions & 1 deletion dash-pipeline/bmv2/dash_metadata.p4
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ enum bit<32> dash_routing_actions_t {
NAT = (1 << 1),
NAT46 = (1 << 2),
NAT64 = (1 << 3),
NAT_PORT = (1 << 4)
NAT_PORT = (1 << 4),
TUNNEL = (1 << 5),
REVERSE_TUNNEL = (1 << 6)
};

enum bit<16> dash_direction_t {
Expand Down Expand Up @@ -320,6 +322,8 @@ struct metadata_t {
encap_data_t encap_data;
// tunnel_data is used by dash_tunnel_id
encap_data_t tunnel_data;
bit<1> enable_reverse_tunnel_learning;
IPv4Address reverse_tunnel_sip;
overlay_rewrite_data_t overlay_data;
bit<16> dash_tunnel_id;
bit<32> meter_class;
Expand Down
7 changes: 7 additions & 0 deletions dash-pipeline/bmv2/dash_pipeline.p4
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ control dash_ingress(
bit<1> full_flow_resimulation_requested,
bit<64> max_resimulated_flow_per_second,
@SaiVal[type="sai_object_id_t"] bit<16> outbound_routing_group_id,
bit<1> enable_reverse_tunnel_learning,
@SaiVal[type="sai_ip_address_t"] IPv4Address reverse_tunnel_sip,
bit<1> is_ha_flow_owner)
{
meta.eni_data.cps = cps;
Expand All @@ -99,6 +101,11 @@ control dash_ingress(
meta.encap_data.vni = vm_vni;
meta.vnet_id = vnet_id;

meta.enable_reverse_tunnel_learning = enable_reverse_tunnel_learning;
meta.reverse_tunnel_sip = reverse_tunnel_sip;

meta.routing_actions = meta.routing_actions | dash_routing_actions_t.REVERSE_TUNNEL;

if (meta.is_overlay_ip_v6 == 1) {
if (meta.direction == dash_direction_t.OUTBOUND) {
ACL_GROUPS_COPY_TO_META(outbound_v6);
Expand Down

0 comments on commit 388323d

Please sign in to comment.