2 * Copyright (c) 2015 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
15 #ifndef included_vnet_nsh_gre_packet_h
16 #define included_vnet_nsh_gre_packet_h
19 * NSH_GRE packet format from draft-quinn-sfc-nsh-03.txt
23 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
24 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
25 * |Ver|O|C|R|R|R|R|R|R| Length | MD Type | Next Protocol |
26 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
29 * Base Header Field Descriptions:
31 * Version: The version field is used to ensure backward compatibility
32 * going forward with future NSH updates.
34 * O bit: Indicates that this packet is an operations and management
35 * (OAM) packet. SFF and SFs nodes MUST examine the payload and take
36 * appropriate action (e.g. return status information).
38 * OAM message specifics and handling details are outside the scope of
41 * C bit: Indicates that a critical metadata TLV is present (see section
42 * 7). This bit acts as an indication for hardware implementers to
43 * decide how to handle the presence of a critical TLV without
44 * necessarily needing to parse all TLVs present. The C bit MUST be set
45 * to 1 if one or more critical TLVs are present.
47 * All other flag fields are reserved.
49 * Length: total length, in 4 byte words, of the NSH header, including
50 * optional variable TLVs. Length must be equal or greater than 6.
52 * MD Type: indicates the format of NSH beyond the base header and the
53 * type of metadata being carried. This typing is used to describe the
54 * use for the metadata. A new registry will be requested from IANA for
55 * the MD Type. NSH defines one type, type = 0x1 which indicates that
56 * the format of the header is as per this draft.
58 * The format of the base header is invariant, and not described by MD
61 * Next Protocol: indicates the protocol type of the original packet. A
62 * new IANA registry will be created for protocol type.
64 * This draft defines the following Next Protocol values:
71 typedef CLIB_PACKED(struct {
77 /* Context headers, always present */
78 u32 c1; u32 c2; u32 c3; u32 c4;
80 /* Optional variable length metadata */
84 #define NSH_GRE_VERSION (0<<6)
85 #define NSH_GRE_O_BIT (1<<5)
86 #define NSH_GRE_C_BIT (1<<4)
88 /* Network byte order shift / mask */
89 #define NSH_GRE_SINDEX_MASK 0xFF
90 #define NSH_GRE_SPI_MASK (0x00FFFFFF)
91 #define NSH_GRE_SPI_SHIFT 8
93 #endif /* included_vnet_nsh_gre_packet_h */