blob: b9ef3445f627f926dbf9e877904162d871187183 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
2 * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
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.
20 */
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
28#ifndef __P2P_H
29#define __P2P_H
30/**===========================================================================
31
32 \file wlan_hdd_p2p.h
33
34 \brief Linux HDD P2P include file
35
36 ==========================================================================*/
37#define ACTION_FRAME_TX_TIMEOUT 2000
38#define WAIT_CANCEL_REM_CHAN 1000
39#define WAIT_REM_CHAN_READY 1000
40#define WAIT_CHANGE_CHANNEL_FOR_OFFCHANNEL_TX 3000
41#define ESTIMATED_ROC_DUR_REQD_FOR_ACTION_TX 20
42#define COMPLETE_EVENT_PROPOGATE_TIME 10
43
44#ifdef QCA_WIFI_3_0_EMU
45#define ACTION_FRAME_DEFAULT_WAIT 500
46#else
47#define ACTION_FRAME_DEFAULT_WAIT 200
48#endif
49
50#define WLAN_HDD_GET_TYPE_FRM_FC(__fc__) (((__fc__) & 0x0F) >> 2)
51#define WLAN_HDD_GET_SUBTYPE_FRM_FC(__fc__) (((__fc__) & 0xF0) >> 4)
52#define WLAN_HDD_80211_FRM_DA_OFFSET 4
53#define P2P_WILDCARD_SSID_LEN 7
54#define P2P_WILDCARD_SSID "DIRECT-"
55
56#ifdef QCA_WIFI_3_0_EMU
57#define P2P_ROC_DURATION_MULTIPLIER_GO_PRESENT 2
58#define P2P_ROC_DURATION_MULTIPLIER_GO_ABSENT 3
59#else
60#define P2P_ROC_DURATION_MULTIPLIER_GO_PRESENT 2
61#define P2P_ROC_DURATION_MULTIPLIER_GO_ABSENT 5
62#endif
63
64#ifdef WLAN_FEATURE_11W
65#define WLAN_HDD_SET_WEP_FRM_FC(__fc__) ((__fc__) = ((__fc__) | 0x40))
66#endif /* WLAN_FEATURE_11W */
67
68#define HDD_P2P_MAX_ROC_DURATION 1000
69#define MAX_ROC_REQ_QUEUE_ENTRY 10
70
71enum hdd_rx_flags {
72 HDD_RX_FLAG_DECRYPTED = 1 << 0,
73 HDD_RX_FLAG_MMIC_STRIPPED = 1 << 1,
74 HDD_RX_FLAG_IV_STRIPPED = 1 << 2,
75};
76
77#define P2P_POWER_SAVE_TYPE_OPPORTUNISTIC (1 << 0)
78#define P2P_POWER_SAVE_TYPE_PERIODIC_NOA (1 << 1)
79#define P2P_POWER_SAVE_TYPE_SINGLE_NOA (1 << 2)
80
81#ifdef WLAN_FEATURE_P2P_DEBUG
82typedef enum { P2P_NOT_ACTIVE,
83 P2P_GO_NEG_PROCESS,
84 P2P_GO_NEG_COMPLETED,
85 P2P_CLIENT_CONNECTING_STATE_1,
86 P2P_GO_COMPLETED_STATE,
87 P2P_CLIENT_CONNECTED_STATE_1,
88 P2P_CLIENT_DISCONNECTED_STATE,
89 P2P_CLIENT_CONNECTING_STATE_2,
90 P2P_CLIENT_COMPLETED_STATE} tP2PConnectionStatus;
91
92extern tP2PConnectionStatus global_p2p_connection_status;
93#endif
94
95typedef struct p2p_app_setP2pPs {
96 uint8_t opp_ps;
97 uint32_t ctWindow;
98 uint8_t count;
99 uint32_t duration;
100 uint32_t interval;
101 uint32_t single_noa_duration;
102 uint8_t psSelection;
103} p2p_app_setP2pPs_t;
104
105int wlan_hdd_cfg80211_remain_on_channel(struct wiphy *wiphy,
106#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
107 struct wireless_dev *wdev,
108#else
109 struct net_device *dev,
110#endif
111 struct ieee80211_channel *chan,
112#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0))
113 enum nl80211_channel_type channel_type,
114#endif
115 unsigned int duration, u64 *cookie);
116
117int wlan_hdd_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy,
118#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
119 struct wireless_dev *wdev,
120#else
121 struct net_device *dev,
122#endif
123 u64 cookie);
124
125int wlan_hdd_cfg80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
126#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
127 struct wireless_dev *wdev,
128#else
129 struct net_device *dev,
130#endif
131 u64 cookie);
132
133int hdd_set_p2p_ps(struct net_device *dev, void *msgData);
134int hdd_set_p2p_opps(struct net_device *dev, uint8_t *command);
135int hdd_set_p2p_noa(struct net_device *dev, uint8_t *command);
136
137void hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter,
138 uint32_t nFrameLength, uint8_t *pbFrames,
139 uint8_t frameType, uint32_t rxChan, int8_t rxRssi);
140
141void hdd_remain_chan_ready_handler(hdd_adapter_t *pAdapter,
142 uint32_t scan_id);
143void hdd_send_action_cnf(hdd_adapter_t *pAdapter, bool actionSendSuccess);
144int wlan_hdd_check_remain_on_channel(hdd_adapter_t *pAdapter);
145void wlan_hdd_cancel_existing_remain_on_channel(hdd_adapter_t *pAdapter);
146
147#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
148int wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
149 struct cfg80211_mgmt_tx_params *params, u64 *cookie);
150#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
151int wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
152 struct ieee80211_channel *chan, bool offchan,
153#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0))
154 enum nl80211_channel_type channel_type,
155 bool channel_type_valid,
156#endif
157 unsigned int wait,
158 const u8 *buf, size_t len, bool no_cck,
159 bool dont_wait_for_ack, u64 *cookie);
160#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
161int wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct net_device *dev,
162 struct ieee80211_channel *chan, bool offchan,
163 enum nl80211_channel_type channel_type,
164 bool channel_type_valid, unsigned int wait,
165 const u8 *buf, size_t len, bool no_cck,
166 bool dont_wait_for_ack, u64 *cookie);
167#else
168int wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct net_device *dev,
169 struct ieee80211_channel *chan, bool offchan,
170 enum nl80211_channel_type channel_type,
171 bool channel_type_valid, unsigned int wait,
172 const u8 *buf, size_t len, u64 *cookie);
173#endif
174
175#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0))
176struct wireless_dev *wlan_hdd_add_virtual_intf(struct wiphy *wiphy,
177 const char *name,
178 enum nl80211_iftype type,
179 u32 *flags,
180 struct vif_params *params);
181#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
182struct wireless_dev *wlan_hdd_add_virtual_intf(struct wiphy *wiphy, char *name,
183 enum nl80211_iftype type,
184 u32 *flags,
185 struct vif_params *params);
186#else
187struct net_device *wlan_hdd_add_virtual_intf(struct wiphy *wiphy, char *name,
188 enum nl80211_iftype type,
189 u32 *flags,
190 struct vif_params *params);
191#endif
192
193#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
194int wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev);
195#else
196int wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev);
197#endif
198
199void wlan_hdd_cleanup_remain_on_channel_ctx(hdd_adapter_t *pAdapter);
200
201void wlan_hdd_roc_request_dequeue(struct work_struct *work);
202#endif /* __P2P_H */