Lines Matching refs:htc
40 static inline void ath10k_htc_restore_tx_skb(struct ath10k_htc *htc,
45 if (htc->ar->bus_param.dev_type != ATH10K_DEV_TYPE_HL)
46 dma_unmap_single(htc->ar->dev, skb_cb->paddr, skb->len, DMA_TO_DEVICE);
53 struct ath10k *ar = ep->htc->ar;
69 ath10k_htc_restore_tx_skb(ep->htc, skb);
82 ep->ep_ops.ep_tx_complete(ep->htc->ar, skb);
100 spin_lock_bh(&ep->htc->tx_lock);
102 spin_unlock_bh(&ep->htc->tx_lock);
109 struct ath10k_htc *htc = ep->htc;
110 struct ath10k *ar = htc->ar;
118 spin_lock_bh(&htc->tx_lock);
122 "htc insufficient credits ep %d required %d available %d consume %d\n",
131 "htc ep %d consumed %d credits total %d\n",
136 spin_unlock_bh(&htc->tx_lock);
142 struct ath10k_htc *htc = ep->htc;
143 struct ath10k *ar = htc->ar;
151 spin_lock_bh(&htc->tx_lock);
154 "htc ep %d reverted %d credits back total %d\n",
156 spin_unlock_bh(&htc->tx_lock);
159 ep->ep_ops.ep_tx_credits(htc->ar);
162 int ath10k_htc_send(struct ath10k_htc *htc,
166 struct ath10k *ar = htc->ar;
167 struct ath10k_htc_ep *ep = &htc->endpoint[eid];
170 struct device *dev = htc->ar->dev;
174 if (htc->ar->state == ATH10K_STATE_WEDGED)
208 ret = ath10k_hif_tx_sg(htc->ar, ep->ul_pipe_id, &sg_item, 1);
226 struct ath10k_htc *htc = &ar->htc;
234 ep = &htc->endpoint[skb_cb->eid];
246 ath10k_htc_process_credit_report(struct ath10k_htc *htc,
251 struct ath10k *ar = htc->ar;
260 spin_lock_bh(&htc->tx_lock);
265 ep = &htc->endpoint[report->eid];
268 ath10k_dbg(ar, ATH10K_DBG_HTC, "htc ep %d got %d credits (total %d)\n",
272 spin_unlock_bh(&htc->tx_lock);
273 ep->ep_ops.ep_tx_credits(htc->ar);
274 spin_lock_bh(&htc->tx_lock);
277 spin_unlock_bh(&htc->tx_lock);
281 ath10k_htc_process_lookahead(struct ath10k_htc *htc,
288 struct ath10k *ar = htc->ar;
300 "htc rx lookahead found pre_valid 0x%x post_valid 0x%x\n",
313 ath10k_htc_process_lookahead_bundle(struct ath10k_htc *htc,
320 struct ath10k *ar = htc->ar;
323 if (!bundle_cnt || (bundle_cnt > htc->max_msgs_per_htc_bundle)) {
344 int ath10k_htc_process_trailer(struct ath10k_htc *htc,
352 struct ath10k *ar = htc->ar;
386 ath10k_htc_process_credit_report(htc,
398 status = ath10k_htc_process_lookahead(htc,
407 status = ath10k_htc_process_lookahead_bundle(htc,
429 ath10k_dbg_dump(ar, ATH10K_DBG_HTC, "htc rx bad trailer", "",
439 struct ath10k_htc *htc = &ar->htc;
455 ath10k_dbg_dump(ar, ATH10K_DBG_HTC, "htc bad header", "",
460 ep = &htc->endpoint[eid];
462 ath10k_warn(ar, "htc rx endpoint %d is not connected\n", eid);
471 ath10k_dbg_dump(ar, ATH10K_DBG_HTC, "htc bad rx pkt len", "",
480 ath10k_dbg_dump(ar, ATH10K_DBG_HTC, "htc bad rx pkt len",
504 status = ath10k_htc_process_trailer(htc, trailer,
517 ath10k_dbg(ar, ATH10K_DBG_HTC, "htc rx completion ep %d skb %pK\n",
531 struct ath10k_htc *htc = &ar->htc;
538 if (completion_done(&htc->ctl_resp)) {
543 complete(&htc->ctl_resp);
547 htc->control_resp_len =
551 memcpy(htc->control_resp_buffer, skb->data,
552 htc->control_resp_len);
554 complete(&htc->ctl_resp);
557 htc->htc_ops.target_send_suspend_complete(ar);
560 ath10k_warn(ar, "ignoring unsolicited htc ep0 event\n");
608 static void ath10k_htc_reset_endpoint_states(struct ath10k_htc *htc)
614 ep = &htc->endpoint[i];
619 ep->htc = htc;
624 static u8 ath10k_htc_get_credit_allocation(struct ath10k_htc *htc,
633 allocation = htc->total_transmit_credits;
643 struct ath10k_htc *htc = ep->htc;
644 struct ath10k *ar = htc->ar;
659 ret = ath10k_hif_tx_sg(htc->ar, ep->ul_pipe_id, &sg_item, 1);
687 struct ath10k_htc *htc = ep->htc;
688 struct ath10k *ar = htc->ar;
691 ret = ath10k_htc_send(htc, ep->eid, skb);
702 struct ath10k_htc *htc = ep->htc;
709 if (htc->ar->state == ATH10K_STATE_WEDGED)
808 for (i = 0; i < ARRAY_SIZE(ar->htc.endpoint); i++) {
809 ep = &ar->htc.endpoint[i];
838 for (i = 0; i < ARRAY_SIZE(ar->htc.endpoint); i++) {
839 ep = &ar->htc.endpoint[i];
855 int ath10k_htc_send_hl(struct ath10k_htc *htc,
859 struct ath10k_htc_ep *ep = &htc->endpoint[eid];
860 struct ath10k *ar = htc->ar;
867 ath10k_dbg(ar, ATH10K_DBG_HTC, "htc send hl eid %d bundle %d tx count %d len %d\n",
875 return ath10k_htc_send(htc, eid, skb);
881 if (ep->htc->max_msgs_per_htc_bundle >= ATH10K_MIN_MSG_PER_HTC_TX_BUNDLE &&
897 for (i = 0; i < ARRAY_SIZE(ar->htc.endpoint); i++) {
898 ep = &ar->htc.endpoint[i];
910 int ath10k_htc_wait_target(struct ath10k_htc *htc)
912 struct ath10k *ar = htc->ar;
918 time_left = wait_for_completion_timeout(&htc->ctl_resp,
930 ath10k_hif_send_complete_check(htc->ar, i, 1);
933 wait_for_completion_timeout(&htc->ctl_resp,
945 if (htc->control_resp_len < sizeof(msg->hdr) + sizeof(msg->ready)) {
947 htc->control_resp_len);
951 msg = (struct ath10k_htc_msg *)htc->control_resp_buffer;
960 htc->total_transmit_credits = __le16_to_cpu(msg->ready.credit_count);
962 htc->total_transmit_credits = 1;
964 htc->target_credit_size = __le16_to_cpu(msg->ready.credit_size);
968 htc->total_transmit_credits,
969 htc->target_credit_size,
972 if ((htc->total_transmit_credits == 0) ||
973 (htc->target_credit_size == 0)) {
981 if (htc->control_resp_len >=
983 htc->alt_data_credit_size =
986 htc->max_msgs_per_htc_bundle =
991 htc->max_msgs_per_htc_bundle,
992 htc->alt_data_credit_size);
1001 void ath10k_htc_change_tx_credit_flow(struct ath10k_htc *htc,
1005 struct ath10k *ar = htc->ar;
1006 struct ath10k_htc_ep *ep = &ar->htc.endpoint[eid];
1011 int ath10k_htc_connect_service(struct ath10k_htc *htc,
1015 struct ath10k *ar = htc->ar;
1039 tx_alloc = ath10k_htc_get_credit_allocation(htc,
1043 "boot htc service %s does not allocate target credits\n",
1046 skb = ath10k_htc_build_tx_ctrl_skb(htc->ar);
1072 reinit_completion(&htc->ctl_resp);
1074 status = ath10k_htc_send(htc, ATH10K_HTC_EP_0, skb);
1081 time_left = wait_for_completion_timeout(&htc->ctl_resp,
1089 msg = (struct ath10k_htc_msg *)htc->control_resp_buffer;
1095 (htc->control_resp_len < sizeof(msg->hdr) +
1127 ep = &htc->endpoint[assigned_eid];
1142 ep->tx_credit_size = htc->target_credit_size;
1145 htc->alt_data_credit_size != 0)
1146 ep->tx_credit_size = htc->alt_data_credit_size;
1151 status = ath10k_hif_map_service_to_pipe(htc->ar,
1162 "boot htc service '%s' ul pipe %d dl pipe %d eid %d ready\n",
1169 "boot htc service '%s' eid %d TX flow control disabled\n",
1214 status = ath10k_htc_connect_service(&ar->htc, &conn_req, &conn_resp);
1243 int ath10k_htc_start(struct ath10k_htc *htc)
1245 struct ath10k *ar = htc->ar;
1250 skb = ath10k_htc_build_tx_ctrl_skb(htc->ar);
1266 htc->max_msgs_per_htc_bundle;
1270 status = ath10k_htc_send(htc, ATH10K_HTC_EP_0, skb);
1291 struct ath10k_htc *htc = &ar->htc;
1295 spin_lock_init(&htc->tx_lock);
1297 ath10k_htc_reset_endpoint_states(htc);
1299 htc->ar = ar;
1310 status = ath10k_htc_connect_service(htc, &conn_req, &conn_resp);
1312 ath10k_err(ar, "could not connect to htc service (%d)\n",
1317 init_completion(&htc->ctl_resp);