1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright 2016 6WIND S.A. 3 */ 4 5 #ifndef _RTE_GRE_H_ 6 #define _RTE_GRE_H_ 7 8 #include <stdint.h> 9 #include <rte_byteorder.h> 10 11 /** 12 * @file 13 * 14 * GRE headers definition. 15 * 16 * Generic Routing Encapsulation (GRE) is a tunneling protocol 17 * that can encapsulate a wide variety of network layer protocols 18 * inside virtual point-to-point links or point-to-multipoint links 19 * over an Internet Protocol network. 20 */ 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 /** 27 * GRE Header 28 */ 29 __extension__ 30 struct rte_gre_hdr { 31 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN 32 uint16_t res2:4; /**< Reserved */ 33 uint16_t s:1; /**< Sequence Number Present bit */ 34 uint16_t k:1; /**< Key Present bit */ 35 uint16_t res1:1; /**< Reserved */ 36 uint16_t c:1; /**< Checksum Present bit */ 37 uint16_t ver:3; /**< Version Number */ 38 uint16_t res3:5; /**< Reserved */ 39 #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN 40 uint16_t c:1; /**< Checksum Present bit */ 41 uint16_t res1:1; /**< Reserved */ 42 uint16_t k:1; /**< Key Present bit */ 43 uint16_t s:1; /**< Sequence Number Present bit */ 44 uint16_t res2:4; /**< Reserved */ 45 uint16_t res3:5; /**< Reserved */ 46 uint16_t ver:3; /**< Version Number */ 47 #endif 48 rte_be16_t proto; /**< Protocol Type */ 49 } __rte_packed; 50 51 /** 52 * Optional field checksum in GRE header 53 */ 54 struct rte_gre_hdr_opt_checksum_rsvd { 55 rte_be16_t checksum; 56 rte_be16_t reserved1; 57 } __rte_packed; 58 59 /** 60 * Optional field key in GRE header 61 */ 62 struct rte_gre_hdr_opt_key { 63 rte_be32_t key; 64 } __rte_packed; 65 66 /** 67 * Optional field sequence in GRE header 68 */ 69 struct rte_gre_hdr_opt_sequence { 70 rte_be32_t sequence; 71 } __rte_packed; 72 73 #ifdef __cplusplus 74 } 75 #endif 76 77 #endif /* RTE_GRE_H_ */ 78