]> git.ipfire.org Git - thirdparty/kernel/linux.git/blob - include/net/gtp.h
Merge tag 'ceph-for-6.9-rc4' of https://github.com/ceph/ceph-client
[thirdparty/kernel/linux.git] / include / net / gtp.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _GTP_H_
3 #define _GTP_H_
4
5 #include <linux/netdevice.h>
6 #include <linux/types.h>
7 #include <net/rtnetlink.h>
8
9 /* General GTP protocol related definitions. */
10
11 #define GTP0_PORT 3386
12 #define GTP1U_PORT 2152
13
14 /* GTP messages types */
15 #define GTP_ECHO_REQ 1 /* Echo Request */
16 #define GTP_ECHO_RSP 2 /* Echo Response */
17 #define GTP_TPDU 255
18
19 #define GTPIE_RECOVERY 14
20
21 struct gtp0_header { /* According to GSM TS 09.60. */
22 __u8 flags;
23 __u8 type;
24 __be16 length;
25 __be16 seq;
26 __be16 flow;
27 __u8 number;
28 __u8 spare[3];
29 __be64 tid;
30 } __attribute__ ((packed));
31
32 struct gtp1_header { /* According to 3GPP TS 29.060. */
33 __u8 flags;
34 __u8 type;
35 __be16 length;
36 __be32 tid;
37 } __attribute__ ((packed));
38
39 struct gtp1_header_long { /* According to 3GPP TS 29.060. */
40 __u8 flags;
41 __u8 type;
42 __be16 length;
43 __be32 tid;
44 __be16 seq;
45 __u8 npdu;
46 __u8 next;
47 } __packed;
48
49 /* GTP Information Element */
50 struct gtp_ie {
51 __u8 tag;
52 __u8 val;
53 } __packed;
54
55 struct gtp0_packet {
56 struct gtp0_header gtp0_h;
57 struct gtp_ie ie;
58 } __packed;
59
60 struct gtp1u_packet {
61 struct gtp1_header_long gtp1u_h;
62 struct gtp_ie ie;
63 } __packed;
64
65 struct gtp_pdu_session_info { /* According to 3GPP TS 38.415. */
66 u8 pdu_type;
67 u8 qfi;
68 };
69
70 static inline bool netif_is_gtp(const struct net_device *dev)
71 {
72 return dev->rtnl_link_ops &&
73 !strcmp(dev->rtnl_link_ops->kind, "gtp");
74 }
75
76 #define GTP1_F_NPDU 0x01
77 #define GTP1_F_SEQ 0x02
78 #define GTP1_F_EXTHDR 0x04
79 #define GTP1_F_MASK 0x07
80
81 #endif