From cb6d2bfa091b06c1c3f3adca3d23b44fde29012d Mon Sep 17 00:00:00 2001 From: Junhua Zhai Date: Thu, 24 Oct 2024 01:55:19 +0000 Subject: [PATCH] Use concrete SNAT/DNAT to replace NAT in flow actions --- dash-pipeline/SAI/specs/sai_spec.yaml | 14 +++++++++----- dash-pipeline/bmv2/dash_headers.p4 | 11 ++++++----- dash-pipeline/bmv2/dash_pipeline.p4 | 2 -- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/dash-pipeline/SAI/specs/sai_spec.yaml b/dash-pipeline/SAI/specs/sai_spec.yaml index 058d29cbb..e79de0027 100644 --- a/dash-pipeline/SAI/specs/sai_spec.yaml +++ b/dash-pipeline/SAI/specs/sai_spec.yaml @@ -348,25 +348,29 @@ enums: description: '' value: '8' - !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember - name: NAT + name: SNAT description: '' value: '16' - !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember - name: NAT46 + name: DNAT description: '' value: '32' - !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember - name: NAT64 + name: NAT46 description: '' value: '64' - !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember - name: NAT_PORT + name: NAT64 description: '' value: '128' - !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember - name: REVERSE_TUNNEL + name: SNAT_PORT description: '' value: '256' + - !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember + name: DNAT_PORT + description: '' + value: '512' - !!python/object:utils.sai_spec.sai_enum.SaiEnum name: sai_dash_ha_state_t description: '' diff --git a/dash-pipeline/bmv2/dash_headers.p4 b/dash-pipeline/bmv2/dash_headers.p4 index 3455ca49e..1b3b6085e 100644 --- a/dash-pipeline/bmv2/dash_headers.p4 +++ b/dash-pipeline/bmv2/dash_headers.p4 @@ -168,11 +168,12 @@ enum bit<32> dash_flow_action_t { ENCAP_U1 = (1 << 1), SET_SMAC = (1 << 2), SET_DMAC = (1 << 3), - NAT = (1 << 4), - NAT46 = (1 << 5), - NAT64 = (1 << 6), - NAT_PORT = (1 << 7), - REVERSE_TUNNEL = (1 << 8) + SNAT = (1 << 4), + DNAT = (1 << 5), + NAT46 = (1 << 6), + NAT64 = (1 << 7), + SNAT_PORT = (1 << 8), + DNAT_PORT = (1 << 9) } enum bit<16> dash_flow_enabled_key_t { diff --git a/dash-pipeline/bmv2/dash_pipeline.p4 b/dash-pipeline/bmv2/dash_pipeline.p4 index abfa597d1..49a737cd9 100644 --- a/dash-pipeline/bmv2/dash_pipeline.p4 +++ b/dash-pipeline/bmv2/dash_pipeline.p4 @@ -88,8 +88,6 @@ control dash_eni_stage( 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);