1 #ifndef _UAPI_MSM_RMNET_H_
2 #define _UAPI_MSM_RMNET_H_
3 
4 /* Bitmap macros for RmNET driver operation mode. */
5 #define RMNET_MODE_NONE     (0x00)
6 #define RMNET_MODE_LLP_ETH  (0x01)
7 #define RMNET_MODE_LLP_IP   (0x02)
8 #define RMNET_MODE_QOS      (0x04)
9 #define RMNET_MODE_MASK     (RMNET_MODE_LLP_ETH | \
10 			     RMNET_MODE_LLP_IP  | \
11 			     RMNET_MODE_QOS)
12 
13 #define RMNET_IS_MODE_QOS(mode)  \
14 	((mode & RMNET_MODE_QOS) == RMNET_MODE_QOS)
15 #define RMNET_IS_MODE_IP(mode)   \
16 	((mode & RMNET_MODE_LLP_IP) == RMNET_MODE_LLP_IP)
17 
18 /* IOCTL command enum
19  * Values chosen to not conflict with other drivers in the ecosystem */
20 enum rmnet_ioctl_cmds_e {
21 	RMNET_IOCTL_SET_LLP_ETHERNET = 0x000089F1, /* Set Ethernet protocol  */
22 	RMNET_IOCTL_SET_LLP_IP       = 0x000089F2, /* Set RAWIP protocol     */
23 	RMNET_IOCTL_GET_LLP          = 0x000089F3, /* Get link protocol      */
24 	RMNET_IOCTL_SET_QOS_ENABLE   = 0x000089F4, /* Set QoS header enabled */
25 	RMNET_IOCTL_SET_QOS_DISABLE  = 0x000089F5, /* Set QoS header disabled*/
26 	RMNET_IOCTL_GET_QOS          = 0x000089F6, /* Get QoS header state   */
27 	RMNET_IOCTL_GET_OPMODE       = 0x000089F7, /* Get operation mode     */
28 	RMNET_IOCTL_OPEN             = 0x000089F8, /* Open transport port    */
29 	RMNET_IOCTL_CLOSE            = 0x000089F9, /* Close transport port   */
30 	RMNET_IOCTL_FLOW_ENABLE      = 0x000089FA, /* Flow enable            */
31 	RMNET_IOCTL_FLOW_DISABLE     = 0x000089FB, /* Flow disable           */
32 	RMNET_IOCTL_FLOW_SET_HNDL    = 0x000089FC, /* Set flow handle        */
33 	RMNET_IOCTL_EXTENDED         = 0x000089FD, /* Extended IOCTLs        */
34 	RMNET_IOCTL_MAX
35 };
36 
37 enum rmnet_ioctl_extended_cmds_e {
38 /* RmNet Data Required IOCTLs */
39 	RMNET_IOCTL_GET_SUPPORTED_FEATURES     = 0x0000,   /* Get features    */
40 	RMNET_IOCTL_SET_MRU                    = 0x0001,   /* Set MRU         */
41 	RMNET_IOCTL_GET_MRU                    = 0x0002,   /* Get MRU         */
42 	RMNET_IOCTL_GET_EPID                   = 0x0003,   /* Get endpoint ID */
43 	RMNET_IOCTL_GET_DRIVER_NAME            = 0x0004,   /* Get driver name */
44 	RMNET_IOCTL_ADD_MUX_CHANNEL            = 0x0005,   /* Add MUX ID      */
45 	RMNET_IOCTL_SET_EGRESS_DATA_FORMAT     = 0x0006,   /* Set EDF         */
46 	RMNET_IOCTL_SET_INGRESS_DATA_FORMAT    = 0x0007,   /* Set IDF         */
47 	RMNET_IOCTL_SET_AGGREGATION_COUNT      = 0x0008,   /* Set agg count   */
48 	RMNET_IOCTL_GET_AGGREGATION_COUNT      = 0x0009,   /* Get agg count   */
49 	RMNET_IOCTL_SET_AGGREGATION_SIZE       = 0x000A,   /* Set agg size    */
50 	RMNET_IOCTL_GET_AGGREGATION_SIZE       = 0x000B,   /* Get agg size    */
51 	RMNET_IOCTL_FLOW_CONTROL               = 0x000C,   /* Do flow control */
52 	RMNET_IOCTL_GET_DFLT_CONTROL_CHANNEL   = 0x000D,   /* For legacy use  */
53 	RMNET_IOCTL_GET_HWSW_MAP               = 0x000E,   /* Get HW/SW map   */
54 	RMNET_IOCTL_SET_RX_HEADROOM            = 0x000F,   /* RX Headroom     */
55 	RMNET_IOCTL_GET_EP_PAIR                = 0x0010,   /* Endpoint pair   */
56 	RMNET_IOCTL_SET_QOS_VERSION            = 0x0011,   /* 8/6 byte QoS hdr*/
57 	RMNET_IOCTL_GET_QOS_VERSION            = 0x0012,   /* 8/6 byte QoS hdr*/
58 	RMNET_IOCTL_GET_SUPPORTED_QOS_MODES    = 0x0013,   /* Get QoS modes   */
59 	RMNET_IOCTL_SET_SLEEP_STATE            = 0x0014,   /* Set sleep state */
60 	RMNET_IOCTL_SET_XLAT_DEV_INFO          = 0x0015,   /* xlat dev name   */
61 	RMNET_IOCTL_EXTENDED_MAX               = 0x0016
62 };
63 
64 /* Return values for the RMNET_IOCTL_GET_SUPPORTED_FEATURES IOCTL */
65 #define RMNET_IOCTL_FEAT_NOTIFY_MUX_CHANNEL              (1<<0)
66 #define RMNET_IOCTL_FEAT_SET_EGRESS_DATA_FORMAT          (1<<1)
67 #define RMNET_IOCTL_FEAT_SET_INGRESS_DATA_FORMAT         (1<<2)
68 #define RMNET_IOCTL_FEAT_SET_AGGREGATION_COUNT           (1<<3)
69 #define RMNET_IOCTL_FEAT_GET_AGGREGATION_COUNT           (1<<4)
70 #define RMNET_IOCTL_FEAT_SET_AGGREGATION_SIZE            (1<<5)
71 #define RMNET_IOCTL_FEAT_GET_AGGREGATION_SIZE            (1<<6)
72 #define RMNET_IOCTL_FEAT_FLOW_CONTROL                    (1<<7)
73 #define RMNET_IOCTL_FEAT_GET_DFLT_CONTROL_CHANNEL        (1<<8)
74 #define RMNET_IOCTL_FEAT_GET_HWSW_MAP                    (1<<9)
75 
76 /* Input values for the RMNET_IOCTL_SET_EGRESS_DATA_FORMAT IOCTL  */
77 #define RMNET_IOCTL_EGRESS_FORMAT_MAP                  (1<<1)
78 #define RMNET_IOCTL_EGRESS_FORMAT_AGGREGATION          (1<<2)
79 #define RMNET_IOCTL_EGRESS_FORMAT_MUXING               (1<<3)
80 #define RMNET_IOCTL_EGRESS_FORMAT_CHECKSUM             (1<<4)
81 
82 /* Input values for the RMNET_IOCTL_SET_INGRESS_DATA_FORMAT IOCTL */
83 #define RMNET_IOCTL_INGRESS_FORMAT_MAP                 (1<<1)
84 #define RMNET_IOCTL_INGRESS_FORMAT_DEAGGREGATION       (1<<2)
85 #define RMNET_IOCTL_INGRESS_FORMAT_DEMUXING            (1<<3)
86 #define RMNET_IOCTL_INGRESS_FORMAT_CHECKSUM            (1<<4)
87 
88 /* User space may not have this defined. */
89 #ifndef IFNAMSIZ
90 #define IFNAMSIZ 16
91 #endif
92 
93 struct rmnet_ioctl_extended_s {
94 	uint32_t   extended_ioctl;
95 	union {
96 		uint32_t data; /* Generic data field for most extended IOCTLs */
97 
98 		/* Return values for
99 		 *    RMNET_IOCTL_GET_DRIVER_NAME
100 		 *    RMNET_IOCTL_GET_DFLT_CONTROL_CHANNEL */
101 		int8_t if_name[IFNAMSIZ];
102 
103 		/* Input values for the RMNET_IOCTL_ADD_MUX_CHANNEL IOCTL */
104 		struct {
105 			uint32_t  mux_id;
106 			int8_t    vchannel_name[IFNAMSIZ];
107 		} rmnet_mux_val;
108 
109 		/* Input values for the RMNET_IOCTL_FLOW_CONTROL IOCTL */
110 		struct {
111 			uint8_t   flow_mode;
112 			uint8_t   mux_id;
113 		} flow_control_prop;
114 
115 		/* Return values for RMNET_IOCTL_GET_EP_PAIR */
116 		struct {
117 			uint32_t   consumer_pipe_num;
118 			uint32_t   producer_pipe_num;
119 		} ipa_ep_pair;
120 	} u;
121 };
122 
123 struct rmnet_ioctl_data_s {
124 	union {
125 		uint32_t	operation_mode;
126 		uint32_t	tcm_handle;
127 	} u;
128 };
129 
130 #define RMNET_IOCTL_QOS_MODE_6   (1<<0)
131 #define RMNET_IOCTL_QOS_MODE_8   (1<<1)
132 
133 /* QMI QoS header definition */
134 #define QMI_QOS_HDR_S  __attribute((__packed__)) qmi_qos_hdr_s
135 struct QMI_QOS_HDR_S {
136 	unsigned char    version;
137 	unsigned char    flags;
138 	uint32_t         flow_id;
139 };
140 
141 /* QMI QoS 8-byte header. */
142 struct qmi_qos_hdr8_s {
143 	struct QMI_QOS_HDR_S   hdr;
144 	uint8_t                reserved[2];
145 } __attribute((__packed__));
146 
147 #endif /* _UAPI_MSM_RMNET_H_ */
148