blob: 73a56ec43c7c0fdf9abd54bca79b097ebced8f68 [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
Jonghwan Hyunc235d462019-01-30 23:31:48 +090021const bit<3> NPROTO_ETHERNET = 0;
22const bit<3> NPROTO_TELEMETRY_DROP_HEADER = 1;
23const bit<3> NPROTO_TELEMETRY_SWITCH_LOCAL_HEADER = 2;
Jonghwan Hyun6777d532018-11-18 20:50:16 +090024
25
26// Report Telemetry Headers
27header report_fixed_header_t {
28 bit<4> ver;
Jonghwan Hyunc235d462019-01-30 23:31:48 +090029 bit<4> len;
30 bit<3> nproto;
31 bit<6> rep_md_bits;
Jonghwan Hyun6777d532018-11-18 20:50:16 +090032 bit<1> d;
33 bit<1> q;
34 bit<1> f;
Jonghwan Hyunc235d462019-01-30 23:31:48 +090035 bit<6> rsvd;
Jonghwan Hyun6777d532018-11-18 20:50:16 +090036 bit<6> hw_id;
Jonghwan Hyunc235d462019-01-30 23:31:48 +090037 bit<32> sw_id;
Jonghwan Hyun6777d532018-11-18 20:50:16 +090038 bit<32> seq_no;
39 bit<32> ingress_tstamp;
40}
Jonghwan Hyunc235d462019-01-30 23:31:48 +090041const bit<8> REPORT_FIXED_HEADER_LEN = 16;
Jonghwan Hyun6777d532018-11-18 20:50:16 +090042
43// Telemetry drop report header
44header 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}
52const bit<8> DROP_REPORT_HEADER_LEN = 12;
53
54// Switch Local Report Header
55header 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}
63const bit<8> LOCAL_REPORT_HEADER_LEN = 16;
64
65header_union local_report_t {
66 drop_report_header_t drop_report_header;
67 local_report_header_t local_report_header;
68}
69
70#endif