]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
459aa660 | 2 | #ifndef _GTP_H_ |
9b8ac4f9 | 3 | #define _GTP_H_ |
459aa660 | 4 | |
949d6b40 JK |
5 | #include <linux/netdevice.h> |
6 | #include <linux/types.h> | |
7 | #include <net/rtnetlink.h> | |
8 | ||
459aa660 PN |
9 | /* General GTP protocol related definitions. */ |
10 | ||
11 | #define GTP0_PORT 3386 | |
12 | #define GTP1U_PORT 2152 | |
13 | ||
9af41cc3 WD |
14 | /* GTP messages types */ |
15 | #define GTP_ECHO_REQ 1 /* Echo Request */ | |
16 | #define GTP_ECHO_RSP 2 /* Echo Response */ | |
459aa660 PN |
17 | #define GTP_TPDU 255 |
18 | ||
9af41cc3 WD |
19 | #define GTPIE_RECOVERY 14 |
20 | ||
459aa660 PN |
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 | ||
9af41cc3 WD |
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 | ||
e3acda7a WD |
65 | struct gtp_pdu_session_info { /* According to 3GPP TS 38.415. */ |
66 | u8 pdu_type; | |
67 | u8 qfi; | |
68 | }; | |
69 | ||
81dd9849 WD |
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 | ||
459aa660 PN |
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 | ||
b6fc0956 PNA |
81 | struct gtp_ext_hdr { |
82 | __u8 len; | |
83 | __u8 data[]; | |
84 | }; | |
85 | ||
459aa660 | 86 | #endif |