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