Lines Matching refs:ab
17 static void ath12k_dp_htt_htc_tx_complete(struct ath12k_base *ab, in ath12k_dp_htt_htc_tx_complete() argument
25 struct ath12k_base *ab = ar->ab; in ath12k_dp_peer_cleanup() local
30 spin_lock_bh(&ab->base_lock); in ath12k_dp_peer_cleanup()
31 peer = ath12k_peer_find(ab, vdev_id, addr); in ath12k_dp_peer_cleanup()
33 ath12k_warn(ab, "failed to lookup peer %pM on vdev %d\n", in ath12k_dp_peer_cleanup()
35 spin_unlock_bh(&ab->base_lock); in ath12k_dp_peer_cleanup()
42 spin_unlock_bh(&ab->base_lock); in ath12k_dp_peer_cleanup()
47 struct ath12k_base *ab = ar->ab; in ath12k_dp_peer_setup() local
59 ath12k_warn(ab, "failed to set default routing %d peer :%pM vdev_id :%d\n", in ath12k_dp_peer_setup()
68 ath12k_warn(ab, "failed to setup rxd tid queue for tid %d: %d\n", in ath12k_dp_peer_setup()
76 ath12k_warn(ab, "failed to setup rx defrag context\n"); in ath12k_dp_peer_setup()
85 spin_lock_bh(&ab->base_lock); in ath12k_dp_peer_setup()
87 peer = ath12k_peer_find(ab, vdev_id, addr); in ath12k_dp_peer_setup()
89 ath12k_warn(ab, "failed to find the peer to del rx tid\n"); in ath12k_dp_peer_setup()
90 spin_unlock_bh(&ab->base_lock); in ath12k_dp_peer_setup()
97 spin_unlock_bh(&ab->base_lock); in ath12k_dp_peer_setup()
102 void ath12k_dp_srng_cleanup(struct ath12k_base *ab, struct dp_srng *ring) in ath12k_dp_srng_cleanup() argument
107 dma_free_coherent(ab->dev, ring->size, ring->vaddr_unaligned, in ath12k_dp_srng_cleanup()
127 static int ath12k_dp_srng_calculate_msi_group(struct ath12k_base *ab, in ath12k_dp_srng_calculate_msi_group() argument
135 grp_mask = &ab->hw_params->ring_mask->rx_wbm_rel[0]; in ath12k_dp_srng_calculate_msi_group()
138 grp_mask = &ab->hw_params->ring_mask->tx[0]; in ath12k_dp_srng_calculate_msi_group()
142 grp_mask = &ab->hw_params->ring_mask->rx_err[0]; in ath12k_dp_srng_calculate_msi_group()
145 grp_mask = &ab->hw_params->ring_mask->rx[0]; in ath12k_dp_srng_calculate_msi_group()
148 grp_mask = &ab->hw_params->ring_mask->reo_status[0]; in ath12k_dp_srng_calculate_msi_group()
152 grp_mask = &ab->hw_params->ring_mask->rx_mon_dest[0]; in ath12k_dp_srng_calculate_msi_group()
155 grp_mask = &ab->hw_params->ring_mask->tx_mon_dest[0]; in ath12k_dp_srng_calculate_msi_group()
158 grp_mask = &ab->hw_params->ring_mask->host2rxdma[0]; in ath12k_dp_srng_calculate_msi_group()
178 static void ath12k_dp_srng_msi_setup(struct ath12k_base *ab, in ath12k_dp_srng_msi_setup() argument
186 ret = ath12k_hif_get_user_msi_vector(ab, "DP", in ath12k_dp_srng_msi_setup()
192 msi_group_number = ath12k_dp_srng_calculate_msi_group(ab, type, in ath12k_dp_srng_msi_setup()
195 ath12k_dbg(ab, ATH12K_DBG_PCI, in ath12k_dp_srng_msi_setup()
204 ath12k_dbg(ab, ATH12K_DBG_PCI, in ath12k_dp_srng_msi_setup()
209 ath12k_hif_get_msi_address(ab, &addr_lo, &addr_hi); in ath12k_dp_srng_msi_setup()
218 int ath12k_dp_srng_setup(struct ath12k_base *ab, struct dp_srng *ring, in ath12k_dp_srng_setup() argument
223 int entry_sz = ath12k_hal_srng_get_entrysize(ab, type); in ath12k_dp_srng_setup()
224 int max_entries = ath12k_hal_srng_get_max_entries(ab, type); in ath12k_dp_srng_setup()
234 ring->vaddr_unaligned = dma_alloc_coherent(ab->dev, ring->size, in ath12k_dp_srng_setup()
247 ath12k_dp_srng_msi_setup(ab, ¶ms, type, ring_num + mac_id); in ath12k_dp_srng_setup()
270 if (ab->hw_params->hw_ops->dp_srng_is_tx_comp_ring(ring_num)) { in ath12k_dp_srng_setup()
298 ath12k_warn(ab, "Not a valid ring type in dp :%d\n", type); in ath12k_dp_srng_setup()
302 ret = ath12k_hal_srng_setup(ab, type, ring_num, mac_id, ¶ms); in ath12k_dp_srng_setup()
304 ath12k_warn(ab, "failed to setup srng: %d ring_id %d\n", in ath12k_dp_srng_setup()
315 u32 ath12k_dp_tx_get_vdev_bank_config(struct ath12k_base *ab, struct ath12k_vif *arvif) in ath12k_dp_tx_get_vdev_bank_config() argument
323 test_bit(ATH12K_FLAG_HW_CRYPTO_DISABLED, &ab->dev_flags)) in ath12k_dp_tx_get_vdev_bank_config()
353 static int ath12k_dp_tx_get_bank_profile(struct ath12k_base *ab, struct ath12k_vif *arvif, in ath12k_dp_tx_get_bank_profile() argument
362 bank_config = ath12k_dp_tx_get_vdev_bank_config(ab, arvif); in ath12k_dp_tx_get_bank_profile()
381 ath12k_err(ab, "unable to find TX bank!"); in ath12k_dp_tx_get_bank_profile()
394 ath12k_hal_tx_configure_bank_register(ab, bank_config, bank_id); in ath12k_dp_tx_get_bank_profile()
396 ath12k_dbg(ab, ATH12K_DBG_DP_HTT, "dp_htt tcl bank_id %d input 0x%x match 0x%x num_users %u", in ath12k_dp_tx_get_bank_profile()
410 static void ath12k_dp_deinit_bank_profiles(struct ath12k_base *ab) in ath12k_dp_deinit_bank_profiles() argument
412 struct ath12k_dp *dp = &ab->dp; in ath12k_dp_deinit_bank_profiles()
418 static int ath12k_dp_init_bank_profiles(struct ath12k_base *ab) in ath12k_dp_init_bank_profiles() argument
420 struct ath12k_dp *dp = &ab->dp; in ath12k_dp_init_bank_profiles()
421 u32 num_tcl_banks = ab->hw_params->num_tcl_banks; in ath12k_dp_init_bank_profiles()
441 static void ath12k_dp_srng_common_cleanup(struct ath12k_base *ab) in ath12k_dp_srng_common_cleanup() argument
443 struct ath12k_dp *dp = &ab->dp; in ath12k_dp_srng_common_cleanup()
446 ath12k_dp_srng_cleanup(ab, &dp->reo_status_ring); in ath12k_dp_srng_common_cleanup()
447 ath12k_dp_srng_cleanup(ab, &dp->reo_cmd_ring); in ath12k_dp_srng_common_cleanup()
448 ath12k_dp_srng_cleanup(ab, &dp->reo_except_ring); in ath12k_dp_srng_common_cleanup()
449 ath12k_dp_srng_cleanup(ab, &dp->rx_rel_ring); in ath12k_dp_srng_common_cleanup()
450 ath12k_dp_srng_cleanup(ab, &dp->reo_reinject_ring); in ath12k_dp_srng_common_cleanup()
451 for (i = 0; i < ab->hw_params->max_tx_ring; i++) { in ath12k_dp_srng_common_cleanup()
452 ath12k_dp_srng_cleanup(ab, &dp->tx_ring[i].tcl_comp_ring); in ath12k_dp_srng_common_cleanup()
453 ath12k_dp_srng_cleanup(ab, &dp->tx_ring[i].tcl_data_ring); in ath12k_dp_srng_common_cleanup()
455 ath12k_dp_srng_cleanup(ab, &dp->tcl_status_ring); in ath12k_dp_srng_common_cleanup()
456 ath12k_dp_srng_cleanup(ab, &dp->tcl_cmd_ring); in ath12k_dp_srng_common_cleanup()
457 ath12k_dp_srng_cleanup(ab, &dp->wbm_desc_rel_ring); in ath12k_dp_srng_common_cleanup()
460 static int ath12k_dp_srng_common_setup(struct ath12k_base *ab) in ath12k_dp_srng_common_setup() argument
462 struct ath12k_dp *dp = &ab->dp; in ath12k_dp_srng_common_setup()
468 ret = ath12k_dp_srng_setup(ab, &dp->wbm_desc_rel_ring, in ath12k_dp_srng_common_setup()
472 ath12k_warn(ab, "failed to set up wbm2sw_release ring :%d\n", in ath12k_dp_srng_common_setup()
477 ret = ath12k_dp_srng_setup(ab, &dp->tcl_cmd_ring, HAL_TCL_CMD, 0, 0, in ath12k_dp_srng_common_setup()
480 ath12k_warn(ab, "failed to set up tcl_cmd ring :%d\n", ret); in ath12k_dp_srng_common_setup()
484 ret = ath12k_dp_srng_setup(ab, &dp->tcl_status_ring, HAL_TCL_STATUS, in ath12k_dp_srng_common_setup()
487 ath12k_warn(ab, "failed to set up tcl_status ring :%d\n", ret); in ath12k_dp_srng_common_setup()
491 for (i = 0; i < ab->hw_params->max_tx_ring; i++) { in ath12k_dp_srng_common_setup()
492 map = ab->hw_params->hal_ops->tcl_to_wbm_rbm_map; in ath12k_dp_srng_common_setup()
495 ret = ath12k_dp_srng_setup(ab, &dp->tx_ring[i].tcl_data_ring, in ath12k_dp_srng_common_setup()
499 ath12k_warn(ab, "failed to set up tcl_data ring (%d) :%d\n", in ath12k_dp_srng_common_setup()
504 ret = ath12k_dp_srng_setup(ab, &dp->tx_ring[i].tcl_comp_ring, in ath12k_dp_srng_common_setup()
508 ath12k_warn(ab, "failed to set up tcl_comp ring (%d) :%d\n", in ath12k_dp_srng_common_setup()
514 ret = ath12k_dp_srng_setup(ab, &dp->reo_reinject_ring, HAL_REO_REINJECT, in ath12k_dp_srng_common_setup()
517 ath12k_warn(ab, "failed to set up reo_reinject ring :%d\n", in ath12k_dp_srng_common_setup()
522 ret = ath12k_dp_srng_setup(ab, &dp->rx_rel_ring, HAL_WBM2SW_RELEASE, in ath12k_dp_srng_common_setup()
526 ath12k_warn(ab, "failed to set up rx_rel ring :%d\n", ret); in ath12k_dp_srng_common_setup()
530 ret = ath12k_dp_srng_setup(ab, &dp->reo_except_ring, HAL_REO_EXCEPTION, in ath12k_dp_srng_common_setup()
533 ath12k_warn(ab, "failed to set up reo_exception ring :%d\n", in ath12k_dp_srng_common_setup()
538 ret = ath12k_dp_srng_setup(ab, &dp->reo_cmd_ring, HAL_REO_CMD, in ath12k_dp_srng_common_setup()
541 ath12k_warn(ab, "failed to set up reo_cmd ring :%d\n", ret); in ath12k_dp_srng_common_setup()
545 srng = &ab->hal.srng_list[dp->reo_cmd_ring.ring_id]; in ath12k_dp_srng_common_setup()
546 ath12k_hal_reo_init_cmd_ring(ab, srng); in ath12k_dp_srng_common_setup()
548 ret = ath12k_dp_srng_setup(ab, &dp->reo_status_ring, HAL_REO_STATUS, in ath12k_dp_srng_common_setup()
551 ath12k_warn(ab, "failed to set up reo_status ring :%d\n", ret); in ath12k_dp_srng_common_setup()
570 ath12k_hal_reo_hw_setup(ab, ring_hash_map); in ath12k_dp_srng_common_setup()
575 ath12k_dp_srng_common_cleanup(ab); in ath12k_dp_srng_common_setup()
580 static void ath12k_dp_scatter_idle_link_desc_cleanup(struct ath12k_base *ab) in ath12k_dp_scatter_idle_link_desc_cleanup() argument
582 struct ath12k_dp *dp = &ab->dp; in ath12k_dp_scatter_idle_link_desc_cleanup()
590 dma_free_coherent(ab->dev, HAL_WBM_IDLE_SCATTER_BUF_SIZE_MAX, in ath12k_dp_scatter_idle_link_desc_cleanup()
596 static int ath12k_dp_scatter_idle_link_desc_setup(struct ath12k_base *ab, in ath12k_dp_scatter_idle_link_desc_setup() argument
602 struct ath12k_dp *dp = &ab->dp; in ath12k_dp_scatter_idle_link_desc_setup()
616 ath12k_hal_srng_get_entrysize(ab, HAL_WBM_IDLE_LINK); in ath12k_dp_scatter_idle_link_desc_setup()
623 slist[i].vaddr = dma_alloc_coherent(ab->dev, in ath12k_dp_scatter_idle_link_desc_setup()
661 ath12k_hal_setup_link_idle_list(ab, slist, num_scatter_buf, in ath12k_dp_scatter_idle_link_desc_setup()
667 ath12k_dp_scatter_idle_link_desc_cleanup(ab); in ath12k_dp_scatter_idle_link_desc_setup()
673 ath12k_dp_link_desc_bank_free(struct ath12k_base *ab, in ath12k_dp_link_desc_bank_free() argument
680 dma_free_coherent(ab->dev, in ath12k_dp_link_desc_bank_free()
689 static int ath12k_dp_link_desc_bank_alloc(struct ath12k_base *ab, in ath12k_dp_link_desc_bank_alloc() argument
694 struct ath12k_dp *dp = &ab->dp; in ath12k_dp_link_desc_bank_alloc()
704 dma_alloc_coherent(ab->dev, desc_sz, in ath12k_dp_link_desc_bank_alloc()
723 ath12k_dp_link_desc_bank_free(ab, dp->link_desc_banks); in ath12k_dp_link_desc_bank_alloc()
728 void ath12k_dp_link_desc_cleanup(struct ath12k_base *ab, in ath12k_dp_link_desc_cleanup() argument
732 ath12k_dp_link_desc_bank_free(ab, desc_bank); in ath12k_dp_link_desc_cleanup()
735 ath12k_dp_srng_cleanup(ab, ring); in ath12k_dp_link_desc_cleanup()
736 ath12k_dp_scatter_idle_link_desc_cleanup(ab); in ath12k_dp_link_desc_cleanup()
740 static int ath12k_wbm_idle_ring_setup(struct ath12k_base *ab, u32 *n_link_desc) in ath12k_wbm_idle_ring_setup() argument
742 struct ath12k_dp *dp = &ab->dp; in ath12k_wbm_idle_ring_setup()
767 ret = ath12k_dp_srng_setup(ab, &dp->wbm_idle_ring, in ath12k_wbm_idle_ring_setup()
770 ath12k_warn(ab, "failed to setup wbm_idle_ring: %d\n", ret); in ath12k_wbm_idle_ring_setup()
776 int ath12k_dp_link_desc_setup(struct ath12k_base *ab, in ath12k_dp_link_desc_setup() argument
810 ret = ath12k_dp_link_desc_bank_alloc(ab, link_desc_banks, in ath12k_dp_link_desc_setup()
816 entry_sz = ath12k_hal_srng_get_entrysize(ab, ring_type); in ath12k_dp_link_desc_setup()
822 ret = ath12k_dp_scatter_idle_link_desc_setup(ab, tot_mem_sz, in ath12k_dp_link_desc_setup()
827 ath12k_warn(ab, "failed to setup scatting idle list descriptor :%d\n", in ath12k_dp_link_desc_setup()
837 ath12k_hal_srng_access_begin(ab, srng); in ath12k_dp_link_desc_setup()
846 (desc = ath12k_hal_srng_src_get_next_entry(ab, srng))) { in ath12k_dp_link_desc_setup()
855 ath12k_hal_srng_access_end(ab, srng); in ath12k_dp_link_desc_setup()
862 ath12k_dp_link_desc_bank_free(ab, link_desc_banks); in ath12k_dp_link_desc_setup()
867 int ath12k_dp_service_srng(struct ath12k_base *ab, in ath12k_dp_service_srng() argument
879 while (i < ab->hw_params->max_tx_ring) { in ath12k_dp_service_srng()
880 if (ab->hw_params->ring_mask->tx[grp_id] & in ath12k_dp_service_srng()
881 BIT(ab->hw_params->hal_ops->tcl_to_wbm_rbm_map[i].wbm_ring_num)) in ath12k_dp_service_srng()
882 ath12k_dp_tx_completion_handler(ab, i); in ath12k_dp_service_srng()
886 if (ab->hw_params->ring_mask->rx_err[grp_id]) { in ath12k_dp_service_srng()
887 work_done = ath12k_dp_rx_process_err(ab, napi, budget); in ath12k_dp_service_srng()
894 if (ab->hw_params->ring_mask->rx_wbm_rel[grp_id]) { in ath12k_dp_service_srng()
895 work_done = ath12k_dp_rx_process_wbm_err(ab, in ath12k_dp_service_srng()
905 if (ab->hw_params->ring_mask->rx[grp_id]) { in ath12k_dp_service_srng()
906 i = fls(ab->hw_params->ring_mask->rx[grp_id]) - 1; in ath12k_dp_service_srng()
907 work_done = ath12k_dp_rx_process(ab, i, napi, in ath12k_dp_service_srng()
915 if (ab->hw_params->ring_mask->rx_mon_dest[grp_id]) { in ath12k_dp_service_srng()
917 ring_mask = ab->hw_params->ring_mask->rx_mon_dest[grp_id]; in ath12k_dp_service_srng()
918 for (i = 0; i < ab->num_radios; i++) { in ath12k_dp_service_srng()
919 for (j = 0; j < ab->hw_params->num_rxmda_per_pdev; j++) { in ath12k_dp_service_srng()
920 int id = i * ab->hw_params->num_rxmda_per_pdev + j; in ath12k_dp_service_srng()
924 ath12k_dp_mon_process_ring(ab, id, napi, budget, in ath12k_dp_service_srng()
936 if (ab->hw_params->ring_mask->tx_mon_dest[grp_id]) { in ath12k_dp_service_srng()
938 ring_mask = ab->hw_params->ring_mask->tx_mon_dest[grp_id]; in ath12k_dp_service_srng()
939 for (i = 0; i < ab->num_radios; i++) { in ath12k_dp_service_srng()
940 for (j = 0; j < ab->hw_params->num_rxmda_per_pdev; j++) { in ath12k_dp_service_srng()
941 int id = i * ab->hw_params->num_rxmda_per_pdev + j; in ath12k_dp_service_srng()
945 ath12k_dp_mon_process_ring(ab, id, napi, budget, in ath12k_dp_service_srng()
957 if (ab->hw_params->ring_mask->reo_status[grp_id]) in ath12k_dp_service_srng()
958 ath12k_dp_rx_process_reo_status(ab); in ath12k_dp_service_srng()
960 if (ab->hw_params->ring_mask->host2rxdma[grp_id]) { in ath12k_dp_service_srng()
961 struct ath12k_dp *dp = &ab->dp; in ath12k_dp_service_srng()
964 ath12k_dp_rx_bufs_replenish(ab, 0, rx_ring, 0, in ath12k_dp_service_srng()
965 ab->hw_params->hal_params->rx_buf_rbm, in ath12k_dp_service_srng()
975 void ath12k_dp_pdev_free(struct ath12k_base *ab) in ath12k_dp_pdev_free() argument
979 del_timer_sync(&ab->mon_reap_timer); in ath12k_dp_pdev_free()
981 for (i = 0; i < ab->num_radios; i++) in ath12k_dp_pdev_free()
982 ath12k_dp_rx_pdev_free(ab, i); in ath12k_dp_pdev_free()
985 void ath12k_dp_pdev_pre_alloc(struct ath12k_base *ab) in ath12k_dp_pdev_pre_alloc() argument
991 for (i = 0; i < ab->num_radios; i++) { in ath12k_dp_pdev_pre_alloc()
992 ar = ab->pdevs[i].ar; in ath12k_dp_pdev_pre_alloc()
1004 struct ath12k_base *ab = from_timer(ab, t, mon_reap_timer); in ath12k_dp_service_mon_ring() local
1007 for (i = 0; i < ab->hw_params->num_rxmda_per_pdev; i++) in ath12k_dp_service_mon_ring()
1008 ath12k_dp_mon_process_ring(ab, i, NULL, DP_MON_SERVICE_BUDGET, in ath12k_dp_service_mon_ring()
1011 mod_timer(&ab->mon_reap_timer, jiffies + in ath12k_dp_service_mon_ring()
1015 static void ath12k_dp_mon_reap_timer_init(struct ath12k_base *ab) in ath12k_dp_mon_reap_timer_init() argument
1017 if (ab->hw_params->rxdma1_enable) in ath12k_dp_mon_reap_timer_init()
1020 timer_setup(&ab->mon_reap_timer, ath12k_dp_service_mon_ring, 0); in ath12k_dp_mon_reap_timer_init()
1023 int ath12k_dp_pdev_alloc(struct ath12k_base *ab) in ath12k_dp_pdev_alloc() argument
1029 ret = ath12k_dp_rx_htt_setup(ab); in ath12k_dp_pdev_alloc()
1033 ath12k_dp_mon_reap_timer_init(ab); in ath12k_dp_pdev_alloc()
1036 for (i = 0; i < ab->num_radios; i++) { in ath12k_dp_pdev_alloc()
1037 ar = ab->pdevs[i].ar; in ath12k_dp_pdev_alloc()
1038 ret = ath12k_dp_rx_pdev_alloc(ab, i); in ath12k_dp_pdev_alloc()
1040 ath12k_warn(ab, "failed to allocate pdev rx for pdev_id :%d\n", in ath12k_dp_pdev_alloc()
1046 ath12k_warn(ab, "failed to initialize mon pdev %d\n", i); in ath12k_dp_pdev_alloc()
1053 ath12k_dp_pdev_free(ab); in ath12k_dp_pdev_alloc()
1070 status = ath12k_htc_connect_service(&dp->ab->htc, &conn_req, in ath12k_dp_htt_connect()
1104 struct ath12k_base *ab = ar->ab; in ath12k_dp_vdev_tx_attach() local
1117 arvif->bank_id = ath12k_dp_tx_get_bank_profile(ab, arvif, &ab->dp); in ath12k_dp_vdev_tx_attach()
1121 ath12k_err(ar->ab, "Failed to initialize DP TX Banks"); in ath12k_dp_vdev_tx_attach()
1126 static void ath12k_dp_cc_cleanup(struct ath12k_base *ab) in ath12k_dp_cc_cleanup() argument
1130 struct ath12k_dp *dp = &ab->dp; in ath12k_dp_cc_cleanup()
1148 dma_unmap_single(ab->dev, ATH12K_SKB_RXCB(skb)->paddr, in ath12k_dp_cc_cleanup()
1175 dma_unmap_single(ab->dev, ATH12K_SKB_CB(skb)->paddr, in ath12k_dp_cc_cleanup()
1203 dma_free_coherent(ab->dev, ATH12K_PAGE_SIZE, in ath12k_dp_cc_cleanup()
1211 static void ath12k_dp_reoq_lut_cleanup(struct ath12k_base *ab) in ath12k_dp_reoq_lut_cleanup() argument
1213 struct ath12k_dp *dp = &ab->dp; in ath12k_dp_reoq_lut_cleanup()
1215 if (!ab->hw_params->reoq_lut_support) in ath12k_dp_reoq_lut_cleanup()
1221 dma_free_coherent(ab->dev, DP_REOQ_LUT_SIZE, in ath12k_dp_reoq_lut_cleanup()
1225 ath12k_hif_write32(ab, in ath12k_dp_reoq_lut_cleanup()
1226 HAL_SEQ_WCSS_UMAC_REO_REG + HAL_REO1_QDESC_LUT_BASE0(ab), 0); in ath12k_dp_reoq_lut_cleanup()
1229 void ath12k_dp_free(struct ath12k_base *ab) in ath12k_dp_free() argument
1231 struct ath12k_dp *dp = &ab->dp; in ath12k_dp_free()
1234 ath12k_dp_link_desc_cleanup(ab, dp->link_desc_banks, in ath12k_dp_free()
1237 ath12k_dp_cc_cleanup(ab); in ath12k_dp_free()
1238 ath12k_dp_reoq_lut_cleanup(ab); in ath12k_dp_free()
1239 ath12k_dp_deinit_bank_profiles(ab); in ath12k_dp_free()
1240 ath12k_dp_srng_common_cleanup(ab); in ath12k_dp_free()
1242 ath12k_dp_rx_reo_cmd_list_cleanup(ab); in ath12k_dp_free()
1244 for (i = 0; i < ab->hw_params->max_tx_ring; i++) in ath12k_dp_free()
1247 ath12k_dp_rx_free(ab); in ath12k_dp_free()
1251 void ath12k_dp_cc_config(struct ath12k_base *ab) in ath12k_dp_cc_config() argument
1253 u32 cmem_base = ab->qmi.dev_mem[ATH12K_QMI_DEVMEM_CMEM_INDEX].start; in ath12k_dp_cc_config()
1258 ath12k_hif_write32(ab, reo_base + HAL_REO1_SW_COOKIE_CFG0(ab), cmem_base); in ath12k_dp_cc_config()
1270 ath12k_hif_write32(ab, reo_base + HAL_REO1_SW_COOKIE_CFG1(ab), val); in ath12k_dp_cc_config()
1273 ath12k_hif_write32(ab, wbm_base + HAL_WBM_SW_COOKIE_CFG0, cmem_base); in ath12k_dp_cc_config()
1283 ath12k_hif_write32(ab, wbm_base + HAL_WBM_SW_COOKIE_CFG1, val); in ath12k_dp_cc_config()
1286 val = ath12k_hif_read32(ab, wbm_base + HAL_WBM_SW_COOKIE_CFG2); in ath12k_dp_cc_config()
1291 ath12k_hif_write32(ab, wbm_base + HAL_WBM_SW_COOKIE_CFG2, val); in ath12k_dp_cc_config()
1294 val = ath12k_hif_read32(ab, wbm_base + HAL_WBM_SW_COOKIE_CONVERT_CFG); in ath12k_dp_cc_config()
1296 ab->hw_params->hal_params->wbm2sw_cc_enable; in ath12k_dp_cc_config()
1298 ath12k_hif_write32(ab, wbm_base + HAL_WBM_SW_COOKIE_CONVERT_CFG, val); in ath12k_dp_cc_config()
1306 static inline void *ath12k_dp_cc_get_desc_addr_ptr(struct ath12k_base *ab, in ath12k_dp_cc_get_desc_addr_ptr() argument
1309 struct ath12k_dp *dp = &ab->dp; in ath12k_dp_cc_get_desc_addr_ptr()
1314 struct ath12k_rx_desc_info *ath12k_dp_get_rx_desc(struct ath12k_base *ab, in ath12k_dp_get_rx_desc() argument
1327 desc_addr_ptr = ath12k_dp_cc_get_desc_addr_ptr(ab, ppt_idx, spt_idx); in ath12k_dp_get_rx_desc()
1332 struct ath12k_tx_desc_info *ath12k_dp_get_tx_desc(struct ath12k_base *ab, in ath12k_dp_get_tx_desc() argument
1342 ppt_idx > ab->dp.num_spt_pages || in ath12k_dp_get_tx_desc()
1346 desc_addr_ptr = ath12k_dp_cc_get_desc_addr_ptr(ab, ppt_idx, spt_idx); in ath12k_dp_get_tx_desc()
1351 static int ath12k_dp_cc_desc_init(struct ath12k_base *ab) in ath12k_dp_cc_desc_init() argument
1353 struct ath12k_dp *dp = &ab->dp; in ath12k_dp_cc_desc_init()
1379 rx_desc_addr = ath12k_dp_cc_get_desc_addr_ptr(ab, i, j); in ath12k_dp_cc_desc_init()
1410 ath12k_dp_cc_get_desc_addr_ptr(ab, ppt_idx, j); in ath12k_dp_cc_desc_init()
1419 static int ath12k_dp_cc_init(struct ath12k_base *ab) in ath12k_dp_cc_init() argument
1421 struct ath12k_dp *dp = &ab->dp; in ath12k_dp_cc_init()
1443 ath12k_warn(ab, "SPT page allocation failure"); in ath12k_dp_cc_init()
1447 cmem_base = ab->qmi.dev_mem[ATH12K_QMI_DEVMEM_CMEM_INDEX].start; in ath12k_dp_cc_init()
1450 dp->spt_info[i].vaddr = dma_alloc_coherent(ab->dev, in ath12k_dp_cc_init()
1461 ath12k_warn(ab, "SPT allocated memory is not 4K aligned"); in ath12k_dp_cc_init()
1467 ath12k_hif_write32(ab, cmem_base + ATH12K_PPT_ADDR_OFFSET(i), in ath12k_dp_cc_init()
1471 ret = ath12k_dp_cc_desc_init(ab); in ath12k_dp_cc_init()
1473 ath12k_warn(ab, "HW CC desc init failed %d", ret); in ath12k_dp_cc_init()
1479 ath12k_dp_cc_cleanup(ab); in ath12k_dp_cc_init()
1483 static int ath12k_dp_reoq_lut_setup(struct ath12k_base *ab) in ath12k_dp_reoq_lut_setup() argument
1485 struct ath12k_dp *dp = &ab->dp; in ath12k_dp_reoq_lut_setup()
1487 if (!ab->hw_params->reoq_lut_support) in ath12k_dp_reoq_lut_setup()
1490 dp->reoq_lut.vaddr = dma_alloc_coherent(ab->dev, in ath12k_dp_reoq_lut_setup()
1495 ath12k_warn(ab, "failed to allocate memory for reoq table"); in ath12k_dp_reoq_lut_setup()
1499 ath12k_hif_write32(ab, HAL_SEQ_WCSS_UMAC_REO_REG + HAL_REO1_QDESC_LUT_BASE0(ab), in ath12k_dp_reoq_lut_setup()
1504 int ath12k_dp_alloc(struct ath12k_base *ab) in ath12k_dp_alloc() argument
1506 struct ath12k_dp *dp = &ab->dp; in ath12k_dp_alloc()
1513 dp->ab = ab; in ath12k_dp_alloc()
1521 ret = ath12k_wbm_idle_ring_setup(ab, &n_link_desc); in ath12k_dp_alloc()
1523 ath12k_warn(ab, "failed to setup wbm_idle_ring: %d\n", ret); in ath12k_dp_alloc()
1527 srng = &ab->hal.srng_list[dp->wbm_idle_ring.ring_id]; in ath12k_dp_alloc()
1529 ret = ath12k_dp_link_desc_setup(ab, dp->link_desc_banks, in ath12k_dp_alloc()
1532 ath12k_warn(ab, "failed to setup link desc: %d\n", ret); in ath12k_dp_alloc()
1536 ret = ath12k_dp_cc_init(ab); in ath12k_dp_alloc()
1539 ath12k_warn(ab, "failed to setup cookie converter %d\n", ret); in ath12k_dp_alloc()
1542 ret = ath12k_dp_init_bank_profiles(ab); in ath12k_dp_alloc()
1544 ath12k_warn(ab, "failed to setup bank profiles %d\n", ret); in ath12k_dp_alloc()
1548 ret = ath12k_dp_srng_common_setup(ab); in ath12k_dp_alloc()
1554 ret = ath12k_dp_reoq_lut_setup(ab); in ath12k_dp_alloc()
1556 ath12k_warn(ab, "failed to setup reoq table %d\n", ret); in ath12k_dp_alloc()
1560 for (i = 0; i < ab->hw_params->max_tx_ring; i++) { in ath12k_dp_alloc()
1576 ath12k_hal_tx_set_dscp_tid_map(ab, i); in ath12k_dp_alloc()
1578 ret = ath12k_dp_rx_alloc(ab); in ath12k_dp_alloc()
1587 ath12k_dp_rx_free(ab); in ath12k_dp_alloc()
1590 ath12k_dp_reoq_lut_cleanup(ab); in ath12k_dp_alloc()
1593 ath12k_dp_srng_common_cleanup(ab); in ath12k_dp_alloc()
1596 ath12k_dp_deinit_bank_profiles(ab); in ath12k_dp_alloc()
1599 ath12k_dp_cc_cleanup(ab); in ath12k_dp_alloc()
1602 ath12k_dp_link_desc_cleanup(ab, dp->link_desc_banks, in ath12k_dp_alloc()