Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Jeff Johnson | a7d5b54 | 2019-02-03 10:15:46 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19 | /** |
| 20 | * DOC: wlan_hdd_oemdata.h |
| 21 | * |
| 22 | * Internal includes for the oem data |
| 23 | */ |
| 24 | |
| 25 | #ifndef __WLAN_HDD_OEM_DATA_H__ |
| 26 | #define __WLAN_HDD_OEM_DATA_H__ |
| 27 | |
Jeff Johnson | 1e3e3ee | 2017-08-28 11:47:40 -0700 | [diff] [blame] | 28 | struct hdd_context; |
| 29 | |
Prashanth Bhatta | 75fa9a1 | 2016-01-11 18:30:08 -0800 | [diff] [blame] | 30 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 31 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 32 | #ifndef OEM_DATA_REQ_SIZE |
Krishna Kumaar Natarajan | ee4dbed | 2016-03-30 16:21:23 -0700 | [diff] [blame] | 33 | #define OEM_DATA_REQ_SIZE 500 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 34 | #endif |
| 35 | |
| 36 | #ifndef OEM_DATA_RSP_SIZE |
| 37 | #define OEM_DATA_RSP_SIZE 1724 |
| 38 | #endif |
| 39 | |
| 40 | #define OEM_APP_SIGNATURE_LEN 16 |
| 41 | #define OEM_APP_SIGNATURE_STR "QUALCOMM-OEM-APP" |
| 42 | |
| 43 | #define OEM_TARGET_SIGNATURE_LEN 8 |
| 44 | #define OEM_TARGET_SIGNATURE "QUALCOMM" |
| 45 | |
| 46 | #define OEM_CAP_MAX_NUM_CHANNELS 128 |
| 47 | |
| 48 | /** |
Paul Zhang | da2970b | 2019-06-23 18:16:38 +0800 | [diff] [blame^] | 49 | * enum oem_err_code - OEM error codes |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 50 | * @OEM_ERR_NULL_CONTEXT: %NULL context |
| 51 | * @OEM_ERR_APP_NOT_REGISTERED: OEM App is not registered |
| 52 | * @OEM_ERR_INVALID_SIGNATURE: Invalid signature |
| 53 | * @OEM_ERR_NULL_MESSAGE_HEADER: Invalid message header |
| 54 | * @OEM_ERR_INVALID_MESSAGE_TYPE: Invalid message type |
| 55 | * @OEM_ERR_INVALID_MESSAGE_LENGTH: Invalid length in message body |
| 56 | */ |
Srinivas Girigowda | caac83f | 2017-03-25 00:44:55 -0700 | [diff] [blame] | 57 | enum oem_err_code { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 58 | OEM_ERR_NULL_CONTEXT = 1, |
| 59 | OEM_ERR_APP_NOT_REGISTERED, |
| 60 | OEM_ERR_INVALID_SIGNATURE, |
| 61 | OEM_ERR_NULL_MESSAGE_HEADER, |
| 62 | OEM_ERR_INVALID_MESSAGE_TYPE, |
| 63 | OEM_ERR_INVALID_MESSAGE_LENGTH |
Srinivas Girigowda | caac83f | 2017-03-25 00:44:55 -0700 | [diff] [blame] | 64 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 65 | |
| 66 | /** |
Srinivas Girigowda | caac83f | 2017-03-25 00:44:55 -0700 | [diff] [blame] | 67 | * struct driver_version - Driver version identifier (w.x.y.z) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 68 | * @major: Version ID major number |
| 69 | * @minor: Version ID minor number |
| 70 | * @patch: Version ID patch number |
| 71 | * @build: Version ID build number |
| 72 | */ |
Srinivas Girigowda | caac83f | 2017-03-25 00:44:55 -0700 | [diff] [blame] | 73 | struct driver_version { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 74 | uint8_t major; |
| 75 | uint8_t minor; |
| 76 | uint8_t patch; |
| 77 | uint8_t build; |
Srinivas Girigowda | caac83f | 2017-03-25 00:44:55 -0700 | [diff] [blame] | 78 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 79 | |
| 80 | /** |
Srinivas Girigowda | caac83f | 2017-03-25 00:44:55 -0700 | [diff] [blame] | 81 | * struct oem_data_cap - OEM Data Capabilities |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 82 | * @oem_target_signature: Signature of chipset vendor, e.g. QUALCOMM |
| 83 | * @oem_target_type: Chip type |
| 84 | * @oem_fw_version: Firmware version |
| 85 | * @driver_version: Host software version |
| 86 | * @allowed_dwell_time_min: Channel dwell time - allowed minimum |
| 87 | * @allowed_dwell_time_max: Channel dwell time - allowed maximum |
| 88 | * @curr_dwell_time_min: Channel dwell time - current minimim |
| 89 | * @curr_dwell_time_max: Channel dwell time - current maximum |
| 90 | * @supported_bands: Supported bands, 2.4G or 5G Hz |
| 91 | * @num_channels: Num of channels IDs to follow |
| 92 | * @channel_list: List of channel IDs |
| 93 | */ |
Srinivas Girigowda | caac83f | 2017-03-25 00:44:55 -0700 | [diff] [blame] | 94 | struct oem_data_cap { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 95 | uint8_t oem_target_signature[OEM_TARGET_SIGNATURE_LEN]; |
| 96 | uint32_t oem_target_type; |
| 97 | uint32_t oem_fw_version; |
Srinivas Girigowda | caac83f | 2017-03-25 00:44:55 -0700 | [diff] [blame] | 98 | struct driver_version driver_version; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 99 | uint16_t allowed_dwell_time_min; |
| 100 | uint16_t allowed_dwell_time_max; |
| 101 | uint16_t curr_dwell_time_min; |
| 102 | uint16_t curr_dwell_time_max; |
| 103 | uint16_t supported_bands; |
| 104 | uint16_t num_channels; |
| 105 | uint8_t channel_list[OEM_CAP_MAX_NUM_CHANNELS]; |
Srinivas Girigowda | caac83f | 2017-03-25 00:44:55 -0700 | [diff] [blame] | 106 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 107 | |
| 108 | /** |
Srinivas Girigowda | caac83f | 2017-03-25 00:44:55 -0700 | [diff] [blame] | 109 | * struct hdd_channel_info - Channel information |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 110 | * @chan_id: channel id |
| 111 | * @reserved0: reserved for padding and future use |
| 112 | * @mhz: primary 20 MHz channel frequency in mhz |
| 113 | * @band_center_freq1: Center frequency 1 in MHz |
| 114 | * @band_center_freq2: Center frequency 2 in MHz, valid only for 11ac |
| 115 | * VHT 80+80 mode |
| 116 | * @info: channel info |
| 117 | * @reg_info_1: regulatory information field 1 which contains min power, |
| 118 | * max power, reg power and reg class id |
| 119 | * @reg_info_2: regulatory information field 2 which contains antennamax |
| 120 | */ |
Srinivas Girigowda | caac83f | 2017-03-25 00:44:55 -0700 | [diff] [blame] | 121 | struct hdd_channel_info { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 122 | uint32_t chan_id; |
| 123 | uint32_t reserved0; |
| 124 | uint32_t mhz; |
| 125 | uint32_t band_center_freq1; |
| 126 | uint32_t band_center_freq2; |
| 127 | uint32_t info; |
| 128 | uint32_t reg_info_1; |
| 129 | uint32_t reg_info_2; |
Srinivas Girigowda | caac83f | 2017-03-25 00:44:55 -0700 | [diff] [blame] | 130 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 131 | |
| 132 | /** |
Srinivas Girigowda | caac83f | 2017-03-25 00:44:55 -0700 | [diff] [blame] | 133 | * struct peer_status_info - Status information for a given peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 134 | * @peer_mac_addr: peer mac address |
| 135 | * @peer_status: peer status: 1: CONNECTED, 2: DISCONNECTED |
| 136 | * @vdev_id: vdev_id for the peer mac |
| 137 | * @peer_capability: peer capability: 0: RTT/RTT2, 1: RTT3. Default is 0 |
| 138 | * @reserved0: reserved0 |
| 139 | * @peer_chan_info: channel info on which peer is connected |
| 140 | */ |
Srinivas Girigowda | caac83f | 2017-03-25 00:44:55 -0700 | [diff] [blame] | 141 | struct peer_status_info { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 142 | uint8_t peer_mac_addr[ETH_ALEN]; |
| 143 | uint8_t peer_status; |
| 144 | uint8_t vdev_id; |
| 145 | uint32_t peer_capability; |
| 146 | uint32_t reserved0; |
Srinivas Girigowda | caac83f | 2017-03-25 00:44:55 -0700 | [diff] [blame] | 147 | struct hdd_channel_info peer_chan_info; |
| 148 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 149 | |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 150 | /** |
| 151 | * enum oem_capability_mask - mask field for userspace client capabilities |
| 152 | * @OEM_CAP_RM_FTMRR: FTM range report mask bit |
| 153 | * @OEM_CAP_RM_LCI: LCI capability mask bit |
| 154 | */ |
| 155 | enum oem_capability_mask { |
| 156 | OEM_CAP_RM_FTMRR = (1 << (0)), |
| 157 | OEM_CAP_RM_LCI = (1 << (1)), |
| 158 | }; |
| 159 | |
| 160 | /** |
Jeff Johnson | 118a4a0 | 2018-05-06 00:14:15 -0700 | [diff] [blame] | 161 | * struct oem_get_capability_rsp - capabilities set by userspace and target. |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 162 | * @target_cap: target capabilities |
| 163 | * @client_capabilities: capabilities set by userspace via set request |
| 164 | */ |
| 165 | struct oem_get_capability_rsp { |
Srinivas Girigowda | caac83f | 2017-03-25 00:44:55 -0700 | [diff] [blame] | 166 | struct oem_data_cap target_cap; |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 167 | struct sme_oem_capability cap; |
| 168 | }; |
| 169 | |
Jeff Johnson | 301e5c9 | 2019-02-23 12:51:00 -0800 | [diff] [blame] | 170 | /** |
| 171 | * hdd_send_peer_status_ind_to_oem_app() - |
| 172 | * Function to send peer status to a registered application |
| 173 | * @peer_mac: MAC address of peer |
| 174 | * @peer_status: ePeerConnected or ePeerDisconnected |
| 175 | * @peer_capability: 0: RTT/RTT2, 1: RTT3. Default is 0 |
| 176 | * @vdev_id: vdev_id |
| 177 | * @chan_info: operating channel information |
| 178 | * @dev_mode: dev mode for which indication is sent |
| 179 | * |
| 180 | * Return: none |
| 181 | */ |
| 182 | void hdd_send_peer_status_ind_to_oem_app(struct qdf_mac_addr *peer_mac, |
| 183 | uint8_t peer_status, |
| 184 | uint8_t peer_capability, |
| 185 | uint8_t vdev_id, |
Jeff Johnson | a7d5b54 | 2019-02-03 10:15:46 -0800 | [diff] [blame] | 186 | struct oem_channel_info *chan_info, |
Jeff Johnson | c1e6278 | 2017-11-09 09:50:17 -0800 | [diff] [blame] | 187 | enum QDF_OPMODE dev_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 188 | |
| 189 | int iw_get_oem_data_cap(struct net_device *dev, struct iw_request_info *info, |
| 190 | union iwreq_data *wrqu, char *extra); |
| 191 | |
Vignesh Viswanathan | a1cb4b4 | 2018-05-17 21:19:27 +0530 | [diff] [blame] | 192 | /** |
| 193 | * oem_activate_service() - API to register the oem command handler |
| 194 | * @hdd_ctx: Pointer to HDD Context |
| 195 | * |
| 196 | * This API is used to register the handler to receive netlink message |
| 197 | * from an OEM application process |
| 198 | * |
| 199 | * Return: 0 on success and errno on failure |
| 200 | */ |
Jeff Johnson | 82797b6 | 2017-08-11 15:31:27 -0700 | [diff] [blame] | 201 | int oem_activate_service(struct hdd_context *hdd_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 202 | |
Vignesh Viswanathan | a1cb4b4 | 2018-05-17 21:19:27 +0530 | [diff] [blame] | 203 | /** |
| 204 | * oem_deactivate_service() - API to unregister the oem command handler |
| 205 | * |
| 206 | * This API is used to deregister the handler to receive netlink message |
| 207 | * from an OEM application process |
| 208 | * |
| 209 | * Return: 0 on success and errno on failure |
| 210 | */ |
| 211 | int oem_deactivate_service(void); |
| 212 | |
Krishna Kumaar Natarajan | c1fa17d | 2016-08-03 14:19:20 -0700 | [diff] [blame] | 213 | void hdd_send_oem_data_rsp_msg(struct oem_data_rsp *oem_rsp); |
Jeff Johnson | 1e3e3ee | 2017-08-28 11:47:40 -0700 | [diff] [blame] | 214 | void hdd_update_channel_bw_info(struct hdd_context *hdd_ctx, |
Yuanyuan Liu | d9db825 | 2017-02-06 14:17:46 -0800 | [diff] [blame] | 215 | uint16_t chan, |
| 216 | void *hdd_chan_info); |
Prashanth Bhatta | 75fa9a1 | 2016-01-11 18:30:08 -0800 | [diff] [blame] | 217 | #else |
Jeff Johnson | 82797b6 | 2017-08-11 15:31:27 -0700 | [diff] [blame] | 218 | static inline int oem_activate_service(struct hdd_context *hdd_ctx) |
Prashanth Bhatta | 75fa9a1 | 2016-01-11 18:30:08 -0800 | [diff] [blame] | 219 | { |
| 220 | return 0; |
| 221 | } |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 222 | |
Vignesh Viswanathan | a1cb4b4 | 2018-05-17 21:19:27 +0530 | [diff] [blame] | 223 | static inline int oem_deactivate_service(void) |
| 224 | { |
| 225 | return 0; |
| 226 | } |
| 227 | |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 228 | static inline void hdd_send_oem_data_rsp_msg(void *oem_rsp) {} |
Yuanyuan Liu | d9db825 | 2017-02-06 14:17:46 -0800 | [diff] [blame] | 229 | |
Jeff Johnson | 1e3e3ee | 2017-08-28 11:47:40 -0700 | [diff] [blame] | 230 | static inline void hdd_update_channel_bw_info(struct hdd_context *hdd_ctx, |
Yuanyuan Liu | d9db825 | 2017-02-06 14:17:46 -0800 | [diff] [blame] | 231 | uint16_t chan, |
| 232 | void *hdd_chan_info) {} |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 233 | #endif /* FEATURE_OEM_DATA_SUPPORT */ |
Paul Zhang | da2970b | 2019-06-23 18:16:38 +0800 | [diff] [blame^] | 234 | |
| 235 | #ifdef FEATURE_OEM_DATA |
| 236 | #define OEM_DATA_MAX_SIZE 1024 |
| 237 | /** |
| 238 | * wlan_hdd_cfg80211_oem_data_handler() - the handler for oem data |
| 239 | * @wiphy: wiphy structure pointer |
| 240 | * @wdev: Wireless device structure pointer |
| 241 | * @data: Pointer to the data received |
| 242 | * @data_len: Length of @data |
| 243 | * |
| 244 | * Return: 0 on success; errno on failure |
| 245 | */ |
| 246 | int wlan_hdd_cfg80211_oem_data_handler(struct wiphy *wiphy, |
| 247 | struct wireless_dev *wdev, |
| 248 | const void *data, int data_len); |
| 249 | |
| 250 | #define FEATURE_OEM_DATA_VENDOR_COMMANDS \ |
| 251 | { \ |
| 252 | .info.vendor_id = QCA_NL80211_VENDOR_ID, \ |
| 253 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_OEM_DATA, \ |
| 254 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | \ |
| 255 | WIPHY_VENDOR_CMD_NEED_NETDEV | \ |
| 256 | WIPHY_VENDOR_CMD_NEED_RUNNING, \ |
| 257 | .doit = wlan_hdd_cfg80211_oem_data_handler \ |
| 258 | }, |
| 259 | #else |
| 260 | #define FEATURE_OEM_DATA_VENDOR_COMMANDS |
| 261 | #endif |
Prashanth Bhatta | 75fa9a1 | 2016-01-11 18:30:08 -0800 | [diff] [blame] | 262 | #endif /* __WLAN_HDD_OEM_DATA_H__ */ |