Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | /* |
| 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: |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 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. |
| 14 | */ |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 15 | /** |
| 16 | * @file |
| 17 | * @brief VXLAN GPE packet header structure |
| 18 | * |
| 19 | */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 20 | #ifndef included_vxlan_gpe_packet_h |
| 21 | #define included_vxlan_gpe_packet_h |
| 22 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 23 | /** |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 24 | * From draft-quinn-vxlan-gpe-03.txt |
| 25 | * |
| 26 | * 0 1 2 3 |
| 27 | * 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 |
| 28 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 29 | * |R|R|R|R|I|P|R|O|Ver| Reserved |Next Protocol | |
| 30 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 31 | * | VXLAN Network Identifier (VNI) | Reserved | |
| 32 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 33 | * |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame^] | 34 | * I Bit: Flag bit 4 indicates that the VNI is valid. |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 35 | * |
| 36 | * P Bit: Flag bit 5 is defined as the Next Protocol bit. The P bit |
| 37 | * MUST be set to 1 to indicate the presence of the 8 bit next |
| 38 | * protocol field. |
| 39 | * |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame^] | 40 | * O Bit: Flag bit 7 is defined as the O bit. When the O bit is set to 1, |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 41 | * |
| 42 | * the packet is an OAM packet and OAM processing MUST occur. The OAM |
| 43 | * protocol details are out of scope for this document. As with the |
| 44 | * P-bit, bit 7 is currently a reserved flag in VXLAN. |
| 45 | * |
| 46 | * VXLAN-gpe bits 8 and 9 are defined as version bits. These bits are |
| 47 | * reserved in VXLAN. The version field is used to ensure backward |
| 48 | * compatibility going forward with future VXLAN-gpe updates. |
| 49 | * |
| 50 | * The initial version for VXLAN-gpe is 0. |
| 51 | * |
| 52 | * This draft defines the following Next Protocol values: |
| 53 | * |
| 54 | * 0x1 : IPv4 |
| 55 | * 0x2 : IPv6 |
| 56 | * 0x3 : Ethernet |
| 57 | * 0x4 : Network Service Header [NSH] |
| 58 | */ |
| 59 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 60 | /** |
| 61 | * @brief VXLAN GPE support inner protocol definition. |
| 62 | * 1 - IP4 |
| 63 | * 2 - IP6 |
| 64 | * 3 - ETHERNET |
| 65 | * 4 - NSH |
| 66 | */ |
| 67 | #define foreach_vxlan_gpe_protocol \ |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 68 | _ (0x01, IP4) \ |
| 69 | _ (0x02, IP6) \ |
| 70 | _ (0x03, ETHERNET) \ |
Vengada Govindan | 6d403a0 | 2016-10-12 05:54:09 -0700 | [diff] [blame] | 71 | _ (0x04, NSH) \ |
| 72 | _ (0x05, IOAM) |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 73 | |
| 74 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 75 | /** |
| 76 | * @brief Struct for VXLAN GPE support inner protocol definition. |
| 77 | * 1 - IP4 |
| 78 | * 2 - IP6 |
| 79 | * 3 - ETHERNET |
| 80 | * 4 - NSH |
Vengada Govindan | 6d403a0 | 2016-10-12 05:54:09 -0700 | [diff] [blame] | 81 | * 5 - IOAM |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 82 | */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame^] | 83 | typedef enum |
| 84 | { |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 85 | #define _(n,f) VXLAN_GPE_PROTOCOL_##f = n, |
| 86 | foreach_vxlan_gpe_protocol |
| 87 | #undef _ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame^] | 88 | VXLAN_GPE_PROTOCOL_MAX, |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 89 | } vxlan_gpe_protocol_t; |
| 90 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 91 | /** |
| 92 | * @brief VXLAN GPE Header definition |
| 93 | */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame^] | 94 | typedef struct |
| 95 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 96 | u8 flags; |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 97 | /** Version and Reserved */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 98 | u8 ver_res; |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 99 | /** Reserved */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 100 | u8 res; |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 101 | /** see vxlan_gpe_protocol_t */ |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 102 | u8 protocol; |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 103 | /** VNI and Reserved */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 104 | u32 vni_res; |
| 105 | } vxlan_gpe_header_t; |
| 106 | |
| 107 | #define VXLAN_GPE_FLAGS_I 0x08 |
| 108 | #define VXLAN_GPE_FLAGS_P 0x04 |
| 109 | #define VXLAN_GPE_FLAGS_O 0x01 |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 110 | #define VXLAN_GPE_VERSION 0x0 |
| 111 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 112 | #endif /* included_vxlan_gpe_packet_h */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame^] | 113 | |
| 114 | /* |
| 115 | * fd.io coding-style-patch-verification: ON |
| 116 | * |
| 117 | * Local Variables: |
| 118 | * eval: (c-set-style "gnu") |
| 119 | * End: |
| 120 | */ |