-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path2345b.p4
55 lines (43 loc) · 1.21 KB
/
2345b.p4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <core.p4>
#include <v1model.p4>
header ethernet_t {
bit<48> dst_addr;
bit<48> src_addr;
bit<16> eth_type;
}
struct Headers {
ethernet_t eth_hdr;
}
struct Meta {
}
parser p(packet_in pkt, out Headers hdr, inout Meta m, inout standard_metadata_t sm) {
state start {
transition parse_hdrs;
}
state parse_hdrs {
pkt.extract(hdr.eth_hdr);
transition accept;
}
}
action dummy(inout Headers val) {}
control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) {
action simple_action() {
if (h.eth_hdr.eth_type == 1) {
return;
}
h.eth_hdr.src_addr = 48w1;
// this serves as a barrier
dummy(h);
}
apply {
h.eth_hdr.src_addr = 48w2;
h.eth_hdr.dst_addr = 48w2;
h.eth_hdr.eth_type = 16w2;
simple_action();
}
}
control vrfy(inout Headers h, inout Meta m) { apply {} }
control update(inout Headers h, inout Meta m) { apply {} }
control egress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { apply {} }
control deparser(packet_out b, in Headers h) { apply {b.emit(h);} }
V1Switch(p(), vrfy(), ingress(), egress(), update(), deparser()) main;