From 62d5816d9d0888f1e45eaa64571bd750fe9fee8b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 24 Jul 2019 11:56:27 +0200 Subject: [PATCH] Merge controller/egress As they are interdependent --- p4src/actions_controller.p4 | 33 ------------------------------ p4src/actions_egress.p4 | 37 ++++++++++++++++++++++++++++++++-- p4src/actions_nat64_generic.p4 | 2 +- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/p4src/actions_controller.p4 b/p4src/actions_controller.p4 index 3b77db3..e69de29 100644 --- a/p4src/actions_controller.p4 +++ b/p4src/actions_controller.p4 @@ -1,33 +0,0 @@ -#ifndef NICO_CONTROLLER -#define NICO_CONTROLLER - -/********************** GENERAL ACTIONS ***********************************/ - -#ifndef _SUME_SWITCH_P4_ -action controller_reply(task_t task) { - meta.task = task; - meta.ingress_port = standard_metadata.ingress_port; - clone3(CloneType.I2E, 100, meta); -} - -#else - -#include "actions_egress.p4" - -action controller_reply(task_t task) { - meta.task = task; - meta.ingress_port = sume_metadata.src_port; - set_egress_port(4); /* port1 = 1, port2 = 2, port3=4 */ -} -#endif /* _SUME_SWITCH_P4_ */ - -action controller_debug_table_id(table_t table_id) { - meta.table_id = table_id; - controller_reply(TASK_DEBUG); -} - -action controller_debug() { - controller_reply(TASK_DEBUG); -} - -#endif \ No newline at end of file diff --git a/p4src/actions_egress.p4 b/p4src/actions_egress.p4 index 47b5556..88d011f 100644 --- a/p4src/actions_egress.p4 +++ b/p4src/actions_egress.p4 @@ -1,8 +1,7 @@ #ifndef NICO_EGRESS #define NICO_EGRESS - -/********************** ROUTING (egress definiton) TABLES ***********************************/ +/********************** EGRESS ACTIONS ***********************************/ action set_egress_port (port_t out_port) { #ifndef _SUME_SWITCH_P4_ @@ -17,6 +16,40 @@ action set_egress_port_and_mac (port_t out_port, mac_addr_t mac_addr) { set_egress_port(out_port); } +/********************** GENERAL ACTIONS ***********************************/ + +#ifndef _SUME_SWITCH_P4_ +action controller_reply(task_t task) { + meta.task = task; + meta.ingress_port = standard_metadata.ingress_port; + clone3(CloneType.I2E, 100, meta); +} + +#else + +#include "actions_egress.p4" + +action controller_reply(task_t task) { + meta.task = task; + meta.ingress_port = sume_metadata.src_port; + set_egress_port(4); /* port1 = 1, port2 = 2, port3=4 */ +} +#endif /* _SUME_SWITCH_P4_ */ + +action controller_debug_table_id(table_t table_id) { + meta.table_id = table_id; + controller_reply(TASK_DEBUG); +} + +action controller_debug() { + controller_reply(TASK_DEBUG); +} + +#endif + +/********************** ROUTING (egress definiton) TABLES ***********************************/ + + table v6_networks { key = { hdr.ipv6.dst_addr: lpm; diff --git a/p4src/actions_nat64_generic.p4 b/p4src/actions_nat64_generic.p4 index ef753ed..1ade5c7 100644 --- a/p4src/actions_nat64_generic.p4 +++ b/p4src/actions_nat64_generic.p4 @@ -1,7 +1,7 @@ #ifndef NICO_NAT64_GENERIC #define NICO_NAT64_GENERIC -#include "actions_controller.p4" +#include "actions_egress.p4" #include "actions_delta_checksum.p4" /********************** NAT64 / NAT46 ACTIONS GENERIC ***********************************/