Skip to content

Commit

Permalink
[dash-p4] Correctly set meta.dst_ip_addr for underlay routing lookup (#…
Browse files Browse the repository at this point in the history
…658)

The key of underlay routing lookup is meta.dst_ip_addr. It should be
updated to underlay destination IP only if underlay1/0 encapsulation is
taken.
  • Loading branch information
jimmyzhai authored Jan 15, 2025
1 parent 902c986 commit 3677225
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions dash-pipeline/bmv2/dash_inbound.p4
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ control inbound(inout headers_t hdr,

inbound_routing_stage.apply(hdr, meta);

meta.routing_actions = dash_routing_actions_t.ENCAP_U0;
do_tunnel_encap(hdr,
meta,
meta.u0_encap_data.underlay_dmac,
Expand Down
9 changes: 7 additions & 2 deletions dash-pipeline/bmv2/dash_pipeline.p4
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,13 @@ control dash_ingress(

routing_action_apply.apply(hdr, meta);

/* Underlay routing */
meta.dst_ip_addr = (bit<128>)hdr.u0_ipv4.dst_addr;
/* Underlay routing, using meta.dst_ip_addr as lookup key */
if (meta.routing_actions & dash_routing_actions_t.ENCAP_U1 != 0) {
meta.dst_ip_addr = (bit<128>)hdr.u1_ipv4.dst_addr;
}
else if (meta.routing_actions & dash_routing_actions_t.ENCAP_U0 != 0) {
meta.dst_ip_addr = (bit<128>)hdr.u0_ipv4.dst_addr;
}

underlay.apply(
hdr
Expand Down

0 comments on commit 3677225

Please sign in to comment.