Lines Matching refs:htc

69 	spin_lock_bh(&ep->htc->tx_lock);  in ath11k_htc_prepare_tx_skb()
71 spin_unlock_bh(&ep->htc->tx_lock); in ath11k_htc_prepare_tx_skb()
74 int ath11k_htc_send(struct ath11k_htc *htc, in ath11k_htc_send() argument
78 struct ath11k_htc_ep *ep = &htc->endpoint[eid]; in ath11k_htc_send()
80 struct device *dev = htc->ab->dev; in ath11k_htc_send()
81 struct ath11k_base *ab = htc->ab; in ath11k_htc_send()
95 credits = DIV_ROUND_UP(skb->len, htc->target_credit_size); in ath11k_htc_send()
96 spin_lock_bh(&htc->tx_lock); in ath11k_htc_send()
101 spin_unlock_bh(&htc->tx_lock); in ath11k_htc_send()
109 spin_unlock_bh(&htc->tx_lock); in ath11k_htc_send()
122 ret = ath11k_ce_send(htc->ab, skb, ep->ul_pipe_id, ep->eid); in ath11k_htc_send()
132 spin_lock_bh(&htc->tx_lock); in ath11k_htc_send()
137 spin_unlock_bh(&htc->tx_lock); in ath11k_htc_send()
140 ep->ep_ops.ep_tx_credits(htc->ab); in ath11k_htc_send()
148 ath11k_htc_process_credit_report(struct ath11k_htc *htc, in ath11k_htc_process_credit_report() argument
153 struct ath11k_base *ab = htc->ab; in ath11k_htc_process_credit_report()
162 spin_lock_bh(&htc->tx_lock); in ath11k_htc_process_credit_report()
167 ep = &htc->endpoint[report->eid]; in ath11k_htc_process_credit_report()
174 spin_unlock_bh(&htc->tx_lock); in ath11k_htc_process_credit_report()
175 ep->ep_ops.ep_tx_credits(htc->ab); in ath11k_htc_process_credit_report()
176 spin_lock_bh(&htc->tx_lock); in ath11k_htc_process_credit_report()
179 spin_unlock_bh(&htc->tx_lock); in ath11k_htc_process_credit_report()
182 static int ath11k_htc_process_trailer(struct ath11k_htc *htc, in ath11k_htc_process_trailer() argument
187 struct ath11k_base *ab = htc->ab; in ath11k_htc_process_trailer()
217 ath11k_htc_process_credit_report(htc, in ath11k_htc_process_trailer()
255 struct ath11k_htc *htc = &ab->htc; in ath11k_htc_tx_completion_handler() local
266 ep = &htc->endpoint[eid]; in ath11k_htc_tx_completion_handler()
267 spin_lock_bh(&htc->tx_lock); in ath11k_htc_tx_completion_handler()
269 spin_unlock_bh(&htc->tx_lock); in ath11k_htc_tx_completion_handler()
274 ep_tx_complete(htc->ab, skb); in ath11k_htc_tx_completion_handler()
286 struct ath11k_htc *htc = &ab->htc; in ath11k_htc_rx_completion_handler() local
305 ep = &htc->endpoint[eid]; in ath11k_htc_rx_completion_handler()
342 status = ath11k_htc_process_trailer(htc, trailer, in ath11k_htc_rx_completion_handler()
361 if (completion_done(&htc->ctl_resp)) { in ath11k_htc_rx_completion_handler()
366 complete(&htc->ctl_resp); in ath11k_htc_rx_completion_handler()
370 htc->control_resp_len = in ath11k_htc_rx_completion_handler()
374 memcpy(htc->control_resp_buffer, skb->data, in ath11k_htc_rx_completion_handler()
375 htc->control_resp_len); in ath11k_htc_rx_completion_handler()
377 complete(&htc->ctl_resp); in ath11k_htc_rx_completion_handler()
457 static void ath11k_htc_reset_endpoint_states(struct ath11k_htc *htc) in ath11k_htc_reset_endpoint_states() argument
463 ep = &htc->endpoint[i]; in ath11k_htc_reset_endpoint_states()
468 ep->htc = htc; in ath11k_htc_reset_endpoint_states()
473 static u8 ath11k_htc_get_credit_allocation(struct ath11k_htc *htc, in ath11k_htc_get_credit_allocation() argument
479 if (htc->service_alloc_table[i].service_id == service_id) { in ath11k_htc_get_credit_allocation()
481 htc->service_alloc_table[i].credit_allocation; in ath11k_htc_get_credit_allocation()
488 static int ath11k_htc_setup_target_buffer_assignments(struct ath11k_htc *htc) in ath11k_htc_setup_target_buffer_assignments() argument
498 credits = htc->total_transmit_credits; in ath11k_htc_setup_target_buffer_assignments()
499 serv_entry = htc->service_alloc_table; in ath11k_htc_setup_target_buffer_assignments()
501 if ((htc->wmi_ep_count == 0) || in ath11k_htc_setup_target_buffer_assignments()
502 (htc->wmi_ep_count > ARRAY_SIZE(svc_id))) in ath11k_htc_setup_target_buffer_assignments()
506 credits = credits / htc->wmi_ep_count; in ath11k_htc_setup_target_buffer_assignments()
507 for (i = 0; i < htc->wmi_ep_count; i++) { in ath11k_htc_setup_target_buffer_assignments()
515 int ath11k_htc_wait_target(struct ath11k_htc *htc) in ath11k_htc_wait_target() argument
518 struct ath11k_base *ab = htc->ab; in ath11k_htc_wait_target()
525 time_left = wait_for_completion_timeout(&htc->ctl_resp, in ath11k_htc_wait_target()
531 ath11k_ce_per_engine_service(htc->ab, i); in ath11k_htc_wait_target()
534 wait_for_completion_timeout(&htc->ctl_resp, in ath11k_htc_wait_target()
546 if (htc->control_resp_len < sizeof(*ready)) { in ath11k_htc_wait_target()
548 htc->control_resp_len); in ath11k_htc_wait_target()
552 ready = (struct ath11k_htc_ready *)htc->control_resp_buffer; in ath11k_htc_wait_target()
563 htc->total_transmit_credits = credit_count; in ath11k_htc_wait_target()
564 htc->target_credit_size = credit_size; in ath11k_htc_wait_target()
568 htc->total_transmit_credits, htc->target_credit_size); in ath11k_htc_wait_target()
570 if ((htc->total_transmit_credits == 0) || in ath11k_htc_wait_target()
571 (htc->target_credit_size == 0)) { in ath11k_htc_wait_target()
580 htc->total_transmit_credits = 1; in ath11k_htc_wait_target()
582 ath11k_htc_setup_target_buffer_assignments(htc); in ath11k_htc_wait_target()
587 int ath11k_htc_connect_service(struct ath11k_htc *htc, in ath11k_htc_connect_service() argument
591 struct ath11k_base *ab = htc->ab; in ath11k_htc_connect_service()
614 tx_alloc = ath11k_htc_get_credit_allocation(htc, in ath11k_htc_connect_service()
621 skb = ath11k_htc_build_tx_ctrl_skb(htc->ab); in ath11k_htc_connect_service()
654 reinit_completion(&htc->ctl_resp); in ath11k_htc_connect_service()
656 status = ath11k_htc_send(htc, ATH11K_HTC_EP_0, skb); in ath11k_htc_connect_service()
663 time_left = wait_for_completion_timeout(&htc->ctl_resp, in ath11k_htc_connect_service()
671 resp_msg = (struct ath11k_htc_conn_svc_resp *)htc->control_resp_buffer; in ath11k_htc_connect_service()
677 (htc->control_resp_len < sizeof(*resp_msg))) { in ath11k_htc_connect_service()
714 ep = &htc->endpoint[assigned_eid]; in ath11k_htc_connect_service()
735 status = ath11k_hif_map_service_to_pipe(htc->ab, in ath11k_htc_connect_service()
757 int ath11k_htc_start(struct ath11k_htc *htc) in ath11k_htc_start() argument
761 struct ath11k_base *ab = htc->ab; in ath11k_htc_start()
764 skb = ath11k_htc_build_tx_ctrl_skb(htc->ab); in ath11k_htc_start()
780 status = ath11k_htc_send(htc, ATH11K_HTC_EP_0, skb); in ath11k_htc_start()
791 struct ath11k_htc *htc = &ab->htc; in ath11k_htc_init() local
796 spin_lock_init(&htc->tx_lock); in ath11k_htc_init()
798 ath11k_htc_reset_endpoint_states(htc); in ath11k_htc_init()
800 htc->ab = ab; in ath11k_htc_init()
804 htc->wmi_ep_count = 1; in ath11k_htc_init()
808 htc->wmi_ep_count = 2; in ath11k_htc_init()
811 htc->wmi_ep_count = 3; in ath11k_htc_init()
814 htc->wmi_ep_count = ab->hw_params.max_radios; in ath11k_htc_init()
827 ret = ath11k_htc_connect_service(htc, &conn_req, &conn_resp); in ath11k_htc_init()
833 init_completion(&htc->ctl_resp); in ath11k_htc_init()