Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [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 | #ifndef __PARSER__ |
| 18 | #define __PARSER__ |
| 19 | |
| 20 | #include "define.p4" |
| 21 | |
Carmelo Cascone | b5324e7 | 2018-11-25 02:26:32 -0800 | [diff] [blame] | 22 | parser FabricParser (packet_in packet, |
| 23 | out parsed_headers_t hdr, |
| 24 | inout fabric_metadata_t fabric_metadata, |
| 25 | inout standard_metadata_t standard_metadata) { |
Yi Tseng | 1d84267 | 2017-11-28 16:06:52 -0800 | [diff] [blame] | 26 | |
Carmelo Cascone | 79a3a31 | 2018-08-16 17:14:43 -0700 | [diff] [blame] | 27 | bit<6> last_ipv4_dscp = 0; |
| 28 | |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 29 | state start { |
| 30 | transition select(standard_metadata.ingress_port) { |
| 31 | CPU_PORT: parse_packet_out; |
| 32 | default: parse_ethernet; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | state parse_packet_out { |
| 37 | packet.extract(hdr.packet_out); |
| 38 | transition parse_ethernet; |
| 39 | } |
| 40 | |
| 41 | state parse_ethernet { |
| 42 | packet.extract(hdr.ethernet); |
Carmelo Cascone | b5324e7 | 2018-11-25 02:26:32 -0800 | [diff] [blame] | 43 | fabric_metadata.vlan_id = DEFAULT_VLAN_ID; |
Daniele Moro | 5a2de71 | 2019-09-24 14:34:07 -0700 | [diff] [blame] | 44 | transition select(packet.lookahead<bit<16>>()){ |
Daniele Moro | 77654f9 | 2019-07-30 10:29:54 -0700 | [diff] [blame] | 45 | ETHERTYPE_QINQ: parse_vlan_tag; |
| 46 | ETHERTYPE_QINQ_NON_STD: parse_vlan_tag; |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 47 | ETHERTYPE_VLAN: parse_vlan_tag; |
Daniele Moro | 5a2de71 | 2019-09-24 14:34:07 -0700 | [diff] [blame] | 48 | default: parse_eth_type; |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 49 | } |
| 50 | } |
| 51 | |
| 52 | state parse_vlan_tag { |
| 53 | packet.extract(hdr.vlan_tag); |
Daniele Moro | b3d199b | 2019-11-01 14:01:46 -0700 | [diff] [blame] | 54 | #ifdef WITH_BNG |
| 55 | fabric_metadata.bng.s_tag = hdr.vlan_tag.vlan_id; |
| 56 | #endif // WITH_BNG |
Daniele Moro | 5a2de71 | 2019-09-24 14:34:07 -0700 | [diff] [blame] | 57 | transition select(packet.lookahead<bit<16>>()){ |
| 58 | #if defined(WITH_XCONNECT) || defined(WITH_DOUBLE_VLAN_TERMINATION) |
Carmelo Cascone | b5324e7 | 2018-11-25 02:26:32 -0800 | [diff] [blame] | 59 | ETHERTYPE_VLAN: parse_inner_vlan_tag; |
Daniele Moro | 5a2de71 | 2019-09-24 14:34:07 -0700 | [diff] [blame] | 60 | #endif // WITH_XCONNECT || WITH_DOUBLE_VLAN_TERMINATION |
| 61 | default: parse_eth_type; |
Carmelo Cascone | b5324e7 | 2018-11-25 02:26:32 -0800 | [diff] [blame] | 62 | } |
| 63 | } |
| 64 | |
Daniele Moro | 5a2de71 | 2019-09-24 14:34:07 -0700 | [diff] [blame] | 65 | #if defined(WITH_XCONNECT) || defined(WITH_DOUBLE_VLAN_TERMINATION) |
Carmelo Cascone | b5324e7 | 2018-11-25 02:26:32 -0800 | [diff] [blame] | 66 | state parse_inner_vlan_tag { |
| 67 | packet.extract(hdr.inner_vlan_tag); |
Daniele Moro | b3d199b | 2019-11-01 14:01:46 -0700 | [diff] [blame] | 68 | #ifdef WITH_BNG |
| 69 | fabric_metadata.bng.c_tag = hdr.inner_vlan_tag.vlan_id; |
| 70 | #endif // WITH_BNG |
Daniele Moro | 5a2de71 | 2019-09-24 14:34:07 -0700 | [diff] [blame] | 71 | transition parse_eth_type; |
| 72 | } |
| 73 | #endif // WITH_XCONNECT || WITH_DOUBLE_VLAN_TERMINATION |
| 74 | |
| 75 | state parse_eth_type { |
| 76 | packet.extract(hdr.eth_type); |
| 77 | transition select(hdr.eth_type.value) { |
Yi Tseng | bd46d05 | 2018-01-22 17:18:16 -0800 | [diff] [blame] | 78 | ETHERTYPE_MPLS: parse_mpls; |
Daniele Moro | 5a2de71 | 2019-09-24 14:34:07 -0700 | [diff] [blame] | 79 | ETHERTYPE_IPV4: parse_ipv4; |
| 80 | #ifdef WITH_IPV6 |
| 81 | ETHERTYPE_IPV6: parse_ipv6; |
| 82 | #endif // WITH_IPV6 |
Carmelo Cascone | 4d8785b | 2019-05-31 17:11:26 -0700 | [diff] [blame] | 83 | #ifdef WITH_BNG |
| 84 | ETHERTYPE_PPPOED: parse_pppoe; |
| 85 | ETHERTYPE_PPPOES: parse_pppoe; |
| 86 | #endif // WITH_BNG |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 87 | default: accept; |
| 88 | } |
| 89 | } |
| 90 | |
Carmelo Cascone | 4d8785b | 2019-05-31 17:11:26 -0700 | [diff] [blame] | 91 | #ifdef WITH_BNG |
| 92 | state parse_pppoe { |
| 93 | packet.extract(hdr.pppoe); |
| 94 | transition select(hdr.pppoe.protocol) { |
Daniele Moro | e22b574 | 2019-06-28 15:32:37 -0700 | [diff] [blame] | 95 | PPPOE_PROTOCOL_MPLS: parse_mpls; |
Daniele Moro | 5a2de71 | 2019-09-24 14:34:07 -0700 | [diff] [blame] | 96 | PPPOE_PROTOCOL_IP4: parse_ipv4; |
Carmelo Cascone | 4d8785b | 2019-05-31 17:11:26 -0700 | [diff] [blame] | 97 | #ifdef WITH_IPV6 |
Daniele Moro | 5a2de71 | 2019-09-24 14:34:07 -0700 | [diff] [blame] | 98 | PPPOE_PROTOCOL_IP6: parse_ipv6; |
Carmelo Cascone | 4d8785b | 2019-05-31 17:11:26 -0700 | [diff] [blame] | 99 | #endif // WITH_IPV6 |
| 100 | default: accept; |
| 101 | } |
| 102 | } |
| 103 | #endif // WITH_BNG |
| 104 | |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 105 | state parse_mpls { |
| 106 | packet.extract(hdr.mpls); |
Carmelo Cascone | b5324e7 | 2018-11-25 02:26:32 -0800 | [diff] [blame] | 107 | fabric_metadata.mpls_label = hdr.mpls.label; |
| 108 | fabric_metadata.mpls_ttl = hdr.mpls.ttl; |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame] | 109 | // There is only one MPLS label for this fabric. |
Carmelo Cascone | b5324e7 | 2018-11-25 02:26:32 -0800 | [diff] [blame] | 110 | // Assume header after MPLS header is IPv4/IPv6 |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame] | 111 | // Lookup first 4 bits for version |
Yi Tseng | 3d3956d | 2018-01-31 17:28:05 -0800 | [diff] [blame] | 112 | transition select(packet.lookahead<bit<IP_VER_LENGTH>>()) { |
Daniele Moro | 7c3a002 | 2019-07-12 13:38:34 -0700 | [diff] [blame] | 113 | // The packet should be either IPv4 or IPv6. |
| 114 | // If we have MPLS, go directly to parsing state without |
| 115 | // moving to pre_ states, the packet is considered MPLS |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 116 | IP_VERSION_4: parse_ipv4; |
Carmelo Cascone | ed88f2b | 2018-01-26 17:36:34 -0800 | [diff] [blame] | 117 | #ifdef WITH_IPV6 |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 118 | IP_VERSION_6: parse_ipv6; |
Carmelo Cascone | ed88f2b | 2018-01-26 17:36:34 -0800 | [diff] [blame] | 119 | #endif // WITH_IPV6 |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 120 | default: parse_ethernet; |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | state parse_ipv4 { |
| 125 | packet.extract(hdr.ipv4); |
| 126 | fabric_metadata.ip_proto = hdr.ipv4.protocol; |
Carmelo Cascone | b5324e7 | 2018-11-25 02:26:32 -0800 | [diff] [blame] | 127 | fabric_metadata.ip_eth_type = ETHERTYPE_IPV4; |
Carmelo Cascone | 79a3a31 | 2018-08-16 17:14:43 -0700 | [diff] [blame] | 128 | last_ipv4_dscp = hdr.ipv4.dscp; |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 129 | //Need header verification? |
| 130 | transition select(hdr.ipv4.protocol) { |
| 131 | PROTO_TCP: parse_tcp; |
| 132 | PROTO_UDP: parse_udp; |
| 133 | PROTO_ICMP: parse_icmp; |
| 134 | default: accept; |
| 135 | } |
| 136 | } |
| 137 | |
Carmelo Cascone | ed88f2b | 2018-01-26 17:36:34 -0800 | [diff] [blame] | 138 | #ifdef WITH_IPV6 |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 139 | state parse_ipv6 { |
| 140 | packet.extract(hdr.ipv6); |
| 141 | fabric_metadata.ip_proto = hdr.ipv6.next_hdr; |
Carmelo Cascone | b5324e7 | 2018-11-25 02:26:32 -0800 | [diff] [blame] | 142 | fabric_metadata.ip_eth_type = ETHERTYPE_IPV6; |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 143 | transition select(hdr.ipv6.next_hdr) { |
| 144 | PROTO_TCP: parse_tcp; |
| 145 | PROTO_UDP: parse_udp; |
| 146 | PROTO_ICMPV6: parse_icmp; |
| 147 | default: accept; |
| 148 | } |
| 149 | } |
Carmelo Cascone | ed88f2b | 2018-01-26 17:36:34 -0800 | [diff] [blame] | 150 | #endif // WITH_IPV6 |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 151 | |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 152 | state parse_tcp { |
| 153 | packet.extract(hdr.tcp); |
Carmelo Cascone | b5324e7 | 2018-11-25 02:26:32 -0800 | [diff] [blame] | 154 | fabric_metadata.l4_sport = hdr.tcp.sport; |
| 155 | fabric_metadata.l4_dport = hdr.tcp.dport; |
Jonghwan Hyun | ed478dc | 2018-08-06 15:35:18 +0900 | [diff] [blame] | 156 | #ifdef WITH_INT |
Carmelo Cascone | 79a3a31 | 2018-08-16 17:14:43 -0700 | [diff] [blame] | 157 | transition parse_int; |
Jonghwan Hyun | ed478dc | 2018-08-06 15:35:18 +0900 | [diff] [blame] | 158 | #else |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 159 | transition accept; |
Jonghwan Hyun | ed478dc | 2018-08-06 15:35:18 +0900 | [diff] [blame] | 160 | #endif // WITH_INT |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | state parse_udp { |
| 164 | packet.extract(hdr.udp); |
Carmelo Cascone | b5324e7 | 2018-11-25 02:26:32 -0800 | [diff] [blame] | 165 | fabric_metadata.l4_sport = hdr.udp.sport; |
| 166 | fabric_metadata.l4_dport = hdr.udp.dport; |
| 167 | transition select(hdr.udp.dport) { |
Carmelo Cascone | 79a3a31 | 2018-08-16 17:14:43 -0700 | [diff] [blame] | 168 | #ifdef WITH_SPGW |
Carmelo Cascone | b81f4be | 2018-01-16 23:24:01 -0800 | [diff] [blame] | 169 | UDP_PORT_GTPU: parse_gtpu; |
Carmelo Cascone | 79a3a31 | 2018-08-16 17:14:43 -0700 | [diff] [blame] | 170 | #endif // WITH_SPGW |
| 171 | #ifdef WITH_INT |
| 172 | default: parse_int; |
Carmelo Cascone | b81f4be | 2018-01-16 23:24:01 -0800 | [diff] [blame] | 173 | #else |
Carmelo Cascone | 79a3a31 | 2018-08-16 17:14:43 -0700 | [diff] [blame] | 174 | default: accept; |
| 175 | #endif // WITH_INT |
| 176 | } |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | state parse_icmp { |
| 180 | packet.extract(hdr.icmp); |
| 181 | transition accept; |
| 182 | } |
Carmelo Cascone | b81f4be | 2018-01-16 23:24:01 -0800 | [diff] [blame] | 183 | |
| 184 | #ifdef WITH_SPGW |
| 185 | state parse_gtpu { |
Carmelo Cascone | 9b0171b | 2018-08-14 01:43:57 -0700 | [diff] [blame] | 186 | transition select(hdr.ipv4.dst_addr[31:32-S1U_SGW_PREFIX_LEN]) { |
| 187 | // Avoid parsing GTP and inner headers if we know this GTP packet |
| 188 | // is not to be processed by this switch. |
| 189 | // FIXME: use parser value sets when support is ready in ONOS. |
| 190 | // To set the S1U_SGW_PREFIX value at runtime. |
| 191 | S1U_SGW_PREFIX[31:32-S1U_SGW_PREFIX_LEN]: do_parse_gtpu; |
| 192 | default: accept; |
| 193 | } |
Carmelo Cascone | b81f4be | 2018-01-16 23:24:01 -0800 | [diff] [blame] | 194 | } |
| 195 | |
Carmelo Cascone | 9b0171b | 2018-08-14 01:43:57 -0700 | [diff] [blame] | 196 | state do_parse_gtpu { |
| 197 | packet.extract(hdr.gtpu); |
| 198 | transition parse_inner_ipv4; |
| 199 | } |
| 200 | |
| 201 | state parse_inner_ipv4 { |
| 202 | packet.extract(hdr.inner_ipv4); |
Carmelo Cascone | 79a3a31 | 2018-08-16 17:14:43 -0700 | [diff] [blame] | 203 | last_ipv4_dscp = hdr.inner_ipv4.dscp; |
Carmelo Cascone | 9b0171b | 2018-08-14 01:43:57 -0700 | [diff] [blame] | 204 | transition select(hdr.inner_ipv4.protocol) { |
Carmelo Cascone | b81f4be | 2018-01-16 23:24:01 -0800 | [diff] [blame] | 205 | PROTO_TCP: parse_tcp; |
Carmelo Cascone | 9b0171b | 2018-08-14 01:43:57 -0700 | [diff] [blame] | 206 | PROTO_UDP: parse_inner_udp; |
Carmelo Cascone | b81f4be | 2018-01-16 23:24:01 -0800 | [diff] [blame] | 207 | PROTO_ICMP: parse_icmp; |
| 208 | default: accept; |
| 209 | } |
| 210 | } |
| 211 | |
Carmelo Cascone | 9b0171b | 2018-08-14 01:43:57 -0700 | [diff] [blame] | 212 | state parse_inner_udp { |
| 213 | packet.extract(hdr.inner_udp); |
Carmelo Cascone | b5324e7 | 2018-11-25 02:26:32 -0800 | [diff] [blame] | 214 | fabric_metadata.l4_sport = hdr.inner_udp.sport; |
| 215 | fabric_metadata.l4_dport = hdr.inner_udp.dport; |
Jonghwan Hyun | ed478dc | 2018-08-06 15:35:18 +0900 | [diff] [blame] | 216 | #ifdef WITH_INT |
Carmelo Cascone | 79a3a31 | 2018-08-16 17:14:43 -0700 | [diff] [blame] | 217 | transition parse_int; |
Jonghwan Hyun | ed478dc | 2018-08-06 15:35:18 +0900 | [diff] [blame] | 218 | #else |
Carmelo Cascone | b81f4be | 2018-01-16 23:24:01 -0800 | [diff] [blame] | 219 | transition accept; |
Jonghwan Hyun | ed478dc | 2018-08-06 15:35:18 +0900 | [diff] [blame] | 220 | #endif // WITH_INT |
Carmelo Cascone | b81f4be | 2018-01-16 23:24:01 -0800 | [diff] [blame] | 221 | } |
| 222 | #endif // WITH_SPGW |
Carmelo Cascone | 79a3a31 | 2018-08-16 17:14:43 -0700 | [diff] [blame] | 223 | |
| 224 | #ifdef WITH_INT |
| 225 | state parse_int { |
| 226 | transition select(last_ipv4_dscp) { |
| 227 | INT_DSCP &&& INT_DSCP: parse_intl4_shim; |
| 228 | default: accept; |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | state parse_intl4_shim { |
| 233 | packet.extract(hdr.intl4_shim); |
| 234 | transition parse_int_header; |
| 235 | } |
| 236 | |
| 237 | state parse_int_header { |
| 238 | packet.extract(hdr.int_header); |
| 239 | // If there is no INT metadata but the INT header (plus shim and tail) |
| 240 | // exists, default value of length field in shim header should be |
| 241 | // INT_HEADER_LEN_WORDS. |
| 242 | transition select (hdr.intl4_shim.len_words) { |
| 243 | INT_HEADER_LEN_WORDS: parse_intl4_tail; |
| 244 | default: parse_int_data; |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | state parse_int_data { |
| 249 | #ifdef WITH_INT_SINK |
| 250 | // Parse INT metadata stack, but not tail |
| 251 | packet.extract(hdr.int_data, (bit<32>) (hdr.intl4_shim.len_words - INT_HEADER_LEN_WORDS) << 5); |
| 252 | transition parse_intl4_tail; |
| 253 | #else // not interested in INT data |
| 254 | transition accept; |
| 255 | #endif // WITH_INT_SINK |
| 256 | } |
| 257 | |
| 258 | state parse_intl4_tail { |
| 259 | packet.extract(hdr.intl4_tail); |
| 260 | transition accept; |
| 261 | } |
| 262 | #endif // WITH_INT |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 263 | } |
| 264 | |
Carmelo Cascone | b5324e7 | 2018-11-25 02:26:32 -0800 | [diff] [blame] | 265 | control FabricDeparser(packet_out packet,in parsed_headers_t hdr) { |
| 266 | |
Yi Tseng | 3d3956d | 2018-01-31 17:28:05 -0800 | [diff] [blame] | 267 | apply { |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 268 | packet.emit(hdr.packet_in); |
Carmelo Cascone | 79a3a31 | 2018-08-16 17:14:43 -0700 | [diff] [blame] | 269 | #ifdef WITH_INT_SINK |
Jonghwan Hyun | ed478dc | 2018-08-06 15:35:18 +0900 | [diff] [blame] | 270 | packet.emit(hdr.report_ethernet); |
Daniele Moro | 5a2de71 | 2019-09-24 14:34:07 -0700 | [diff] [blame] | 271 | packet.emit(hdr.report_eth_type); |
Jonghwan Hyun | ed478dc | 2018-08-06 15:35:18 +0900 | [diff] [blame] | 272 | packet.emit(hdr.report_ipv4); |
| 273 | packet.emit(hdr.report_udp); |
| 274 | packet.emit(hdr.report_fixed_header); |
Carmelo Cascone | 79a3a31 | 2018-08-16 17:14:43 -0700 | [diff] [blame] | 275 | #endif // WITH_INT_SINK |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 276 | packet.emit(hdr.ethernet); |
| 277 | packet.emit(hdr.vlan_tag); |
Daniele Moro | 5a2de71 | 2019-09-24 14:34:07 -0700 | [diff] [blame] | 278 | #if defined(WITH_XCONNECT) || defined(WITH_DOUBLE_VLAN_TERMINATION) |
Carmelo Cascone | b5324e7 | 2018-11-25 02:26:32 -0800 | [diff] [blame] | 279 | packet.emit(hdr.inner_vlan_tag); |
Daniele Moro | 5a2de71 | 2019-09-24 14:34:07 -0700 | [diff] [blame] | 280 | #endif // WITH_XCONNECT || WITH_DOUBLE_VLAN_TERMINATION |
| 281 | packet.emit(hdr.eth_type); |
Carmelo Cascone | 4d8785b | 2019-05-31 17:11:26 -0700 | [diff] [blame] | 282 | #ifdef WITH_BNG |
| 283 | packet.emit(hdr.pppoe); |
| 284 | #endif // WITH_BNG |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 285 | packet.emit(hdr.mpls); |
Carmelo Cascone | b81f4be | 2018-01-16 23:24:01 -0800 | [diff] [blame] | 286 | #ifdef WITH_SPGW |
| 287 | packet.emit(hdr.gtpu_ipv4); |
| 288 | packet.emit(hdr.gtpu_udp); |
| 289 | packet.emit(hdr.gtpu); |
| 290 | #endif // WITH_SPGW |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 291 | packet.emit(hdr.ipv4); |
Carmelo Cascone | ed88f2b | 2018-01-26 17:36:34 -0800 | [diff] [blame] | 292 | #ifdef WITH_IPV6 |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 293 | packet.emit(hdr.ipv6); |
Carmelo Cascone | ed88f2b | 2018-01-26 17:36:34 -0800 | [diff] [blame] | 294 | #endif // WITH_IPV6 |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 295 | packet.emit(hdr.tcp); |
| 296 | packet.emit(hdr.udp); |
Yi Tseng | f73a553 | 2017-11-17 15:58:57 -0800 | [diff] [blame] | 297 | packet.emit(hdr.icmp); |
Jonghwan Hyun | ed478dc | 2018-08-06 15:35:18 +0900 | [diff] [blame] | 298 | #ifdef WITH_INT |
| 299 | packet.emit(hdr.intl4_shim); |
| 300 | packet.emit(hdr.int_header); |
Carmelo Cascone | 79a3a31 | 2018-08-16 17:14:43 -0700 | [diff] [blame] | 301 | #ifdef WITH_INT_TRANSIT |
Jonghwan Hyun | ed478dc | 2018-08-06 15:35:18 +0900 | [diff] [blame] | 302 | packet.emit(hdr.int_switch_id); |
| 303 | packet.emit(hdr.int_port_ids); |
| 304 | packet.emit(hdr.int_hop_latency); |
| 305 | packet.emit(hdr.int_q_occupancy); |
| 306 | packet.emit(hdr.int_ingress_tstamp); |
| 307 | packet.emit(hdr.int_egress_tstamp); |
| 308 | packet.emit(hdr.int_q_congestion); |
| 309 | packet.emit(hdr.int_egress_tx_util); |
Carmelo Cascone | 79a3a31 | 2018-08-16 17:14:43 -0700 | [diff] [blame] | 310 | #endif // WITH_INT_TRANSIT |
Carmelo Cascone | 8e5818d | 2018-10-26 11:45:23 -0700 | [diff] [blame] | 311 | #ifdef WITH_INT_SINK |
Jonghwan Hyun | ed478dc | 2018-08-06 15:35:18 +0900 | [diff] [blame] | 312 | packet.emit(hdr.int_data); |
Carmelo Cascone | 8e5818d | 2018-10-26 11:45:23 -0700 | [diff] [blame] | 313 | #endif // WITH_INT_SINK |
Jonghwan Hyun | ed478dc | 2018-08-06 15:35:18 +0900 | [diff] [blame] | 314 | packet.emit(hdr.intl4_tail); |
| 315 | #endif // WITH_INT |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 316 | } |
| 317 | } |
| 318 | |
Daniele Moro | 5a2de71 | 2019-09-24 14:34:07 -0700 | [diff] [blame] | 319 | #endif |