1 /* 2 * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. 3 * 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 19 #ifndef _DP_INTERNAL_H_ 20 #define _DP_INTERNAL_H_ 21 22 #include "dp_types.h" 23 24 #define RX_BUFFER_SIZE_PKTLOG_LITE 1024 25 26 /* Macro For NYSM value received in VHT TLV */ 27 #define VHT_SGI_NYSM 3 28 29 #if DP_PRINT_ENABLE 30 #include <stdarg.h> /* va_list */ 31 #include <qdf_types.h> /* qdf_vprint */ 32 #include <cdp_txrx_handle.h> 33 34 enum { 35 /* FATAL_ERR - print only irrecoverable error messages */ 36 DP_PRINT_LEVEL_FATAL_ERR, 37 38 /* ERR - include non-fatal err messages */ 39 DP_PRINT_LEVEL_ERR, 40 41 /* WARN - include warnings */ 42 DP_PRINT_LEVEL_WARN, 43 44 /* INFO1 - include fundamental, infrequent events */ 45 DP_PRINT_LEVEL_INFO1, 46 47 /* INFO2 - include non-fundamental but infrequent events */ 48 DP_PRINT_LEVEL_INFO2, 49 }; 50 51 52 #define dp_print(level, fmt, ...) do { \ 53 if (level <= g_txrx_print_level) \ 54 qdf_print(fmt, ## __VA_ARGS__); \ 55 while (0) 56 #define DP_PRINT(level, fmt, ...) do { \ 57 dp_print(level, "DP: " fmt, ## __VA_ARGS__); \ 58 while (0) 59 #else 60 #define DP_PRINT(level, fmt, ...) 61 #endif /* DP_PRINT_ENABLE */ 62 63 #define DP_TRACE(LVL, fmt, args ...) \ 64 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_##LVL, \ 65 fmt, ## args) 66 67 #define DP_TRACE_STATS(LVL, fmt, args ...) \ 68 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_##LVL, \ 69 fmt, ## args) 70 71 #define DP_PRINT_STATS(fmt, args ...) \ 72 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, \ 73 fmt, ## args) 74 75 #define DP_STATS_INIT(_handle) \ 76 qdf_mem_set(&((_handle)->stats), sizeof((_handle)->stats), 0x0) 77 78 #define DP_STATS_CLR(_handle) \ 79 qdf_mem_set(&((_handle)->stats), sizeof((_handle)->stats), 0x0) 80 81 #ifndef DISABLE_DP_STATS 82 #define DP_STATS_INC(_handle, _field, _delta) \ 83 { \ 84 if (likely(_handle)) \ 85 _handle->stats._field += _delta; \ 86 } 87 88 #define DP_STATS_INCC(_handle, _field, _delta, _cond) \ 89 { \ 90 if (_cond && likely(_handle)) \ 91 _handle->stats._field += _delta; \ 92 } 93 94 #define DP_STATS_DEC(_handle, _field, _delta) \ 95 { \ 96 if (likely(_handle)) \ 97 _handle->stats._field -= _delta; \ 98 } 99 100 #define DP_STATS_UPD(_handle, _field, _delta) \ 101 { \ 102 if (likely(_handle)) \ 103 _handle->stats._field = _delta; \ 104 } 105 106 #define DP_STATS_INC_PKT(_handle, _field, _count, _bytes) \ 107 { \ 108 DP_STATS_INC(_handle, _field.num, _count); \ 109 DP_STATS_INC(_handle, _field.bytes, _bytes) \ 110 } 111 112 #define DP_STATS_INCC_PKT(_handle, _field, _count, _bytes, _cond) \ 113 { \ 114 DP_STATS_INCC(_handle, _field.num, _count, _cond); \ 115 DP_STATS_INCC(_handle, _field.bytes, _bytes, _cond) \ 116 } 117 118 #define DP_STATS_AGGR(_handle_a, _handle_b, _field) \ 119 { \ 120 _handle_a->stats._field += _handle_b->stats._field; \ 121 } 122 123 #define DP_STATS_AGGR_PKT(_handle_a, _handle_b, _field) \ 124 { \ 125 DP_STATS_AGGR(_handle_a, _handle_b, _field.num); \ 126 DP_STATS_AGGR(_handle_a, _handle_b, _field.bytes);\ 127 } 128 129 #define DP_STATS_UPD_STRUCT(_handle_a, _handle_b, _field) \ 130 { \ 131 _handle_a->stats._field = _handle_b->stats._field; \ 132 } 133 134 #define DP_HIST_INIT() \ 135 uint32_t num_of_packets[MAX_PDEV_CNT] = {0}; 136 137 #define DP_HIST_PACKET_COUNT_INC(_pdev_id) \ 138 { \ 139 ++num_of_packets[_pdev_id]; \ 140 } 141 142 #define DP_TX_HISTOGRAM_UPDATE(_pdev, _p_cntrs) \ 143 do { \ 144 if (_p_cntrs == 1) { \ 145 DP_STATS_INC(_pdev, \ 146 tx_comp_histogram.pkts_1, 1); \ 147 } else if (_p_cntrs > 1 && _p_cntrs <= 20) { \ 148 DP_STATS_INC(_pdev, \ 149 tx_comp_histogram.pkts_2_20, 1); \ 150 } else if (_p_cntrs > 20 && _p_cntrs <= 40) { \ 151 DP_STATS_INC(_pdev, \ 152 tx_comp_histogram.pkts_21_40, 1); \ 153 } else if (_p_cntrs > 40 && _p_cntrs <= 60) { \ 154 DP_STATS_INC(_pdev, \ 155 tx_comp_histogram.pkts_41_60, 1); \ 156 } else if (_p_cntrs > 60 && _p_cntrs <= 80) { \ 157 DP_STATS_INC(_pdev, \ 158 tx_comp_histogram.pkts_61_80, 1); \ 159 } else if (_p_cntrs > 80 && _p_cntrs <= 100) { \ 160 DP_STATS_INC(_pdev, \ 161 tx_comp_histogram.pkts_81_100, 1); \ 162 } else if (_p_cntrs > 100 && _p_cntrs <= 200) { \ 163 DP_STATS_INC(_pdev, \ 164 tx_comp_histogram.pkts_101_200, 1); \ 165 } else if (_p_cntrs > 200) { \ 166 DP_STATS_INC(_pdev, \ 167 tx_comp_histogram.pkts_201_plus, 1); \ 168 } \ 169 } while (0) 170 171 #define DP_RX_HISTOGRAM_UPDATE(_pdev, _p_cntrs) \ 172 do { \ 173 if (_p_cntrs == 1) { \ 174 DP_STATS_INC(_pdev, \ 175 rx_ind_histogram.pkts_1, 1); \ 176 } else if (_p_cntrs > 1 && _p_cntrs <= 20) { \ 177 DP_STATS_INC(_pdev, \ 178 rx_ind_histogram.pkts_2_20, 1); \ 179 } else if (_p_cntrs > 20 && _p_cntrs <= 40) { \ 180 DP_STATS_INC(_pdev, \ 181 rx_ind_histogram.pkts_21_40, 1); \ 182 } else if (_p_cntrs > 40 && _p_cntrs <= 60) { \ 183 DP_STATS_INC(_pdev, \ 184 rx_ind_histogram.pkts_41_60, 1); \ 185 } else if (_p_cntrs > 60 && _p_cntrs <= 80) { \ 186 DP_STATS_INC(_pdev, \ 187 rx_ind_histogram.pkts_61_80, 1); \ 188 } else if (_p_cntrs > 80 && _p_cntrs <= 100) { \ 189 DP_STATS_INC(_pdev, \ 190 rx_ind_histogram.pkts_81_100, 1); \ 191 } else if (_p_cntrs > 100 && _p_cntrs <= 200) { \ 192 DP_STATS_INC(_pdev, \ 193 rx_ind_histogram.pkts_101_200, 1); \ 194 } else if (_p_cntrs > 200) { \ 195 DP_STATS_INC(_pdev, \ 196 rx_ind_histogram.pkts_201_plus, 1); \ 197 } \ 198 } while (0) 199 200 #define DP_TX_HIST_STATS_PER_PDEV() \ 201 do { \ 202 uint8_t hist_stats = 0; \ 203 for (hist_stats = 0; hist_stats < soc->pdev_count; \ 204 hist_stats++) { \ 205 DP_TX_HISTOGRAM_UPDATE(soc->pdev_list[hist_stats], \ 206 num_of_packets[hist_stats]); \ 207 } \ 208 } while (0) 209 210 211 #define DP_RX_HIST_STATS_PER_PDEV() \ 212 do { \ 213 uint8_t hist_stats = 0; \ 214 for (hist_stats = 0; hist_stats < soc->pdev_count; \ 215 hist_stats++) { \ 216 DP_RX_HISTOGRAM_UPDATE(soc->pdev_list[hist_stats], \ 217 num_of_packets[hist_stats]); \ 218 } \ 219 } while (0) 220 221 222 #else 223 #define DP_STATS_INC(_handle, _field, _delta) 224 #define DP_STATS_INCC(_handle, _field, _delta, _cond) 225 #define DP_STATS_DEC(_handle, _field, _delta) 226 #define DP_STATS_UPD(_handle, _field, _delta) 227 #define DP_STATS_INC_PKT(_handle, _field, _count, _bytes) 228 #define DP_STATS_INCC_PKT(_handle, _field, _count, _bytes, _cond) 229 #define DP_STATS_AGGR(_handle_a, _handle_b, _field) 230 #define DP_STATS_AGGR_PKT(_handle_a, _handle_b, _field) 231 #define DP_HIST_INIT() 232 #define DP_HIST_PACKET_COUNT_INC(_pdev_id) 233 #define DP_TX_HISTOGRAM_UPDATE(_pdev, _p_cntrs) 234 #define DP_RX_HISTOGRAM_UPDATE(_pdev, _p_cntrs) 235 #define DP_RX_HIST_STATS_PER_PDEV() 236 #define DP_TX_HIST_STATS_PER_PDEV() 237 #endif 238 239 #define DP_HTT_T2H_HP_PIPE 5 240 241 #define DP_UPDATE_STATS(_tgtobj, _srcobj) \ 242 do { \ 243 uint8_t i; \ 244 uint8_t pream_type; \ 245 for (pream_type = 0; pream_type < DOT11_MAX; pream_type++) { \ 246 for (i = 0; i < MAX_MCS; i++) { \ 247 DP_STATS_AGGR(_tgtobj, _srcobj, \ 248 tx.pkt_type[pream_type].mcs_count[i]); \ 249 DP_STATS_AGGR(_tgtobj, _srcobj, \ 250 rx.pkt_type[pream_type].mcs_count[i]); \ 251 } \ 252 } \ 253 \ 254 for (i = 0; i < MAX_BW; i++) { \ 255 DP_STATS_AGGR(_tgtobj, _srcobj, tx.bw[i]); \ 256 DP_STATS_AGGR(_tgtobj, _srcobj, rx.bw[i]); \ 257 } \ 258 \ 259 for (i = 0; i < SS_COUNT; i++) { \ 260 DP_STATS_AGGR(_tgtobj, _srcobj, rx.nss[i]); \ 261 DP_STATS_AGGR(_tgtobj, _srcobj, tx.nss[i]); \ 262 } \ 263 for (i = 0; i < WME_AC_MAX; i++) { \ 264 DP_STATS_AGGR(_tgtobj, _srcobj, tx.wme_ac_type[i]); \ 265 DP_STATS_AGGR(_tgtobj, _srcobj, rx.wme_ac_type[i]); \ 266 DP_STATS_AGGR(_tgtobj, _srcobj, tx.excess_retries_per_ac[i]); \ 267 \ 268 } \ 269 \ 270 for (i = 0; i < MAX_GI; i++) { \ 271 DP_STATS_AGGR(_tgtobj, _srcobj, tx.sgi_count[i]); \ 272 DP_STATS_AGGR(_tgtobj, _srcobj, rx.sgi_count[i]); \ 273 } \ 274 \ 275 for (i = 0; i < MAX_RECEPTION_TYPES; i++) \ 276 DP_STATS_AGGR(_tgtobj, _srcobj, rx.reception_type[i]); \ 277 \ 278 DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.comp_pkt); \ 279 DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.ucast); \ 280 DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.mcast); \ 281 DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.bcast); \ 282 DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.tx_success); \ 283 DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.nawds_mcast); \ 284 DP_STATS_AGGR(_tgtobj, _srcobj, tx.tx_failed); \ 285 DP_STATS_AGGR(_tgtobj, _srcobj, tx.ofdma); \ 286 DP_STATS_AGGR(_tgtobj, _srcobj, tx.stbc); \ 287 DP_STATS_AGGR(_tgtobj, _srcobj, tx.ldpc); \ 288 DP_STATS_AGGR(_tgtobj, _srcobj, tx.retries); \ 289 DP_STATS_AGGR(_tgtobj, _srcobj, tx.non_amsdu_cnt); \ 290 DP_STATS_AGGR(_tgtobj, _srcobj, tx.amsdu_cnt); \ 291 DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_rem); \ 292 DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_rem_tx); \ 293 DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_rem_notx); \ 294 DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_reason1); \ 295 DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_reason2); \ 296 DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_reason3); \ 297 DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.age_out); \ 298 \ 299 DP_STATS_AGGR(_tgtobj, _srcobj, rx.err.mic_err); \ 300 DP_STATS_UPD_STRUCT(_tgtobj, _srcobj, rx.rssi); \ 301 DP_STATS_UPD_STRUCT(_tgtobj, _srcobj, rx.rx_rate); \ 302 DP_STATS_AGGR(_tgtobj, _srcobj, rx.err.decrypt_err); \ 303 DP_STATS_AGGR(_tgtobj, _srcobj, rx.non_ampdu_cnt); \ 304 DP_STATS_AGGR(_tgtobj, _srcobj, rx.ampdu_cnt); \ 305 DP_STATS_AGGR(_tgtobj, _srcobj, rx.non_amsdu_cnt); \ 306 DP_STATS_AGGR(_tgtobj, _srcobj, rx.amsdu_cnt); \ 307 DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.to_stack); \ 308 \ 309 for (i = 0; i < CDP_MAX_RX_RINGS; i++) \ 310 DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.rcvd_reo[i]); \ 311 \ 312 _srcobj->stats.rx.unicast.num = \ 313 _srcobj->stats.rx.to_stack.num - \ 314 (_srcobj->stats.rx.multicast.num + \ 315 _srcobj->stats.rx.bcast.num); \ 316 _srcobj->stats.rx.unicast.bytes = \ 317 _srcobj->stats.rx.to_stack.bytes - \ 318 (_srcobj->stats.rx.multicast.bytes + \ 319 _srcobj->stats.rx.bcast.bytes); \ 320 DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.unicast); \ 321 DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.multicast); \ 322 DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.bcast); \ 323 DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.raw); \ 324 DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.intra_bss.pkts); \ 325 DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.intra_bss.fail); \ 326 \ 327 _tgtobj->stats.tx.last_ack_rssi = \ 328 _srcobj->stats.tx.last_ack_rssi; \ 329 } while (0) 330 331 extern int dp_peer_find_attach(struct dp_soc *soc); 332 extern void dp_peer_find_detach(struct dp_soc *soc); 333 extern void dp_peer_find_hash_add(struct dp_soc *soc, struct dp_peer *peer); 334 extern void dp_peer_find_hash_remove(struct dp_soc *soc, struct dp_peer *peer); 335 extern void dp_peer_find_hash_erase(struct dp_soc *soc); 336 extern void dp_peer_rx_init(struct dp_pdev *pdev, struct dp_peer *peer); 337 extern void dp_peer_cleanup(struct dp_vdev *vdev, struct dp_peer *peer); 338 extern void dp_peer_rx_cleanup(struct dp_vdev *vdev, struct dp_peer *peer); 339 extern void dp_peer_unref_delete(void *peer_handle); 340 extern void dp_rx_discard(struct dp_vdev *vdev, struct dp_peer *peer, 341 unsigned tid, qdf_nbuf_t msdu_list); 342 extern void *dp_find_peer_by_addr(struct cdp_pdev *dev, 343 uint8_t *peer_mac_addr, uint8_t *peer_id); 344 extern struct dp_peer *dp_peer_find_hash_find(struct dp_soc *soc, 345 uint8_t *peer_mac_addr, int mac_addr_is_aligned, uint8_t vdev_id); 346 347 #ifndef CONFIG_WIN 348 QDF_STATUS dp_register_peer(struct cdp_pdev *pdev_handle, 349 struct ol_txrx_desc_type *sta_desc); 350 QDF_STATUS dp_clear_peer(struct cdp_pdev *pdev_handle, uint8_t local_id); 351 void *dp_find_peer_by_addr_and_vdev(struct cdp_pdev *pdev_handle, 352 struct cdp_vdev *vdev, 353 uint8_t *peer_addr, uint8_t *local_id); 354 uint16_t dp_local_peer_id(void *peer); 355 void *dp_peer_find_by_local_id(struct cdp_pdev *pdev_handle, uint8_t local_id); 356 QDF_STATUS dp_peer_state_update(struct cdp_pdev *pdev_handle, uint8_t *peer_mac, 357 enum ol_txrx_peer_state state); 358 QDF_STATUS dp_get_vdevid(void *peer_handle, uint8_t *vdev_id); 359 struct cdp_vdev *dp_get_vdev_by_sta_id(struct cdp_pdev *pdev_handle, 360 uint8_t sta_id); 361 struct cdp_vdev *dp_get_vdev_for_peer(void *peer); 362 uint8_t *dp_peer_get_peer_mac_addr(void *peer); 363 int dp_get_peer_state(void *peer_handle); 364 void dp_local_peer_id_pool_init(struct dp_pdev *pdev); 365 void dp_local_peer_id_alloc(struct dp_pdev *pdev, struct dp_peer *peer); 366 void dp_local_peer_id_free(struct dp_pdev *pdev, struct dp_peer *peer); 367 qdf_time_t *dp_get_last_assoc_received(void *peer_handle); 368 qdf_time_t *dp_get_last_disassoc_received(void *peer_handle); 369 qdf_time_t *dp_get_last_deauth_received(void *peer_handle); 370 #endif 371 extern int dp_addba_requestprocess_wifi3(void *peer_handle, 372 uint8_t dialogtoken, uint16_t tid, uint16_t batimeout, 373 uint16_t buffersize, uint16_t startseqnum); 374 extern void dp_addba_responsesetup_wifi3(void *peer_handle, uint8_t tid, 375 uint8_t *dialogtoken, uint16_t *statuscode, 376 uint16_t *buffersize, uint16_t *batimeout); 377 extern void dp_set_addba_response(void *peer_handle, uint8_t tid, 378 uint16_t statuscode); 379 extern int dp_delba_process_wifi3(void *peer_handle, 380 int tid, uint16_t reasoncode); 381 382 extern int dp_rx_tid_setup_wifi3(struct dp_peer *peer, int tid, 383 uint32_t ba_window_size, uint32_t start_seq); 384 385 extern QDF_STATUS dp_reo_send_cmd(struct dp_soc *soc, 386 enum hal_reo_cmd_type type, struct hal_reo_cmd_params *params, 387 void (*callback_fn), void *data); 388 389 extern void dp_reo_cmdlist_destroy(struct dp_soc *soc); 390 extern void dp_reo_status_ring_handler(struct dp_soc *soc); 391 void dp_aggregate_vdev_stats(struct dp_vdev *vdev); 392 void dp_rx_tid_stats_cb(struct dp_soc *soc, void *cb_ctxt, 393 union hal_reo_status *reo_status); 394 void dp_rx_bar_stats_cb(struct dp_soc *soc, void *cb_ctxt, 395 union hal_reo_status *reo_status); 396 uint16_t dp_tx_me_send_convert_ucast(struct cdp_vdev *vdev_handle, 397 qdf_nbuf_t nbuf, uint8_t newmac[][DP_MAC_ADDR_LEN], 398 uint8_t new_mac_cnt); 399 void dp_tx_me_alloc_descriptor(struct cdp_pdev *pdev); 400 401 void dp_tx_me_free_descriptor(struct cdp_pdev *pdev); 402 QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev, 403 uint32_t stats_type_upload_mask, uint32_t config_param_0, 404 uint32_t config_param_1, uint32_t config_param_2, 405 uint32_t config_param_3, int cookie, int cookie_msb, 406 uint8_t mac_id); 407 void dp_htt_stats_print_tag(uint8_t tag_type, uint32_t *tag_buf); 408 void dp_htt_stats_copy_tag(struct dp_pdev *pdev, uint8_t tag_type, uint32_t *tag_buf); 409 void dp_peer_rxtid_stats(struct dp_peer *peer, void (*callback_fn), 410 void *cb_ctxt); 411 void dp_set_pn_check_wifi3(struct cdp_vdev *vdev_handle, 412 struct cdp_peer *peer_handle, enum cdp_sec_type sec_type, 413 uint32_t *rx_pn); 414 415 void *dp_get_pdev_for_mac_id(struct dp_soc *soc, uint32_t mac_id); 416 void dp_mark_peer_inact(void *peer_handle, bool inactive); 417 bool dp_set_inact_params(struct cdp_pdev *pdev_handle, 418 u_int16_t inact_check_interval, 419 u_int16_t inact_normal, u_int16_t inact_overload); 420 bool dp_start_inact_timer(struct cdp_pdev *pdev_handle, bool enable); 421 void dp_set_overload(struct cdp_pdev *pdev_handle, bool overload); 422 bool dp_peer_is_inact(void *peer_handle); 423 void dp_init_inact_timer(struct dp_soc *soc); 424 void dp_free_inact_timer(struct dp_soc *soc); 425 426 /* 427 * dp_get_mac_id_for_pdev() - Return mac corresponding to pdev for mac 428 * 429 * @mac_id: MAC id 430 * @pdev_id: pdev_id corresponding to pdev, 0 for MCL 431 * 432 * Single pdev using both MACs will operate on both MAC rings, 433 * which is the case for MCL. 434 * For WIN each PDEV will operate one ring, so index is zero. 435 * 436 */ 437 static inline int dp_get_mac_id_for_pdev(uint32_t mac_id, uint32_t pdev_id) 438 { 439 if (mac_id && pdev_id) { 440 qdf_print("Both mac_id and pdev_id cannot be non zero"); 441 QDF_BUG(0); 442 return 0; 443 } 444 return (mac_id + pdev_id); 445 } 446 447 /* 448 * dp_get_mac_id_for_mac() - Return mac corresponding WIN and MCL mac_ids 449 * 450 * @soc: handle to DP soc 451 * @mac_id: MAC id 452 * 453 * Single pdev using both MACs will operate on both MAC rings, 454 * which is the case for MCL. 455 * For WIN each PDEV will operate one ring, so index is zero. 456 * 457 */ 458 static inline int dp_get_mac_id_for_mac(struct dp_soc *soc, uint32_t mac_id) 459 { 460 /* 461 * Single pdev using both MACs will operate on both MAC rings, 462 * which is the case for MCL. 463 */ 464 if (!wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx)) 465 return mac_id; 466 467 /* For WIN each PDEV will operate one ring, so index is zero. */ 468 return 0; 469 } 470 471 #ifdef WDI_EVENT_ENABLE 472 QDF_STATUS dp_h2t_cfg_stats_msg_send(struct dp_pdev *pdev, 473 uint32_t stats_type_upload_mask, 474 uint8_t mac_id); 475 476 int dp_wdi_event_unsub(struct cdp_pdev *txrx_pdev_handle, 477 void *event_cb_sub_handle, 478 uint32_t event); 479 480 int dp_wdi_event_sub(struct cdp_pdev *txrx_pdev_handle, 481 void *event_cb_sub_handle, 482 uint32_t event); 483 484 void dp_wdi_event_handler(enum WDI_EVENT event, void *soc, 485 void *data, u_int16_t peer_id, 486 int status, u_int8_t pdev_id); 487 488 int dp_wdi_event_attach(struct dp_pdev *txrx_pdev); 489 int dp_wdi_event_detach(struct dp_pdev *txrx_pdev); 490 int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event, 491 bool enable); 492 void *dp_get_pldev(struct cdp_pdev *txrx_pdev); 493 void dp_pkt_log_init(struct cdp_pdev *ppdev, void *scn); 494 495 static inline void dp_hif_update_pipe_callback(void *soc, void *cb_context, 496 QDF_STATUS (*callback)(void *, qdf_nbuf_t, uint8_t), uint8_t pipe_id) 497 { 498 struct hif_msg_callbacks hif_pipe_callbacks; 499 struct dp_soc *dp_soc = (struct dp_soc *)soc; 500 501 /* TODO: Temporary change to bypass HTC connection for this new 502 * HIF pipe, which will be used for packet log and other high- 503 * priority HTT messages. Proper HTC connection to be added 504 * later once required FW changes are available 505 */ 506 hif_pipe_callbacks.rxCompletionHandler = callback; 507 hif_pipe_callbacks.Context = cb_context; 508 hif_update_pipe_callback(dp_soc->hif_handle, 509 DP_HTT_T2H_HP_PIPE, &hif_pipe_callbacks); 510 } 511 512 #else 513 static inline int dp_wdi_event_unsub(struct cdp_pdev *txrx_pdev_handle, 514 void *event_cb_sub_handle, 515 uint32_t event) 516 { 517 return 0; 518 } 519 520 static inline int dp_wdi_event_sub(struct cdp_pdev *txrx_pdev_handle, 521 void *event_cb_sub_handle, 522 uint32_t event) 523 { 524 return 0; 525 } 526 527 static inline void dp_wdi_event_handler(enum WDI_EVENT event, void *soc, 528 void *data, u_int16_t peer_id, 529 int status, u_int8_t pdev_id) 530 { 531 } 532 533 static inline int dp_wdi_event_attach(struct dp_pdev *txrx_pdev) 534 { 535 return 0; 536 } 537 538 static inline int dp_wdi_event_detach(struct dp_pdev *txrx_pdev) 539 { 540 return 0; 541 } 542 543 static inline int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event, 544 bool enable) 545 { 546 return 0; 547 } 548 static inline QDF_STATUS dp_h2t_cfg_stats_msg_send(struct dp_pdev *pdev, 549 uint32_t stats_type_upload_mask, uint8_t mac_id) 550 { 551 return 0; 552 } 553 static inline void dp_hif_update_pipe_callback(void *soc, void *cb_context, 554 QDF_STATUS (*callback)(void *, qdf_nbuf_t, uint8_t), uint8_t pipe_id) 555 { 556 } 557 #endif /* CONFIG_WIN */ 558 #ifdef QCA_LL_TX_FLOW_CONTROL_V2 559 void dp_tx_dump_flow_pool_info(void *soc); 560 int dp_tx_delete_flow_pool(struct dp_soc *soc, struct dp_tx_desc_pool_s *pool, 561 bool force); 562 #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */ 563 #endif /* #ifndef _DP_INTERNAL_H_ */ 564