blob: bf0f6f751ba87ebccd3e12d6c83fd6891be57def [file] [log] [blame]
Jonghwan Hyun6777d532018-11-18 20:50:16 +09001/*
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
21const bit<4> NPROTO_ETHERNET = 0;
22const bit<4> NPROTO_TELEMETRY_DROP_HEADER = 1;
23const bit<4> NPROTO_TELEMETRY_SWITCH_LOCAL_HEADER = 2;
24
25
26// Report Telemetry Headers
27header report_fixed_header_t {
28 bit<4> ver;
29 bit<4> nproto;
30 bit<1> d;
31 bit<1> q;
32 bit<1> f;
33 bit<15> rsvd;
34 bit<6> hw_id;
35 bit<32> seq_no;
36 bit<32> ingress_tstamp;
37}
38const bit<8> REPORT_FIXED_HEADER_LEN = 12;
39
40// Telemetry drop report header
41header drop_report_header_t {
42 bit<32> switch_id;
43 bit<16> ingress_port_id;
44 bit<16> egress_port_id;
45 bit<8> queue_id;
46 bit<8> drop_reason;
47 bit<16> pad;
48}
49const bit<8> DROP_REPORT_HEADER_LEN = 12;
50
51// Switch Local Report Header
52header local_report_header_t {
53 bit<32> switch_id;
54 bit<16> ingress_port_id;
55 bit<16> egress_port_id;
56 bit<8> queue_id;
57 bit<24> queue_occupancy;
58 bit<32> egress_tstamp;
59}
60const bit<8> LOCAL_REPORT_HEADER_LEN = 16;
61
62header_union local_report_t {
63 drop_report_header_t drop_report_header;
64 local_report_header_t local_report_header;
65}
66
67#endif