1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 1982, 1986, 1990, 1993
3 * The Regents of the University of California.
4 * Copyright(c) 2010-2014 Intel Corporation.
18 #include <rte_byteorder.h>
25 * Simplified GTP protocol header.
26 * Contains 8-bit header info, 8-bit message type,
27 * 16-bit payload length after mandatory header, 32-bit TEID.
28 * No optional fields and next extension header.
33 uint8_t gtp_hdr_info; /**< GTP header info */
35 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
36 uint8_t pn:1; /**< N-PDU Number present bit */
37 uint8_t s:1; /**< Sequence Number Present bit */
38 uint8_t e:1; /**< Extension Present bit */
39 uint8_t res1:1; /**< Reserved */
40 uint8_t pt:1; /**< Protocol Type bit */
41 uint8_t ver:3; /**< Version Number */
42 #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
43 uint8_t ver:3; /**< Version Number */
44 uint8_t pt:1; /**< Protocol Type bit */
45 uint8_t res1:1; /**< Reserved */
46 uint8_t e:1; /**< Extension Present bit */
47 uint8_t s:1; /**< Sequence Number Present bit */
48 uint8_t pn:1; /**< N-PDU Number present bit */
52 uint8_t msg_type; /**< GTP message type */
53 rte_be16_t plen; /**< Total payload length */
54 rte_be32_t teid; /**< Tunnel endpoint ID */
57 /* Optional word of GTP header, present if any of E, S, PN is set. */
58 struct rte_gtp_hdr_ext_word {
59 rte_be16_t sqn; /**< Sequence Number. */
60 uint8_t npdu; /**< N-PDU number. */
61 uint8_t next_ext; /**< Next Extension Header Type. */
64 /** GTP header length */
65 #define RTE_ETHER_GTP_HLEN \
66 (sizeof(struct rte_udp_hdr) + sizeof(struct rte_gtp_hdr))
67 /* GTP next protocal type */
68 #define RTE_GTP_TYPE_IPV4 0x40 /**< GTP next protocal type IPv4 */
69 #define RTE_GTP_TYPE_IPV6 0x60 /**< GTP next protocal type IPv6 */
70 /* GTP destination port number */
71 #define RTE_GTPC_UDP_PORT 2123 /**< GTP-C UDP destination port */
72 #define RTE_GTPU_UDP_PORT 2152 /**< GTP-U UDP destination port */
78 #endif /* RTE_GTP_H_ */