diff --git a/backends/tc/ebpfCodeGen.cpp b/backends/tc/ebpfCodeGen.cpp index 2e08e94dc71..b8aecf1fef5 100644 --- a/backends/tc/ebpfCodeGen.cpp +++ b/backends/tc/ebpfCodeGen.cpp @@ -824,10 +824,13 @@ void EBPFTablePNA::emitAction(EBPF::CodeBuilder *builder, cstring valueName, builder->emitIndent(); builder->appendFormat("switch (%s->action) ", valueName.c_str()); builder->blockStart(); + bool noActionGenerated = false; for (auto a : actionList->actionList) { auto adecl = program->refMap->getDeclaration(a->getPath(), true); auto action = adecl->getNode()->checkedTo(); + if (action->name.originalName == P4::P4CoreLibrary::instance().noAction.name) + noActionGenerated = true; cstring name = EBPF::EBPFObject::externalName(action), msgStr, convStr; builder->emitIndent(); cstring actionName = p4ActionToActionIDName(action); @@ -867,16 +870,32 @@ void EBPFTablePNA::emitAction(EBPF::CodeBuilder *builder, cstring valueName, builder->appendLine("break;"); builder->decreaseIndent(); } + if (!noActionGenerated) { + cstring noActionName = P4::P4CoreLibrary::instance().noAction.name; + cstring tableInstance = dataMapName; + cstring actionName = + Util::printf_format("%s_ACT_%s", tableInstance.toUpper(), noActionName.toUpper()); + builder->emitIndent(); + builder->appendFormat("case %s: ", actionName); + builder->newline(); + builder->increaseIndent(); + builder->emitIndent(); + builder->blockStart(); + builder->blockEnd(true); + builder->emitIndent(); + builder->appendLine("break;"); + builder->decreaseIndent(); + } - builder->emitIndent(); - builder->appendLine("default:"); - builder->increaseIndent(); - builder->target->emitTraceMessage(builder, "Control: Invalid action type, aborting"); - - builder->emitIndent(); - builder->appendFormat("return %s", builder->target->abortReturnCode().c_str()); - builder->endOfStatement(true); - builder->decreaseIndent(); + // builder->emitIndent(); + // builder->appendLine("default:"); + // builder->increaseIndent(); + // builder->target->emitTraceMessage(builder, "Control: Invalid action type, aborting"); + // + // builder->emitIndent(); + // builder->appendFormat("return %s", builder->target->abortReturnCode().c_str()); + // builder->endOfStatement(true); + // builder->decreaseIndent(); builder->blockEnd(true); @@ -888,13 +907,8 @@ void EBPFTablePNA::emitAction(EBPF::CodeBuilder *builder, cstring valueName, builder->blockEnd(false); builder->appendFormat(" else "); - if (dropOnNoMatchingEntryFound()) { - builder->target->emitTraceMessage(builder, "Control: Entry not found, aborting"); - emitDefaultAction(builder, valueName); - } else { - builder->target->emitTraceMessage(builder, - "Control: Entry not found, executing implicit NoAction"); - } + builder->blockStart(); + builder->blockEnd(true); } void EBPFTablePNA::emitInitializer(EBPF::CodeBuilder *builder) { @@ -917,46 +931,30 @@ void EBPFTablePNA::emitDefaultActionStruct(EBPF::CodeBuilder *builder) { } } -void EBPFTablePNA::emitDefaultAction(EBPF::CodeBuilder *builder, cstring valueName) { - const IR::P4Table *t = table->container; - const IR::Expression *default_action = t->getDefaultAction(); - bool visitDefaultAction = false; - if (default_action) { - if (auto mc = default_action->to()) { - default_action = mc->method; - } - auto path = default_action->to(); - BUG_CHECK(path, "Default action path %1% cannot be found", default_action); - if (auto defaultActionDecl = - program->refMap->getDeclaration(path->path)->to()) { - if (defaultActionDecl->name.originalName != "NoAction") { - visitDefaultAction = true; - auto visitor = createActionTranslationVisitor(valueName, program); - visitor->setBuilder(builder); - visitor->copySubstitutions(codeGen); - visitor->copyPointerVariables(codeGen); - defaultActionDecl->apply(*visitor); - builder->newline(); - } - } - } - if (visitDefaultAction == false) { - builder->blockStart(); - builder->blockEnd(true); - } -} - void EBPFTablePNA::emitValueActionIDNames(EBPF::CodeBuilder *builder) { // create type definition for action builder->emitIndent(); + bool noActionGenerated = false; for (auto a : actionList->actionList) { auto adecl = program->refMap->getDeclaration(a->getPath(), true); auto action = adecl->getNode()->checkedTo(); + if (action->name.originalName == P4::P4CoreLibrary::instance().noAction.name) + noActionGenerated = true; unsigned int action_idx = tcIR->getActionId(tcIR->externalName(action)); builder->emitIndent(); builder->appendFormat("#define %s %d", p4ActionToActionIDName(action), action_idx); builder->newline(); } + if (!noActionGenerated) { + cstring noActionName = P4::P4CoreLibrary::instance().noAction.name; + cstring tableInstance = dataMapName; + cstring actionName = + Util::printf_format("%s_ACT_%s", tableInstance.toUpper(), noActionName.toUpper()); + unsigned int action_idx = tcIR->getActionId(noActionName); + builder->emitIndent(); + builder->appendFormat("#define %s %d", actionName, action_idx); + builder->newline(); + } builder->emitIndent(); } diff --git a/backends/tc/ebpfCodeGen.h b/backends/tc/ebpfCodeGen.h index 18ff1c95aae..fd7dbc9ac36 100644 --- a/backends/tc/ebpfCodeGen.h +++ b/backends/tc/ebpfCodeGen.h @@ -157,7 +157,6 @@ class EBPFTablePNA : public EBPF::EBPFTablePSA { void emitAction(EBPF::CodeBuilder *builder, cstring valueName, cstring actionRunVariable) override; void emitValueActionIDNames(EBPF::CodeBuilder *builder) override; - void emitDefaultAction(EBPF::CodeBuilder *builder, cstring valueName); cstring p4ActionToActionIDName(const IR::P4Action *action) const; }; diff --git a/testdata/p4tc_samples_outputs/calculator_control_blocks.c b/testdata/p4tc_samples_outputs/calculator_control_blocks.c index 02551b4910a..fca73c19aad 100644 --- a/testdata/p4tc_samples_outputs/calculator_control_blocks.c +++ b/testdata/p4tc_samples_outputs/calculator_control_blocks.c @@ -14,6 +14,7 @@ struct __attribute__((__packed__)) MainControlImpl_calculate_key { #define MAINCONTROLIMPL_CALCULATE_ACT_MAINCONTROLIMPL_OPERATION_OR 4 #define MAINCONTROLIMPL_CALCULATE_ACT_MAINCONTROLIMPL_OPERATION_XOR 5 #define MAINCONTROLIMPL_CALCULATE_ACT_MAINCONTROLIMPL_OPERATION_DROP 6 +#define MAINCONTROLIMPL_CALCULATE_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_calculate_value { unsigned int action; union { @@ -147,12 +148,12 @@ if (/* hdr->p4calc.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_CALCULATE_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; } diff --git a/testdata/p4tc_samples_outputs/checksum_control_blocks.c b/testdata/p4tc_samples_outputs/checksum_control_blocks.c index fdebb16aef6..45611003e0c 100644 --- a/testdata/p4tc_samples_outputs/checksum_control_blocks.c +++ b/testdata/p4tc_samples_outputs/checksum_control_blocks.c @@ -10,6 +10,7 @@ struct __attribute__((__packed__)) ingress_nh_table_key { } __attribute__((aligned(4))); #define INGRESS_NH_TABLE_ACT_INGRESS_SEND_NH 1 #define INGRESS_NH_TABLE_ACT_INGRESS_DROP 2 +#define INGRESS_NH_TABLE_ACT_NOACTION 0 struct __attribute__((__packed__)) ingress_nh_table_value { unsigned int action; union { @@ -89,12 +90,12 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head drop_packet(); } break; - default: - return TC_ACT_SHOT; + case INGRESS_NH_TABLE_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; 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 15c08c51f34..24460e4da35 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 @@ -10,6 +10,7 @@ struct __attribute__((__packed__)) MainControlImpl_t_range_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_T_RANGE_ACT_MAINCONTROLIMPL_A 1 #define MAINCONTROLIMPL_T_RANGE_ACT_MAINCONTROLIMPL_A_WITH_CONTROL_PARAMS 2 +#define MAINCONTROLIMPL_T_RANGE_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_t_range_value { unsigned int action; union { @@ -82,11 +83,12 @@ static __always_inline int process(struct __sk_buff *skb, struct Header_t *h, st h->h.t = value->u.MainControlImpl_a_with_control_params.x; } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_T_RANGE_ACT_NOACTION: + { + } + break; } } else { - h->h.e = 0; } } ; 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 3a4341ced60..e78a348129b 100644 --- a/testdata/p4tc_samples_outputs/default_action_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/default_action_example_control_blocks.c @@ -11,6 +11,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_DEFAULT_ROUTE_DROP 2 +#define MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_value { unsigned int action; union { @@ -32,6 +33,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_2_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_2_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_2_ACT_MAINCONTROLIMPL_DROP 3 +#define MAINCONTROLIMPL_IPV4_TBL_2_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_2_value { unsigned int action; union { @@ -110,12 +112,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; @@ -159,12 +161,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_2_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; 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 106c2d4c5b4..eba18b90beb 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 @@ -15,6 +15,7 @@ struct MainControlImpl_set_ct_options_key_mask { #define MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_MAINCONTROLIMPL_TCP_SYN_PACKET 1 #define MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_MAINCONTROLIMPL_TCP_FIN_OR_RST_PACKET 2 #define MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_MAINCONTROLIMPL_TCP_OTHER_PACKETS 3 +#define MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_set_ct_options_value { unsigned int action; __u32 priority; @@ -94,8 +95,10 @@ if (/* hdr->ipv4.isValid() */ { } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_NOACTION: + { + } + break; } } else { } 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 d46c7b3b316..3da86934149 100644 --- a/testdata/p4tc_samples_outputs/drop_packet_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/drop_packet_example_control_blocks.c @@ -10,6 +10,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_ACT_MAINCONTROLIMPL_DEFAULT_ROUTE_DROP 2 +#define MAINCONTROLIMPL_IPV4_TBL_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_value { unsigned int action; union { @@ -87,12 +88,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; } 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 d09395a25a6..db20e62cbbf 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 @@ -10,6 +10,7 @@ struct __attribute__((__packed__)) ingress_nh_table2_key { } __attribute__((aligned(4))); #define INGRESS_NH_TABLE2_ACT_INGRESS_SEND_NH 2 #define INGRESS_NH_TABLE2_ACT_INGRESS_DROP 3 +#define INGRESS_NH_TABLE2_ACT_NOACTION 0 struct __attribute__((__packed__)) ingress_nh_table2_value { unsigned int action; union { @@ -30,6 +31,7 @@ struct __attribute__((__packed__)) ingress_nh_table_key { } __attribute__((aligned(4))); #define INGRESS_NH_TABLE_ACT__SEND_NH 1 #define INGRESS_NH_TABLE_ACT_INGRESS_DROP 3 +#define INGRESS_NH_TABLE_ACT_NOACTION 0 struct __attribute__((__packed__)) ingress_nh_table_value { unsigned int action; union { @@ -109,12 +111,12 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head drop_packet(); } break; - default: - return TC_ACT_SHOT; + case INGRESS_NH_TABLE_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; @@ -157,12 +159,12 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head drop_packet(); } break; - default: - return TC_ACT_SHOT; + case INGRESS_NH_TABLE2_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; 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 836beff5e0e..c532b17f2a9 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 @@ -10,6 +10,7 @@ struct __attribute__((__packed__)) ingress_nh_table2_key { } __attribute__((aligned(4))); #define INGRESS_NH_TABLE2_ACT_INGRESS_SEND_NH 2 #define INGRESS_NH_TABLE2_ACT_INGRESS_DROP 3 +#define INGRESS_NH_TABLE2_ACT_NOACTION 0 struct __attribute__((__packed__)) ingress_nh_table2_value { unsigned int action; union { @@ -31,6 +32,7 @@ struct __attribute__((__packed__)) ingress_nh_table_key { } __attribute__((aligned(4))); #define INGRESS_NH_TABLE_ACT_INGRESS_SEND_NH 2 #define INGRESS_NH_TABLE_ACT__DROP 1 +#define INGRESS_NH_TABLE_ACT_NOACTION 0 struct __attribute__((__packed__)) ingress_nh_table_value { unsigned int action; union { @@ -110,12 +112,12 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head drop_packet(); } break; - default: - return TC_ACT_SHOT; + case INGRESS_NH_TABLE_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; @@ -159,12 +161,12 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head drop_packet(); } break; - default: - return TC_ACT_SHOT; + case INGRESS_NH_TABLE2_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; diff --git a/testdata/p4tc_samples_outputs/ipip_control_blocks.c b/testdata/p4tc_samples_outputs/ipip_control_blocks.c index 869ab9f499e..85d99ae3e6e 100644 --- a/testdata/p4tc_samples_outputs/ipip_control_blocks.c +++ b/testdata/p4tc_samples_outputs/ipip_control_blocks.c @@ -11,6 +11,7 @@ struct __attribute__((__packed__)) Main_fwd_table_key { #define MAIN_FWD_TABLE_ACT_MAIN_SET_IPIP 1 #define MAIN_FWD_TABLE_ACT_MAIN_SET_NH 2 #define MAIN_FWD_TABLE_ACT_MAIN_DROP 3 +#define MAIN_FWD_TABLE_ACT_NOACTION 0 struct __attribute__((__packed__)) Main_fwd_table_value { unsigned int action; union { @@ -105,12 +106,12 @@ if (/* hdr->outer.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAIN_FWD_TABLE_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; diff --git a/testdata/p4tc_samples_outputs/matchtype_control_blocks.c b/testdata/p4tc_samples_outputs/matchtype_control_blocks.c index 615716098e9..14fa2f8ba0f 100644 --- a/testdata/p4tc_samples_outputs/matchtype_control_blocks.c +++ b/testdata/p4tc_samples_outputs/matchtype_control_blocks.c @@ -10,6 +10,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_DEFAULT_ROUTE_DROP 2 +#define MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_value { unsigned int action; union { @@ -35,6 +36,7 @@ struct MainControlImpl_ipv4_tbl_2_key_mask { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_2_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_2_ACT_MAINCONTROLIMPL_DROP 3 +#define MAINCONTROLIMPL_IPV4_TBL_2_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_2_value { unsigned int action; __u32 priority; @@ -55,6 +57,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_3_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_3_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_3_ACT_MAINCONTROLIMPL_DROP 3 +#define MAINCONTROLIMPL_IPV4_TBL_3_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_3_value { unsigned int action; union { @@ -76,6 +79,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_4_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_4_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_4_ACT_MAINCONTROLIMPL_DROP 3 +#define MAINCONTROLIMPL_IPV4_TBL_4_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_4_value { unsigned int action; union { @@ -153,12 +157,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; @@ -202,12 +206,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_2_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; @@ -249,12 +253,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_3_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; @@ -298,12 +302,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_4_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; 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 1a8f4ca0698..b4c0965b0bf 100644 --- a/testdata/p4tc_samples_outputs/mix_matchtype_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/mix_matchtype_example_control_blocks.c @@ -10,6 +10,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_DEFAULT_ROUTE_DROP 2 +#define MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_value { unsigned int action; union { @@ -35,6 +36,7 @@ struct MainControlImpl_ipv4_tbl_2_key_mask { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_2_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_2_ACT_MAINCONTROLIMPL_DROP 3 +#define MAINCONTROLIMPL_IPV4_TBL_2_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_2_value { unsigned int action; __u32 priority; @@ -60,6 +62,7 @@ struct MainControlImpl_ipv4_tbl_3_key_mask { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_3_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_3_ACT_MAINCONTROLIMPL_DROP 3 +#define MAINCONTROLIMPL_IPV4_TBL_3_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_3_value { unsigned int action; __u32 priority; @@ -82,6 +85,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_4_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_4_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_4_ACT_MAINCONTROLIMPL_DROP 3 +#define MAINCONTROLIMPL_IPV4_TBL_4_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_4_value { unsigned int action; union { @@ -159,12 +163,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; @@ -208,12 +212,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_2_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; @@ -256,12 +260,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_3_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; @@ -305,12 +309,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_4_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; 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 cef2af98355..e50c404fae2 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 @@ -10,6 +10,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_DEFAULT_ROUTE_DROP 2 +#define MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_value { unsigned int action; union { @@ -31,6 +32,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_2_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_2_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_2_ACT_MAINCONTROLIMPL_DROP 4 +#define MAINCONTROLIMPL_IPV4_TBL_2_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_2_value { unsigned int action; union { @@ -151,6 +153,7 @@ struct MainControlImpl_set_ct_options_key_mask { #define MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_MAINCONTROLIMPL_TCP_SYN_PACKET 5 #define MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_MAINCONTROLIMPL_TCP_FIN_OR_RST_PACKET 6 #define MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_MAINCONTROLIMPL_TCP_OTHER_PACKETS 7 +#define MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_set_ct_options_value { unsigned int action; __u32 priority; @@ -232,14 +235,12 @@ if (hdr->ipv4.protocol == 6 && (hdr->tcp.srcPort > 0)) { } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION: + { + } + break; } } else { -if (hdr->ipv4.protocol == 6 && (hdr->tcp.srcPort > 0)) { -/* drop_packet() */ - drop_packet(); } - } } ; @@ -285,14 +286,12 @@ if (hdr->ipv4.protocol != 4 || (hdr->tcp.srcPort <= 3)) { } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_2_ACT_NOACTION: + { + } + break; } } else { -if (hdr->ipv4.protocol != 4 || (hdr->tcp.srcPort <= 3)) { -/* drop_packet() */ - drop_packet(); } - } } ; @@ -342,8 +341,6 @@ if (hdr->ipv4.protocol != 4 || (hdr->tcp.srcPort <= 3)) { { } break; - default: - return TC_ACT_SHOT; } } else { } @@ -395,8 +392,6 @@ if (hdr->ipv4.protocol != 4 || (hdr->tcp.srcPort <= 3)) { { } break; - default: - return TC_ACT_SHOT; } } else { } @@ -431,8 +426,6 @@ if (hdr->ipv4.protocol != 4 || (hdr->tcp.srcPort <= 3)) { { } break; - default: - return TC_ACT_SHOT; } } else { } @@ -475,8 +468,10 @@ if (hdr->ipv4.protocol != 4 || (hdr->tcp.srcPort <= 3)) { { } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_NOACTION: + { + } + break; } } else { } @@ -556,14 +551,8 @@ if (hdr->ipv4.protocol != 4 || (hdr->tcp.srcPort <= 3)) { { } break; - default: - return TC_ACT_SHOT; } } else { -if (hdr->ipv4.protocol != 4 || (hdr->tcp.srcPort <= 3)) { -/* drop_packet() */ - drop_packet(); } - } } ; 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 5847d331d0b..92d19521fa5 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 @@ -10,6 +10,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_DEFAULT_ROUTE_DROP 2 +#define MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_value { unsigned int action; union { @@ -31,6 +32,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_2_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_2_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_2_ACT_MAINCONTROLIMPL_DROP 4 +#define MAINCONTROLIMPL_IPV4_TBL_2_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_2_value { unsigned int action; union { @@ -148,6 +150,7 @@ struct MainControlImpl_set_ct_options_key_mask { #define MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_MAINCONTROLIMPL_TCP_SYN_PACKET 5 #define MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_MAINCONTROLIMPL_TCP_FIN_OR_RST_PACKET 6 #define MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_MAINCONTROLIMPL_TCP_OTHER_PACKETS 7 +#define MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_set_ct_options_value { unsigned int action; __u32 priority; @@ -230,14 +233,12 @@ if (hdr->ipv4.protocol != 6) { } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION: + { + } + break; } } else { -if (hdr->ipv4.protocol != 6) { -/* drop_packet() */ - drop_packet(); } - } } ; @@ -284,14 +285,12 @@ if (hdr->ipv4.protocol == 6 || ((hdr->ipv4.version > 1) && (hdr->ipv4.ihl <= 2)) } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_2_ACT_NOACTION: + { + } + break; } } else { -if (hdr->ipv4.protocol == 6 || ((hdr->ipv4.version > 1) && (hdr->ipv4.ihl <= 2))) { -/* drop_packet() */ - drop_packet(); } - } } ; @@ -341,8 +340,6 @@ if (hdr->ipv4.protocol == 6 || ((hdr->ipv4.version > 1) && (hdr->ipv4.ihl <= 2)) { } break; - default: - return TC_ACT_SHOT; } } else { } @@ -394,8 +391,6 @@ if (hdr->ipv4.protocol == 6 || ((hdr->ipv4.version > 1) && (hdr->ipv4.ihl <= 2)) { } break; - default: - return TC_ACT_SHOT; } } else { } @@ -430,8 +425,6 @@ if (hdr->ipv4.protocol == 6 || ((hdr->ipv4.version > 1) && (hdr->ipv4.ihl <= 2)) { } break; - default: - return TC_ACT_SHOT; } } else { } @@ -474,8 +467,10 @@ if (hdr->ipv4.protocol == 6 || ((hdr->ipv4.version > 1) && (hdr->ipv4.ihl <= 2)) { } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_NOACTION: + { + } + break; } } else { } @@ -556,14 +551,8 @@ if (hdr->ipv4.protocol == 6 || ((hdr->ipv4.version > 1) && (hdr->ipv4.ihl <= 2)) { } break; - default: - return TC_ACT_SHOT; } } else { -if (hdr->ipv4.protocol == 6 || ((hdr->ipv4.version > 1) && (hdr->ipv4.ihl <= 2))) { -/* drop_packet() */ - drop_packet(); } - } } ; 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 58e28abf8fe..bf9ca60d7a2 100644 --- a/testdata/p4tc_samples_outputs/name_annotation_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/name_annotation_example_control_blocks.c @@ -10,6 +10,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_DEFAULT_ROUTE_DROP 2 +#define MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_value { unsigned int action; union { @@ -31,6 +32,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_2_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_2_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_2_ACT_MAINCONTROLIMPL_DROP 3 +#define MAINCONTROLIMPL_IPV4_TBL_2_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_2_value { unsigned int action; union { @@ -108,12 +110,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; @@ -157,12 +159,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_2_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; 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 468378e1f5b..1e0e9acb763 100644 --- a/testdata/p4tc_samples_outputs/noaction_example_01_control_blocks.c +++ b/testdata/p4tc_samples_outputs/noaction_example_01_control_blocks.c @@ -10,6 +10,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_DEFAULT_ROUTE_DROP 2 +#define MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_value { unsigned int action; union { @@ -109,12 +110,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; @@ -162,8 +163,6 @@ if (/* hdr->ipv4.isValid() */ { } break; - default: - return TC_ACT_SHOT; } } else { } 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 9cf37571bce..0d8030310d2 100644 --- a/testdata/p4tc_samples_outputs/noaction_example_02_control_blocks.c +++ b/testdata/p4tc_samples_outputs/noaction_example_02_control_blocks.c @@ -10,6 +10,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_DEFAULT_ROUTE_DROP 2 +#define MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_value { unsigned int action; union { @@ -100,12 +101,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; @@ -138,8 +139,6 @@ if (/* hdr->ipv4.isValid() */ { } break; - default: - return TC_ACT_SHOT; } } else { } 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 f58fcae558c..b4cd7484c3b 100644 --- a/testdata/p4tc_samples_outputs/nummask_annotation_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/nummask_annotation_example_control_blocks.c @@ -11,6 +11,7 @@ struct __attribute__((__packed__)) MainControlImpl_set_ct_options_key { #define MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_MAINCONTROLIMPL_TCP_SYN_PACKET 1 #define MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_MAINCONTROLIMPL_TCP_FIN_OR_RST_PACKET 2 #define MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_MAINCONTROLIMPL_TCP_OTHER_PACKETS 3 +#define MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_set_ct_options_value { unsigned int action; union { @@ -89,8 +90,10 @@ if (((u32)istd.input_port == 2 && /* hdr->ipv4.isValid() */ { } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_SET_CT_OPTIONS_ACT_NOACTION: + { + } + break; } } else { } 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 56d6a1aeacd..2495782b55f 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 @@ -12,6 +12,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_ACT_MAINCONTROLIMPL_DEFAULT_ROUTE_DROP 2 +#define MAINCONTROLIMPL_IPV4_TBL_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_value { unsigned int action; union { @@ -91,12 +92,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; } 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 53e5b8adbc8..807e9eebb14 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 @@ -11,6 +11,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_DEFAULT_ROUTE_DROP 2 +#define MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_value { unsigned int action; union { @@ -31,6 +32,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_2_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_2_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_2_ACT_MAINCONTROLIMPL_DROP 3 +#define MAINCONTROLIMPL_IPV4_TBL_2_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_2_value { unsigned int action; union { @@ -114,12 +116,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; @@ -169,12 +171,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_2_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; 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 11b502ab389..92f2a9b2037 100644 --- a/testdata/p4tc_samples_outputs/simple_exact_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/simple_exact_example_control_blocks.c @@ -10,6 +10,7 @@ struct __attribute__((__packed__)) ingress_nh_table_key { } __attribute__((aligned(4))); #define INGRESS_NH_TABLE_ACT_INGRESS_SEND_NH 1 #define INGRESS_NH_TABLE_ACT_INGRESS_DROP 2 +#define INGRESS_NH_TABLE_ACT_NOACTION 0 struct __attribute__((__packed__)) ingress_nh_table_value { unsigned int action; union { @@ -89,12 +90,12 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head drop_packet(); } break; - default: - return TC_ACT_SHOT; + case INGRESS_NH_TABLE_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; 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 815e641e62c..b700fa861e6 100644 --- a/testdata/p4tc_samples_outputs/simple_lpm_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/simple_lpm_example_control_blocks.c @@ -10,6 +10,7 @@ struct __attribute__((__packed__)) ingress_nh_table_key { } __attribute__((aligned(4))); #define INGRESS_NH_TABLE_ACT_INGRESS_SEND_NH 1 #define INGRESS_NH_TABLE_ACT_INGRESS_DROP 2 +#define INGRESS_NH_TABLE_ACT_NOACTION 0 struct __attribute__((__packed__)) ingress_nh_table_value { unsigned int action; union { @@ -89,12 +90,12 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head drop_packet(); } break; - default: - return TC_ACT_SHOT; + case INGRESS_NH_TABLE_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; 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 17ccdd51618..b3de3fa4e20 100644 --- a/testdata/p4tc_samples_outputs/simple_ternary_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/simple_ternary_example_control_blocks.c @@ -15,6 +15,7 @@ struct ingress_nh_table_key_mask { } __attribute__((aligned(4))); #define INGRESS_NH_TABLE_ACT_INGRESS_SEND_NH 1 #define INGRESS_NH_TABLE_ACT_INGRESS_DROP 2 +#define INGRESS_NH_TABLE_ACT_NOACTION 0 struct __attribute__((__packed__)) ingress_nh_table_value { unsigned int action; __u32 priority; @@ -96,12 +97,12 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head drop_packet(); } break; - default: - return TC_ACT_SHOT; + case INGRESS_NH_TABLE_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; 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 2b310596638..efe113ccf01 100644 --- a/testdata/p4tc_samples_outputs/size_param_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/size_param_example_control_blocks.c @@ -10,6 +10,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_NEXT_HOP 1 #define MAINCONTROLIMPL_IPV4_TBL_1_ACT_MAINCONTROLIMPL_DEFAULT_ROUTE_DROP 2 +#define MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_1_value { unsigned int action; union { @@ -31,6 +32,7 @@ struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_2_key { } __attribute__((aligned(4))); #define MAINCONTROLIMPL_IPV4_TBL_2_ACT_MAINCONTROLIMPL_SENDTOPORT 3 #define MAINCONTROLIMPL_IPV4_TBL_2_ACT_MAINCONTROLIMPL_DROP 4 +#define MAINCONTROLIMPL_IPV4_TBL_2_ACT_NOACTION 0 struct __attribute__((__packed__)) MainControlImpl_ipv4_tbl_2_value { unsigned int action; union { @@ -108,12 +110,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_1_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; @@ -157,12 +159,12 @@ if (/* hdr->ipv4.isValid() */ drop_packet(); } break; - default: - return TC_ACT_SHOT; + case MAINCONTROLIMPL_IPV4_TBL_2_ACT_NOACTION: + { + } + break; } } else { -/* drop_packet() */ - drop_packet(); } } ; 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 6379ab5ec43..8290c0c2f82 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 @@ -107,8 +107,6 @@ if (/* hdr->ipv4.isValid() */ { } break; - default: - return TC_ACT_SHOT; } } else { } @@ -143,8 +141,6 @@ if (/* hdr->ipv4.isValid() */ { } break; - default: - return TC_ACT_SHOT; } } else { } 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 c278cd17ca0..294dc8cb7e4 100644 --- a/testdata/p4tc_samples_outputs/test_ipv6_example_control_blocks.c +++ b/testdata/p4tc_samples_outputs/test_ipv6_example_control_blocks.c @@ -80,12 +80,8 @@ static __always_inline int process(struct __sk_buff *skb, struct headers_t *hdr, { } break; - default: - return TC_ACT_SHOT; } } else { - __builtin_memcpy(&hdr->ipv6.dstAddr, &value->u.MainControlImpl_set_dst.addr6, 16); - hdr->ipv6.hopLimit = (hdr->ipv6.hopLimit + 255); } } ;