Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame^] | 2 | * Copyright (c) 2012-2013, 2017-2018 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 28 | #ifndef __P2P_H |
| 29 | #define __P2P_H |
| 30 | /**=========================================================================== |
| 31 | |
| 32 | \file wlan_hdd_p2p.h |
| 33 | |
| 34 | \brief Linux HDD P2P include file |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 35 | |
| 36 | ==========================================================================*/ |
Ganesh Kondabattini | babfb49 | 2014-12-17 20:25:29 +0530 | [diff] [blame] | 37 | #include <linux/netdevice.h> |
| 38 | #include <linux/inetdevice.h> |
Sudhir Sattayappa Kohalli | 8ee532d | 2013-02-15 13:16:26 -0800 | [diff] [blame] | 39 | #define ACTION_FRAME_TX_TIMEOUT 2000 |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 40 | #define WAIT_CANCEL_REM_CHAN 1000 |
| 41 | #define WAIT_REM_CHAN_READY 1000 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 42 | #define WAIT_CHANGE_CHANNEL_FOR_OFFCHANNEL_TX 3000 |
Nirav Shah | 87cd0cb | 2013-12-28 21:22:09 +0530 | [diff] [blame] | 43 | #define READY_EVENT_PROPOGATE_TIME 2 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 44 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 45 | #define ACTION_FRAME_DEFAULT_WAIT 200 |
| 46 | |
vamsi | da0e5ab | 2013-12-26 14:33:27 +0530 | [diff] [blame] | 47 | #define ESTIMATED_ROC_DUR_REQD_FOR_ACTION_TX 20 |
| 48 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 49 | #define WLAN_HDD_GET_TYPE_FRM_FC(__fc__) (((__fc__) & 0x0F) >> 2) |
| 50 | #define WLAN_HDD_GET_SUBTYPE_FRM_FC(__fc__) (((__fc__) & 0xF0) >> 4) |
| 51 | #define WLAN_HDD_80211_FRM_DA_OFFSET 4 |
| 52 | #define P2P_WILDCARD_SSID_LEN 7 |
| 53 | #define P2P_WILDCARD_SSID "DIRECT-" |
Sushant Kaushik | 22257d6 | 2014-05-20 19:27:07 +0530 | [diff] [blame] | 54 | #define ACTION_FRAME_RSP_WAIT 500 |
| 55 | #define ACTION_FRAME_ACK_WAIT 300 |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 56 | #ifdef WLAN_FEATURE_11W |
| 57 | #define WLAN_HDD_SET_WEP_FRM_FC(__fc__) ( (__fc__) = ((__fc__) | 0x40)) |
| 58 | #endif //WLAN_FEATURE_11W |
| 59 | |
Ganesh Kondabattini | babfb49 | 2014-12-17 20:25:29 +0530 | [diff] [blame] | 60 | #define HDD_P2P_MAX_ROC_DURATION 1000 |
| 61 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 62 | enum hdd_rx_flags { |
| 63 | HDD_RX_FLAG_DECRYPTED = 1 << 0, |
| 64 | HDD_RX_FLAG_MMIC_STRIPPED = 1 << 1, |
| 65 | HDD_RX_FLAG_IV_STRIPPED = 1 << 2, |
| 66 | }; |
| 67 | |
| 68 | |
Madan Mohan Koyyalamudi | c0d1b3f | 2012-11-13 10:41:07 -0800 | [diff] [blame] | 69 | #define P2P_POWER_SAVE_TYPE_OPPORTUNISTIC (1 << 0) |
| 70 | #define P2P_POWER_SAVE_TYPE_PERIODIC_NOA (1 << 1) |
| 71 | #define P2P_POWER_SAVE_TYPE_SINGLE_NOA (1 << 2) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 72 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 73 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 74 | typedef enum { P2P_NOT_ACTIVE, |
| 75 | P2P_GO_NEG_PROCESS, |
| 76 | P2P_GO_NEG_COMPLETED, |
| 77 | P2P_CLIENT_CONNECTING_STATE_1, |
| 78 | P2P_GO_COMPLETED_STATE, |
| 79 | P2P_CLIENT_CONNECTED_STATE_1, |
| 80 | P2P_CLIENT_DISCONNECTED_STATE, |
| 81 | P2P_CLIENT_CONNECTING_STATE_2, |
| 82 | P2P_CLIENT_COMPLETED_STATE |
| 83 | }tP2PConnectionStatus; |
| 84 | |
| 85 | extern tP2PConnectionStatus globalP2PConnectionStatus; |
| 86 | #endif |
| 87 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 88 | typedef struct p2p_app_setP2pPs{ |
| 89 | tANI_U8 opp_ps; |
| 90 | tANI_U32 ctWindow; |
| 91 | tANI_U8 count; |
| 92 | tANI_U32 duration; |
| 93 | tANI_U32 interval; |
| 94 | tANI_U32 single_noa_duration; |
| 95 | tANI_U8 psSelection; |
| 96 | }p2p_app_setP2pPs_t; |
| 97 | |
| 98 | int wlan_hdd_cfg80211_remain_on_channel( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 99 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 100 | struct wireless_dev *wdev, |
| 101 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 102 | struct net_device *dev, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 103 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 104 | struct ieee80211_channel *chan, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 105 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 106 | enum nl80211_channel_type channel_type, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 107 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 108 | unsigned int duration, u64 *cookie ); |
| 109 | |
| 110 | int wlan_hdd_cfg80211_cancel_remain_on_channel( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 111 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 112 | struct wireless_dev *wdev, |
| 113 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 114 | struct net_device *dev, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 115 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 116 | u64 cookie ); |
| 117 | |
| 118 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 119 | int wlan_hdd_cfg80211_mgmt_tx_cancel_wait(struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 120 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 121 | struct wireless_dev *wdev, |
| 122 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 123 | struct net_device *dev, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 124 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 125 | u64 cookie); |
| 126 | #endif |
| 127 | |
| 128 | int hdd_setP2pPs( struct net_device *dev, void *msgData ); |
| 129 | int hdd_setP2pOpps( struct net_device *dev, tANI_U8 *command ); |
| 130 | int hdd_setP2pNoa( struct net_device *dev, tANI_U8 *command ); |
| 131 | |
Abhishek Singh | 7d624e1 | 2015-11-30 14:29:27 +0530 | [diff] [blame] | 132 | void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 133 | tANI_U32 nFrameLength, tANI_U8* pbFrames, |
| 134 | tANI_U8 frameType, |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 135 | tANI_U32 rxChan, tANI_S8 rxRssi); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 136 | void hdd_remainChanReadyHandler( hdd_adapter_t *pAdapter ); |
| 137 | void hdd_sendActionCnf( hdd_adapter_t *pAdapter, tANI_BOOLEAN actionSendSuccess ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 138 | int wlan_hdd_check_remain_on_channel(hdd_adapter_t *pAdapter); |
Sushant Kaushik | 5ad9b7b | 2014-05-21 21:09:43 +0530 | [diff] [blame] | 139 | VOS_STATUS wlan_hdd_cancel_existing_remain_on_channel(hdd_adapter_t *pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 140 | |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 141 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 142 | int wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 143 | struct cfg80211_mgmt_tx_params *params, u64 *cookie); |
| 144 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 145 | int wlan_hdd_mgmt_tx( struct wiphy *wiphy, struct wireless_dev *wdev, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 146 | struct ieee80211_channel *chan, bool offchan, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 147 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 148 | enum nl80211_channel_type channel_type, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 149 | bool channel_type_valid, |
| 150 | #endif |
| 151 | unsigned int wait, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 152 | const u8 *buf, size_t len, bool no_cck, |
| 153 | bool dont_wait_for_ack, u64 *cookie ); |
| 154 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 155 | int wlan_hdd_mgmt_tx( struct wiphy *wiphy, struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 156 | struct ieee80211_channel *chan, bool offchan, |
| 157 | enum nl80211_channel_type channel_type, |
| 158 | bool channel_type_valid, unsigned int wait, |
| 159 | const u8 *buf, size_t len, bool no_cck, |
| 160 | bool dont_wait_for_ack, u64 *cookie ); |
| 161 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 162 | int wlan_hdd_mgmt_tx( struct wiphy *wiphy, struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 163 | struct ieee80211_channel *chan, bool offchan, |
| 164 | enum nl80211_channel_type channel_type, |
| 165 | bool channel_type_valid, unsigned int wait, |
| 166 | const u8 *buf, size_t len, u64 *cookie ); |
| 167 | #else |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 168 | int wlan_hdd_mgmt_tx( struct wiphy *wiphy, struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 169 | struct ieee80211_channel *chan, |
| 170 | enum nl80211_channel_type channel_type, |
| 171 | bool channel_type_valid, |
| 172 | const u8 *buf, size_t len, u64 *cookie ); |
| 173 | #endif |
| 174 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame^] | 175 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) |
| 176 | struct wireless_dev *wlan_hdd_add_virtual_intf(struct wiphy *wiphy, |
| 177 | const char *name, |
| 178 | unsigned char name_assign_type, |
| 179 | enum nl80211_iftype type, |
| 180 | struct vif_params *params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 181 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame^] | 182 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) || \ |
| 183 | defined(WITH_BACKPORTS) |
| 184 | /** |
| 185 | * wlan_hdd_add_virtual_intf() - Add virtual interface wrapper |
| 186 | * @wiphy: wiphy pointer |
| 187 | * @name: User-visible name of the interface |
| 188 | * @name_assign_type: the name of assign type of the netdev |
| 189 | * @nl80211_iftype: (virtual) interface types |
| 190 | * @flags: monitor mode configuration flags (not used) |
| 191 | * @vif_params: virtual interface parameters (not used) |
| 192 | * |
| 193 | * Return: the pointer of wireless dev, otherwise ERR_PTR. |
| 194 | */ |
| 195 | struct wireless_dev *wlan_hdd_add_virtual_intf(struct wiphy *wiphy, |
| 196 | const char *name, |
| 197 | unsigned char name_assign_type, |
| 198 | enum nl80211_iftype type, |
| 199 | u32 *flags, |
| 200 | struct vif_params *params); |
| 201 | |
| 202 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) |
| 203 | /** |
| 204 | * wlan_hdd_add_virtual_intf() - Add virtual interface wrapper |
| 205 | * @wiphy: wiphy pointer |
| 206 | * @name: User-visible name of the interface |
| 207 | * @nl80211_iftype: (virtual) interface types |
| 208 | * @flags: monitor mode configuration flags (not used) |
| 209 | * @vif_params: virtual interface parameters (not used) |
| 210 | * |
| 211 | * Return: the pointer of wireless dev, otherwise ERR_PTR. |
| 212 | */ |
| 213 | struct wireless_dev *wlan_hdd_add_virtual_intf(struct wiphy *wiphy, |
| 214 | const char *name, |
| 215 | enum nl80211_iftype type, |
| 216 | u32 *flags, |
| 217 | struct vif_params *params); |
| 218 | |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 219 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 220 | struct wireless_dev* wlan_hdd_add_virtual_intf( |
| 221 | struct wiphy *wiphy, char *name, enum nl80211_iftype type, |
| 222 | u32 *flags, struct vif_params *params ); |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame^] | 223 | |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 224 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame^] | 225 | struct net_device* wlan_hdd_add_virtual_intf(struct wiphy *wiphy, |
| 226 | char *name, |
| 227 | enum nl80211_iftype type, |
| 228 | u32 *flags, |
| 229 | struct vif_params *params); |
| 230 | |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 231 | #else |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame^] | 232 | int wlan_hdd_add_virtual_intf(struct wiphy *wiphy, char *name, |
| 233 | enum nl80211_iftype type, |
| 234 | u32 *flags, struct vif_params *params); |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 235 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 236 | |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 237 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 238 | int wlan_hdd_del_virtual_intf( struct wiphy *wiphy, struct wireless_dev *wdev ); |
| 239 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 240 | int wlan_hdd_del_virtual_intf( struct wiphy *wiphy, struct net_device *dev ); |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 241 | #endif |
Ganesh Kondabattini | babfb49 | 2014-12-17 20:25:29 +0530 | [diff] [blame] | 242 | void hdd_p2p_roc_work_queue(struct work_struct *work); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 243 | #endif // __P2P_H |