0001
0002 #ifndef _GTP_H_
0003 #define _GTP_H_
0004
0005 #include <linux/netdevice.h>
0006 #include <linux/types.h>
0007 #include <net/rtnetlink.h>
0008
0009
0010
0011 #define GTP0_PORT 3386
0012 #define GTP1U_PORT 2152
0013
0014
0015 #define GTP_ECHO_REQ 1
0016 #define GTP_ECHO_RSP 2
0017 #define GTP_TPDU 255
0018
0019 #define GTPIE_RECOVERY 14
0020
0021 struct gtp0_header {
0022 __u8 flags;
0023 __u8 type;
0024 __be16 length;
0025 __be16 seq;
0026 __be16 flow;
0027 __u8 number;
0028 __u8 spare[3];
0029 __be64 tid;
0030 } __attribute__ ((packed));
0031
0032 struct gtp1_header {
0033 __u8 flags;
0034 __u8 type;
0035 __be16 length;
0036 __be32 tid;
0037 } __attribute__ ((packed));
0038
0039 struct gtp1_header_long {
0040 __u8 flags;
0041 __u8 type;
0042 __be16 length;
0043 __be32 tid;
0044 __be16 seq;
0045 __u8 npdu;
0046 __u8 next;
0047 } __packed;
0048
0049
0050 struct gtp_ie {
0051 __u8 tag;
0052 __u8 val;
0053 } __packed;
0054
0055 struct gtp0_packet {
0056 struct gtp0_header gtp0_h;
0057 struct gtp_ie ie;
0058 } __packed;
0059
0060 struct gtp1u_packet {
0061 struct gtp1_header_long gtp1u_h;
0062 struct gtp_ie ie;
0063 } __packed;
0064
0065 struct gtp_pdu_session_info {
0066 u8 pdu_type;
0067 u8 qfi;
0068 };
0069
0070 static inline bool netif_is_gtp(const struct net_device *dev)
0071 {
0072 return dev->rtnl_link_ops &&
0073 !strcmp(dev->rtnl_link_ops->kind, "gtp");
0074 }
0075
0076 #define GTP1_F_NPDU 0x01
0077 #define GTP1_F_SEQ 0x02
0078 #define GTP1_F_EXTHDR 0x04
0079 #define GTP1_F_MASK 0x07
0080
0081 #endif