diff --git a/p4src/headers.p4 b/p4src/headers.p4 index a5f78bc..863b115 100644 --- a/p4src/headers.p4 +++ b/p4src/headers.p4 @@ -119,6 +119,7 @@ struct headers { struct metadata { bit<16> tcp_length; + bit<16> ethertype; /* we use this, if we are cloning */ } #endif \ No newline at end of file diff --git a/p4src/static-mapping.p4 b/p4src/static-mapping.p4 index ea25d5d..0fad976 100644 --- a/p4src/static-mapping.p4 +++ b/p4src/static-mapping.p4 @@ -27,12 +27,12 @@ control MyIngress(inout headers hdr, } action controller_debug() { - hdr.ethernet.ethertype = TYPE_DEBUG; + meta.ethertype = TYPE_DEBUG; clone3(CloneType.I2E, 100, meta); } action controller_reply() { - hdr.ethernet.ethertype = TYPE_CPU; + meta.ethertype = TYPE_CPU; clone3(CloneType.I2E, 100, meta); } @@ -206,11 +206,12 @@ control MyEgress(inout headers hdr, // If ingress clone if (standard_metadata.instance_type == 1){ + hdr.ethernet.ethertype = meta.ethertype; // hdr.cpu.setValid(); // hdr.cpu.srcAddr = hdr.ethernet.srcAddr; // hdr.cpu.ingress_port = (bit<16>)meta.ingress_port; - // hdr.ethernet.etherType = L2_LEARN_ETHER_TYPE; + // truncate((bit<32>)22); //ether+cpu header }