Lines Matching refs:htc

68 	spin_lock_bh(&ep->htc->tx_lock);
70 spin_unlock_bh(&ep->htc->tx_lock);
73 int ath11k_htc_send(struct ath11k_htc *htc,
77 struct ath11k_htc_ep *ep = &htc->endpoint[eid];
79 struct device *dev = htc->ab->dev;
80 struct ath11k_base *ab = htc->ab;
94 credits = DIV_ROUND_UP(skb->len, htc->target_credit_size);
95 spin_lock_bh(&htc->tx_lock);
100 spin_unlock_bh(&htc->tx_lock);
108 spin_unlock_bh(&htc->tx_lock);
124 ret = ath11k_ce_send(htc->ab, skb, ep->ul_pipe_id, ep->eid);
134 spin_lock_bh(&htc->tx_lock);
139 spin_unlock_bh(&htc->tx_lock);
142 ep->ep_ops.ep_tx_credits(htc->ab);
150 ath11k_htc_process_credit_report(struct ath11k_htc *htc,
155 struct ath11k_base *ab = htc->ab;
164 spin_lock_bh(&htc->tx_lock);
169 ep = &htc->endpoint[report->eid];
176 spin_unlock_bh(&htc->tx_lock);
177 ep->ep_ops.ep_tx_credits(htc->ab);
178 spin_lock_bh(&htc->tx_lock);
181 spin_unlock_bh(&htc->tx_lock);
184 static int ath11k_htc_process_trailer(struct ath11k_htc *htc,
189 struct ath11k_base *ab = htc->ab;
219 ath11k_htc_process_credit_report(htc,
257 struct ath11k_htc *htc = &ab->htc;
268 ep = &htc->endpoint[eid];
269 spin_lock_bh(&htc->tx_lock);
271 spin_unlock_bh(&htc->tx_lock);
276 ep_tx_complete(htc->ab, skb);
288 struct ath11k_htc *htc = &ab->htc;
307 ep = &htc->endpoint[eid];
347 status = ath11k_htc_process_trailer(htc, trailer,
371 if (completion_done(&htc->ctl_resp)) {
376 complete(&htc->ctl_resp);
380 htc->control_resp_len =
384 memcpy(htc->control_resp_buffer, skb->data,
385 htc->control_resp_len);
387 complete(&htc->ctl_resp);
399 ath11k_warn(ab, "ignoring unsolicited htc ep0 event %ld\n",
423 ath11k_warn(ab, "unexpected htc rx\n");
465 static void ath11k_htc_reset_endpoint_states(struct ath11k_htc *htc)
471 ep = &htc->endpoint[i];
476 ep->htc = htc;
481 static u8 ath11k_htc_get_credit_allocation(struct ath11k_htc *htc,
487 if (htc->service_alloc_table[i].service_id == service_id) {
489 htc->service_alloc_table[i].credit_allocation;
496 static int ath11k_htc_setup_target_buffer_assignments(struct ath11k_htc *htc)
506 credits = htc->total_transmit_credits;
507 serv_entry = htc->service_alloc_table;
509 if ((htc->wmi_ep_count == 0) ||
510 (htc->wmi_ep_count > ARRAY_SIZE(svc_id)))
514 credits = credits / htc->wmi_ep_count;
515 for (i = 0; i < htc->wmi_ep_count; i++) {
523 int ath11k_htc_wait_target(struct ath11k_htc *htc)
526 struct ath11k_base *ab = htc->ab;
533 time_left = wait_for_completion_timeout(&htc->ctl_resp,
539 ath11k_ce_per_engine_service(htc->ab, i);
542 wait_for_completion_timeout(&htc->ctl_resp,
554 if (htc->control_resp_len < sizeof(*ready)) {
556 htc->control_resp_len);
560 ready = (struct ath11k_htc_ready *)htc->control_resp_buffer;
571 htc->total_transmit_credits = credit_count;
572 htc->target_credit_size = credit_size;
576 htc->total_transmit_credits, htc->target_credit_size);
578 if ((htc->total_transmit_credits == 0) ||
579 (htc->target_credit_size == 0)) {
588 htc->total_transmit_credits = 1;
590 ath11k_htc_setup_target_buffer_assignments(htc);
595 int ath11k_htc_connect_service(struct ath11k_htc *htc,
599 struct ath11k_base *ab = htc->ab;
622 tx_alloc = ath11k_htc_get_credit_allocation(htc,
626 "htc service %s does not allocate target credits\n",
629 skb = ath11k_htc_build_tx_ctrl_skb(htc->ab);
662 reinit_completion(&htc->ctl_resp);
664 status = ath11k_htc_send(htc, ATH11K_HTC_EP_0, skb);
671 time_left = wait_for_completion_timeout(&htc->ctl_resp,
679 resp_msg = (struct ath11k_htc_conn_svc_resp *)htc->control_resp_buffer;
685 (htc->control_resp_len < sizeof(*resp_msg))) {
722 ep = &htc->endpoint[assigned_eid];
743 status = ath11k_hif_map_service_to_pipe(htc->ab,
751 "htc service '%s' ul pipe %d dl pipe %d eid %d ready\n",
758 "htc service '%s' eid %d tx flow control disabled\n",
765 int ath11k_htc_start(struct ath11k_htc *htc)
769 struct ath11k_base *ab = htc->ab;
772 skb = ath11k_htc_build_tx_ctrl_skb(htc->ab);
788 status = ath11k_htc_send(htc, ATH11K_HTC_EP_0, skb);
799 struct ath11k_htc *htc = &ab->htc;
804 spin_lock_init(&htc->tx_lock);
806 ath11k_htc_reset_endpoint_states(htc);
808 htc->ab = ab;
812 htc->wmi_ep_count = 1;
816 htc->wmi_ep_count = 2;
819 htc->wmi_ep_count = 3;
822 htc->wmi_ep_count = ab->hw_params.max_radios;
835 ret = ath11k_htc_connect_service(htc, &conn_req, &conn_resp);
837 ath11k_err(ab, "could not connect to htc service (%d)\n", ret);
841 init_completion(&htc->ctl_resp);