Transport table debug information to controller

This commit is contained in:
Nico Schottelius 2019-03-25 13:43:47 +01:00
commit 9ca4d4c8de
4 changed files with 88 additions and 26 deletions

View file

@ -12,6 +12,14 @@ typedef bit<9> port_t;
typedef bit<16> mcast_t;
typedef bit<16> task_t;
typedef bit<8> table_t; /* to map debug messages */
const bit<8> TABLE_NAT64 = 1;
const bit<8> TABLE_ICMP6 = 2;
const bit<8> TABLE_V6_NETWORKS = 3;
const bit<8> TABLE_NAT46 = 4;
const bit<8> TABLE_V4_NETWORKS = 5;
const bit<16> TYPE_IPV4 = 0x0800;
const bit<16> TYPE_IPV6 = 0x86DD;
@ -148,6 +156,7 @@ header cpu_t {
task_t task;
bit<16> ingress_port;
bit<16> ethertype;
table_t table_id;
}
struct headers {
@ -169,6 +178,7 @@ struct metadata {
task_t switch_task;
bit<16> tcp_length;
bit<32> cast_length;
table_t table_id;
}
#endif

View file

@ -32,6 +32,11 @@ control MyIngress(inout headers hdr,
clone3(CloneType.I2E, 100, meta);
}
action controller_debug_table_id(table_t table_id) {
hdr.cpu.table_id = table_id;
controller_reply(TASK_DEBUG);
}
action controller_debug() {
controller_reply(TASK_DEBUG);
}
@ -242,7 +247,6 @@ control MyIngress(inout headers hdr,
}
size = NDP_TABLE_SIZE;
default_action = NoAction;
// default_action = controller_debug;
}
/* Handle multicast registration of NDP */
@ -257,7 +261,6 @@ control MyIngress(inout headers hdr,
}
size = NDP_TABLE_SIZE;
default_action = NoAction;
// default_action = controller_debug;
}
/********************** NDP support for OTHERS (unused ATM) ***********************************/
@ -273,7 +276,7 @@ control MyIngress(inout headers hdr,
NoAction;
}
size = NDP_TABLE_SIZE;
default_action = controller_debug;
default_action = NoAction;
}
@ -306,7 +309,7 @@ control MyIngress(inout headers hdr,
NoAction;
}
size = ROUTING_TABLE_SIZE;
default_action = controller_debug;
default_action = NoAction;
}
table v4_networks {
@ -319,19 +322,30 @@ control MyIngress(inout headers hdr,
NoAction;
}
size = ROUTING_TABLE_SIZE;
default_action = controller_debug;
default_action = NoAction;
}
/********************** APPLYING TABLES ***********************************/
apply {
if(hdr.ipv6.isValid()) {
icmp6.apply(); /* icmp6 echo, icmp6 ndp */
nat64.apply(); /* v6 -> v4 */
v6_networks.apply(); /* routing, egress */
if(!icmp6.apply().hit) { /* icmp6 echo, icmp6 ndp */
controller_debug_table_id(TABLE_ICMP6);
}
if(!nat64.apply().hit) { /* v6 -> v4 */
controller_debug_table_id(TABLE_NAT64);
}
if(!v6_networks.apply().hit) {
controller_debug_table_id(TABLE_V6_NETWORKS);
}
}
if(hdr.ipv4.isValid()) {
nat46.apply(); /* v4->v6 */
v4_networks.apply(); /* routing, egress */
if(!nat46.apply().hit) { /* v4->v6 */
controller_debug_table_id(TABLE_NAT46);
}
if(!v4_networks.apply().hit) { /* routing, egress */
controller_debug_table_id(TABLE_V4_NETWORKS)
}
}
}
}
@ -351,6 +365,7 @@ control MyEgress(inout headers hdr,
hdr.cpu.ethertype = hdr.ethernet.ethertype;
hdr.cpu.ingress_port = (bit<16>) meta.ingress_port;
hdr.ethernet.ethertype = TYPE_CPU;
}
}