blob: 7b814493a4126d25dbc2488cec03d0c60c3e99da [file] [log] [blame]
Carmelo Cascone97efefb2019-12-05 16:40:45 -08001/*
2 * Copyright 2019-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#define _PKT_OUT_HDR_ANNOT @not_extracted_in_egress
18
19#define _BOOL bit<1>
20#define _TRUE 1w1
21#define _FALSE 1w0
22
23#ifdef WITH_INT_TRANSIT
24#define _PRE_INGRESS fabric_metadata.int_meta.ig_tstamp = (bit<32>) standard_metadata.ingress_global_timestamp;
25#define _PRE_EGRESS fabric_metadata.int_meta.eg_tstamp = (bit<32>) standard_metadata.egress_global_timestamp;
26#endif // WITH_INT_TRANSIT
27
28#define _INT_INIT_METADATA \
29 hdr.int_switch_id.switch_id = switch_id;\
30 hdr.int_port_ids.ingress_port_id = (bit<16>) smeta.ingress_port;\
31 hdr.int_port_ids.egress_port_id = (bit<16>) smeta.egress_port;\
32 hdr.int_ingress_tstamp.ingress_tstamp = fmeta.int_meta.ig_tstamp;\
33 hdr.int_egress_tstamp.egress_tstamp = fmeta.int_meta.eg_tstamp;\
34 hdr.int_hop_latency.hop_latency = (bit<32>) smeta.egress_global_timestamp - (bit<32>) smeta.ingress_global_timestamp;\
35 hdr.int_q_occupancy.q_id = 8w0;\
36 hdr.int_q_occupancy.q_occupancy = (bit<24>) smeta.deq_qdepth;\
37 hdr.int_q_congestion.q_id = 8w0;\
38 hdr.int_q_congestion.q_congestion = 24w0;\
39 hdr.int_egress_tx_util.egress_port_tx_util = 32w0;\
40
41#define _INT_METADATA_ACTIONS \
42 action int_set_header_0() { hdr.int_switch_id.setValid(); }\
43 action int_set_header_1() { hdr.int_port_ids.setValid(); }\
44 action int_set_header_2() { hdr.int_hop_latency.setValid(); }\
45 action int_set_header_3() { hdr.int_q_occupancy.setValid(); }\
46 action int_set_header_4() { hdr.int_ingress_tstamp.setValid(); }\
47 action int_set_header_5() { hdr.int_egress_tstamp.setValid(); }\
48 action int_set_header_6() { hdr.int_q_congestion.setValid(); }\
49 action int_set_header_7() { hdr.int_egress_tx_util.setValid(); }\
50
51#define __TABLE_SIZE__
52#define BNG_MAX_SUBSC 1024
53#define BNG_MAX_NET_PER_SUBSC 4
54#define BNG_MAX_SUBSC_NET BNG_MAX_NET_PER_SUBSC * BNG_MAX_SUBSC
55#ifdef WITH_BNG
56 #define PORT_VLAN_TABLE_SIZE BNG_MAX_SUBSC + 2048
57#else
58 #define PORT_VLAN_TABLE_SIZE 2048
59#endif // WITH_BNG
60#define FWD_CLASSIFIER_TABLE_SIZE 128
61#define BRIDGING_TABLE_SIZE 2048
62#define MPLS_TABLE_SIZE 2048
63#ifdef WITH_BNG
64 #define ROUTING_V4_TABLE_SIZE BNG_MAX_SUBSC_NET + 1024
65#else
66 #define ROUTING_V4_TABLE_SIZE 30000
67#endif // WITH_BNG
68#define ACL_TABLE_SIZE 2048
69// Depends on number of unique next_id expected
70#define NEXT_VLAN_TABLE_SIZE 2048
71#define XCONNECT_NEXT_TABLE_SIZE 4096
72#define SIMPLE_NEXT_TABLE_SIZE 2048
73#define HASHED_NEXT_TABLE_SIZE 2048
74// Max size of ECMP groups
75#define HASHED_SELECTOR_MAX_GROUP_SIZE 16
76// Ideally HASHED_NEXT_TABLE_SIZE * HASHED_SELECTOR_MAX_GROUP_SIZE
77#define HASHED_ACT_PROFILE_SIZE 32w32768
78#define MULTICAST_NEXT_TABLE_SIZE 2048
79#define EGRESS_VLAN_TABLE_SIZE 2048
80
81#define _ROUTING_V4_TABLE_ANNOT @alpm(1)
82
83#include "fabric.p4"