blob: 3cc7dc7c0d184bbce5c95145664945f4de6042d4 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Abhishek Singh7996eb72015-12-30 17:24:02 +05302 * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
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
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080041#define COMPLETE_EVENT_PROPOGATE_TIME 10
42
43#ifdef QCA_WIFI_3_0_EMU
44#define ACTION_FRAME_DEFAULT_WAIT 500
45#else
46#define ACTION_FRAME_DEFAULT_WAIT 200
47#endif
48
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-"
54
55#ifdef QCA_WIFI_3_0_EMU
56#define P2P_ROC_DURATION_MULTIPLIER_GO_PRESENT 2
57#define P2P_ROC_DURATION_MULTIPLIER_GO_ABSENT 3
58#else
59#define P2P_ROC_DURATION_MULTIPLIER_GO_PRESENT 2
60#define P2P_ROC_DURATION_MULTIPLIER_GO_ABSENT 5
61#endif
62
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080063#define HDD_P2P_MAX_ROC_DURATION 1000
64#define MAX_ROC_REQ_QUEUE_ENTRY 10
65
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080066#define P2P_POWER_SAVE_TYPE_OPPORTUNISTIC (1 << 0)
67#define P2P_POWER_SAVE_TYPE_PERIODIC_NOA (1 << 1)
68#define P2P_POWER_SAVE_TYPE_SINGLE_NOA (1 << 2)
69
70#ifdef WLAN_FEATURE_P2P_DEBUG
71typedef enum { P2P_NOT_ACTIVE,
72 P2P_GO_NEG_PROCESS,
73 P2P_GO_NEG_COMPLETED,
74 P2P_CLIENT_CONNECTING_STATE_1,
75 P2P_GO_COMPLETED_STATE,
76 P2P_CLIENT_CONNECTED_STATE_1,
77 P2P_CLIENT_DISCONNECTED_STATE,
78 P2P_CLIENT_CONNECTING_STATE_2,
79 P2P_CLIENT_COMPLETED_STATE} tP2PConnectionStatus;
80
81extern tP2PConnectionStatus global_p2p_connection_status;
82#endif
83
84typedef struct p2p_app_setP2pPs {
85 uint8_t opp_ps;
86 uint32_t ctWindow;
87 uint8_t count;
88 uint32_t duration;
89 uint32_t interval;
90 uint32_t single_noa_duration;
91 uint8_t psSelection;
92} p2p_app_setP2pPs_t;
93
94int wlan_hdd_cfg80211_remain_on_channel(struct wiphy *wiphy,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080095 struct wireless_dev *wdev,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080096 struct ieee80211_channel *chan,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080097 unsigned int duration, u64 *cookie);
98
99int wlan_hdd_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800100 struct wireless_dev *wdev,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800101 u64 cookie);
102
103int wlan_hdd_cfg80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800104 struct wireless_dev *wdev,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800105 u64 cookie);
106
107int hdd_set_p2p_ps(struct net_device *dev, void *msgData);
108int hdd_set_p2p_opps(struct net_device *dev, uint8_t *command);
109int hdd_set_p2p_noa(struct net_device *dev, uint8_t *command);
110
Abhishek Singh7996eb72015-12-30 17:24:02 +0530111void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800112 uint32_t nFrameLength, uint8_t *pbFrames,
113 uint8_t frameType, uint32_t rxChan, int8_t rxRssi);
114
115void hdd_remain_chan_ready_handler(hdd_adapter_t *pAdapter,
116 uint32_t scan_id);
117void hdd_send_action_cnf(hdd_adapter_t *pAdapter, bool actionSendSuccess);
118int wlan_hdd_check_remain_on_channel(hdd_adapter_t *pAdapter);
119void wlan_hdd_cancel_existing_remain_on_channel(hdd_adapter_t *pAdapter);
120
121#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
122int wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
123 struct cfg80211_mgmt_tx_params *params, u64 *cookie);
Amar Singhal01098f72015-10-08 11:55:32 -0700124#else
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800125int wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
126 struct ieee80211_channel *chan, bool offchan,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800127 unsigned int wait,
128 const u8 *buf, size_t len, bool no_cck,
129 bool dont_wait_for_ack, u64 *cookie);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800130#endif
131
Ryan Hsu07495ea2016-01-21 15:25:39 -0800132#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) || defined(WITH_BACKPORTS)
133struct wireless_dev *wlan_hdd_add_virtual_intf(struct wiphy *wiphy,
134 const char *name,
135 unsigned char name_assign_type,
136 enum nl80211_iftype type,
137 u32 *flags,
138 struct vif_params *params);
139#else
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800140struct wireless_dev *wlan_hdd_add_virtual_intf(struct wiphy *wiphy,
141 const char *name,
142 enum nl80211_iftype type,
143 u32 *flags,
144 struct vif_params *params);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800145
Ryan Hsu07495ea2016-01-21 15:25:39 -0800146#endif
147
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800148int wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev);
Amar Singhal01098f72015-10-08 11:55:32 -0700149
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800150
151void wlan_hdd_cleanup_remain_on_channel_ctx(hdd_adapter_t *pAdapter);
152
153void wlan_hdd_roc_request_dequeue(struct work_struct *work);
154#endif /* __P2P_H */