Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Jeff Johnson | 3f6c89f | 2018-03-01 14:27:38 -0800 | [diff] [blame] | 2 | * Copyright (c) 2014-2018 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4 | * 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 Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19 | #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 Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 25 | * Linux HDD SOFTAP Tx/Rx APIs |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 26 | */ |
| 27 | |
| 28 | #include <wlan_hdd_hostapd.h> |
Manjunathappa Prakash | 3454fd6 | 2016-04-01 08:52:06 -0700 | [diff] [blame] | 29 | #include <cdp_txrx_peer_ops.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 30 | |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 31 | /** |
| 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 Girigowda | de28a9d | 2018-03-19 19:19:49 -0700 | [diff] [blame] | 42 | netdev_tx_t hdd_softap_hard_start_xmit(struct sk_buff *skb, |
| 43 | struct net_device *dev); |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 44 | |
| 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 Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 55 | void hdd_softap_tx_timeout(struct net_device *dev); |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 56 | |
| 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 Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 64 | QDF_STATUS hdd_softap_init_tx_rx(struct hdd_adapter *adapter); |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 65 | |
| 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 Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 73 | QDF_STATUS hdd_softap_deinit_tx_rx(struct hdd_adapter *adapter); |
Jeff Johnson | 349d9a9 | 2017-10-21 15:38:03 -0700 | [diff] [blame] | 74 | |
| 75 | /** |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 76 | * hdd_softap_init_tx_rx_sta() - Initialize Tx/Rx for a softap station |
Jeff Johnson | 349d9a9 | 2017-10-21 15:38:03 -0700 | [diff] [blame] | 77 | * @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 Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 84 | QDF_STATUS hdd_softap_init_tx_rx_sta(struct hdd_adapter *adapter, |
Jeff Johnson | 349d9a9 | 2017-10-21 15:38:03 -0700 | [diff] [blame] | 85 | uint8_t sta_id, |
| 86 | struct qdf_mac_addr *sta_mac); |
| 87 | |
Jeff Johnson | b157c72 | 2017-10-21 15:46:42 -0700 | [diff] [blame] | 88 | /** |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 89 | * hdd_softap_deinit_tx_rx_sta() - Deinitialize Tx/Rx for a softap station |
Jeff Johnson | b157c72 | 2017-10-21 15:46:42 -0700 | [diff] [blame] | 90 | * @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 Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 96 | QDF_STATUS hdd_softap_deinit_tx_rx_sta(struct hdd_adapter *adapter, |
Jeff Johnson | b157c72 | 2017-10-21 15:46:42 -0700 | [diff] [blame] | 97 | uint8_t sta_id); |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 98 | |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 99 | /** |
| 100 | * hdd_softap_rx_packet_cbk() - Receive packet handler |
Mohit Khanna | 7032200 | 2018-05-15 19:21:32 -0700 | [diff] [blame^] | 101 | * @adapter_context: pointer to HDD adapter |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 102 | * @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 Khanna | 7032200 | 2018-05-15 19:21:32 -0700 | [diff] [blame^] | 111 | QDF_STATUS hdd_softap_rx_packet_cbk(void *adapter_context, qdf_nbuf_t rx_buf); |
Alok Kumar | 4696fb0 | 2018-06-06 00:10:18 +0530 | [diff] [blame] | 112 | |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 113 | /** |
| 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 Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 120 | QDF_STATUS hdd_softap_deregister_sta(struct hdd_adapter *adapter, |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 121 | uint8_t sta_id); |
Jeff Johnson | 3f6c89f | 2018-03-01 14:27:38 -0800 | [diff] [blame] | 122 | |
| 123 | /** |
| 124 | * hdd_softap_register_sta() - Register a SoftAP STA |
| 125 | * @adapter: pointer to adapter context |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 126 | * @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 Johnson | 3f6c89f | 2018-03-01 14:27:38 -0800 | [diff] [blame] | 131 | * |
| 132 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 133 | */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 134 | QDF_STATUS hdd_softap_register_sta(struct hdd_adapter *adapter, |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 135 | bool auth_required, |
| 136 | bool privacy_required, |
| 137 | uint8_t sta_id, |
| 138 | struct qdf_mac_addr *sta_mac, |
| 139 | bool wmm_enabled); |
Jeff Johnson | 3f6c89f | 2018-03-01 14:27:38 -0800 | [diff] [blame] | 140 | |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 141 | /** |
| 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 Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 148 | QDF_STATUS hdd_softap_register_bc_sta(struct hdd_adapter *adapter, |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 149 | 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 Johnson | 9c4f93d | 2017-10-04 08:56:22 -0700 | [diff] [blame] | 157 | QDF_STATUS hdd_softap_stop_bss(struct hdd_adapter *adapter); |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 158 | |
| 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 Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 167 | QDF_STATUS hdd_softap_change_sta_state(struct hdd_adapter *adapter, |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 168 | struct qdf_mac_addr *sta_mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 169 | enum ol_txrx_peer_state state); |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 170 | |
| 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 Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 181 | QDF_STATUS hdd_softap_get_sta_id(struct hdd_adapter *adapter, |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 182 | struct qdf_mac_addr *sta_mac, |
| 183 | uint8_t *sta_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 184 | |
| 185 | #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 186 | /** |
| 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 Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 196 | void hdd_softap_tx_resume_timer_expired_handler(void *adapter_context); |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 197 | |
| 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 Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 207 | void hdd_softap_tx_resume_cb(void *adapter_context, bool tx_resume); |
| 208 | #else |
| 209 | static inline |
| 210 | void hdd_softap_tx_resume_timer_expired_handler(void *adapter_context) |
| 211 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 212 | } |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 213 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 214 | static inline |
| 215 | void hdd_softap_tx_resume_cb(void *adapter_context, bool tx_resume) |
| 216 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 217 | } |
| 218 | #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */ |
| 219 | |
Yun Park | c3e3556 | 2018-03-08 12:05:52 -0800 | [diff] [blame] | 220 | /** |
| 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 | */ |
| 228 | int hdd_post_dhcp_ind(struct hdd_adapter *adapter, |
Jeff Johnson | fb0857d | 2018-07-08 13:23:04 -0700 | [diff] [blame] | 229 | uint8_t sta_id, uint16_t type); |
Alok Kumar | 4696fb0 | 2018-06-06 00:10:18 +0530 | [diff] [blame] | 230 | |
| 231 | /** |
Yun Park | c3e3556 | 2018-03-08 12:05:52 -0800 | [diff] [blame] | 232 | * 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 | */ |
| 240 | int hdd_inspect_dhcp_packet(struct hdd_adapter *adapter, |
Alok Kumar | 4696fb0 | 2018-06-06 00:10:18 +0530 | [diff] [blame] | 241 | uint8_t sta_id, |
| 242 | struct sk_buff *skb, |
| 243 | enum qdf_proto_dir dir); |
Yun Park | c3e3556 | 2018-03-08 12:05:52 -0800 | [diff] [blame] | 244 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 245 | #endif /* end #if !defined(WLAN_HDD_SOFTAP_TX_RX_H) */ |