Setup ethertype in egress control

This commit is contained in:
Nico Schottelius 2019-03-04 14:15:44 +01:00
parent d1433c3e0b
commit 4e8da01250
2 changed files with 5 additions and 3 deletions

View File

@ -119,6 +119,7 @@ struct headers {
struct metadata { struct metadata {
bit<16> tcp_length; bit<16> tcp_length;
bit<16> ethertype; /* we use this, if we are cloning */
} }
#endif #endif

View File

@ -27,12 +27,12 @@ control MyIngress(inout headers hdr,
} }
action controller_debug() { action controller_debug() {
hdr.ethernet.ethertype = TYPE_DEBUG; meta.ethertype = TYPE_DEBUG;
clone3(CloneType.I2E, 100, meta); clone3(CloneType.I2E, 100, meta);
} }
action controller_reply() { action controller_reply() {
hdr.ethernet.ethertype = TYPE_CPU; meta.ethertype = TYPE_CPU;
clone3(CloneType.I2E, 100, meta); clone3(CloneType.I2E, 100, meta);
} }
@ -206,11 +206,12 @@ control MyEgress(inout headers hdr,
// If ingress clone // If ingress clone
if (standard_metadata.instance_type == 1){ if (standard_metadata.instance_type == 1){
hdr.ethernet.ethertype = meta.ethertype;
// hdr.cpu.setValid(); // hdr.cpu.setValid();
// hdr.cpu.srcAddr = hdr.ethernet.srcAddr; // hdr.cpu.srcAddr = hdr.ethernet.srcAddr;
// hdr.cpu.ingress_port = (bit<16>)meta.ingress_port; // hdr.cpu.ingress_port = (bit<16>)meta.ingress_port;
// hdr.ethernet.etherType = L2_LEARN_ETHER_TYPE;
// truncate((bit<32>)22); //ether+cpu header // truncate((bit<32>)22); //ether+cpu header
} }