Skip to content
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

Add tunnel type control between VM and SmartSwitch #660

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
19 changes: 19 additions & 0 deletions dash-pipeline/SAI/specs/dash_eni.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,19 @@ sai_apis:
valid_only: null
is_vlan: false
deprecated: false
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_ENI_ATTR_INBOUND_DASH_ENCAPSULATION
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi Marian, may I know which scenario is this? In my understanding, we need to support both encapsulations in the inbound side at the same time, so this solution might not work.

description: Action parameter inbound DASH encapsulation
type: sai_dash_encapsulation_t
attr_value_field: s32
default: SAI_DASH_ENCAPSULATION_VXLAN
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 Expand Up @@ -1925,3 +1938,9 @@ sai_apis:
bitwidth: 1
ip_is_v6_field_id: 0
skipattr: null
SAI_ENI_ATTR_INBOUND_DASH_ENCAPSULATION: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaActionParam
id: 43
field: s32
bitwidth: 16
ip_is_v6_field_id: 0
skipattr: null
2 changes: 1 addition & 1 deletion dash-pipeline/bmv2/dash_inbound.p4
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ control inbound(inout headers_t hdr,
meta.u0_encap_data.underlay_smac,
meta.u0_encap_data.underlay_dip,
meta.u0_encap_data.underlay_sip,
dash_encapsulation_t.VXLAN,
meta.eni_data.inbound_dash_encapsulation,
meta.u0_encap_data.vni);
}
}
Expand Down
1 change: 1 addition & 0 deletions dash-pipeline/bmv2/dash_metadata.p4
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ struct eni_data_t {
dash_tunnel_dscp_mode_t dscp_mode;
outbound_routing_group_data_t outbound_routing_group_data;
IPv4Address vip;
dash_encapsulation_t inbound_dash_encapsulation;
}

struct meter_context_t {
Expand Down
6 changes: 6 additions & 0 deletions dash-pipeline/bmv2/dash_parser.p4
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ parser dash_parser(
transition select(hd.u0_ipv6.next_header) {
UDP_PROTO: parse_u0_udp;
TCP_PROTO: parse_u0_tcp;
NVGRE_PROTO: parse_u0_nvgre;
default: accept;
}
}
Expand All @@ -125,6 +126,11 @@ parser dash_parser(
transition parse_customer_ethernet;
}

state parse_u0_nvgre {
packet.extract(hd.u0_nvgre);
transition parse_customer_ethernet;
}

state parse_customer_ethernet {
packet.extract(hd.customer_ethernet);
transition select(hd.customer_ethernet.ether_type) {
Expand Down
13 changes: 11 additions & 2 deletions dash-pipeline/bmv2/dash_pipeline.p4
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ control dash_eni_stage(
@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)
bit<1> is_ha_flow_owner,
@SaiVal[type="sai_dash_encapsulation_t", default_value="SAI_DASH_ENCAPSULATION_VXLAN"]
dash_encapsulation_t inbound_dash_encapsulation)
{
meta.eni_data.cps = cps;
meta.eni_data.pps = pps;
Expand All @@ -77,6 +79,7 @@ control dash_eni_stage(
meta.eni_data.pl_underlay_sip = pl_underlay_sip;
meta.u0_encap_data.underlay_dip = vm_underlay_dip;
meta.eni_data.outbound_routing_group_data.outbound_routing_group_id = outbound_routing_group_id;
meta.eni_data.inbound_dash_encapsulation = inbound_dash_encapsulation;
if (dash_tunnel_dscp_mode == dash_tunnel_dscp_mode_t.PIPE_MODEL) {
meta.eni_data.dscp = dscp;
}
Expand Down Expand Up @@ -167,7 +170,13 @@ control dash_lookup_stage(
UPDATE_ENI_COUNTER(eni_lb_fast_path_icmp_in);
}

do_tunnel_decap(hdr, meta);
if (hdr.u0_vxlan.isValid()) {
do_tunnel_decap(hdr, meta);
} else if (hdr.u0_nvgre.isValid()) {
do_tunnel_decap(hdr, meta);
} else {
deny();
}
}
}

Expand Down
Loading