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