Skip to content

Commit

Permalink
Changes to support most recent version of p4c-dpdk (#512)
Browse files Browse the repository at this point in the history
* Changes to support most recent version of p4c-dpdk

* Edit Dockerfile.p4c-dpdk to cause CI to generate a new image

* Update p4c-dpdk docker image to use p4c version 1.2.4.8

* Fix typo
  • Loading branch information
jafingerhut committed Feb 9, 2024
1 parent 43168ea commit 8ba8678
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
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
5 changes: 2 additions & 3 deletions dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# This Dockerfile builds an image used to compile P4 programs for the DPDK backend only
# It's based on public p4lang/p4c docker but strips out uneeded backends.
# See https://docs.docker.com/develop/develop-images/multistage-build/
FROM p4lang/p4c:latest as p4lang-p4c
# :latest on 2023-01-30:
#FROM p4lang/p4c@sha256:<TODO-need SHA> as p4lang-p4c
# :latest on 2024-Feb-01:
FROM p4lang/p4c:1.2.4.8 as p4lang-p4c
LABEL maintainer="SONIC-DASH Community"
LABEL description="DASH p4c-dpdk compiler, minimal"

Expand Down

0 comments on commit 8ba8678

Please sign in to comment.