diff --git a/dash-pipeline/Makefile b/dash-pipeline/Makefile index af320dd6c..5929fc840 100644 --- a/dash-pipeline/Makefile +++ b/dash-pipeline/Makefile @@ -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) diff --git a/dash-pipeline/bmv2/dash_outbound.p4 b/dash-pipeline/bmv2/dash_outbound.p4 index c32ff6b66..1b1128651 100644 --- a/dash-pipeline/bmv2/dash_outbound.p4 +++ b/dash-pipeline/bmv2/dash_outbound.p4 @@ -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; diff --git a/dash-pipeline/bmv2/dash_service_tunnel.p4 b/dash-pipeline/bmv2/dash_service_tunnel.p4 index ba4161c1a..44d1474bc 100644 --- a/dash-pipeline/bmv2/dash_service_tunnel.p4 +++ b/dash-pipeline/bmv2/dash_service_tunnel.p4 @@ -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; diff --git a/dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk b/dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk index 3931d2a88..aa98bf239 100644 --- a/dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk +++ b/dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk @@ -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: 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"