blob: 9796b2894572fd8ad671ff970ef561a5015ef4e9 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Jeff Johnson94214342018-05-06 07:58:13 -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#ifndef __P2P_H
20#define __P2P_H
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080021
Jeff Johnson81258562017-01-12 10:40:13 -080022/**
23 * DOC: wlan_hdd_p2p.h
24 *
25 * Linux HDD P2P include file
26 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080027
28#define WLAN_HDD_GET_TYPE_FRM_FC(__fc__) (((__fc__) & 0x0F) >> 2)
29#define WLAN_HDD_GET_SUBTYPE_FRM_FC(__fc__) (((__fc__) & 0xF0) >> 4)
30#define WLAN_HDD_80211_FRM_DA_OFFSET 4
Abhishek Singh437606a2016-04-27 13:51:49 +053031#define WLAN_HDD_80211_PEER_ADDR_OFFSET (WLAN_HDD_80211_FRM_DA_OFFSET + \
32 MAC_ADDR_LEN)
33
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080034#define P2P_POWER_SAVE_TYPE_OPPORTUNISTIC (1 << 0)
35#define P2P_POWER_SAVE_TYPE_PERIODIC_NOA (1 << 1)
36#define P2P_POWER_SAVE_TYPE_SINGLE_NOA (1 << 2)
37
Srinivas Girigowda5d5fdc52017-03-24 22:30:57 -070038struct p2p_app_set_ps {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080039 uint8_t opp_ps;
40 uint32_t ctWindow;
41 uint8_t count;
42 uint32_t duration;
43 uint32_t interval;
44 uint32_t single_noa_duration;
45 uint8_t psSelection;
Srinivas Girigowda5d5fdc52017-03-24 22:30:57 -070046};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080047
48int wlan_hdd_cfg80211_remain_on_channel(struct wiphy *wiphy,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080049 struct wireless_dev *wdev,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080050 struct ieee80211_channel *chan,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080051 unsigned int duration, u64 *cookie);
52
53int wlan_hdd_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080054 struct wireless_dev *wdev,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080055 u64 cookie);
56
57int wlan_hdd_cfg80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080058 struct wireless_dev *wdev,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080059 u64 cookie);
60
61int hdd_set_p2p_ps(struct net_device *dev, void *msgData);
62int hdd_set_p2p_opps(struct net_device *dev, uint8_t *command);
63int hdd_set_p2p_noa(struct net_device *dev, uint8_t *command);
64
Jeff Johnson19b66e82017-10-02 13:25:56 -070065void __hdd_indicate_mgmt_frame(struct hdd_adapter *adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080066 uint32_t nFrameLength, uint8_t *pbFrames,
67 uint8_t frameType, uint32_t rxChan, int8_t rxRssi);
68
Jeff Johnson19b66e82017-10-02 13:25:56 -070069int wlan_hdd_check_remain_on_channel(struct hdd_adapter *adapter);
Jeff Johnson19b66e82017-10-02 13:25:56 -070070void wlan_hdd_cancel_existing_remain_on_channel(struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080071
72#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
73int wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
74 struct cfg80211_mgmt_tx_params *params, u64 *cookie);
Amar Singhal01098f72015-10-08 11:55:32 -070075#else
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080076int wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
77 struct ieee80211_channel *chan, bool offchan,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080078 unsigned int wait,
79 const u8 *buf, size_t len, bool no_cck,
80 bool dont_wait_for_ack, u64 *cookie);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080081#endif
82
Dustin Brown9ed30a52017-08-16 13:59:38 -070083#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
84struct wireless_dev *wlan_hdd_add_virtual_intf(struct wiphy *wiphy,
85 const char *name,
86 unsigned char name_assign_type,
87 enum nl80211_iftype type,
88 struct vif_params *params);
89#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) || defined(WITH_BACKPORTS)
Ryan Hsu07495ea2016-01-21 15:25:39 -080090struct wireless_dev *wlan_hdd_add_virtual_intf(struct wiphy *wiphy,
91 const char *name,
92 unsigned char name_assign_type,
93 enum nl80211_iftype type,
94 u32 *flags,
95 struct vif_params *params);
96#else
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080097struct wireless_dev *wlan_hdd_add_virtual_intf(struct wiphy *wiphy,
98 const char *name,
99 enum nl80211_iftype type,
100 u32 *flags,
101 struct vif_params *params);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800102
Ryan Hsu07495ea2016-01-21 15:25:39 -0800103#endif
104
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800105int wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev);
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -0700106int __wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev);
Amar Singhal01098f72015-10-08 11:55:32 -0700107
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800108
Jeff Johnson19b66e82017-10-02 13:25:56 -0700109void wlan_hdd_cleanup_remain_on_channel_ctx(struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800110
111void wlan_hdd_roc_request_dequeue(struct work_struct *work);
Wu Gao9a704f42017-03-10 18:42:11 +0800112
113/**
114 * wlan_hdd_set_power_save() - hdd set power save
115 * @adapter: adapter context
Wu Gao02bd75b2017-10-13 18:34:02 +0800116 * @ps_config: pointer to power save configure
Wu Gao9a704f42017-03-10 18:42:11 +0800117 *
118 * This function sets power save parameters.
119 *
120 * Return: 0 - success
121 * others - failure
122 */
Jeff Johnsonfbb54522017-08-29 14:25:27 -0700123int wlan_hdd_set_power_save(struct hdd_adapter *adapter,
Wu Gao02bd75b2017-10-13 18:34:02 +0800124 struct p2p_ps_config *ps_config);
Wu Gao9a704f42017-03-10 18:42:11 +0800125
126/**
Archana Ramachandranb8c04f92017-03-17 20:05:47 -0700127 * wlan_hdd_set_mas() - Function to set MAS value to FW
128 * @adapter: Pointer to HDD adapter
129 * @mas_value: 0-Disable, 1-Enable MAS
130 *
131 * This function passes down the value of MAS to FW
132 *
133 * Return: Configuration message posting status, SUCCESS or Fail
134 *
135 */
Jeff Johnsonfbb54522017-08-29 14:25:27 -0700136int32_t wlan_hdd_set_mas(struct hdd_adapter *adapter, uint8_t mas_value);
Archana Ramachandranb8c04f92017-03-17 20:05:47 -0700137
138/**
139 * wlan_hdd_set_mcc_p2p_quota() - Function to set quota for P2P
140 * to FW
141 * @adapter: Pointer to HDD adapter
142 * @set_value: Quota value for the interface
143 *
144 * This function is used to set the quota for P2P cases
145 *
146 * Return: Configuration message posting status, SUCCESS or Fail
147 *
148 */
Jeff Johnsonfbb54522017-08-29 14:25:27 -0700149int wlan_hdd_set_mcc_p2p_quota(struct hdd_adapter *adapter,
Archana Ramachandranb8c04f92017-03-17 20:05:47 -0700150 uint32_t set_value);
151
152/**
153 * wlan_hdd_go_set_mcc_p2p_quota() - Function to set quota for
154 * P2P GO to FW
155 * @hostapd_adapter: Pointer to HDD adapter
156 * @set_value: Quota value for the interface
157 *
158 * This function is used to set the quota for P2P GO cases
159 *
160 * Return: Configuration message posting status, SUCCESS or Fail
161 *
162 */
Jeff Johnsonfbb54522017-08-29 14:25:27 -0700163int wlan_hdd_go_set_mcc_p2p_quota(struct hdd_adapter *hostapd_adapter,
Archana Ramachandranb8c04f92017-03-17 20:05:47 -0700164 uint32_t set_value);
165/**
166 * wlan_hdd_set_mcc_latency() - Set MCC latency to FW
167 * @adapter: Pointer to HDD adapter
168 * @set_value: Latency value
169 *
170 * Sets the MCC latency value during STA-P2P concurrency
171 *
172 * Return: None
173 */
Jeff Johnsonfbb54522017-08-29 14:25:27 -0700174void wlan_hdd_set_mcc_latency(struct hdd_adapter *adapter, int set_value);
Wu Gao4a1ec8c2018-07-23 19:18:40 +0800175
176/**
177 * wlan_hdd_cleanup_actionframe() - Cleanup action frame
178 * @adapter: Pointer to HDD adapter
179 *
180 * This function cleans up action frame.
181 *
182 * Return: None
183 */
184void wlan_hdd_cleanup_actionframe(struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800185#endif /* __P2P_H */