Carmelo Cascone | 4f01102 | 2017-06-05 01:41:02 -0400 | [diff] [blame] | 1 | #include "include/defines.p4" |
| 2 | #include "include/headers.p4" |
| 3 | #include "include/parser.p4" |
| 4 | #include "include/actions.p4" |
| 5 | #include "include/port_counters.p4" |
Carmelo Cascone | 16de6db | 2017-08-22 00:27:57 +0200 | [diff] [blame] | 6 | #include "include/packet_io.p4" |
Carmelo Cascone | 4f01102 | 2017-06-05 01:41:02 -0400 | [diff] [blame] | 7 | |
| 8 | table table0 { |
| 9 | reads { |
Carmelo Cascone | 16de6db | 2017-08-22 00:27:57 +0200 | [diff] [blame] | 10 | IGR_PORT_FIELD : ternary; |
| 11 | ethernet.dstAddr : ternary; |
| 12 | ethernet.srcAddr : ternary; |
Carmelo Cascone | 4f01102 | 2017-06-05 01:41:02 -0400 | [diff] [blame] | 13 | ethernet.etherType : ternary; |
| 14 | } |
| 15 | actions { |
| 16 | set_egress_port; |
| 17 | send_to_cpu; |
Carmelo Cascone | 16de6db | 2017-08-22 00:27:57 +0200 | [diff] [blame] | 18 | _drop; |
Carmelo Cascone | 4f01102 | 2017-06-05 01:41:02 -0400 | [diff] [blame] | 19 | } |
| 20 | support_timeout: true; |
| 21 | } |
| 22 | |
| 23 | counter table0_counter { |
| 24 | type: packets; |
| 25 | direct: table0; |
| 26 | min_width : 32; |
| 27 | } |
| 28 | |
| 29 | control ingress { |
Carmelo Cascone | 16de6db | 2017-08-22 00:27:57 +0200 | [diff] [blame] | 30 | if (not valid(packet_out_hdr)) { |
| 31 | apply(table0); |
| 32 | } |
Carmelo Cascone | f2ac720 | 2017-09-08 00:57:44 +0200 | [diff] [blame] | 33 | ingress_pkt_io_control(); |
Carmelo Cascone | 4f01102 | 2017-06-05 01:41:02 -0400 | [diff] [blame] | 34 | process_port_counters(); |
Carmelo Cascone | 4f01102 | 2017-06-05 01:41:02 -0400 | [diff] [blame] | 35 | } |