Lines Matching full:ep

51 void ath10k_htc_notify_tx_completion(struct ath10k_htc_ep *ep,  in ath10k_htc_notify_tx_completion()  argument
54 struct ath10k *ar = ep->htc->ar; in ath10k_htc_notify_tx_completion()
57 ath10k_dbg(ar, ATH10K_DBG_HTC, "%s: ep %d skb %pK\n", __func__, in ath10k_htc_notify_tx_completion()
58 ep->eid, skb); in ath10k_htc_notify_tx_completion()
66 ep->ul_pipe_id == 3) in ath10k_htc_notify_tx_completion()
70 ath10k_htc_restore_tx_skb(ep->htc, skb); in ath10k_htc_notify_tx_completion()
72 if (!ep->ep_ops.ep_tx_complete) { in ath10k_htc_notify_tx_completion()
73 ath10k_warn(ar, "no tx handler for eid %d\n", ep->eid); in ath10k_htc_notify_tx_completion()
83 ep->ep_ops.ep_tx_complete(ep->htc->ar, skb); in ath10k_htc_notify_tx_completion()
87 static void ath10k_htc_prepare_tx_skb(struct ath10k_htc_ep *ep, in ath10k_htc_prepare_tx_skb() argument
95 hdr->eid = ep->eid; in ath10k_htc_prepare_tx_skb()
98 if (ep->tx_credit_flow_enabled && !ep->bundle_tx) in ath10k_htc_prepare_tx_skb()
101 spin_lock_bh(&ep->htc->tx_lock); in ath10k_htc_prepare_tx_skb()
102 hdr->seq_no = ep->seq_no++; in ath10k_htc_prepare_tx_skb()
103 spin_unlock_bh(&ep->htc->tx_lock); in ath10k_htc_prepare_tx_skb()
106 static int ath10k_htc_consume_credit(struct ath10k_htc_ep *ep, in ath10k_htc_consume_credit() argument
110 struct ath10k_htc *htc = ep->htc; in ath10k_htc_consume_credit()
112 enum ath10k_htc_ep_id eid = ep->eid; in ath10k_htc_consume_credit()
115 if (!ep->tx_credit_flow_enabled) in ath10k_htc_consume_credit()
118 credits = DIV_ROUND_UP(len, ep->tx_credit_size); in ath10k_htc_consume_credit()
121 if (ep->tx_credits < credits) { in ath10k_htc_consume_credit()
123 "htc insufficient credits ep %d required %d available %d consume %d\n", in ath10k_htc_consume_credit()
124 eid, credits, ep->tx_credits, consume); in ath10k_htc_consume_credit()
130 ep->tx_credits -= credits; in ath10k_htc_consume_credit()
132 "htc ep %d consumed %d credits total %d\n", in ath10k_htc_consume_credit()
133 eid, credits, ep->tx_credits); in ath10k_htc_consume_credit()
141 static void ath10k_htc_release_credit(struct ath10k_htc_ep *ep, unsigned int len) in ath10k_htc_release_credit() argument
143 struct ath10k_htc *htc = ep->htc; in ath10k_htc_release_credit()
145 enum ath10k_htc_ep_id eid = ep->eid; in ath10k_htc_release_credit()
148 if (!ep->tx_credit_flow_enabled) in ath10k_htc_release_credit()
151 credits = DIV_ROUND_UP(len, ep->tx_credit_size); in ath10k_htc_release_credit()
153 ep->tx_credits += credits; in ath10k_htc_release_credit()
155 "htc ep %d reverted %d credits back total %d\n", in ath10k_htc_release_credit()
156 eid, credits, ep->tx_credits); in ath10k_htc_release_credit()
159 if (ep->ep_ops.ep_tx_credits) in ath10k_htc_release_credit()
160 ep->ep_ops.ep_tx_credits(htc->ar); in ath10k_htc_release_credit()
168 struct ath10k_htc_ep *ep = &htc->endpoint[eid]; in ath10k_htc_send() local
186 ret = ath10k_htc_consume_credit(ep, skb_len, true); in ath10k_htc_send()
190 ath10k_htc_prepare_tx_skb(ep, skb); in ath10k_htc_send()
203 sg_item.transfer_id = ep->eid; in ath10k_htc_send()
209 ret = ath10k_hif_tx_sg(htc->ar, ep->ul_pipe_id, &sg_item, 1); in ath10k_htc_send()
219 ath10k_htc_release_credit(ep, skb_len); in ath10k_htc_send()
229 struct ath10k_htc_ep *ep; in ath10k_htc_tx_completion_handler() local
235 ep = &htc->endpoint[skb_cb->eid]; in ath10k_htc_tx_completion_handler()
237 ath10k_htc_notify_tx_completion(ep, skb); in ath10k_htc_tx_completion_handler()
253 struct ath10k_htc_ep *ep; in ath10k_htc_process_credit_report() local
266 ep = &htc->endpoint[report->eid]; in ath10k_htc_process_credit_report()
267 ep->tx_credits += report->credits; in ath10k_htc_process_credit_report()
269 ath10k_dbg(ar, ATH10K_DBG_HTC, "htc ep %d got %d credits (total %d)\n", in ath10k_htc_process_credit_report()
270 report->eid, report->credits, ep->tx_credits); in ath10k_htc_process_credit_report()
272 if (ep->ep_ops.ep_tx_credits) { in ath10k_htc_process_credit_report()
274 ep->ep_ops.ep_tx_credits(htc->ar); in ath10k_htc_process_credit_report()
442 struct ath10k_htc_ep *ep; in ath10k_htc_rx_completion_handler() local
461 ep = &htc->endpoint[eid]; in ath10k_htc_rx_completion_handler()
462 if (ep->service_id == ATH10K_HTC_SVC_ID_UNUSED) { in ath10k_htc_rx_completion_handler()
518 ath10k_dbg(ar, ATH10K_DBG_HTC, "htc rx completion ep %d skb %pK\n", in ath10k_htc_rx_completion_handler()
520 ep->ep_ops.ep_rx_complete(ar, skb); in ath10k_htc_rx_completion_handler()
541 * sending unsolicited messages on the ep 0 in ath10k_htc_control_rx_complete()
611 struct ath10k_htc_ep *ep; in ath10k_htc_reset_endpoint_states() local
615 ep = &htc->endpoint[i]; in ath10k_htc_reset_endpoint_states()
616 ep->service_id = ATH10K_HTC_SVC_ID_UNUSED; in ath10k_htc_reset_endpoint_states()
617 ep->max_ep_message_len = 0; in ath10k_htc_reset_endpoint_states()
618 ep->max_tx_queue_depth = 0; in ath10k_htc_reset_endpoint_states()
619 ep->eid = i; in ath10k_htc_reset_endpoint_states()
620 ep->htc = htc; in ath10k_htc_reset_endpoint_states()
621 ep->tx_credit_flow_enabled = true; in ath10k_htc_reset_endpoint_states()
639 static int ath10k_htc_send_bundle(struct ath10k_htc_ep *ep, in ath10k_htc_send_bundle() argument
644 struct ath10k_htc *htc = ep->htc; in ath10k_htc_send_bundle()
652 ret = ath10k_htc_consume_credit(ep, skb_len, true); in ath10k_htc_send_bundle()
655 sg_item.transfer_id = ep->eid; in ath10k_htc_send_bundle()
660 ret = ath10k_hif_tx_sg(htc->ar, ep->ul_pipe_id, &sg_item, 1); in ath10k_htc_send_bundle()
662 ath10k_htc_release_credit(ep, skb_len); in ath10k_htc_send_bundle()
671 skb_queue_head(&ep->tx_req_head, skb); in ath10k_htc_send_bundle()
673 skb_queue_tail(&ep->tx_complete_head, skb); in ath10k_htc_send_bundle()
682 ret, ep->eid, skb_queue_len(&ep->tx_req_head), cn, skb_len); in ath10k_htc_send_bundle()
686 static void ath10k_htc_send_one_skb(struct ath10k_htc_ep *ep, struct sk_buff *skb) in ath10k_htc_send_one_skb() argument
688 struct ath10k_htc *htc = ep->htc; in ath10k_htc_send_one_skb()
692 ret = ath10k_htc_send(htc, ep->eid, skb); in ath10k_htc_send_one_skb()
695 skb_queue_head(&ep->tx_req_head, skb); in ath10k_htc_send_one_skb()
698 ret, ep->eid, skb->len, skb_queue_len(&ep->tx_req_head)); in ath10k_htc_send_one_skb()
701 static int ath10k_htc_send_bundle_skbs(struct ath10k_htc_ep *ep) in ath10k_htc_send_bundle_skbs() argument
703 struct ath10k_htc *htc = ep->htc; in ath10k_htc_send_bundle_skbs()
713 if (ep->tx_credit_flow_enabled && in ath10k_htc_send_bundle_skbs()
714 ep->tx_credits < ATH10K_MIN_CREDIT_PER_HTC_TX_BUNDLE) in ath10k_htc_send_bundle_skbs()
717 bundles_left = ATH10K_MAX_MSG_PER_HTC_TX_BUNDLE * ep->tx_credit_size; in ath10k_htc_send_bundle_skbs()
727 skb = skb_dequeue(&ep->tx_req_head); in ath10k_htc_send_bundle_skbs()
733 credit_remainder = trans_len % ep->tx_credit_size; in ath10k_htc_send_bundle_skbs()
736 credit_pad = ep->tx_credit_size - credit_remainder; in ath10k_htc_send_bundle_skbs()
740 ret = ath10k_htc_consume_credit(ep, in ath10k_htc_send_bundle_skbs()
744 skb_queue_head(&ep->tx_req_head, skb); in ath10k_htc_send_bundle_skbs()
750 ret = ath10k_htc_send_bundle(ep, bundle_skb, &tx_save_head); in ath10k_htc_send_bundle_skbs()
753 skb_queue_head(&ep->tx_req_head, skb); in ath10k_htc_send_bundle_skbs()
757 if (skb_queue_len(&ep->tx_req_head) == 0) { in ath10k_htc_send_bundle_skbs()
758 ath10k_htc_send_one_skb(ep, skb); in ath10k_htc_send_bundle_skbs()
762 if (ep->tx_credit_flow_enabled && in ath10k_htc_send_bundle_skbs()
763 ep->tx_credits < ATH10K_MIN_CREDIT_PER_HTC_TX_BUNDLE) { in ath10k_htc_send_bundle_skbs()
764 skb_queue_head(&ep->tx_req_head, skb); in ath10k_htc_send_bundle_skbs()
769 ATH10K_MAX_MSG_PER_HTC_TX_BUNDLE * ep->tx_credit_size; in ath10k_htc_send_bundle_skbs()
773 skb_queue_head(&ep->tx_req_head, skb); in ath10k_htc_send_bundle_skbs()
781 ath10k_htc_prepare_tx_skb(ep, skb); in ath10k_htc_send_bundle_skbs()
794 ret = ath10k_htc_send_bundle(ep, bundle_skb, &tx_save_head); in ath10k_htc_send_bundle_skbs()
805 struct ath10k_htc_ep *ep; in ath10k_htc_bundle_tx_work() local
810 ep = &ar->htc.endpoint[i]; in ath10k_htc_bundle_tx_work()
812 if (!ep->bundle_tx) in ath10k_htc_bundle_tx_work()
816 ep->eid, skb_queue_len(&ep->tx_req_head)); in ath10k_htc_bundle_tx_work()
818 if (skb_queue_len(&ep->tx_req_head) >= in ath10k_htc_bundle_tx_work()
820 ath10k_htc_send_bundle_skbs(ep); in ath10k_htc_bundle_tx_work()
822 skb = skb_dequeue(&ep->tx_req_head); in ath10k_htc_bundle_tx_work()
826 ath10k_htc_send_one_skb(ep, skb); in ath10k_htc_bundle_tx_work()
834 struct ath10k_htc_ep *ep; in ath10k_htc_tx_complete_work() local
840 ep = &ar->htc.endpoint[i]; in ath10k_htc_tx_complete_work()
841 eid = ep->eid; in ath10k_htc_tx_complete_work()
842 if (ep->bundle_tx && eid == ar->htt.eid) { in ath10k_htc_tx_complete_work()
844 ep->eid, skb_queue_len(&ep->tx_complete_head)); in ath10k_htc_tx_complete_work()
847 skb = skb_dequeue(&ep->tx_complete_head); in ath10k_htc_tx_complete_work()
850 ath10k_htc_notify_tx_completion(ep, skb); in ath10k_htc_tx_complete_work()
860 struct ath10k_htc_ep *ep = &htc->endpoint[eid]; in ath10k_htc_send_hl() local
863 if (sizeof(struct ath10k_htc_hdr) + skb->len > ep->tx_credit_size) { in ath10k_htc_send_hl()
869 eid, ep->bundle_tx, skb_queue_len(&ep->tx_req_head), skb->len); in ath10k_htc_send_hl()
871 if (ep->bundle_tx) { in ath10k_htc_send_hl()
872 skb_queue_tail(&ep->tx_req_head, skb); in ath10k_htc_send_hl()
880 void ath10k_htc_setup_tx_req(struct ath10k_htc_ep *ep) in ath10k_htc_setup_tx_req() argument
882 if (ep->htc->max_msgs_per_htc_bundle >= ATH10K_MIN_MSG_PER_HTC_TX_BUNDLE && in ath10k_htc_setup_tx_req()
883 !ep->bundle_tx) { in ath10k_htc_setup_tx_req()
884 ep->bundle_tx = true; in ath10k_htc_setup_tx_req()
885 skb_queue_head_init(&ep->tx_req_head); in ath10k_htc_setup_tx_req()
886 skb_queue_head_init(&ep->tx_complete_head); in ath10k_htc_setup_tx_req()
892 struct ath10k_htc_ep *ep; in ath10k_htc_stop_hl() local
899 ep = &ar->htc.endpoint[i]; in ath10k_htc_stop_hl()
901 if (!ep->bundle_tx) in ath10k_htc_stop_hl()
905 ep->eid, skb_queue_len(&ep->tx_req_head)); in ath10k_htc_stop_hl()
907 skb_queue_purge(&ep->tx_req_head); in ath10k_htc_stop_hl()
1007 struct ath10k_htc_ep *ep = &ar->htc.endpoint[eid]; in ath10k_htc_change_tx_credit_flow() local
1009 ep->tx_credit_flow_enabled = enable; in ath10k_htc_change_tx_credit_flow()
1022 struct ath10k_htc_ep *ep; in ath10k_htc_connect_service() local
1103 "HTC Service %s connect response: status: 0x%x, assigned ep: 0x%x\n", in ath10k_htc_connect_service()
1128 ep = &htc->endpoint[assigned_eid]; in ath10k_htc_connect_service()
1129 ep->eid = assigned_eid; in ath10k_htc_connect_service()
1131 if (ep->service_id != ATH10K_HTC_SVC_ID_UNUSED) in ath10k_htc_connect_service()
1139 ep->service_id = conn_req->service_id; in ath10k_htc_connect_service()
1140 ep->max_tx_queue_depth = conn_req->max_send_queue_depth; in ath10k_htc_connect_service()
1141 ep->max_ep_message_len = __le16_to_cpu(resp_msg->max_msg_size); in ath10k_htc_connect_service()
1142 ep->tx_credits = tx_alloc; in ath10k_htc_connect_service()
1143 ep->tx_credit_size = htc->target_credit_size; in ath10k_htc_connect_service()
1147 ep->tx_credit_size = htc->alt_data_credit_size; in ath10k_htc_connect_service()
1150 ep->ep_ops = conn_req->ep_ops; in ath10k_htc_connect_service()
1153 ep->service_id, in ath10k_htc_connect_service()
1154 &ep->ul_pipe_id, in ath10k_htc_connect_service()
1155 &ep->dl_pipe_id); in ath10k_htc_connect_service()
1158 ep->service_id); in ath10k_htc_connect_service()
1164 htc_service_name(ep->service_id), ep->ul_pipe_id, in ath10k_htc_connect_service()
1165 ep->dl_pipe_id, ep->eid); in ath10k_htc_connect_service()
1167 if (disable_credit_flow_ctrl && ep->tx_credit_flow_enabled) { in ath10k_htc_connect_service()
1168 ep->tx_credit_flow_enabled = false; in ath10k_htc_connect_service()
1171 htc_service_name(ep->service_id), assigned_eid); in ath10k_htc_connect_service()