blob: fa968bdc857c8e51751671575ee30be9e4c1d74c [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Jeff Johnson3f6c89f2018-03-01 14:27:38 -08002 * Copyright (c) 2014-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#if !defined(WLAN_HDD_SOFTAP_TX_RX_H)
20#define WLAN_HDD_SOFTAP_TX_RX_H
21
22/**
23 * DOC: wlan_hdd_softap_tx_rx.h
24 *
Jeff Johnsonfb0857d2018-07-08 13:23:04 -070025 * Linux HDD SOFTAP Tx/Rx APIs
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080026 */
27
28#include <wlan_hdd_hostapd.h>
Manjunathappa Prakash3454fd62016-04-01 08:52:06 -070029#include <cdp_txrx_peer_ops.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080030
Jeff Johnsonfb0857d2018-07-08 13:23:04 -070031/**
32 * hdd_softap_hard_start_xmit() - Transmit a frame
33 * @skb: pointer to OS packet
34 * @dev: pointer to net_device structure
35 *
36 * Function registered as a net_device .ndo_start_xmit() method for
37 * master mode interfaces (SoftAP/P2P GO), called by the OS if any
38 * packet needs to be transmitted.
39 *
40 * Return: Status of the transmission
41 */
Srinivas Girigowdade28a9d2018-03-19 19:19:49 -070042netdev_tx_t hdd_softap_hard_start_xmit(struct sk_buff *skb,
43 struct net_device *dev);
Jeff Johnsonfb0857d2018-07-08 13:23:04 -070044
45/**
46 * hdd_softap_tx_timeout() - TX timeout handler
47 * @dev: pointer to network device
48 *
49 * Function registered as a net_device .ndo_tx_timeout() method for
50 * master mode interfaces (SoftAP/P2P GO), called by the OS if the
51 * driver takes too long to transmit a frame.
52 *
53 * Return: None
54 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080055void hdd_softap_tx_timeout(struct net_device *dev);
Jeff Johnsonfb0857d2018-07-08 13:23:04 -070056
57/**
58 * hdd_softap_init_tx_rx() - Initialize Tx/Rx module
59 * @adapter: pointer to adapter context
60 *
61 * Return: QDF_STATUS_E_FAILURE if any errors encountered,
62 * QDF_STATUS_SUCCESS otherwise
63 */
Jeff Johnsond31ab6a2017-10-02 13:23:51 -070064QDF_STATUS hdd_softap_init_tx_rx(struct hdd_adapter *adapter);
Jeff Johnsonfb0857d2018-07-08 13:23:04 -070065
66/**
67 * hdd_softap_deinit_tx_rx() - Deinitialize Tx/Rx module
68 * @adapter: pointer to adapter context
69 *
70 * Return: QDF_STATUS_E_FAILURE if any errors encountered,
71 * QDF_STATUS_SUCCESS otherwise
72 */
Jeff Johnsond31ab6a2017-10-02 13:23:51 -070073QDF_STATUS hdd_softap_deinit_tx_rx(struct hdd_adapter *adapter);
Jeff Johnson349d9a92017-10-21 15:38:03 -070074
75/**
Jeff Johnsonfb0857d2018-07-08 13:23:04 -070076 * hdd_softap_init_tx_rx_sta() - Initialize Tx/Rx for a softap station
Jeff Johnson349d9a92017-10-21 15:38:03 -070077 * @adapter: pointer to adapter context
78 * @sta_id: Station ID to initialize
79 * @sta_mac: pointer to the MAC address of the station
80 *
81 * Return: QDF_STATUS_E_FAILURE if any errors encountered,
82 * QDF_STATUS_SUCCESS otherwise
83 */
Jeff Johnsond31ab6a2017-10-02 13:23:51 -070084QDF_STATUS hdd_softap_init_tx_rx_sta(struct hdd_adapter *adapter,
Jeff Johnson349d9a92017-10-21 15:38:03 -070085 uint8_t sta_id,
86 struct qdf_mac_addr *sta_mac);
87
Jeff Johnsonb157c722017-10-21 15:46:42 -070088/**
Jeff Johnsonfb0857d2018-07-08 13:23:04 -070089 * hdd_softap_deinit_tx_rx_sta() - Deinitialize Tx/Rx for a softap station
Jeff Johnsonb157c722017-10-21 15:46:42 -070090 * @adapter: pointer to adapter context
91 * @sta_id: Station ID to deinitialize
92 *
93 * Return: QDF_STATUS_E_FAILURE if any errors encountered,
94 * QDF_STATUS_SUCCESS otherwise
95 */
Jeff Johnsond31ab6a2017-10-02 13:23:51 -070096QDF_STATUS hdd_softap_deinit_tx_rx_sta(struct hdd_adapter *adapter,
Jeff Johnsonb157c722017-10-21 15:46:42 -070097 uint8_t sta_id);
Dhanashri Atre182b0272016-02-17 15:35:07 -080098
Jeff Johnsonfb0857d2018-07-08 13:23:04 -070099/**
100 * hdd_softap_rx_packet_cbk() - Receive packet handler
Mohit Khanna70322002018-05-15 19:21:32 -0700101 * @adapter_context: pointer to HDD adapter
Jeff Johnsonfb0857d2018-07-08 13:23:04 -0700102 * @rx_buf: pointer to rx qdf_nbuf chain
103 *
104 * Receive callback registered with the Data Path. The Data Path will
105 * call this to notify the HDD when one or more packets were received
106 * for a registered STA.
107 *
108 * Return: QDF_STATUS_E_FAILURE if any errors encountered,
109 * QDF_STATUS_SUCCESS otherwise
110 */
Mohit Khanna70322002018-05-15 19:21:32 -0700111QDF_STATUS hdd_softap_rx_packet_cbk(void *adapter_context, qdf_nbuf_t rx_buf);
Alok Kumar4696fb02018-06-06 00:10:18 +0530112
Jeff Johnsonfb0857d2018-07-08 13:23:04 -0700113/**
114 * hdd_softap_deregister_sta() - Deregister a STA with the Data Path
115 * @adapter: pointer to adapter context
116 * @sta_id: Station ID to deregister
117 *
118 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
119 */
Jeff Johnsond31ab6a2017-10-02 13:23:51 -0700120QDF_STATUS hdd_softap_deregister_sta(struct hdd_adapter *adapter,
Jeff Johnsonfb0857d2018-07-08 13:23:04 -0700121 uint8_t sta_id);
Jeff Johnson3f6c89f2018-03-01 14:27:38 -0800122
123/**
124 * hdd_softap_register_sta() - Register a SoftAP STA
125 * @adapter: pointer to adapter context
Jeff Johnsonfb0857d2018-07-08 13:23:04 -0700126 * @auth_required: is additional authentication required?
127 * @privacy_required: should 802.11 privacy bit be set?
128 * @sta_id: station ID assigned to this station
129 * @sta_mac: station MAC address
130 * @wmm_enabled: is WMM enabled for this STA?
Jeff Johnson3f6c89f2018-03-01 14:27:38 -0800131 *
132 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
133 */
Jeff Johnsond31ab6a2017-10-02 13:23:51 -0700134QDF_STATUS hdd_softap_register_sta(struct hdd_adapter *adapter,
Jeff Johnsonfb0857d2018-07-08 13:23:04 -0700135 bool auth_required,
136 bool privacy_required,
137 uint8_t sta_id,
138 struct qdf_mac_addr *sta_mac,
139 bool wmm_enabled);
Jeff Johnson3f6c89f2018-03-01 14:27:38 -0800140
Jeff Johnsonfb0857d2018-07-08 13:23:04 -0700141/**
142 * hdd_softap_register_bc_sta() - Register the SoftAP broadcast STA
143 * @adapter: pointer to adapter context
144 * @privacy_required: should 802.11 privacy bit be set?
145 *
146 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
147 */
Jeff Johnsond31ab6a2017-10-02 13:23:51 -0700148QDF_STATUS hdd_softap_register_bc_sta(struct hdd_adapter *adapter,
Jeff Johnsonfb0857d2018-07-08 13:23:04 -0700149 bool privacy_required);
150
151/**
152 * hdd_softap_stop_bss() - Stop the BSS
153 * @adapter: pointer to adapter context
154 *
155 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
156 */
Jeff Johnson9c4f93d2017-10-04 08:56:22 -0700157QDF_STATUS hdd_softap_stop_bss(struct hdd_adapter *adapter);
Jeff Johnsonfb0857d2018-07-08 13:23:04 -0700158
159/**
160 * hdd_softap_change_sta_state() - Change the state of a SoftAP station
161 * @adapter: pointer to adapter context
162 * @sta_mac: MAC address of the station
163 * @state: new state of the station
164 *
165 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
166 */
Jeff Johnsond31ab6a2017-10-02 13:23:51 -0700167QDF_STATUS hdd_softap_change_sta_state(struct hdd_adapter *adapter,
Jeff Johnsonfb0857d2018-07-08 13:23:04 -0700168 struct qdf_mac_addr *sta_mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800169 enum ol_txrx_peer_state state);
Jeff Johnsonfb0857d2018-07-08 13:23:04 -0700170
171/**
172 * hdd_softap_get_sta_id() - Find station ID from MAC address
173 * @adapter: pointer to adapter context
174 * @sta_mac: MAC address of the destination
175 * @sta_id: Station ID associated with the MAC address
176 *
177 * Return: QDF_STATUS_SUCCESS if a match was found, in which case
178 * @sta_id is populated, QDF_STATUS_E_FAILURE if a match is
179 * not found
180 */
Jeff Johnsond31ab6a2017-10-02 13:23:51 -0700181QDF_STATUS hdd_softap_get_sta_id(struct hdd_adapter *adapter,
Jeff Johnsonfb0857d2018-07-08 13:23:04 -0700182 struct qdf_mac_addr *sta_mac,
183 uint8_t *sta_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800184
185#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
Jeff Johnsonfb0857d2018-07-08 13:23:04 -0700186/**
187 * hdd_softap_tx_resume_timer_expired_handler() - TX Q resume timer handler
188 * @adapter_context: pointer to vdev adapter
189 *
190 * TX Q resume timer handler for SAP and P2P GO interface. If Blocked
191 * OS Q is not resumed during timeout period, to prevent permanent
192 * stall, resume OS Q forcefully for SAP and P2P GO interface.
193 *
194 * Return: None
195 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800196void hdd_softap_tx_resume_timer_expired_handler(void *adapter_context);
Jeff Johnsonfb0857d2018-07-08 13:23:04 -0700197
198/**
199 * hdd_softap_tx_resume_cb() - Resume OS TX Q.
200 * @adapter_context: pointer to vdev apdapter
201 * @tx_resume: TX Q resume trigger
202 *
203 * Q was stopped due to WLAN TX path low resource condition
204 *
205 * Return: None
206 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800207void hdd_softap_tx_resume_cb(void *adapter_context, bool tx_resume);
208#else
209static inline
210void hdd_softap_tx_resume_timer_expired_handler(void *adapter_context)
211{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800212}
Jeff Johnsonfb0857d2018-07-08 13:23:04 -0700213
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800214static inline
215void hdd_softap_tx_resume_cb(void *adapter_context, bool tx_resume)
216{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800217}
218#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
219
Yun Parkc3e35562018-03-08 12:05:52 -0800220/**
221 * hdd_post_dhcp_ind() - Send DHCP START/STOP indication to FW
222 * @adapter: pointer to hdd adapter
223 * @sta_id: peer station ID
224 * @type: WMA message type
225 *
226 * Return: error number
227 */
228int hdd_post_dhcp_ind(struct hdd_adapter *adapter,
Jeff Johnsonfb0857d2018-07-08 13:23:04 -0700229 uint8_t sta_id, uint16_t type);
Alok Kumar4696fb02018-06-06 00:10:18 +0530230
231/**
Yun Parkc3e35562018-03-08 12:05:52 -0800232 * hdd_inspect_dhcp_packet() - Inspect DHCP packet
233 * @adapter: pointer to hdd adapter
234 * @sta_id: peer station ID
235 * @skb: pointer to OS packet (sk_buff)
236 * @dir: direction
237 *
238 * Return: error number
239 */
240int hdd_inspect_dhcp_packet(struct hdd_adapter *adapter,
Alok Kumar4696fb02018-06-06 00:10:18 +0530241 uint8_t sta_id,
242 struct sk_buff *skb,
243 enum qdf_proto_dir dir);
Yun Parkc3e35562018-03-08 12:05:52 -0800244
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800245#endif /* end #if !defined(WLAN_HDD_SOFTAP_TX_RX_H) */