1 /* 2 * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 #ifndef _DP_RX_TID_H_ 21 #define _DP_RX_TID_H_ 22 23 #include "dp_types.h" 24 25 /* 26 * dp_rxtid_stats_cmd_cb - function pointer for peer 27 * rx tid stats cmd call_back 28 * @soc: 29 * @cb_ctxt: 30 * @reo_status: 31 */ 32 typedef void (*dp_rxtid_stats_cmd_cb)(struct dp_soc *soc, void *cb_ctxt, 33 union hal_reo_status *reo_status); 34 35 #ifndef WLAN_SOFTUMAC_SUPPORT 36 void dp_rx_tid_stats_cb(struct dp_soc *soc, void *cb_ctxt, 37 union hal_reo_status *reo_status); 38 39 /** 40 * dp_peer_rx_cleanup() - Cleanup receive TID state 41 * @vdev: Datapath vdev 42 * @peer: Datapath peer 43 * 44 */ 45 void dp_peer_rx_cleanup(struct dp_vdev *vdev, struct dp_peer *peer); 46 47 /** 48 * dp_rx_tid_setup_wifi3() - Set up receive TID state 49 * @peer: Datapath peer handle 50 * @tid_bitmap: TIDs to be set up 51 * @ba_window_size: BlockAck window size 52 * @start_seq: Starting sequence number 53 * 54 * Return: QDF_STATUS code 55 */ 56 QDF_STATUS dp_rx_tid_setup_wifi3(struct dp_peer *peer, uint32_t tid_bitmap, 57 uint32_t ba_window_size, uint32_t start_seq); 58 59 /** 60 * dp_rx_tid_update_wifi3() - Update receive TID state 61 * @peer: Datapath peer handle 62 * @tid: TID 63 * @ba_window_size: BlockAck window size 64 * @start_seq: Starting sequence number 65 * @bar_update: BAR update triggered 66 * 67 * Return: QDF_STATUS code 68 */ 69 QDF_STATUS dp_rx_tid_update_wifi3(struct dp_peer *peer, int tid, 70 uint32_t ba_window_size, uint32_t start_seq, 71 bool bar_update); 72 73 /* 74 * dp_rx_tid_delete_cb() - Callback to flush reo descriptor HW cache 75 * after deleting the entries (ie., setting valid=0) 76 * 77 * @soc: DP SOC handle 78 * @cb_ctxt: Callback context 79 * @reo_status: REO command status 80 */ 81 void dp_rx_tid_delete_cb(struct dp_soc *soc, 82 void *cb_ctxt, 83 union hal_reo_status *reo_status); 84 85 #ifdef IPA_OFFLOAD 86 void dp_peer_update_tid_stats_from_reo(struct dp_soc *soc, void *cb_ctxt, 87 union hal_reo_status *reo_status); 88 int dp_peer_get_rxtid_stats_ipa(struct dp_peer *peer, 89 dp_rxtid_stats_cmd_cb dp_stats_cmd_cb); 90 #endif 91 92 #ifdef DP_UMAC_HW_RESET_SUPPORT 93 void dp_reset_tid_q_setup(struct dp_soc *soc); 94 #endif 95 96 /** 97 * dp_addba_resp_tx_completion_wifi3() - Update Rx Tid State 98 * 99 * @cdp_soc: Datapath soc handle 100 * @peer_mac: Datapath peer mac address 101 * @vdev_id: id of atapath vdev 102 * @tid: TID number 103 * @status: tx completion status 104 * Return: 0 on success, error code on failure 105 */ 106 int dp_addba_resp_tx_completion_wifi3(struct cdp_soc_t *cdp_soc, 107 uint8_t *peer_mac, 108 uint16_t vdev_id, 109 uint8_t tid, int status); 110 111 /** 112 * dp_addba_responsesetup_wifi3() - Process ADDBA request from peer 113 * @cdp_soc: Datapath soc handle 114 * @peer_mac: Datapath peer mac address 115 * @vdev_id: id of atapath vdev 116 * @tid: TID number 117 * @dialogtoken: output dialogtoken 118 * @statuscode: output dialogtoken 119 * @buffersize: Output BA window size 120 * @batimeout: Output BA timeout 121 */ 122 QDF_STATUS 123 dp_addba_responsesetup_wifi3(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac, 124 uint16_t vdev_id, uint8_t tid, 125 uint8_t *dialogtoken, uint16_t *statuscode, 126 uint16_t *buffersize, uint16_t *batimeout); 127 128 /** 129 * dp_rx_tid_update_ba_win_size() - Update the DP tid BA window size 130 * @cdp_soc: soc handle 131 * @peer_mac: mac address of peer handle 132 * @vdev_id: id of vdev handle 133 * @tid: tid 134 * @buffersize: BA window size 135 * 136 * Return: success/failure of tid update 137 */ 138 QDF_STATUS dp_rx_tid_update_ba_win_size(struct cdp_soc_t *cdp_soc, 139 uint8_t *peer_mac, uint16_t vdev_id, 140 uint8_t tid, uint16_t buffersize); 141 142 /** 143 * dp_addba_requestprocess_wifi3() - Process ADDBA request from peer 144 * @cdp_soc: Datapath soc handle 145 * @peer_mac: Datapath peer mac address 146 * @vdev_id: id of atapath vdev 147 * @dialogtoken: dialogtoken from ADDBA frame 148 * @tid: TID number 149 * @batimeout: BA timeout 150 * @buffersize: BA window size 151 * @startseqnum: Start seq. number received in BA sequence control 152 * 153 * Return: 0 on success, error code on failure 154 */ 155 int dp_addba_requestprocess_wifi3(struct cdp_soc_t *cdp_soc, 156 uint8_t *peer_mac, 157 uint16_t vdev_id, 158 uint8_t dialogtoken, 159 uint16_t tid, uint16_t batimeout, 160 uint16_t buffersize, 161 uint16_t startseqnum); 162 163 /** 164 * dp_set_addba_response() - Set a user defined ADDBA response status code 165 * @cdp_soc: Datapath soc handle 166 * @peer_mac: Datapath peer mac address 167 * @vdev_id: id of atapath vdev 168 * @tid: TID number 169 * @statuscode: response status code to be set 170 */ 171 QDF_STATUS 172 dp_set_addba_response(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac, 173 uint16_t vdev_id, uint8_t tid, uint16_t statuscode); 174 175 /** 176 * dp_delba_process_wifi3() - Process DELBA from peer 177 * @cdp_soc: Datapath soc handle 178 * @peer_mac: Datapath peer mac address 179 * @vdev_id: id of atapath vdev 180 * @tid: TID number 181 * @reasoncode: Reason code received in DELBA frame 182 * 183 * Return: 0 on success, error code on failure 184 */ 185 int dp_delba_process_wifi3(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac, 186 uint16_t vdev_id, int tid, uint16_t reasoncode); 187 188 /** 189 * dp_delba_tx_completion_wifi3() - Handle delba tx completion 190 * @cdp_soc: soc handle 191 * @peer_mac: peer mac address 192 * @vdev_id: id of the vdev handle 193 * @tid: Tid number 194 * @status: Tx completion status 195 * 196 * Indicate status of delba Tx to DP for stats update and retry 197 * delba if tx failed. 198 * 199 * Return: 0 on success, error code on failure 200 */ 201 int dp_delba_tx_completion_wifi3(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac, 202 uint16_t vdev_id, 203 uint8_t tid, int status); 204 205 /** 206 * dp_set_pn_check_wifi3() - enable PN check in REO for security 207 * @soc: Datapath soc handle 208 * @vdev_id: id of atapath vdev 209 * @peer_mac: Datapath peer mac address 210 * @sec_type: security type 211 * @rx_pn: Receive pn starting number 212 * 213 */ 214 QDF_STATUS 215 dp_set_pn_check_wifi3(struct cdp_soc_t *soc, uint8_t vdev_id, 216 uint8_t *peer_mac, enum cdp_sec_type sec_type, 217 uint32_t *rx_pn); 218 QDF_STATUS 219 dp_rx_delba_ind_handler(void *soc_handle, uint16_t peer_id, 220 uint8_t tid, uint16_t win_sz); 221 222 /** 223 * dp_peer_rxtid_stats() - Retried Rx TID (REO queue) stats from HW 224 * @peer: DP peer handle 225 * @dp_stats_cmd_cb: REO command callback function 226 * @cb_ctxt: Callback context 227 * 228 * Return: count of tid stats cmd send succeeded 229 */ 230 int dp_peer_rxtid_stats(struct dp_peer *peer, 231 dp_rxtid_stats_cmd_cb dp_stats_cmd_cb, 232 void *cb_ctxt); 233 QDF_STATUS dp_peer_rx_tids_create(struct dp_peer *peer); 234 void dp_peer_rx_tids_destroy(struct dp_peer *peer); 235 236 #ifdef DUMP_REO_QUEUE_INFO_IN_DDR 237 /** 238 * dp_send_cache_flush_for_rx_tid() - Send cache flush cmd to REO per tid 239 * @soc : dp_soc handle 240 * @peer: peer 241 * 242 * This function is used to send cache flush cmd to reo and 243 * to register the callback to handle the dumping of the reo 244 * queue stas from DDR 245 * 246 * Return: none 247 */ 248 void dp_send_cache_flush_for_rx_tid(struct dp_soc *soc, struct dp_peer *peer); 249 250 /** 251 * dp_get_rx_reo_queue_info() - Handler to get rx tid info 252 * @soc_hdl : cdp_soc_t handle 253 * @vdev_id: vdev id 254 * 255 * Handler to get rx tid info from DDR after h/w cache is 256 * invalidated first using the cache flush cmd. 257 * 258 * Return: none 259 */ 260 void dp_get_rx_reo_queue_info(struct cdp_soc_t *soc_hdl, uint8_t vdev_id); 261 262 /** 263 * dp_dump_rx_reo_queue_info() - Callback function to dump reo queue stats 264 * @soc : dp_soc handle 265 * @cb_ctxt: callback context 266 * @reo_status: vdev id 267 * 268 * This is the callback function registered after sending the reo cmd 269 * to flush the h/w cache and invalidate it. In the callback the reo 270 * queue desc info is dumped from DDR. 271 * 272 * Return: none 273 */ 274 void dp_dump_rx_reo_queue_info(struct dp_soc *soc, void *cb_ctxt, 275 union hal_reo_status *reo_status); 276 277 #else /* DUMP_REO_QUEUE_INFO_IN_DDR */ 278 279 static inline void dp_get_rx_reo_queue_info(struct cdp_soc_t *soc_hdl, 280 uint8_t vdev_id) 281 { 282 } 283 #endif /* DUMP_REO_QUEUE_INFO_IN_DDR */ 284 void dp_peer_rx_tid_setup(struct dp_peer *peer); 285 #else 286 static inline void dp_rx_tid_stats_cb(struct dp_soc *soc, void *cb_ctxt, 287 union hal_reo_status *reo_status) {} 288 static inline void dp_peer_rx_cleanup(struct dp_vdev *vdev, 289 struct dp_peer *peer) {} 290 static inline int dp_addba_resp_tx_completion_wifi3(struct cdp_soc_t *cdp_soc, 291 uint8_t *peer_mac, 292 uint16_t vdev_id, 293 uint8_t tid, int status) 294 { 295 return QDF_STATUS_SUCCESS; 296 } 297 298 static inline QDF_STATUS 299 dp_addba_responsesetup_wifi3(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac, 300 uint16_t vdev_id, uint8_t tid, 301 uint8_t *dialogtoken, uint16_t *statuscode, 302 uint16_t *buffersize, uint16_t *batimeout) 303 { 304 return QDF_STATUS_SUCCESS; 305 } 306 307 static inline QDF_STATUS 308 dp_rx_tid_update_ba_win_size(struct cdp_soc_t *cdp_soc, 309 uint8_t *peer_mac, uint16_t vdev_id, 310 uint8_t tid, uint16_t buffersize) 311 { 312 return QDF_STATUS_SUCCESS; 313 } 314 315 static inline int 316 dp_addba_requestprocess_wifi3(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac, 317 uint16_t vdev_id, uint8_t dialogtoken, 318 uint16_t tid, uint16_t batimeout, 319 uint16_t buffersize, uint16_t startseqnum) 320 { 321 return QDF_STATUS_SUCCESS; 322 } 323 324 static inline QDF_STATUS 325 dp_set_addba_response(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac, 326 uint16_t vdev_id, uint8_t tid, uint16_t statuscode) 327 { 328 return QDF_STATUS_SUCCESS; 329 } 330 331 static inline int 332 dp_delba_process_wifi3(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac, 333 uint16_t vdev_id, int tid, uint16_t reasoncode) 334 { 335 return QDF_STATUS_SUCCESS; 336 } 337 338 static inline int dp_delba_tx_completion_wifi3(struct cdp_soc_t *cdp_soc, 339 uint8_t *peer_mac, 340 uint16_t vdev_id, 341 uint8_t tid, int status) 342 { 343 return QDF_STATUS_SUCCESS; 344 } 345 346 static inline QDF_STATUS 347 dp_set_pn_check_wifi3(struct cdp_soc_t *soc, uint8_t vdev_id, 348 uint8_t *peer_mac, enum cdp_sec_type sec_type, 349 uint32_t *rx_pn) 350 { 351 return QDF_STATUS_SUCCESS; 352 } 353 354 static inline QDF_STATUS 355 dp_rx_delba_ind_handler(void *soc_handle, uint16_t peer_id, 356 uint8_t tid, uint16_t win_sz) 357 { 358 return QDF_STATUS_SUCCESS; 359 } 360 361 static inline int 362 dp_peer_rxtid_stats(struct dp_peer *peer, 363 dp_rxtid_stats_cmd_cb dp_stats_cmd_cb, 364 void *cb_ctxt) 365 { 366 return 0; 367 } 368 369 static inline QDF_STATUS dp_peer_rx_tids_create(struct dp_peer *peer) 370 { 371 return QDF_STATUS_SUCCESS; 372 } 373 374 static inline void dp_peer_rx_tids_destroy(struct dp_peer *peer) {} 375 376 static inline void dp_get_rx_reo_queue_info(struct cdp_soc_t *soc_hdl, 377 uint8_t vdev_id) {} 378 static inline void dp_peer_rx_tid_setup(struct dp_peer *peer) {} 379 380 static inline QDF_STATUS 381 dp_rx_tid_setup_wifi3(struct dp_peer *peer, int tid, 382 uint32_t ba_window_size, uint32_t start_seq) 383 { 384 return QDF_STATUS_SUCCESS; 385 } 386 #endif 387 #endif /* _DP_RX_TID_H_ */ 388