From dcae42a1c0095743ae3c2645f5b363885924a5b7 Mon Sep 17 00:00:00 2001 From: Thomas Calvert <49273329+thomascalvert-xlnx@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:36:39 +0000 Subject: [PATCH] backends/tc: Fix issues reported in #4327 (#4484) * tc: Fix ingress pipeline not restoring header pointer from metadata. Issue reported in #4327. * tc: Fix lookahead not restoring offsetVar. Issue reported in #4327. * Update p4tc golden outputs. --- backends/ebpf/ebpfParser.h | 2 +- backends/tc/ebpfCodeGen.cpp | 32 +++++++++++++++++++ backends/tc/ebpfCodeGen.h | 1 + .../calculator_control_blocks.c | 1 + .../p4tc_samples_outputs/calculator_parser.c | 6 ++++ .../checksum_control_blocks.c | 1 + .../const_entries_range_mask_control_blocks.c | 1 + .../default_action_example_control_blocks.c | 1 + ...ault_action_with_param_01_control_blocks.c | 1 + ...default_action_with_param_control_blocks.c | 1 + ...default_hit_const_example_control_blocks.c | 1 + .../drop_packet_example_control_blocks.c | 1 + .../global_action_example_01_control_blocks.c | 1 + .../global_action_example_02_control_blocks.c | 1 + .../hash1_control_blocks.c | 1 + .../ipip_control_blocks.c | 1 + .../matchtype_control_blocks.c | 1 + .../mix_matchtype_example_control_blocks.c | 1 + ...ultiple_tables_example_01_control_blocks.c | 1 + ...ultiple_tables_example_02_control_blocks.c | 1 + .../name_annotation_example_control_blocks.c | 1 + .../no_table_example_control_blocks.c | 1 + .../noaction_example_01_control_blocks.c | 1 + .../noaction_example_02_control_blocks.c | 1 + ...ummask_annotation_example_control_blocks.c | 1 + .../send_to_port_example_control_blocks.c | 1 + .../set_entry_timer_example_control_blocks.c | 1 + .../simple_exact_example_control_blocks.c | 1 + .../simple_lpm_example_control_blocks.c | 1 + .../simple_ternary_example_control_blocks.c | 1 + .../size_param_example_control_blocks.c | 1 + ...c_type_annotation_example_control_blocks.c | 1 + .../test_ipv6_example_control_blocks.c | 1 + 33 files changed, 69 insertions(+), 1 deletion(-) diff --git a/backends/ebpf/ebpfParser.h b/backends/ebpf/ebpfParser.h index 5c0952a9257..4ca45d5deb6 100644 --- a/backends/ebpf/ebpfParser.h +++ b/backends/ebpf/ebpfParser.h @@ -39,7 +39,7 @@ class StateTranslationVisitor : public CodeGenInspector { virtual void compileExtractField(const IR::Expression *expr, const IR::StructField *field, unsigned hdrOffsetBits, EBPFType *type); virtual void compileExtract(const IR::Expression *destination); - void compileLookahead(const IR::Expression *destination); + virtual void compileLookahead(const IR::Expression *destination); void compileAdvance(const P4::ExternMethod *ext); void compileVerify(const IR::MethodCallExpression *expression); diff --git a/backends/tc/ebpfCodeGen.cpp b/backends/tc/ebpfCodeGen.cpp index 51867161222..830d4a8246f 100644 --- a/backends/tc/ebpfCodeGen.cpp +++ b/backends/tc/ebpfCodeGen.cpp @@ -268,6 +268,10 @@ void TCIngressPipelinePNA::emit(EBPF::CodeBuilder *builder) { builder->newline(); builder->emitIndent(); builder->appendFormat("unsigned %s = hdrMd->%s;", offsetVar.c_str(), offsetVar.c_str()); + builder->newline(); + builder->emitIndent(); + builder->appendFormat("%s = %s + BYTES(%s);", headerStartVar.c_str(), + packetStartVar.c_str(), offsetVar.c_str()); } builder->newline(); emitHeadersFromCPUMAP(builder); @@ -705,6 +709,34 @@ void PnaStateTranslationVisitor::compileExtractField(const IR::Expression *expr, builder->newline(); } +void PnaStateTranslationVisitor::compileLookahead(const IR::Expression *destination) { + cstring msgStr = Util::printf_format("Parser: lookahead for %s %s", + state->parser->typeMap->getType(destination)->toString(), + destination->toString()); + builder->target->emitTraceMessage(builder, msgStr.c_str()); + + builder->emitIndent(); + builder->blockStart(); + builder->emitIndent(); + builder->appendFormat("u8* %s_save = %s", state->parser->program->headerStartVar.c_str(), + state->parser->program->headerStartVar.c_str()); + builder->endOfStatement(true); + builder->emitIndent(); + builder->appendFormat("unsigned %s_save = %s", state->parser->program->offsetVar.c_str(), + state->parser->program->offsetVar.c_str()); + builder->endOfStatement(true); + compileExtract(destination); + builder->emitIndent(); + builder->appendFormat("%s = %s_save", state->parser->program->headerStartVar.c_str(), + state->parser->program->headerStartVar.c_str()); + builder->endOfStatement(true); + builder->emitIndent(); + builder->appendFormat("%s = %s_save", state->parser->program->offsetVar.c_str(), + state->parser->program->offsetVar.c_str()); + builder->endOfStatement(true); + builder->blockEnd(true); +} + // =====================EBPFTablePNA============================= void EBPFTablePNA::emitKeyType(EBPF::CodeBuilder *builder) { builder->emitIndent(); diff --git a/backends/tc/ebpfCodeGen.h b/backends/tc/ebpfCodeGen.h index 633a6121c07..1d5786a7467 100644 --- a/backends/tc/ebpfCodeGen.h +++ b/backends/tc/ebpfCodeGen.h @@ -121,6 +121,7 @@ class PnaStateTranslationVisitor : public EBPF::PsaStateTranslationVisitor { protected: void compileExtractField(const IR::Expression *expr, const IR::StructField *field, unsigned hdrOffsetBits, EBPF::EBPFType *type) override; + void compileLookahead(const IR::Expression *destination) override; }; class EBPFPnaParser : public EBPF::EBPFPsaParser { diff --git a/testdata/p4tc_samples_outputs/calculator_control_blocks.c b/testdata/p4tc_samples_outputs/calculator_control_blocks.c index ec01e4ce737..f6b4c710f8c 100644 --- a/testdata/p4tc_samples_outputs/calculator_control_blocks.c +++ b/testdata/p4tc_samples_outputs/calculator_control_blocks.c @@ -56,6 +56,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/calculator_parser.c b/testdata/p4tc_samples_outputs/calculator_parser.c index 33044da36b6..a9623807c5c 100644 --- a/testdata/p4tc_samples_outputs/calculator_parser.c +++ b/testdata/p4tc_samples_outputs/calculator_parser.c @@ -34,6 +34,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h check_p4calc: { { u8* hdr_start_save = hdr_start; + unsigned ebpf_packetOffsetInBits_save = ebpf_packetOffsetInBits; if ((u8*)ebpf_packetEnd < hdr_start + BYTES(128 + 0)) { ebpf_errorCode = PacketTooShort; goto reject; @@ -65,9 +66,11 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h hdr_start += BYTES(128); hdr_start = hdr_start_save; + ebpf_packetOffsetInBits = ebpf_packetOffsetInBits_save; } { u8* hdr_start_save = hdr_start; + unsigned ebpf_packetOffsetInBits_save = ebpf_packetOffsetInBits; if ((u8*)ebpf_packetEnd < hdr_start + BYTES(128 + 0)) { ebpf_errorCode = PacketTooShort; goto reject; @@ -99,9 +102,11 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h hdr_start += BYTES(128); hdr_start = hdr_start_save; + ebpf_packetOffsetInBits = ebpf_packetOffsetInBits_save; } { u8* hdr_start_save = hdr_start; + unsigned ebpf_packetOffsetInBits_save = ebpf_packetOffsetInBits; if ((u8*)ebpf_packetEnd < hdr_start + BYTES(128 + 0)) { ebpf_errorCode = PacketTooShort; goto reject; @@ -133,6 +138,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h hdr_start += BYTES(128); hdr_start = hdr_start_save; + ebpf_packetOffsetInBits = ebpf_packetOffsetInBits_save; } u32 select_0; select_0 = (((((u32)(((u16)tmp_0.p << 8) | ((u16)tmp_2.four & 0xff)) << 8) & ((1 << 24) - 1)) | (((u32)tmp_4.ver & 0xff) & ((1 << 24) - 1))) & ((1 << 24) - 1)); diff --git a/testdata/p4tc_samples_outputs/checksum_control_blocks.c b/testdata/p4tc_samples_outputs/checksum_control_blocks.c index 648b91dbf4b..f7bf2be6257 100644 --- a/testdata/p4tc_samples_outputs/checksum_control_blocks.c +++ b/testdata/p4tc_samples_outputs/checksum_control_blocks.c @@ -47,6 +47,7 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/const_entries_range_mask_control_blocks.c b/testdata/p4tc_samples_outputs/const_entries_range_mask_control_blocks.c index a75cb96c001..e4e92178eb5 100644 --- a/testdata/p4tc_samples_outputs/const_entries_range_mask_control_blocks.c +++ b/testdata/p4tc_samples_outputs/const_entries_range_mask_control_blocks.c @@ -45,6 +45,7 @@ static __always_inline int process(struct __sk_buff *skb, struct Header_t *h, st if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); h = &(hdrMd->cpumap_hdr); m = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/default_action_example_control_blocks.c b/testdata/p4tc_samples_outputs/default_action_example_control_blocks.c index e856bfcea05..db36a1f74f2 100644 --- a/testdata/p4tc_samples_outputs/default_action_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/default_action_example_control_blocks.c @@ -68,6 +68,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); user_meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/default_action_with_param_01_control_blocks.c b/testdata/p4tc_samples_outputs/default_action_with_param_01_control_blocks.c index 3f339eaf937..ec49d583490 100644 --- a/testdata/p4tc_samples_outputs/default_action_with_param_01_control_blocks.c +++ b/testdata/p4tc_samples_outputs/default_action_with_param_01_control_blocks.c @@ -66,6 +66,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); user_meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/default_action_with_param_control_blocks.c b/testdata/p4tc_samples_outputs/default_action_with_param_control_blocks.c index 41a3afb8601..22d8dba79de 100644 --- a/testdata/p4tc_samples_outputs/default_action_with_param_control_blocks.c +++ b/testdata/p4tc_samples_outputs/default_action_with_param_control_blocks.c @@ -68,6 +68,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); user_meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/default_hit_const_example_control_blocks.c b/testdata/p4tc_samples_outputs/default_hit_const_example_control_blocks.c index ec132972c01..030749a7586 100644 --- a/testdata/p4tc_samples_outputs/default_hit_const_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/default_hit_const_example_control_blocks.c @@ -52,6 +52,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/drop_packet_example_control_blocks.c b/testdata/p4tc_samples_outputs/drop_packet_example_control_blocks.c index a19dbd4a575..7982640a80a 100644 --- a/testdata/p4tc_samples_outputs/drop_packet_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/drop_packet_example_control_blocks.c @@ -45,6 +45,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); user_meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/global_action_example_01_control_blocks.c b/testdata/p4tc_samples_outputs/global_action_example_01_control_blocks.c index daace3c16c4..ba344055f17 100644 --- a/testdata/p4tc_samples_outputs/global_action_example_01_control_blocks.c +++ b/testdata/p4tc_samples_outputs/global_action_example_01_control_blocks.c @@ -68,6 +68,7 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/global_action_example_02_control_blocks.c b/testdata/p4tc_samples_outputs/global_action_example_02_control_blocks.c index b5a3932293c..ac79caa03dc 100644 --- a/testdata/p4tc_samples_outputs/global_action_example_02_control_blocks.c +++ b/testdata/p4tc_samples_outputs/global_action_example_02_control_blocks.c @@ -69,6 +69,7 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/hash1_control_blocks.c b/testdata/p4tc_samples_outputs/hash1_control_blocks.c index b03d47f1780..06cda69cbcc 100644 --- a/testdata/p4tc_samples_outputs/hash1_control_blocks.c +++ b/testdata/p4tc_samples_outputs/hash1_control_blocks.c @@ -25,6 +25,7 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/ipip_control_blocks.c b/testdata/p4tc_samples_outputs/ipip_control_blocks.c index 518bc78a403..6f0474f07b6 100644 --- a/testdata/p4tc_samples_outputs/ipip_control_blocks.c +++ b/testdata/p4tc_samples_outputs/ipip_control_blocks.c @@ -52,6 +52,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/matchtype_control_blocks.c b/testdata/p4tc_samples_outputs/matchtype_control_blocks.c index e892f5fd596..8c9394cb148 100644 --- a/testdata/p4tc_samples_outputs/matchtype_control_blocks.c +++ b/testdata/p4tc_samples_outputs/matchtype_control_blocks.c @@ -114,6 +114,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); user_meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/mix_matchtype_example_control_blocks.c b/testdata/p4tc_samples_outputs/mix_matchtype_example_control_blocks.c index 45948a137bb..8753274d468 100644 --- a/testdata/p4tc_samples_outputs/mix_matchtype_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/mix_matchtype_example_control_blocks.c @@ -120,6 +120,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); user_meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/multiple_tables_example_01_control_blocks.c b/testdata/p4tc_samples_outputs/multiple_tables_example_01_control_blocks.c index 605663081ef..152e489e7a7 100644 --- a/testdata/p4tc_samples_outputs/multiple_tables_example_01_control_blocks.c +++ b/testdata/p4tc_samples_outputs/multiple_tables_example_01_control_blocks.c @@ -190,6 +190,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); user_meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/multiple_tables_example_02_control_blocks.c b/testdata/p4tc_samples_outputs/multiple_tables_example_02_control_blocks.c index cec853677a4..e85f1b94f21 100644 --- a/testdata/p4tc_samples_outputs/multiple_tables_example_02_control_blocks.c +++ b/testdata/p4tc_samples_outputs/multiple_tables_example_02_control_blocks.c @@ -187,6 +187,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); user_meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/name_annotation_example_control_blocks.c b/testdata/p4tc_samples_outputs/name_annotation_example_control_blocks.c index 44f7250bdbb..05aa35446a5 100644 --- a/testdata/p4tc_samples_outputs/name_annotation_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/name_annotation_example_control_blocks.c @@ -67,6 +67,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); user_meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/no_table_example_control_blocks.c b/testdata/p4tc_samples_outputs/no_table_example_control_blocks.c index ce0ea5f04af..7f48768c9b9 100644 --- a/testdata/p4tc_samples_outputs/no_table_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/no_table_example_control_blocks.c @@ -25,6 +25,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); user_meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/noaction_example_01_control_blocks.c b/testdata/p4tc_samples_outputs/noaction_example_01_control_blocks.c index ebd01062783..b737dc8667b 100644 --- a/testdata/p4tc_samples_outputs/noaction_example_01_control_blocks.c +++ b/testdata/p4tc_samples_outputs/noaction_example_01_control_blocks.c @@ -67,6 +67,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); user_meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/noaction_example_02_control_blocks.c b/testdata/p4tc_samples_outputs/noaction_example_02_control_blocks.c index 272aaf83999..cf628fa093e 100644 --- a/testdata/p4tc_samples_outputs/noaction_example_02_control_blocks.c +++ b/testdata/p4tc_samples_outputs/noaction_example_02_control_blocks.c @@ -58,6 +58,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); user_meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/nummask_annotation_example_control_blocks.c b/testdata/p4tc_samples_outputs/nummask_annotation_example_control_blocks.c index 078922d5d0a..5a9cf8261ca 100644 --- a/testdata/p4tc_samples_outputs/nummask_annotation_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/nummask_annotation_example_control_blocks.c @@ -47,6 +47,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/send_to_port_example_control_blocks.c b/testdata/p4tc_samples_outputs/send_to_port_example_control_blocks.c index cf55e82afac..a5a44ef048e 100644 --- a/testdata/p4tc_samples_outputs/send_to_port_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/send_to_port_example_control_blocks.c @@ -47,6 +47,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); user_meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/set_entry_timer_example_control_blocks.c b/testdata/p4tc_samples_outputs/set_entry_timer_example_control_blocks.c index 8225a54b07e..9799a406fce 100644 --- a/testdata/p4tc_samples_outputs/set_entry_timer_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/set_entry_timer_example_control_blocks.c @@ -66,6 +66,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); user_meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/simple_exact_example_control_blocks.c b/testdata/p4tc_samples_outputs/simple_exact_example_control_blocks.c index 11cab625ecd..91fb742ac0f 100644 --- a/testdata/p4tc_samples_outputs/simple_exact_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/simple_exact_example_control_blocks.c @@ -47,6 +47,7 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/simple_lpm_example_control_blocks.c b/testdata/p4tc_samples_outputs/simple_lpm_example_control_blocks.c index 3b63078c4eb..446bbb8100a 100644 --- a/testdata/p4tc_samples_outputs/simple_lpm_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/simple_lpm_example_control_blocks.c @@ -47,6 +47,7 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/simple_ternary_example_control_blocks.c b/testdata/p4tc_samples_outputs/simple_ternary_example_control_blocks.c index 2ad17283857..9e9c34f1926 100644 --- a/testdata/p4tc_samples_outputs/simple_ternary_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/simple_ternary_example_control_blocks.c @@ -53,6 +53,7 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/size_param_example_control_blocks.c b/testdata/p4tc_samples_outputs/size_param_example_control_blocks.c index 0105a9e2923..af7755a2667 100644 --- a/testdata/p4tc_samples_outputs/size_param_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/size_param_example_control_blocks.c @@ -67,6 +67,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); user_meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/tc_type_annotation_example_control_blocks.c b/testdata/p4tc_samples_outputs/tc_type_annotation_example_control_blocks.c index 53832531e97..e673a5fa76d 100644 --- a/testdata/p4tc_samples_outputs/tc_type_annotation_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/tc_type_annotation_example_control_blocks.c @@ -59,6 +59,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); user_meta = &(hdrMd->cpumap_usermeta); { diff --git a/testdata/p4tc_samples_outputs/test_ipv6_example_control_blocks.c b/testdata/p4tc_samples_outputs/test_ipv6_example_control_blocks.c index 6ea9752d0c1..9fc5798d242 100644 --- a/testdata/p4tc_samples_outputs/test_ipv6_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/test_ipv6_example_control_blocks.c @@ -42,6 +42,7 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, if (!hdrMd) return TC_ACT_SHOT; unsigned ebpf_packetOffsetInBits = hdrMd->ebpf_packetOffsetInBits; + hdr_start = pkt + BYTES(ebpf_packetOffsetInBits); hdr = &(hdrMd->cpumap_hdr); user_meta = &(hdrMd->cpumap_usermeta); {