blob: c8cd09d56d16f9e78e4b1b11ae7e375922ae1bb0 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Jeff Johnson118a4a02018-05-06 00:14:15 -07002 * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * 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 Dhavali7090c5f2015-11-02 17:55:19 -080019/**
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 Johnson1e3e3ee2017-08-28 11:47:40 -070028struct hdd_context;
29
Prashanth Bhatta75fa9a12016-01-11 18:30:08 -080030#ifdef FEATURE_OEM_DATA_SUPPORT
31
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080032#ifndef OEM_DATA_REQ_SIZE
Krishna Kumaar Natarajanee4dbed2016-03-30 16:21:23 -070033#define OEM_DATA_REQ_SIZE 500
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080034#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/**
49 * typedef eOemErrorCode - OEM error codes
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 Girigowdacaac83f2017-03-25 00:44:55 -070057enum oem_err_code {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080058 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 Girigowdacaac83f2017-03-25 00:44:55 -070064};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080065
66/**
Srinivas Girigowdacaac83f2017-03-25 00:44:55 -070067 * struct driver_version - Driver version identifier (w.x.y.z)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080068 * @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 Girigowdacaac83f2017-03-25 00:44:55 -070073struct driver_version {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080074 uint8_t major;
75 uint8_t minor;
76 uint8_t patch;
77 uint8_t build;
Srinivas Girigowdacaac83f2017-03-25 00:44:55 -070078};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080079
80/**
Srinivas Girigowdacaac83f2017-03-25 00:44:55 -070081 * struct oem_data_cap - OEM Data Capabilities
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080082 * @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 Girigowdacaac83f2017-03-25 00:44:55 -070094struct oem_data_cap {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080095 uint8_t oem_target_signature[OEM_TARGET_SIGNATURE_LEN];
96 uint32_t oem_target_type;
97 uint32_t oem_fw_version;
Srinivas Girigowdacaac83f2017-03-25 00:44:55 -070098 struct driver_version driver_version;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080099 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 Girigowdacaac83f2017-03-25 00:44:55 -0700106};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800107
108/**
Srinivas Girigowdacaac83f2017-03-25 00:44:55 -0700109 * struct hdd_channel_info - Channel information
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800110 * @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 Girigowdacaac83f2017-03-25 00:44:55 -0700121struct hdd_channel_info {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800122 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 Girigowdacaac83f2017-03-25 00:44:55 -0700130};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800131
132/**
Srinivas Girigowdacaac83f2017-03-25 00:44:55 -0700133 * struct peer_status_info - Status information for a given peer
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800134 * @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 Girigowdacaac83f2017-03-25 00:44:55 -0700141struct peer_status_info {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800142 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 Girigowdacaac83f2017-03-25 00:44:55 -0700147 struct hdd_channel_info peer_chan_info;
148};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800149
Krishna Kumaar Natarajan53ca2902015-12-04 14:01:46 -0800150/**
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 */
155enum oem_capability_mask {
156 OEM_CAP_RM_FTMRR = (1 << (0)),
157 OEM_CAP_RM_LCI = (1 << (1)),
158};
159
160/**
Jeff Johnson118a4a02018-05-06 00:14:15 -0700161 * struct oem_get_capability_rsp - capabilities set by userspace and target.
Krishna Kumaar Natarajan53ca2902015-12-04 14:01:46 -0800162 * @target_cap: target capabilities
163 * @client_capabilities: capabilities set by userspace via set request
164 */
165struct oem_get_capability_rsp {
Srinivas Girigowdacaac83f2017-03-25 00:44:55 -0700166 struct oem_data_cap target_cap;
Krishna Kumaar Natarajan53ca2902015-12-04 14:01:46 -0800167 struct sme_oem_capability cap;
168};
169
Anurag Chouhan6d760662016-02-20 16:05:43 +0530170void hdd_send_peer_status_ind_to_oem_app(struct qdf_mac_addr *peerMac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800171 uint8_t peerStatus,
172 uint8_t peerTimingMeasCap,
173 uint8_t sessionId,
Jeff Johnson03294f12016-12-09 17:10:24 -0800174 struct sSirSmeChanInfo *chan_info,
Jeff Johnsonc1e62782017-11-09 09:50:17 -0800175 enum QDF_OPMODE dev_mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800176
177int iw_get_oem_data_cap(struct net_device *dev, struct iw_request_info *info,
178 union iwreq_data *wrqu, char *extra);
179
Vignesh Viswanathana1cb4b42018-05-17 21:19:27 +0530180/**
181 * oem_activate_service() - API to register the oem command handler
182 * @hdd_ctx: Pointer to HDD Context
183 *
184 * This API is used to register the handler to receive netlink message
185 * from an OEM application process
186 *
187 * Return: 0 on success and errno on failure
188 */
Jeff Johnson82797b62017-08-11 15:31:27 -0700189int oem_activate_service(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800190
Vignesh Viswanathana1cb4b42018-05-17 21:19:27 +0530191/**
192 * oem_deactivate_service() - API to unregister the oem command handler
193 *
194 * This API is used to deregister the handler to receive netlink message
195 * from an OEM application process
196 *
197 * Return: 0 on success and errno on failure
198 */
199int oem_deactivate_service(void);
200
Krishna Kumaar Natarajanc1fa17d2016-08-03 14:19:20 -0700201void hdd_send_oem_data_rsp_msg(struct oem_data_rsp *oem_rsp);
Jeff Johnson1e3e3ee2017-08-28 11:47:40 -0700202void hdd_update_channel_bw_info(struct hdd_context *hdd_ctx,
Yuanyuan Liud9db8252017-02-06 14:17:46 -0800203 uint16_t chan,
204 void *hdd_chan_info);
Prashanth Bhatta75fa9a12016-01-11 18:30:08 -0800205#else
Jeff Johnson82797b62017-08-11 15:31:27 -0700206static inline int oem_activate_service(struct hdd_context *hdd_ctx)
Prashanth Bhatta75fa9a12016-01-11 18:30:08 -0800207{
208 return 0;
209}
Naveen Rawat910726a2017-03-06 11:42:51 -0800210
Vignesh Viswanathana1cb4b42018-05-17 21:19:27 +0530211static inline int oem_deactivate_service(void)
212{
213 return 0;
214}
215
Naveen Rawat910726a2017-03-06 11:42:51 -0800216static inline void hdd_send_oem_data_rsp_msg(void *oem_rsp) {}
Yuanyuan Liud9db8252017-02-06 14:17:46 -0800217
Jeff Johnson1e3e3ee2017-08-28 11:47:40 -0700218static inline void hdd_update_channel_bw_info(struct hdd_context *hdd_ctx,
Yuanyuan Liud9db8252017-02-06 14:17:46 -0800219 uint16_t chan,
220 void *hdd_chan_info) {}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800221#endif /* FEATURE_OEM_DATA_SUPPORT */
Prashanth Bhatta75fa9a12016-01-11 18:30:08 -0800222#endif /* __WLAN_HDD_OEM_DATA_H__ */