From e583d223e3d38dc62aed84f8e147cbe691c4e71d Mon Sep 17 00:00:00 2001 From: vbnogueira <105989644+vbnogueira@users.noreply.github.com> Date: Thu, 23 Jan 2025 11:24:30 -0300 Subject: [PATCH] Small fixes for p4tc (#5097) Signed-off-by: Victor Nogueira --- backends/tc/ebpfCodeGen.cpp | 8 ++++++-- backends/tc/runtime/pna.h | 8 ++++---- .../add_entry_1_example_control_blocks.c | 5 +++-- .../add_entry_3_example_control_blocks.c | 5 +++-- .../add_entry_example_control_blocks.c | 5 +++-- testdata/p4tc_samples_outputs/calculator_control_blocks.c | 5 +++-- testdata/p4tc_samples_outputs/checksum_control_blocks.c | 5 +++-- .../const_entries_range_mask_control_blocks.c | 5 +++-- .../default_action_example_01_control_blocks.c | 5 +++-- .../default_action_example_control_blocks.c | 5 +++-- .../default_action_with_param_01_control_blocks.c | 5 +++-- .../default_action_with_param_control_blocks.c | 5 +++-- .../default_hit_const_example_control_blocks.c | 5 +++-- testdata/p4tc_samples_outputs/digest_01_control_blocks.c | 5 +++-- testdata/p4tc_samples_outputs/digest_control_blocks.c | 5 +++-- .../digest_parser_meta_control_blocks.c | 5 +++-- .../direct_counter_example_control_blocks.c | 5 +++-- .../direct_meter_color_control_blocks.c | 5 +++-- .../p4tc_samples_outputs/direct_meter_control_blocks.c | 5 +++-- .../drop_packet_example_control_blocks.c | 5 +++-- .../global_action_example_01_control_blocks.c | 5 +++-- .../global_action_example_02_control_blocks.c | 5 +++-- testdata/p4tc_samples_outputs/hash1_control_blocks.c | 5 +++-- testdata/p4tc_samples_outputs/hash_control_blocks.c | 5 +++-- .../indirect_counter_01_example_control_blocks.c | 5 +++-- .../internetchecksum_01_control_blocks.c | 5 +++-- testdata/p4tc_samples_outputs/ipip_control_blocks.c | 5 +++-- .../p4tc_samples_outputs/is_host_port_control_blocks.c | 5 +++-- .../p4tc_samples_outputs/is_net_port_control_blocks.c | 5 +++-- testdata/p4tc_samples_outputs/matchtype_control_blocks.c | 5 +++-- .../p4tc_samples_outputs/meter_color_control_blocks.c | 5 +++-- testdata/p4tc_samples_outputs/meter_control_blocks.c | 5 +++-- .../mix_matchtype_example_control_blocks.c | 5 +++-- .../multiple_tables_example_01_control_blocks.c | 5 +++-- .../multiple_tables_example_02_control_blocks.c | 5 +++-- .../name_annotation_example_control_blocks.c | 5 +++-- .../no_table_example_control_blocks.c | 5 +++-- .../noaction_example_01_control_blocks.c | 5 +++-- .../noaction_example_02_control_blocks.c | 5 +++-- .../nummask_annotation_example_control_blocks.c | 5 +++-- .../send_to_port_example_control_blocks.c | 5 +++-- .../set_entry_timer_example_control_blocks.c | 5 +++-- .../simple_exact_example_control_blocks.c | 5 +++-- .../simple_extern_example_control_blocks.c | 5 +++-- .../simple_lpm_example_control_blocks.c | 5 +++-- .../simple_ternary_example_control_blocks.c | 5 +++-- .../size_param_example_control_blocks.c | 5 +++-- testdata/p4tc_samples_outputs/skb_meta_control_blocks.c | 5 +++-- .../tc_may_override_example_01_control_blocks.c | 5 +++-- .../tc_may_override_example_02_control_blocks.c | 5 +++-- .../tc_may_override_example_03_control_blocks.c | 5 +++-- .../tc_may_override_example_04_control_blocks.c | 5 +++-- .../tc_may_override_example_05_control_blocks.c | 5 +++-- .../tc_may_override_example_06_control_blocks.c | 5 +++-- .../tc_may_override_example_07_control_blocks.c | 5 +++-- .../tc_may_override_example_08_control_blocks.c | 5 +++-- .../tc_may_override_example_09_control_blocks.c | 5 +++-- .../tc_type_annotation_example_control_blocks.c | 5 +++-- .../test_ipv6_example_control_blocks.c | 5 +++-- 59 files changed, 181 insertions(+), 120 deletions(-) diff --git a/backends/tc/ebpfCodeGen.cpp b/backends/tc/ebpfCodeGen.cpp index ac4bded08ff..22e87123df2 100644 --- a/backends/tc/ebpfCodeGen.cpp +++ b/backends/tc/ebpfCodeGen.cpp @@ -485,6 +485,9 @@ void TCIngressPipelinePNA::emitGlobalMetadataInitializer(EBPF::CodeBuilder *buil builder->emitIndent(); builder->append("compiler_meta__->recirculate = false;"); builder->newline(); + builder->emitIndent(); + builder->append("compiler_meta__->egress_port = 0;"); + builder->newline(); // workaround to make TC protocol-independent, DO NOT REMOVE builder->emitIndent(); @@ -1260,7 +1263,8 @@ void IngressDeparserPNA::emit(EBPF::CodeBuilder *builder) { builder->emitIndent(); builder->appendLine("// 0x0800 = IPv4, 0x86dd = IPv6"); builder->emitIndent(); - builder->append("if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) "); + builder->append( + "if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) "); builder->blockStart(); builder->emitIndent(); builder->appendFormat("saved_proto = skb->protocol"); @@ -1269,7 +1273,7 @@ void IngressDeparserPNA::emit(EBPF::CodeBuilder *builder) { builder->appendFormat("have_saved_proto = true"); builder->endOfStatement(true); builder->emitIndent(); - builder->appendFormat("bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800)"); + builder->appendFormat("bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800))"); builder->endOfStatement(true); builder->emitIndent(); builder->appendFormat("bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set))"); diff --git a/backends/tc/runtime/pna.h b/backends/tc/runtime/pna.h index 42b0714b4a2..3ec10ffc095 100644 --- a/backends/tc/runtime/pna.h +++ b/backends/tc/runtime/pna.h @@ -114,12 +114,12 @@ struct __attribute__((__packed__)) p4tc_table_entry_act_bpf { struct p4tc_table_entry_create_bpf_params__local { struct p4tc_table_entry_act_bpf act_bpf; + u32 profile_id; u32 pipeid; u32 tblid; - u32 profile_id; - u32 handle; - u32 classid; - u32 chain; + u32 handle; + u32 chain; + u32 classid; u16 proto; u16 prio; }; diff --git a/testdata/p4tc_samples_outputs/add_entry_1_example_control_blocks.c b/testdata/p4tc_samples_outputs/add_entry_1_example_control_blocks.c index 6cbed581b2d..13eed6fe99b 100644 --- a/testdata/p4tc_samples_outputs/add_entry_1_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/add_entry_1_example_control_blocks.c @@ -162,10 +162,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -318,6 +318,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/add_entry_3_example_control_blocks.c b/testdata/p4tc_samples_outputs/add_entry_3_example_control_blocks.c index 7e9355909bb..3067c948db7 100644 --- a/testdata/p4tc_samples_outputs/add_entry_3_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/add_entry_3_example_control_blocks.c @@ -162,10 +162,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -318,6 +318,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/add_entry_example_control_blocks.c b/testdata/p4tc_samples_outputs/add_entry_example_control_blocks.c index b5c813ebe3e..d28ee13aa22 100644 --- a/testdata/p4tc_samples_outputs/add_entry_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/add_entry_example_control_blocks.c @@ -236,10 +236,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -391,6 +391,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/calculator_control_blocks.c b/testdata/p4tc_samples_outputs/calculator_control_blocks.c index 60547beff5f..4fddd637428 100644 --- a/testdata/p4tc_samples_outputs/calculator_control_blocks.c +++ b/testdata/p4tc_samples_outputs/calculator_control_blocks.c @@ -200,10 +200,10 @@ if (/* hdr->p4calc.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -333,6 +333,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/checksum_control_blocks.c b/testdata/p4tc_samples_outputs/checksum_control_blocks.c index 75453be3060..e42627ae709 100644 --- a/testdata/p4tc_samples_outputs/checksum_control_blocks.c +++ b/testdata/p4tc_samples_outputs/checksum_control_blocks.c @@ -134,10 +134,10 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -289,6 +289,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 2db79d16a9f..634df42f27b 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 @@ -119,10 +119,10 @@ static __always_inline int process(struct __sk_buff *skb, struct Header_t *h, st bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -154,6 +154,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/default_action_example_01_control_blocks.c b/testdata/p4tc_samples_outputs/default_action_example_01_control_blocks.c index fa15e70ed4e..d370c2b17c7 100644 --- a/testdata/p4tc_samples_outputs/default_action_example_01_control_blocks.c +++ b/testdata/p4tc_samples_outputs/default_action_example_01_control_blocks.c @@ -190,10 +190,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -347,6 +347,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 df79cd64e45..475eaa59364 100644 --- a/testdata/p4tc_samples_outputs/default_action_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/default_action_example_control_blocks.c @@ -210,10 +210,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -367,6 +367,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 2897a539871..df0431b5f23 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 @@ -210,10 +210,10 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -367,6 +367,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 949201b7b8a..c39e72e909a 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 @@ -210,10 +210,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -367,6 +367,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 b4f11a1fe74..f415ad2f825 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 @@ -135,10 +135,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -213,6 +213,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/digest_01_control_blocks.c b/testdata/p4tc_samples_outputs/digest_01_control_blocks.c index ba4a9e80e48..6be779b37d7 100644 --- a/testdata/p4tc_samples_outputs/digest_01_control_blocks.c +++ b/testdata/p4tc_samples_outputs/digest_01_control_blocks.c @@ -155,10 +155,10 @@ if (meta->send_digest) { bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -310,6 +310,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/digest_control_blocks.c b/testdata/p4tc_samples_outputs/digest_control_blocks.c index 3047bfc234d..2914282306c 100644 --- a/testdata/p4tc_samples_outputs/digest_control_blocks.c +++ b/testdata/p4tc_samples_outputs/digest_control_blocks.c @@ -156,10 +156,10 @@ if (meta->send_digest) { bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -311,6 +311,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/digest_parser_meta_control_blocks.c b/testdata/p4tc_samples_outputs/digest_parser_meta_control_blocks.c index 0a07f6218b8..a67cc6006cb 100644 --- a/testdata/p4tc_samples_outputs/digest_parser_meta_control_blocks.c +++ b/testdata/p4tc_samples_outputs/digest_parser_meta_control_blocks.c @@ -151,10 +151,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -306,6 +306,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/direct_counter_example_control_blocks.c b/testdata/p4tc_samples_outputs/direct_counter_example_control_blocks.c index c218f0a5d7d..c7685b87a03 100644 --- a/testdata/p4tc_samples_outputs/direct_counter_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/direct_counter_example_control_blocks.c @@ -143,10 +143,10 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -300,6 +300,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/direct_meter_color_control_blocks.c b/testdata/p4tc_samples_outputs/direct_meter_color_control_blocks.c index ca8ba0098df..4d710d536f5 100644 --- a/testdata/p4tc_samples_outputs/direct_meter_color_control_blocks.c +++ b/testdata/p4tc_samples_outputs/direct_meter_color_control_blocks.c @@ -145,10 +145,10 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -302,6 +302,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/direct_meter_control_blocks.c b/testdata/p4tc_samples_outputs/direct_meter_control_blocks.c index a3948999e37..4024b9e53be 100644 --- a/testdata/p4tc_samples_outputs/direct_meter_control_blocks.c +++ b/testdata/p4tc_samples_outputs/direct_meter_control_blocks.c @@ -139,10 +139,10 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -296,6 +296,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 891f46879a7..5d72342264f 100644 --- a/testdata/p4tc_samples_outputs/drop_packet_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/drop_packet_example_control_blocks.c @@ -133,10 +133,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -290,6 +290,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 553c4224a1e..528f6f8f8d6 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 @@ -207,10 +207,10 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -362,6 +362,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 85ec5ae5be2..80f2e61812f 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 @@ -209,10 +209,10 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -364,6 +364,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/hash1_control_blocks.c b/testdata/p4tc_samples_outputs/hash1_control_blocks.c index d33fc45293f..345720b4122 100644 --- a/testdata/p4tc_samples_outputs/hash1_control_blocks.c +++ b/testdata/p4tc_samples_outputs/hash1_control_blocks.c @@ -68,10 +68,10 @@ ingress_h_reg; bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -187,6 +187,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/hash_control_blocks.c b/testdata/p4tc_samples_outputs/hash_control_blocks.c index 94f46c9f9f9..758ffab8ff7 100644 --- a/testdata/p4tc_samples_outputs/hash_control_blocks.c +++ b/testdata/p4tc_samples_outputs/hash_control_blocks.c @@ -68,10 +68,10 @@ ingress_h_reg ^ 0xFFFFFFFF; bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -191,6 +191,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/indirect_counter_01_example_control_blocks.c b/testdata/p4tc_samples_outputs/indirect_counter_01_example_control_blocks.c index 0670ed1c4a2..13485139b47 100644 --- a/testdata/p4tc_samples_outputs/indirect_counter_01_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/indirect_counter_01_example_control_blocks.c @@ -149,10 +149,10 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -306,6 +306,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/internetchecksum_01_control_blocks.c b/testdata/p4tc_samples_outputs/internetchecksum_01_control_blocks.c index 0c5bc31c61e..ef344ecc21e 100644 --- a/testdata/p4tc_samples_outputs/internetchecksum_01_control_blocks.c +++ b/testdata/p4tc_samples_outputs/internetchecksum_01_control_blocks.c @@ -241,10 +241,10 @@ struct p4tc_ext_csum_params chk_csum = {}; bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -475,6 +475,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/ipip_control_blocks.c b/testdata/p4tc_samples_outputs/ipip_control_blocks.c index bbbb11d6701..c5ebb7b2665 100644 --- a/testdata/p4tc_samples_outputs/ipip_control_blocks.c +++ b/testdata/p4tc_samples_outputs/ipip_control_blocks.c @@ -175,10 +175,10 @@ if (/* hdr->outer.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -413,6 +413,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/is_host_port_control_blocks.c b/testdata/p4tc_samples_outputs/is_host_port_control_blocks.c index b98c36a886e..b2dfb7b028a 100644 --- a/testdata/p4tc_samples_outputs/is_host_port_control_blocks.c +++ b/testdata/p4tc_samples_outputs/is_host_port_control_blocks.c @@ -146,10 +146,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -303,6 +303,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/is_net_port_control_blocks.c b/testdata/p4tc_samples_outputs/is_net_port_control_blocks.c index 91f2bfb8f3c..1c259f3a063 100644 --- a/testdata/p4tc_samples_outputs/is_net_port_control_blocks.c +++ b/testdata/p4tc_samples_outputs/is_net_port_control_blocks.c @@ -146,10 +146,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -303,6 +303,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/matchtype_control_blocks.c b/testdata/p4tc_samples_outputs/matchtype_control_blocks.c index d5319ec9a1c..32731322750 100644 --- a/testdata/p4tc_samples_outputs/matchtype_control_blocks.c +++ b/testdata/p4tc_samples_outputs/matchtype_control_blocks.c @@ -358,10 +358,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -515,6 +515,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/meter_color_control_blocks.c b/testdata/p4tc_samples_outputs/meter_color_control_blocks.c index 5f5dea88b9b..ce6b557e2b7 100644 --- a/testdata/p4tc_samples_outputs/meter_color_control_blocks.c +++ b/testdata/p4tc_samples_outputs/meter_color_control_blocks.c @@ -146,10 +146,10 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -303,6 +303,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/meter_control_blocks.c b/testdata/p4tc_samples_outputs/meter_control_blocks.c index f242c579cc9..a43f2d8b04d 100644 --- a/testdata/p4tc_samples_outputs/meter_control_blocks.c +++ b/testdata/p4tc_samples_outputs/meter_control_blocks.c @@ -144,10 +144,10 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -301,6 +301,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 fd2088e2766..e87236af49c 100644 --- a/testdata/p4tc_samples_outputs/mix_matchtype_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/mix_matchtype_example_control_blocks.c @@ -364,10 +364,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -521,6 +521,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 39e0fc5f4b3..caad29bc029 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 @@ -615,10 +615,10 @@ if (hdr->ipv4.protocol != 4 || (hdr->tcp.srcPort <= 3)) { bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -772,6 +772,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 ac6fee0a896..ececfc15a80 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 @@ -615,10 +615,10 @@ if (hdr->ipv4.protocol == 6 || ((hdr->ipv4.version > 1) && (hdr->ipv4.ihl <= 2)) bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -772,6 +772,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 812f90fcde9..68a7fb0579e 100644 --- a/testdata/p4tc_samples_outputs/name_annotation_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/name_annotation_example_control_blocks.c @@ -208,10 +208,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -365,6 +365,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 0a660aa2c30..7109ece56a2 100644 --- a/testdata/p4tc_samples_outputs/no_table_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/no_table_example_control_blocks.c @@ -66,10 +66,10 @@ if ((u32)skb->ifindex == 4) { bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -257,6 +257,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 b4f75605375..d54dc68c7e3 100644 --- a/testdata/p4tc_samples_outputs/noaction_example_01_control_blocks.c +++ b/testdata/p4tc_samples_outputs/noaction_example_01_control_blocks.c @@ -208,10 +208,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -365,6 +365,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 d2b3b7e6bed..4cd975c41f6 100644 --- a/testdata/p4tc_samples_outputs/noaction_example_02_control_blocks.c +++ b/testdata/p4tc_samples_outputs/noaction_example_02_control_blocks.c @@ -184,10 +184,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -341,6 +341,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 7083be009d6..be9e1e485eb 100644 --- a/testdata/p4tc_samples_outputs/nummask_annotation_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/nummask_annotation_example_control_blocks.c @@ -131,10 +131,10 @@ if (((u32)skb->ifindex == 2 && /* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -209,6 +209,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 d99ba816271..b9e1a0291b3 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 @@ -163,10 +163,10 @@ ext_val = *ext_val_ptr; bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -320,6 +320,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 df6f3416b98..6649d2d2f83 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 @@ -218,10 +218,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -375,6 +375,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 f4cc947d344..087421eaf76 100644 --- a/testdata/p4tc_samples_outputs/simple_exact_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/simple_exact_example_control_blocks.c @@ -134,10 +134,10 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -291,6 +291,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/simple_extern_example_control_blocks.c b/testdata/p4tc_samples_outputs/simple_extern_example_control_blocks.c index c46b97de1d7..4a81ca51c3c 100644 --- a/testdata/p4tc_samples_outputs/simple_extern_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/simple_extern_example_control_blocks.c @@ -185,10 +185,10 @@ ext_val = *ext_val_ptr; bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -342,6 +342,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 01f93dca0de..c864d10055f 100644 --- a/testdata/p4tc_samples_outputs/simple_lpm_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/simple_lpm_example_control_blocks.c @@ -134,10 +134,10 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -289,6 +289,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 ce7dfbd4f69..7033a4f7523 100644 --- a/testdata/p4tc_samples_outputs/simple_ternary_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/simple_ternary_example_control_blocks.c @@ -140,10 +140,10 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -295,6 +295,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 22580bb3f9e..da7c20cf70c 100644 --- a/testdata/p4tc_samples_outputs/size_param_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/size_param_example_control_blocks.c @@ -208,10 +208,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -365,6 +365,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/skb_meta_control_blocks.c b/testdata/p4tc_samples_outputs/skb_meta_control_blocks.c index 78a78259329..733a6815063 100644 --- a/testdata/p4tc_samples_outputs/skb_meta_control_blocks.c +++ b/testdata/p4tc_samples_outputs/skb_meta_control_blocks.c @@ -151,10 +151,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -314,6 +314,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/tc_may_override_example_01_control_blocks.c b/testdata/p4tc_samples_outputs/tc_may_override_example_01_control_blocks.c index e5917830cc5..ad183b4aaea 100644 --- a/testdata/p4tc_samples_outputs/tc_may_override_example_01_control_blocks.c +++ b/testdata/p4tc_samples_outputs/tc_may_override_example_01_control_blocks.c @@ -228,10 +228,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -385,6 +385,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/tc_may_override_example_02_control_blocks.c b/testdata/p4tc_samples_outputs/tc_may_override_example_02_control_blocks.c index f9f030850ff..c1d7d08b7e9 100644 --- a/testdata/p4tc_samples_outputs/tc_may_override_example_02_control_blocks.c +++ b/testdata/p4tc_samples_outputs/tc_may_override_example_02_control_blocks.c @@ -210,10 +210,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -367,6 +367,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/tc_may_override_example_03_control_blocks.c b/testdata/p4tc_samples_outputs/tc_may_override_example_03_control_blocks.c index 37517dbd541..26d5f79de7e 100644 --- a/testdata/p4tc_samples_outputs/tc_may_override_example_03_control_blocks.c +++ b/testdata/p4tc_samples_outputs/tc_may_override_example_03_control_blocks.c @@ -210,10 +210,10 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -367,6 +367,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/tc_may_override_example_04_control_blocks.c b/testdata/p4tc_samples_outputs/tc_may_override_example_04_control_blocks.c index 5839f4c8d78..40de0416c51 100644 --- a/testdata/p4tc_samples_outputs/tc_may_override_example_04_control_blocks.c +++ b/testdata/p4tc_samples_outputs/tc_may_override_example_04_control_blocks.c @@ -222,10 +222,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -379,6 +379,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/tc_may_override_example_05_control_blocks.c b/testdata/p4tc_samples_outputs/tc_may_override_example_05_control_blocks.c index 061b01e593f..61a7cc0f171 100644 --- a/testdata/p4tc_samples_outputs/tc_may_override_example_05_control_blocks.c +++ b/testdata/p4tc_samples_outputs/tc_may_override_example_05_control_blocks.c @@ -219,10 +219,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -376,6 +376,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/tc_may_override_example_06_control_blocks.c b/testdata/p4tc_samples_outputs/tc_may_override_example_06_control_blocks.c index 0254808af0e..aac1c81c72e 100644 --- a/testdata/p4tc_samples_outputs/tc_may_override_example_06_control_blocks.c +++ b/testdata/p4tc_samples_outputs/tc_may_override_example_06_control_blocks.c @@ -228,10 +228,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -385,6 +385,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/tc_may_override_example_07_control_blocks.c b/testdata/p4tc_samples_outputs/tc_may_override_example_07_control_blocks.c index 0539af21ebc..7e6e0c85e24 100644 --- a/testdata/p4tc_samples_outputs/tc_may_override_example_07_control_blocks.c +++ b/testdata/p4tc_samples_outputs/tc_may_override_example_07_control_blocks.c @@ -237,10 +237,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -394,6 +394,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/tc_may_override_example_08_control_blocks.c b/testdata/p4tc_samples_outputs/tc_may_override_example_08_control_blocks.c index 9bfbdd7ff76..200c6070fdb 100644 --- a/testdata/p4tc_samples_outputs/tc_may_override_example_08_control_blocks.c +++ b/testdata/p4tc_samples_outputs/tc_may_override_example_08_control_blocks.c @@ -237,10 +237,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -394,6 +394,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; diff --git a/testdata/p4tc_samples_outputs/tc_may_override_example_09_control_blocks.c b/testdata/p4tc_samples_outputs/tc_may_override_example_09_control_blocks.c index 4bd6a9602e1..59c7c110f3a 100644 --- a/testdata/p4tc_samples_outputs/tc_may_override_example_09_control_blocks.c +++ b/testdata/p4tc_samples_outputs/tc_may_override_example_09_control_blocks.c @@ -228,10 +228,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -385,6 +385,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 d0831c79172..7bbce2ecbe6 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 @@ -186,10 +186,10 @@ if (/* hdr->ipv4.isValid() */ bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -341,6 +341,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta; 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 3657aa7c4d4..ef967bc9bcf 100644 --- a/testdata/p4tc_samples_outputs/test_ipv6_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/test_ipv6_example_control_blocks.c @@ -120,10 +120,10 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, bool have_saved_proto = false; // bpf_skb_adjust_room works only when protocol is IPv4 or IPv6 // 0x0800 = IPv4, 0x86dd = IPv6 - if ((skb->protocol != 0x0800) && (skb->protocol != 0x86dd)) { + if ((skb->protocol != bpf_htons(0x0800)) && (skb->protocol != bpf_htons(0x86dd))) { saved_proto = skb->protocol; have_saved_proto = true; - bpf_p4tc_skb_set_protocol(skb, &sa->set, 0x0800); + bpf_p4tc_skb_set_protocol(skb, &sa->set, bpf_htons(0x0800)); bpf_p4tc_skb_meta_set(skb, &sa->set, sizeof(sa->set)); } ; @@ -305,6 +305,7 @@ int tc_ingress_func(struct __sk_buff *skb) { struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb; compiler_meta__->drop = false; compiler_meta__->recirculate = false; + compiler_meta__->egress_port = 0; if (!compiler_meta__->recirculated) { compiler_meta__->mark = 153; struct internal_metadata *md = (struct internal_metadata *)(unsigned long)skb->data_meta;