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()
69 ath10k_htc_restore_tx_skb(ep->htc, skb); in ath10k_htc_notify_tx_completion()
82 ep->ep_ops.ep_tx_complete(ep->htc->ar, skb); in ath10k_htc_notify_tx_completion()
100 spin_lock_bh(&ep->htc->tx_lock); in ath10k_htc_prepare_tx_skb()
102 spin_unlock_bh(&ep->htc->tx_lock); in ath10k_htc_prepare_tx_skb()
109 struct ath10k_htc *htc = ep->htc; in ath10k_htc_consume_credit() local
110 struct ath10k *ar = htc->ar; in ath10k_htc_consume_credit()
118 spin_lock_bh(&htc->tx_lock); in ath10k_htc_consume_credit()
136 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_consume_credit()
142 struct ath10k_htc *htc = ep->htc; in ath10k_htc_release_credit() local
143 struct ath10k *ar = htc->ar; in ath10k_htc_release_credit()
151 spin_lock_bh(&htc->tx_lock); in ath10k_htc_release_credit()
156 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_release_credit()
159 ep->ep_ops.ep_tx_credits(htc->ar); in ath10k_htc_release_credit()
162 int ath10k_htc_send(struct ath10k_htc *htc, in ath10k_htc_send() argument
166 struct ath10k *ar = htc->ar; in ath10k_htc_send()
167 struct ath10k_htc_ep *ep = &htc->endpoint[eid]; in ath10k_htc_send()
170 struct device *dev = htc->ar->dev; in ath10k_htc_send()
174 if (htc->ar->state == ATH10K_STATE_WEDGED) in ath10k_htc_send()
208 ret = ath10k_hif_tx_sg(htc->ar, ep->ul_pipe_id, &sg_item, 1); in ath10k_htc_send()
226 struct ath10k_htc *htc = &ar->htc; in ath10k_htc_tx_completion_handler() local
234 ep = &htc->endpoint[skb_cb->eid]; in ath10k_htc_tx_completion_handler()
246 ath10k_htc_process_credit_report(struct ath10k_htc *htc, in ath10k_htc_process_credit_report() argument
251 struct ath10k *ar = htc->ar; in ath10k_htc_process_credit_report()
260 spin_lock_bh(&htc->tx_lock); in ath10k_htc_process_credit_report()
265 ep = &htc->endpoint[report->eid]; in ath10k_htc_process_credit_report()
272 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_process_credit_report()
273 ep->ep_ops.ep_tx_credits(htc->ar); in ath10k_htc_process_credit_report()
274 spin_lock_bh(&htc->tx_lock); in ath10k_htc_process_credit_report()
277 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_process_credit_report()
281 ath10k_htc_process_lookahead(struct ath10k_htc *htc, in ath10k_htc_process_lookahead() argument
288 struct ath10k *ar = htc->ar; in ath10k_htc_process_lookahead()
313 ath10k_htc_process_lookahead_bundle(struct ath10k_htc *htc, in ath10k_htc_process_lookahead_bundle() argument
320 struct ath10k *ar = htc->ar; in ath10k_htc_process_lookahead_bundle()
323 if (!bundle_cnt || (bundle_cnt > htc->max_msgs_per_htc_bundle)) { in ath10k_htc_process_lookahead_bundle()
344 int ath10k_htc_process_trailer(struct ath10k_htc *htc, in ath10k_htc_process_trailer() argument
352 struct ath10k *ar = htc->ar; in ath10k_htc_process_trailer()
386 ath10k_htc_process_credit_report(htc, in ath10k_htc_process_trailer()
398 status = ath10k_htc_process_lookahead(htc, in ath10k_htc_process_trailer()
407 status = ath10k_htc_process_lookahead_bundle(htc, in ath10k_htc_process_trailer()
439 struct ath10k_htc *htc = &ar->htc; in ath10k_htc_rx_completion_handler() local
460 ep = &htc->endpoint[eid]; in ath10k_htc_rx_completion_handler()
504 status = ath10k_htc_process_trailer(htc, trailer, in ath10k_htc_rx_completion_handler()
531 struct ath10k_htc *htc = &ar->htc; in ath10k_htc_control_rx_complete() local
538 if (completion_done(&htc->ctl_resp)) { in ath10k_htc_control_rx_complete()
543 complete(&htc->ctl_resp); in ath10k_htc_control_rx_complete()
547 htc->control_resp_len = in ath10k_htc_control_rx_complete()
551 memcpy(htc->control_resp_buffer, skb->data, in ath10k_htc_control_rx_complete()
552 htc->control_resp_len); in ath10k_htc_control_rx_complete()
554 complete(&htc->ctl_resp); in ath10k_htc_control_rx_complete()
557 htc->htc_ops.target_send_suspend_complete(ar); in ath10k_htc_control_rx_complete()
608 static void ath10k_htc_reset_endpoint_states(struct ath10k_htc *htc) in ath10k_htc_reset_endpoint_states() argument
614 ep = &htc->endpoint[i]; in ath10k_htc_reset_endpoint_states()
619 ep->htc = htc; in ath10k_htc_reset_endpoint_states()
624 static u8 ath10k_htc_get_credit_allocation(struct ath10k_htc *htc, in ath10k_htc_get_credit_allocation() argument
633 allocation = htc->total_transmit_credits; in ath10k_htc_get_credit_allocation()
643 struct ath10k_htc *htc = ep->htc; in ath10k_htc_send_bundle() local
644 struct ath10k *ar = htc->ar; in ath10k_htc_send_bundle()
659 ret = ath10k_hif_tx_sg(htc->ar, ep->ul_pipe_id, &sg_item, 1); in ath10k_htc_send_bundle()
687 struct ath10k_htc *htc = ep->htc; in ath10k_htc_send_one_skb() local
688 struct ath10k *ar = htc->ar; in ath10k_htc_send_one_skb()
691 ret = ath10k_htc_send(htc, ep->eid, skb); in ath10k_htc_send_one_skb()
702 struct ath10k_htc *htc = ep->htc; in ath10k_htc_send_bundle_skbs() local
709 if (htc->ar->state == ATH10K_STATE_WEDGED) in ath10k_htc_send_bundle_skbs()
808 for (i = 0; i < ARRAY_SIZE(ar->htc.endpoint); i++) { in ath10k_htc_bundle_tx_work()
809 ep = &ar->htc.endpoint[i]; in ath10k_htc_bundle_tx_work()
838 for (i = 0; i < ARRAY_SIZE(ar->htc.endpoint); i++) { in ath10k_htc_tx_complete_work()
839 ep = &ar->htc.endpoint[i]; in ath10k_htc_tx_complete_work()
855 int ath10k_htc_send_hl(struct ath10k_htc *htc, in ath10k_htc_send_hl() argument
859 struct ath10k_htc_ep *ep = &htc->endpoint[eid]; in ath10k_htc_send_hl()
860 struct ath10k *ar = htc->ar; in ath10k_htc_send_hl()
875 return ath10k_htc_send(htc, eid, skb); in ath10k_htc_send_hl()
881 if (ep->htc->max_msgs_per_htc_bundle >= ATH10K_MIN_MSG_PER_HTC_TX_BUNDLE && in ath10k_htc_setup_tx_req()
897 for (i = 0; i < ARRAY_SIZE(ar->htc.endpoint); i++) { in ath10k_htc_stop_hl()
898 ep = &ar->htc.endpoint[i]; in ath10k_htc_stop_hl()
910 int ath10k_htc_wait_target(struct ath10k_htc *htc) in ath10k_htc_wait_target() argument
912 struct ath10k *ar = htc->ar; in ath10k_htc_wait_target()
918 time_left = wait_for_completion_timeout(&htc->ctl_resp, in ath10k_htc_wait_target()
930 ath10k_hif_send_complete_check(htc->ar, i, 1); in ath10k_htc_wait_target()
933 wait_for_completion_timeout(&htc->ctl_resp, in ath10k_htc_wait_target()
945 if (htc->control_resp_len < sizeof(msg->hdr) + sizeof(msg->ready)) { in ath10k_htc_wait_target()
947 htc->control_resp_len); in ath10k_htc_wait_target()
951 msg = (struct ath10k_htc_msg *)htc->control_resp_buffer; in ath10k_htc_wait_target()
960 htc->total_transmit_credits = __le16_to_cpu(msg->ready.credit_count); in ath10k_htc_wait_target()
962 htc->total_transmit_credits = 1; in ath10k_htc_wait_target()
964 htc->target_credit_size = __le16_to_cpu(msg->ready.credit_size); in ath10k_htc_wait_target()
968 htc->total_transmit_credits, in ath10k_htc_wait_target()
969 htc->target_credit_size, in ath10k_htc_wait_target()
972 if ((htc->total_transmit_credits == 0) || in ath10k_htc_wait_target()
973 (htc->target_credit_size == 0)) { in ath10k_htc_wait_target()
981 if (htc->control_resp_len >= in ath10k_htc_wait_target()
983 htc->alt_data_credit_size = in ath10k_htc_wait_target()
986 htc->max_msgs_per_htc_bundle = in ath10k_htc_wait_target()
991 htc->max_msgs_per_htc_bundle, in ath10k_htc_wait_target()
992 htc->alt_data_credit_size); in ath10k_htc_wait_target()
1001 void ath10k_htc_change_tx_credit_flow(struct ath10k_htc *htc, in ath10k_htc_change_tx_credit_flow() argument
1005 struct ath10k *ar = htc->ar; in ath10k_htc_change_tx_credit_flow()
1006 struct ath10k_htc_ep *ep = &ar->htc.endpoint[eid]; in ath10k_htc_change_tx_credit_flow()
1011 int ath10k_htc_connect_service(struct ath10k_htc *htc, in ath10k_htc_connect_service() argument
1015 struct ath10k *ar = htc->ar; in ath10k_htc_connect_service()
1039 tx_alloc = ath10k_htc_get_credit_allocation(htc, in ath10k_htc_connect_service()
1046 skb = ath10k_htc_build_tx_ctrl_skb(htc->ar); in ath10k_htc_connect_service()
1072 reinit_completion(&htc->ctl_resp); in ath10k_htc_connect_service()
1074 status = ath10k_htc_send(htc, ATH10K_HTC_EP_0, skb); in ath10k_htc_connect_service()
1081 time_left = wait_for_completion_timeout(&htc->ctl_resp, in ath10k_htc_connect_service()
1089 msg = (struct ath10k_htc_msg *)htc->control_resp_buffer; in ath10k_htc_connect_service()
1095 (htc->control_resp_len < sizeof(msg->hdr) + in ath10k_htc_connect_service()
1127 ep = &htc->endpoint[assigned_eid]; in ath10k_htc_connect_service()
1142 ep->tx_credit_size = htc->target_credit_size; in ath10k_htc_connect_service()
1145 htc->alt_data_credit_size != 0) in ath10k_htc_connect_service()
1146 ep->tx_credit_size = htc->alt_data_credit_size; in ath10k_htc_connect_service()
1151 status = ath10k_hif_map_service_to_pipe(htc->ar, in ath10k_htc_connect_service()
1214 status = ath10k_htc_connect_service(&ar->htc, &conn_req, &conn_resp); in ath10k_htc_pktlog_connect()
1243 int ath10k_htc_start(struct ath10k_htc *htc) in ath10k_htc_start() argument
1245 struct ath10k *ar = htc->ar; in ath10k_htc_start()
1250 skb = ath10k_htc_build_tx_ctrl_skb(htc->ar); in ath10k_htc_start()
1266 htc->max_msgs_per_htc_bundle; in ath10k_htc_start()
1270 status = ath10k_htc_send(htc, ATH10K_HTC_EP_0, skb); in ath10k_htc_start()
1291 struct ath10k_htc *htc = &ar->htc; in ath10k_htc_init() local
1295 spin_lock_init(&htc->tx_lock); in ath10k_htc_init()
1297 ath10k_htc_reset_endpoint_states(htc); in ath10k_htc_init()
1299 htc->ar = ar; in ath10k_htc_init()
1310 status = ath10k_htc_connect_service(htc, &conn_req, &conn_resp); in ath10k_htc_init()
1317 init_completion(&htc->ctl_resp); in ath10k_htc_init()