Skip to content

Commit

Permalink
Changes to support most recent version of p4c-dpdk
Browse files Browse the repository at this point in the history
  • Loading branch information
jafingerhut committed Feb 9, 2024
1 parent 43168ea commit 93161ef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dash-pipeline/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,11 @@ p4c-dpdk-pna:
-v $(PWD)/dpdk-pna:/dpdk-pna \
-w / \
$(DOCKER_P4C_DPDK_IMG) \
p4c-dpdk -DTARGET_DPDK_PNA -DPNA_CONNTRACK --pp $(P4_DPDK_OUTDIR)/dash_pipeline.pp.p4 \
p4c-dpdk \
-DTARGET_DPDK_PNA -DPNA_CONNTRACK -DDISABLE_128BIT_ARITHMETIC \
--pp $(P4_DPDK_OUTDIR)/dash_pipeline.pp.p4 \
-o $(P4_DPDK_OUTDIR)/dash_pipeline.spec --arch pna \
--context $(P4_DPDK_OUTDIR)/dash_pipeline.p4.context.json \
--bf-rt-schema $(P4_DPDK_OUTDIR)/dash_pipeline.p4.bfrt.json \
--p4runtime-files $(P4_DPDK_OUTDIR)/dash_pipeline.p4.p4info.txt \
$(P4_MAIN)
Expand Down
5 changes: 5 additions & 0 deletions dash-pipeline/bmv2/dash_outbound.p4
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,13 @@ control outbound(inout headers_t hdr,
overlay_sip_mask);

/* encapsulation will be done in apply block based on dash_encapsulation */
#ifndef DISABLE_128BIT_ARITHMETIC
// As of 2024-Feb-09, p4c-dpdk does not yet support arithmetic
// on 128-bit operands. This lack of support extends to cast
// operations.
meta.encap_data.underlay_dip = underlay_dip == 0 ? meta.encap_data.original_overlay_dip : (IPv4Address)underlay_dip;
meta.encap_data.underlay_sip = underlay_sip == 0 ? meta.encap_data.original_overlay_sip : (IPv4Address)underlay_sip;
#endif
meta.encap_data.overlay_dmac = hdr.u0_ethernet.dst_addr;
meta.encap_data.dash_encapsulation = dash_encapsulation;
meta.encap_data.service_tunnel_key = tunnel_key;
Expand Down
4 changes: 4 additions & 0 deletions dash-pipeline/bmv2/dash_service_tunnel.p4
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ action service_tunnel_encode(inout headers_t hdr,
hdr.u0_ipv6.payload_length = hdr.u0_ipv4.total_len - IPV4_HDR_SIZE;
hdr.u0_ipv6.next_header = hdr.u0_ipv4.protocol;
hdr.u0_ipv6.hop_limit = hdr.u0_ipv4.ttl;
#ifndef DISABLE_128BIT_ARITHMETIC
// As of 2024-Feb-09, p4c-dpdk does not yet support arithmetic on
// 128-bit operands.
hdr.u0_ipv6.dst_addr = ((IPv6Address)hdr.u0_ipv4.dst_addr & ~st_dst_mask) | (st_dst & st_dst_mask);
hdr.u0_ipv6.src_addr = ((IPv6Address)hdr.u0_ipv4.src_addr & ~st_src_mask) | (st_src & st_src_mask);
#endif

hdr.u0_ipv4.setInvalid();
hdr.u0_ethernet.ether_type = IPV6_ETHTYPE;
Expand Down

0 comments on commit 93161ef

Please sign in to comment.