include ether type in cpu package

This commit is contained in:
Nico Schottelius 2019-03-04 18:05:56 +01:00
commit 60a3c8d8c5
3 changed files with 13 additions and 20 deletions

View file

@ -8,9 +8,9 @@
typedef bit<48> mac_addr_t;
typedef bit<32> ipv4_addr_t;
typedef bit<128> ipv6_addr_t;
typedef bit<9> port_t;
typedef bit<9> port_t;
typedef bit<16> mcast_t;
typedef bit<8> task_t;
typedef bit<8> task_t;
const bit<16> TYPE_IPV4 = 0x0800;
@ -114,6 +114,7 @@ header icmp_t {
header cpu_t {
port_t ingress_port;
task_t task;
bit<16> ethertype;
}
struct headers {
@ -128,8 +129,9 @@ struct headers {
}
struct metadata {
bit<16> tcp_length;
port_t ingress_port;
task_t task;
bit<16> tcp_length;
}
#endif

View file

@ -203,9 +203,11 @@ control MyEgress(inout headers hdr,
apply {
// ingress clone
if (standard_metadata.instance_type == 1){
hdr.ethernet.ethertype = TYPE_CPU;
hdr.cpu.setValid();
hdr.cpu.task = meta.task;
hdr.cpu.ethertype = hdr.ethernet.ethertype;
hdr.ethernet.ethertype = TYPE_CPU;
}
}
}