Lines Matching refs:htc

40 static inline void ath10k_htc_restore_tx_skb(struct ath10k_htc *htc,  in ath10k_htc_restore_tx_skb()  argument
45 if (htc->ar->bus_param.dev_type != ATH10K_DEV_TYPE_HL) in ath10k_htc_restore_tx_skb()
46 dma_unmap_single(htc->ar->dev, skb_cb->paddr, skb->len, DMA_TO_DEVICE); in ath10k_htc_restore_tx_skb()
53 struct ath10k *ar = ep->htc->ar; in ath10k_htc_notify_tx_completion()
60 ath10k_htc_restore_tx_skb(ep->htc, skb); in ath10k_htc_notify_tx_completion()
73 ep->ep_ops.ep_tx_complete(ep->htc->ar, skb); in ath10k_htc_notify_tx_completion()
91 spin_lock_bh(&ep->htc->tx_lock); in ath10k_htc_prepare_tx_skb()
93 spin_unlock_bh(&ep->htc->tx_lock); in ath10k_htc_prepare_tx_skb()
100 struct ath10k_htc *htc = ep->htc; in ath10k_htc_consume_credit() local
101 struct ath10k *ar = htc->ar; in ath10k_htc_consume_credit()
109 spin_lock_bh(&htc->tx_lock); in ath10k_htc_consume_credit()
127 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_consume_credit()
133 struct ath10k_htc *htc = ep->htc; in ath10k_htc_release_credit() local
134 struct ath10k *ar = htc->ar; in ath10k_htc_release_credit()
142 spin_lock_bh(&htc->tx_lock); in ath10k_htc_release_credit()
147 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_release_credit()
150 ep->ep_ops.ep_tx_credits(htc->ar); in ath10k_htc_release_credit()
153 int ath10k_htc_send(struct ath10k_htc *htc, in ath10k_htc_send() argument
157 struct ath10k *ar = htc->ar; in ath10k_htc_send()
158 struct ath10k_htc_ep *ep = &htc->endpoint[eid]; in ath10k_htc_send()
161 struct device *dev = htc->ar->dev; in ath10k_htc_send()
165 if (htc->ar->state == ATH10K_STATE_WEDGED) in ath10k_htc_send()
199 ret = ath10k_hif_tx_sg(htc->ar, ep->ul_pipe_id, &sg_item, 1); in ath10k_htc_send()
217 struct ath10k_htc *htc = &ar->htc; in ath10k_htc_tx_completion_handler() local
225 ep = &htc->endpoint[skb_cb->eid]; in ath10k_htc_tx_completion_handler()
237 ath10k_htc_process_credit_report(struct ath10k_htc *htc, in ath10k_htc_process_credit_report() argument
242 struct ath10k *ar = htc->ar; in ath10k_htc_process_credit_report()
251 spin_lock_bh(&htc->tx_lock); in ath10k_htc_process_credit_report()
256 ep = &htc->endpoint[report->eid]; in ath10k_htc_process_credit_report()
263 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_process_credit_report()
264 ep->ep_ops.ep_tx_credits(htc->ar); in ath10k_htc_process_credit_report()
265 spin_lock_bh(&htc->tx_lock); in ath10k_htc_process_credit_report()
268 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_process_credit_report()
272 ath10k_htc_process_lookahead(struct ath10k_htc *htc, in ath10k_htc_process_lookahead() argument
279 struct ath10k *ar = htc->ar; in ath10k_htc_process_lookahead()
304 ath10k_htc_process_lookahead_bundle(struct ath10k_htc *htc, in ath10k_htc_process_lookahead_bundle() argument
311 struct ath10k *ar = htc->ar; in ath10k_htc_process_lookahead_bundle()
314 if (!bundle_cnt || (bundle_cnt > htc->max_msgs_per_htc_bundle)) { in ath10k_htc_process_lookahead_bundle()
335 int ath10k_htc_process_trailer(struct ath10k_htc *htc, in ath10k_htc_process_trailer() argument
343 struct ath10k *ar = htc->ar; in ath10k_htc_process_trailer()
377 ath10k_htc_process_credit_report(htc, in ath10k_htc_process_trailer()
389 status = ath10k_htc_process_lookahead(htc, in ath10k_htc_process_trailer()
398 status = ath10k_htc_process_lookahead_bundle(htc, in ath10k_htc_process_trailer()
430 struct ath10k_htc *htc = &ar->htc; in ath10k_htc_rx_completion_handler() local
451 ep = &htc->endpoint[eid]; in ath10k_htc_rx_completion_handler()
491 status = ath10k_htc_process_trailer(htc, trailer, in ath10k_htc_rx_completion_handler()
518 struct ath10k_htc *htc = &ar->htc; in ath10k_htc_control_rx_complete() local
525 if (completion_done(&htc->ctl_resp)) { in ath10k_htc_control_rx_complete()
530 complete(&htc->ctl_resp); in ath10k_htc_control_rx_complete()
534 htc->control_resp_len = in ath10k_htc_control_rx_complete()
538 memcpy(htc->control_resp_buffer, skb->data, in ath10k_htc_control_rx_complete()
539 htc->control_resp_len); in ath10k_htc_control_rx_complete()
541 complete(&htc->ctl_resp); in ath10k_htc_control_rx_complete()
544 htc->htc_ops.target_send_suspend_complete(ar); in ath10k_htc_control_rx_complete()
595 static void ath10k_htc_reset_endpoint_states(struct ath10k_htc *htc) in ath10k_htc_reset_endpoint_states() argument
601 ep = &htc->endpoint[i]; in ath10k_htc_reset_endpoint_states()
606 ep->htc = htc; in ath10k_htc_reset_endpoint_states()
611 static u8 ath10k_htc_get_credit_allocation(struct ath10k_htc *htc, in ath10k_htc_get_credit_allocation() argument
620 allocation = htc->total_transmit_credits; in ath10k_htc_get_credit_allocation()
630 struct ath10k_htc *htc = ep->htc; in ath10k_htc_send_bundle() local
631 struct ath10k *ar = htc->ar; in ath10k_htc_send_bundle()
646 ret = ath10k_hif_tx_sg(htc->ar, ep->ul_pipe_id, &sg_item, 1); in ath10k_htc_send_bundle()
674 struct ath10k_htc *htc = ep->htc; in ath10k_htc_send_one_skb() local
675 struct ath10k *ar = htc->ar; in ath10k_htc_send_one_skb()
678 ret = ath10k_htc_send(htc, ep->eid, skb); in ath10k_htc_send_one_skb()
689 struct ath10k_htc *htc = ep->htc; in ath10k_htc_send_bundle_skbs() local
696 if (htc->ar->state == ATH10K_STATE_WEDGED) in ath10k_htc_send_bundle_skbs()
795 for (i = 0; i < ARRAY_SIZE(ar->htc.endpoint); i++) { in ath10k_htc_bundle_tx_work()
796 ep = &ar->htc.endpoint[i]; in ath10k_htc_bundle_tx_work()
825 for (i = 0; i < ARRAY_SIZE(ar->htc.endpoint); i++) { in ath10k_htc_tx_complete_work()
826 ep = &ar->htc.endpoint[i]; in ath10k_htc_tx_complete_work()
842 int ath10k_htc_send_hl(struct ath10k_htc *htc, in ath10k_htc_send_hl() argument
846 struct ath10k_htc_ep *ep = &htc->endpoint[eid]; in ath10k_htc_send_hl()
847 struct ath10k *ar = htc->ar; in ath10k_htc_send_hl()
862 return ath10k_htc_send(htc, eid, skb); in ath10k_htc_send_hl()
868 if (ep->htc->max_msgs_per_htc_bundle >= ATH10K_MIN_MSG_PER_HTC_TX_BUNDLE && in ath10k_htc_setup_tx_req()
884 for (i = 0; i < ARRAY_SIZE(ar->htc.endpoint); i++) { in ath10k_htc_stop_hl()
885 ep = &ar->htc.endpoint[i]; in ath10k_htc_stop_hl()
897 int ath10k_htc_wait_target(struct ath10k_htc *htc) in ath10k_htc_wait_target() argument
899 struct ath10k *ar = htc->ar; in ath10k_htc_wait_target()
905 time_left = wait_for_completion_timeout(&htc->ctl_resp, in ath10k_htc_wait_target()
917 ath10k_hif_send_complete_check(htc->ar, i, 1); in ath10k_htc_wait_target()
920 wait_for_completion_timeout(&htc->ctl_resp, in ath10k_htc_wait_target()
932 if (htc->control_resp_len < sizeof(msg->hdr) + sizeof(msg->ready)) { in ath10k_htc_wait_target()
934 htc->control_resp_len); in ath10k_htc_wait_target()
938 msg = (struct ath10k_htc_msg *)htc->control_resp_buffer; in ath10k_htc_wait_target()
946 htc->total_transmit_credits = __le16_to_cpu(msg->ready.credit_count); in ath10k_htc_wait_target()
947 htc->target_credit_size = __le16_to_cpu(msg->ready.credit_size); in ath10k_htc_wait_target()
951 htc->total_transmit_credits, in ath10k_htc_wait_target()
952 htc->target_credit_size); in ath10k_htc_wait_target()
954 if ((htc->total_transmit_credits == 0) || in ath10k_htc_wait_target()
955 (htc->target_credit_size == 0)) { in ath10k_htc_wait_target()
963 if (htc->control_resp_len >= in ath10k_htc_wait_target()
965 htc->alt_data_credit_size = in ath10k_htc_wait_target()
968 htc->max_msgs_per_htc_bundle = in ath10k_htc_wait_target()
973 htc->max_msgs_per_htc_bundle, in ath10k_htc_wait_target()
974 htc->alt_data_credit_size); in ath10k_htc_wait_target()
983 void ath10k_htc_change_tx_credit_flow(struct ath10k_htc *htc, in ath10k_htc_change_tx_credit_flow() argument
987 struct ath10k *ar = htc->ar; in ath10k_htc_change_tx_credit_flow()
988 struct ath10k_htc_ep *ep = &ar->htc.endpoint[eid]; in ath10k_htc_change_tx_credit_flow()
993 int ath10k_htc_connect_service(struct ath10k_htc *htc, in ath10k_htc_connect_service() argument
997 struct ath10k *ar = htc->ar; in ath10k_htc_connect_service()
1021 tx_alloc = ath10k_htc_get_credit_allocation(htc, in ath10k_htc_connect_service()
1028 skb = ath10k_htc_build_tx_ctrl_skb(htc->ar); in ath10k_htc_connect_service()
1054 reinit_completion(&htc->ctl_resp); in ath10k_htc_connect_service()
1056 status = ath10k_htc_send(htc, ATH10K_HTC_EP_0, skb); in ath10k_htc_connect_service()
1063 time_left = wait_for_completion_timeout(&htc->ctl_resp, in ath10k_htc_connect_service()
1071 msg = (struct ath10k_htc_msg *)htc->control_resp_buffer; in ath10k_htc_connect_service()
1077 (htc->control_resp_len < sizeof(msg->hdr) + in ath10k_htc_connect_service()
1109 ep = &htc->endpoint[assigned_eid]; in ath10k_htc_connect_service()
1124 ep->tx_credit_size = htc->target_credit_size; in ath10k_htc_connect_service()
1127 htc->alt_data_credit_size != 0) in ath10k_htc_connect_service()
1128 ep->tx_credit_size = htc->alt_data_credit_size; in ath10k_htc_connect_service()
1133 status = ath10k_hif_map_service_to_pipe(htc->ar, in ath10k_htc_connect_service()
1196 status = ath10k_htc_connect_service(&ar->htc, &conn_req, &conn_resp); in ath10k_htc_pktlog_connect()
1225 int ath10k_htc_start(struct ath10k_htc *htc) in ath10k_htc_start() argument
1227 struct ath10k *ar = htc->ar; in ath10k_htc_start()
1232 skb = ath10k_htc_build_tx_ctrl_skb(htc->ar); in ath10k_htc_start()
1248 htc->max_msgs_per_htc_bundle; in ath10k_htc_start()
1252 status = ath10k_htc_send(htc, ATH10K_HTC_EP_0, skb); in ath10k_htc_start()
1273 struct ath10k_htc *htc = &ar->htc; in ath10k_htc_init() local
1277 spin_lock_init(&htc->tx_lock); in ath10k_htc_init()
1279 ath10k_htc_reset_endpoint_states(htc); in ath10k_htc_init()
1281 htc->ar = ar; in ath10k_htc_init()
1292 status = ath10k_htc_connect_service(htc, &conn_req, &conn_resp); in ath10k_htc_init()
1299 init_completion(&htc->ctl_resp); in ath10k_htc_init()