From 53f8d0dc3a5082e5bf91f25bc1fa136dc50e6d10 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Sun, 10 Nov 2024 12:16:25 +0000 Subject: [PATCH] Always call packet->reset_exit() at beginning of Pipeline::apply() The only place the code checks for is_marked_for_exit() is inside of Pipeline::apply(), so by resetting exit flag at beginning of Pipeline::apply, no users of Pipeline class need to worry about the exit flag at all. It is handled completely locally within Pipeline::apply(), and could even be a local variable of Pipeline::appply() if the primitive made that straightforward (which it does not). Signed-off-by: Andy Fingerhut --- src/bm_sim/pipeline.cpp | 1 + targets/pna_nic/pna_nic.cpp | 1 - targets/psa_switch/psa_switch.cpp | 2 -- targets/simple_switch/simple_switch.cpp | 2 -- 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/bm_sim/pipeline.cpp b/src/bm_sim/pipeline.cpp index a0bb4864e..5879f85d7 100644 --- a/src/bm_sim/pipeline.cpp +++ b/src/bm_sim/pipeline.cpp @@ -28,6 +28,7 @@ namespace bm { void Pipeline::apply(Packet *pkt) { + pkt->reset_exit(); BMELOG(pipeline_start, *pkt, *this); // TODO(antonin) // this is temporary while we experiment with the debugger diff --git a/targets/pna_nic/pna_nic.cpp b/targets/pna_nic/pna_nic.cpp index 76aaa3966..ae1bbc40d 100644 --- a/targets/pna_nic/pna_nic.cpp +++ b/targets/pna_nic/pna_nic.cpp @@ -200,7 +200,6 @@ PnaNic::main_thread() { Pipeline *main_mau = this->get_pipeline("main_control"); main_mau->apply(packet.get()); - packet->reset_exit(); Deparser *deparser = this->get_deparser("main_deparser"); deparser->deparse(packet.get()); diff --git a/targets/psa_switch/psa_switch.cpp b/targets/psa_switch/psa_switch.cpp index bbabaec34..e227003ca 100644 --- a/targets/psa_switch/psa_switch.cpp +++ b/targets/psa_switch/psa_switch.cpp @@ -424,7 +424,6 @@ PsaSwitch::ingress_thread() { Pipeline *ingress_mau = this->get_pipeline("ingress"); ingress_mau->apply(packet.get()); - packet->reset_exit(); const auto &f_ig_cos = phv->get_field("psa_ingress_output_metadata.class_of_service"); const auto ig_cos = f_ig_cos.get_uint(); @@ -561,7 +560,6 @@ PsaSwitch::egress_thread(size_t worker_id) { Pipeline *egress_mau = this->get_pipeline("egress"); egress_mau->apply(packet.get()); - packet->reset_exit(); // TODO(peter): add stf test where exit is invoked but packet still gets recirc'd phv->get_field("psa_egress_deparser_input_metadata.egress_port").set( phv->get_field("psa_egress_parser_input_metadata.egress_port")); diff --git a/targets/simple_switch/simple_switch.cpp b/targets/simple_switch/simple_switch.cpp index bf6c2c56d..92cfeee13 100644 --- a/targets/simple_switch/simple_switch.cpp +++ b/targets/simple_switch/simple_switch.cpp @@ -520,8 +520,6 @@ SimpleSwitch::ingress_thread() { ingress_mau->apply(packet.get()); - packet->reset_exit(); - Field &f_egress_spec = phv->get_field("standard_metadata.egress_spec"); port_t egress_spec = f_egress_spec.get_uint();