1 /* 2 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 2 and 6 * only version 2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * RMNET Data configuration specification 14 */ 15 16 #ifndef _RMNET_DATA_H_ 17 #define _RMNET_DATA_H_ 18 19 /* ***************** Constants ********************************************** */ 20 #define RMNET_LOCAL_LOGICAL_ENDPOINT -1 21 22 #define RMNET_EGRESS_FORMAT__RESERVED__ (1<<0) 23 #define RMNET_EGRESS_FORMAT_MAP (1<<1) 24 #define RMNET_EGRESS_FORMAT_AGGREGATION (1<<2) 25 #define RMNET_EGRESS_FORMAT_MUXING (1<<3) 26 27 #define RMNET_INGRESS_FIX_ETHERNET (1<<0) 28 #define RMNET_INGRESS_FORMAT_MAP (1<<1) 29 #define RMNET_INGRESS_FORMAT_DEAGGREGATION (1<<2) 30 #define RMNET_INGRESS_FORMAT_DEMUXING (1<<3) 31 #define RMNET_INGRESS_FORMAT_MAP_COMMANDS (1<<4) 32 #define RMNET_INGRESS_FORMAT_MAP_CKSUMV3 (1<<5) 33 34 /* ***************** Netlink API ******************************************** */ 35 #define RMNET_NETLINK_PROTO 31 36 #define RMNET_MAX_STR_LEN 16 37 #define RMNET_NL_DATA_MAX_LEN 64 38 39 #define RMNET_NETLINK_MSG_COMMAND 0 40 #define RMNET_NETLINK_MSG_RETURNCODE 1 41 #define RMNET_NETLINK_MSG_RETURNDATA 2 42 43 struct rmnet_nl_msg_s { 44 uint16_t reserved; 45 uint16_t message_type; 46 uint16_t reserved2:14; 47 uint16_t crd:2; 48 union { 49 uint16_t arg_length; 50 uint16_t return_code; 51 }; 52 union { 53 uint8_t data[RMNET_NL_DATA_MAX_LEN]; 54 struct { 55 uint8_t dev[RMNET_MAX_STR_LEN]; 56 uint32_t flags; 57 uint16_t agg_size; 58 uint16_t agg_count; 59 uint8_t tail_spacing; 60 } data_format; 61 struct { 62 uint8_t dev[RMNET_MAX_STR_LEN]; 63 int32_t ep_id; 64 uint8_t operating_mode; 65 uint8_t next_dev[RMNET_MAX_STR_LEN]; 66 } local_ep_config; 67 struct { 68 uint32_t id; 69 uint8_t vnd_name[RMNET_MAX_STR_LEN]; 70 } vnd; 71 struct { 72 uint32_t id; 73 uint32_t map_flow_id; 74 uint32_t tc_flow_id; 75 } flow_control; 76 }; 77 }; 78 79 enum rmnet_netlink_message_types_e { 80 /* 81 * RMNET_NETLINK_ASSOCIATE_NETWORK_DEVICE - Register RMNET data driver 82 * on a particular device. 83 * Args: char[] dev_name: Null terminated ASCII string, max length: 15 84 * Returns: status code 85 */ 86 RMNET_NETLINK_ASSOCIATE_NETWORK_DEVICE, 87 88 /* 89 * RMNET_NETLINK_UNASSOCIATE_NETWORK_DEVICE - Unregister RMNET data 90 * driver on a particular 91 * device. 92 * Args: char[] dev_name: Null terminated ASCII string, max length: 15 93 * Returns: status code 94 */ 95 RMNET_NETLINK_UNASSOCIATE_NETWORK_DEVICE, 96 97 /* 98 * RMNET_NETLINK_GET_NETWORK_DEVICE_ASSOCIATED - Get if RMNET data 99 * driver is registered on a 100 * particular device. 101 * Args: char[] dev_name: Null terminated ASCII string, max length: 15 102 * Returns: 1 if registered, 0 if not 103 */ 104 RMNET_NETLINK_GET_NETWORK_DEVICE_ASSOCIATED, 105 106 /* 107 * RMNET_NETLINK_SET_LINK_EGRESS_DATA_FORMAT - Sets the egress data 108 * format for a particular 109 * link. 110 * Args: uint32_t egress_flags 111 * char[] dev_name: Null terminated ASCII string, max length: 15 112 * Returns: status code 113 */ 114 RMNET_NETLINK_SET_LINK_EGRESS_DATA_FORMAT, 115 116 /* 117 * RMNET_NETLINK_GET_LINK_EGRESS_DATA_FORMAT - Gets the egress data 118 * format for a particular 119 * link. 120 * Args: char[] dev_name: Null terminated ASCII string, max length: 15 121 * Returns: 4-bytes data: uint32_t egress_flags 122 */ 123 RMNET_NETLINK_GET_LINK_EGRESS_DATA_FORMAT, 124 125 /* 126 * RMNET_NETLINK_SET_LINK_INGRESS_DATA_FORMAT - Sets the ingress data 127 * format for a particular 128 * link. 129 * Args: uint32_t ingress_flags 130 * char[] dev_name: Null terminated ASCII string, max length: 15 131 * Returns: status code 132 */ 133 RMNET_NETLINK_SET_LINK_INGRESS_DATA_FORMAT, 134 135 /* 136 * RMNET_NETLINK_GET_LINK_INGRESS_DATA_FORMAT - Gets the ingress data 137 * format for a particular 138 * link. 139 * Args: char[] dev_name: Null terminated ASCII string, max length: 15 140 * Returns: 4-bytes data: uint32_t ingress_flags 141 */ 142 RMNET_NETLINK_GET_LINK_INGRESS_DATA_FORMAT, 143 144 /* 145 * RMNET_NETLINK_SET_LOGICAL_EP_CONFIG - Sets the logical endpoint 146 * configuration for a particular 147 * link. 148 * Args: char[] dev_name: Null terminated ASCII string, max length: 15 149 * int32_t logical_ep_id, valid values are -1 through 31 150 * uint8_t rmnet_mode: one of none, vnd, bridged 151 * char[] egress_dev_name: Egress device if operating in bridge mode 152 * Returns: status code 153 */ 154 RMNET_NETLINK_SET_LOGICAL_EP_CONFIG, 155 156 /* 157 * RMNET_NETLINK_UNSET_LOGICAL_EP_CONFIG - Un-sets the logical endpoint 158 * configuration for a particular 159 * link. 160 * Args: char[] dev_name: Null terminated ASCII string, max length: 15 161 * int32_t logical_ep_id, valid values are -1 through 31 162 * Returns: status code 163 */ 164 RMNET_NETLINK_UNSET_LOGICAL_EP_CONFIG, 165 166 /* 167 * RMNET_NETLINK_GET_LOGICAL_EP_CONFIG - Gets the logical endpoint 168 * configuration for a particular 169 * link. 170 * Args: char[] dev_name: Null terminated ASCII string, max length: 15 171 * int32_t logical_ep_id, valid values are -1 through 31 172 * Returns: uint8_t rmnet_mode: one of none, vnd, bridged 173 * char[] egress_dev_name: Egress device 174 */ 175 RMNET_NETLINK_GET_LOGICAL_EP_CONFIG, 176 177 /* 178 * RMNET_NETLINK_NEW_VND - Creates a new virtual network device node 179 * Args: int32_t node number 180 * Returns: status code 181 */ 182 RMNET_NETLINK_NEW_VND, 183 184 /* 185 * RMNET_NETLINK_NEW_VND_WITH_PREFIX - Creates a new virtual network 186 * device node with the specified 187 * prefix for the device name 188 * Args: int32_t node number 189 * char[] vnd_name - Use as prefix 190 * Returns: status code 191 */ 192 RMNET_NETLINK_NEW_VND_WITH_PREFIX, 193 194 /* 195 * RMNET_NETLINK_GET_VND_NAME - Gets the string name of a VND from ID 196 * Args: int32_t node number 197 * Returns: char[] vnd_name 198 */ 199 RMNET_NETLINK_GET_VND_NAME, 200 201 /* 202 * RMNET_NETLINK_FREE_VND - Removes virtual network device node 203 * Args: int32_t node number 204 * Returns: status code 205 */ 206 RMNET_NETLINK_FREE_VND, 207 208 /* 209 * RMNET_NETLINK_ADD_VND_TC_FLOW - Add flow control handle on VND 210 * Args: int32_t node number 211 * uint32_t MAP Flow Handle 212 * uint32_t TC Flow Handle 213 * Returns: status code 214 */ 215 RMNET_NETLINK_ADD_VND_TC_FLOW, 216 217 /* 218 * RMNET_NETLINK_DEL_VND_TC_FLOW - Removes flow control handle on VND 219 * Args: int32_t node number 220 * uint32_t MAP Flow Handle 221 * Returns: status code 222 */ 223 RMNET_NETLINK_DEL_VND_TC_FLOW 224 }; 225 226 enum rmnet_config_endpoint_modes_e { 227 RMNET_EPMODE_NONE, 228 RMNET_EPMODE_VND, 229 RMNET_EPMODE_BRIDGE, 230 RMNET_EPMODE_LENGTH /* Must be the last item in the list */ 231 }; 232 233 enum rmnet_config_return_codes_e { 234 RMNET_CONFIG_OK, 235 RMNET_CONFIG_UNKNOWN_MESSAGE, 236 RMNET_CONFIG_UNKNOWN_ERROR, 237 RMNET_CONFIG_NOMEM, 238 RMNET_CONFIG_DEVICE_IN_USE, 239 RMNET_CONFIG_INVALID_REQUEST, 240 RMNET_CONFIG_NO_SUCH_DEVICE, 241 RMNET_CONFIG_BAD_ARGUMENTS, 242 RMNET_CONFIG_BAD_EGRESS_DEVICE, 243 RMNET_CONFIG_TC_HANDLE_FULL 244 }; 245 246 #endif /* _RMNET_DATA_H_ */ 247