Jonghwan Hyun | 6777d53 | 2018-11-18 20:50:16 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Foundation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* -*- P4_16 -*- */ |
| 18 | #ifndef __TELEMETRY_REPORT_HEADERS__ |
| 19 | #define __TELEMETRY_REPORT_HEADERS__ |
| 20 | |
Jonghwan Hyun | c235d46 | 2019-01-30 23:31:48 +0900 | [diff] [blame] | 21 | const bit<3> NPROTO_ETHERNET = 0; |
| 22 | const bit<3> NPROTO_TELEMETRY_DROP_HEADER = 1; |
| 23 | const bit<3> NPROTO_TELEMETRY_SWITCH_LOCAL_HEADER = 2; |
Jonghwan Hyun | 6777d53 | 2018-11-18 20:50:16 +0900 | [diff] [blame] | 24 | |
| 25 | |
| 26 | // Report Telemetry Headers |
| 27 | header report_fixed_header_t { |
| 28 | bit<4> ver; |
Jonghwan Hyun | c235d46 | 2019-01-30 23:31:48 +0900 | [diff] [blame] | 29 | bit<4> len; |
| 30 | bit<3> nproto; |
| 31 | bit<6> rep_md_bits; |
Jonghwan Hyun | 6777d53 | 2018-11-18 20:50:16 +0900 | [diff] [blame] | 32 | bit<1> d; |
| 33 | bit<1> q; |
| 34 | bit<1> f; |
Jonghwan Hyun | c235d46 | 2019-01-30 23:31:48 +0900 | [diff] [blame] | 35 | bit<6> rsvd; |
Jonghwan Hyun | 6777d53 | 2018-11-18 20:50:16 +0900 | [diff] [blame] | 36 | bit<6> hw_id; |
Jonghwan Hyun | c235d46 | 2019-01-30 23:31:48 +0900 | [diff] [blame] | 37 | bit<32> sw_id; |
Jonghwan Hyun | 6777d53 | 2018-11-18 20:50:16 +0900 | [diff] [blame] | 38 | bit<32> seq_no; |
| 39 | bit<32> ingress_tstamp; |
| 40 | } |
Jonghwan Hyun | c235d46 | 2019-01-30 23:31:48 +0900 | [diff] [blame] | 41 | const bit<8> REPORT_FIXED_HEADER_LEN = 16; |
Jonghwan Hyun | 6777d53 | 2018-11-18 20:50:16 +0900 | [diff] [blame] | 42 | |
| 43 | // Telemetry drop report header |
| 44 | header drop_report_header_t { |
| 45 | bit<32> switch_id; |
| 46 | bit<16> ingress_port_id; |
| 47 | bit<16> egress_port_id; |
| 48 | bit<8> queue_id; |
| 49 | bit<8> drop_reason; |
| 50 | bit<16> pad; |
| 51 | } |
| 52 | const bit<8> DROP_REPORT_HEADER_LEN = 12; |
| 53 | |
| 54 | // Switch Local Report Header |
| 55 | header local_report_header_t { |
| 56 | bit<32> switch_id; |
| 57 | bit<16> ingress_port_id; |
| 58 | bit<16> egress_port_id; |
| 59 | bit<8> queue_id; |
| 60 | bit<24> queue_occupancy; |
| 61 | bit<32> egress_tstamp; |
| 62 | } |
| 63 | const bit<8> LOCAL_REPORT_HEADER_LEN = 16; |
| 64 | |
| 65 | header_union local_report_t { |
| 66 | drop_report_header_t drop_report_header; |
| 67 | local_report_header_t local_report_header; |
| 68 | } |
| 69 | |
| 70 | #endif |