From 93161efde85b45d623888f65dbb56c7bc54c71cb Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Fri, 9 Feb 2024 11:44:33 -0500 Subject: [PATCH 1/4] Changes to support most recent version of p4c-dpdk --- dash-pipeline/Makefile | 5 ++++- dash-pipeline/bmv2/dash_outbound.p4 | 5 +++++ dash-pipeline/bmv2/dash_service_tunnel.p4 | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) 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; From b9dc5b4dafd29cd485d3e91a995d31af30a83e2a Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Fri, 9 Feb 2024 12:00:28 -0500 Subject: [PATCH 2/4] Edit Dockerfile.p4c-dpdk to cause CI to generate a new image --- dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk b/dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk index 3931d2a88..b4e4cfe65 100644 --- a/dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk +++ b/dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk @@ -2,7 +2,7 @@ # 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: +# :latest on 2024-02-09: #FROM p4lang/p4c@sha256: as p4lang-p4c LABEL maintainer="SONIC-DASH Community" LABEL description="DASH p4c-dpdk compiler, minimal" From 875f59d8059b5107f16a9bf04321f009b72aa0a7 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Fri, 9 Feb 2024 12:05:12 -0500 Subject: [PATCH 3/4] Update p4c-dpdk docker image to use p4c version 1.2.4.8 --- dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk b/dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk index b4e4cfe65..62460b18d 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 2024-02-09: -#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" From c74d34fbcdca42a4dfd62ea7cfb4702fb389d745 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Fri, 9 Feb 2024 12:09:05 -0500 Subject: [PATCH 4/4] Fix typo --- dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk b/dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk index 62460b18d..aa98bf239 100644 --- a/dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk +++ b/dash-pipeline/dockerfiles/Dockerfile.p4c-dpdk @@ -2,7 +2,7 @@ # It's based on public p4lang/p4c docker but strips out uneeded backends. # See https://docs.docker.com/develop/develop-images/multistage-build/ # :latest on 2024-Feb-01: -FROM p4lang/p4c@1.2.4.8 as p4lang-p4c +FROM p4lang/p4c:1.2.4.8 as p4lang-p4c LABEL maintainer="SONIC-DASH Community" LABEL description="DASH p4c-dpdk compiler, minimal"