Lines Matching full:ep
53 void ath10k_htc_notify_tx_completion(struct ath10k_htc_ep *ep, in ath10k_htc_notify_tx_completion() argument
56 struct ath10k *ar = ep->htc->ar; in ath10k_htc_notify_tx_completion()
59 ath10k_dbg(ar, ATH10K_DBG_HTC, "%s: ep %d skb %pK\n", __func__, in ath10k_htc_notify_tx_completion()
60 ep->eid, skb); in ath10k_htc_notify_tx_completion()
68 ep->ul_pipe_id == 3) in ath10k_htc_notify_tx_completion()
72 ath10k_htc_restore_tx_skb(ep->htc, skb); in ath10k_htc_notify_tx_completion()
74 if (!ep->ep_ops.ep_tx_complete) { in ath10k_htc_notify_tx_completion()
75 ath10k_warn(ar, "no tx handler for eid %d\n", ep->eid); in ath10k_htc_notify_tx_completion()
85 ep->ep_ops.ep_tx_complete(ep->htc->ar, skb); in ath10k_htc_notify_tx_completion()
89 static void ath10k_htc_prepare_tx_skb(struct ath10k_htc_ep *ep, in ath10k_htc_prepare_tx_skb() argument
97 hdr->eid = ep->eid; in ath10k_htc_prepare_tx_skb()
100 if (ep->tx_credit_flow_enabled && !ep->bundle_tx) in ath10k_htc_prepare_tx_skb()
103 spin_lock_bh(&ep->htc->tx_lock); in ath10k_htc_prepare_tx_skb()
104 hdr->seq_no = ep->seq_no++; in ath10k_htc_prepare_tx_skb()
105 spin_unlock_bh(&ep->htc->tx_lock); in ath10k_htc_prepare_tx_skb()
108 static int ath10k_htc_consume_credit(struct ath10k_htc_ep *ep, in ath10k_htc_consume_credit() argument
112 struct ath10k_htc *htc = ep->htc; in ath10k_htc_consume_credit()
114 enum ath10k_htc_ep_id eid = ep->eid; in ath10k_htc_consume_credit()
117 if (!ep->tx_credit_flow_enabled) in ath10k_htc_consume_credit()
120 credits = DIV_ROUND_UP(len, ep->tx_credit_size); in ath10k_htc_consume_credit()
123 if (ep->tx_credits < credits) { in ath10k_htc_consume_credit()
125 "htc insufficient credits ep %d required %d available %d consume %d\n", in ath10k_htc_consume_credit()
126 eid, credits, ep->tx_credits, consume); in ath10k_htc_consume_credit()
132 ep->tx_credits -= credits; in ath10k_htc_consume_credit()
134 "htc ep %d consumed %d credits total %d\n", in ath10k_htc_consume_credit()
135 eid, credits, ep->tx_credits); in ath10k_htc_consume_credit()
143 static void ath10k_htc_release_credit(struct ath10k_htc_ep *ep, unsigned int len) in ath10k_htc_release_credit() argument
145 struct ath10k_htc *htc = ep->htc; in ath10k_htc_release_credit()
147 enum ath10k_htc_ep_id eid = ep->eid; in ath10k_htc_release_credit()
150 if (!ep->tx_credit_flow_enabled) in ath10k_htc_release_credit()
153 credits = DIV_ROUND_UP(len, ep->tx_credit_size); in ath10k_htc_release_credit()
155 ep->tx_credits += credits; in ath10k_htc_release_credit()
157 "htc ep %d reverted %d credits back total %d\n", in ath10k_htc_release_credit()
158 eid, credits, ep->tx_credits); in ath10k_htc_release_credit()
161 if (ep->ep_ops.ep_tx_credits) in ath10k_htc_release_credit()
162 ep->ep_ops.ep_tx_credits(htc->ar); in ath10k_htc_release_credit()
170 struct ath10k_htc_ep *ep = &htc->endpoint[eid]; in ath10k_htc_send() local
188 ret = ath10k_htc_consume_credit(ep, skb_len, true); in ath10k_htc_send()
192 ath10k_htc_prepare_tx_skb(ep, skb); in ath10k_htc_send()
205 sg_item.transfer_id = ep->eid; in ath10k_htc_send()
211 ret = ath10k_hif_tx_sg(htc->ar, ep->ul_pipe_id, &sg_item, 1); in ath10k_htc_send()
221 ath10k_htc_release_credit(ep, skb_len); in ath10k_htc_send()
231 struct ath10k_htc_ep *ep; in ath10k_htc_tx_completion_handler() local
237 ep = &htc->endpoint[skb_cb->eid]; in ath10k_htc_tx_completion_handler()
239 ath10k_htc_notify_tx_completion(ep, skb); in ath10k_htc_tx_completion_handler()
255 struct ath10k_htc_ep *ep; in ath10k_htc_process_credit_report() local
268 ep = &htc->endpoint[report->eid]; in ath10k_htc_process_credit_report()
269 ep->tx_credits += report->credits; in ath10k_htc_process_credit_report()
271 ath10k_dbg(ar, ATH10K_DBG_HTC, "htc ep %d got %d credits (total %d)\n", in ath10k_htc_process_credit_report()
272 report->eid, report->credits, ep->tx_credits); in ath10k_htc_process_credit_report()
274 if (ep->ep_ops.ep_tx_credits) { in ath10k_htc_process_credit_report()
276 ep->ep_ops.ep_tx_credits(htc->ar); in ath10k_htc_process_credit_report()
444 struct ath10k_htc_ep *ep; in ath10k_htc_rx_completion_handler() local
463 ep = &htc->endpoint[eid]; in ath10k_htc_rx_completion_handler()
464 if (ep->service_id == ATH10K_HTC_SVC_ID_UNUSED) { in ath10k_htc_rx_completion_handler()
520 ath10k_dbg(ar, ATH10K_DBG_HTC, "htc rx completion ep %d skb %pK\n", in ath10k_htc_rx_completion_handler()
522 ep->ep_ops.ep_rx_complete(ar, skb); in ath10k_htc_rx_completion_handler()
543 * sending unsolicited messages on the ep 0 in ath10k_htc_control_rx_complete()
613 struct ath10k_htc_ep *ep; in ath10k_htc_reset_endpoint_states() local
617 ep = &htc->endpoint[i]; in ath10k_htc_reset_endpoint_states()
618 ep->service_id = ATH10K_HTC_SVC_ID_UNUSED; in ath10k_htc_reset_endpoint_states()
619 ep->max_ep_message_len = 0; in ath10k_htc_reset_endpoint_states()
620 ep->max_tx_queue_depth = 0; in ath10k_htc_reset_endpoint_states()
621 ep->eid = i; in ath10k_htc_reset_endpoint_states()
622 ep->htc = htc; in ath10k_htc_reset_endpoint_states()
623 ep->tx_credit_flow_enabled = true; in ath10k_htc_reset_endpoint_states()
641 static int ath10k_htc_send_bundle(struct ath10k_htc_ep *ep, in ath10k_htc_send_bundle() argument
646 struct ath10k_htc *htc = ep->htc; in ath10k_htc_send_bundle()
654 ret = ath10k_htc_consume_credit(ep, skb_len, true); in ath10k_htc_send_bundle()
657 sg_item.transfer_id = ep->eid; in ath10k_htc_send_bundle()
662 ret = ath10k_hif_tx_sg(htc->ar, ep->ul_pipe_id, &sg_item, 1); in ath10k_htc_send_bundle()
664 ath10k_htc_release_credit(ep, skb_len); in ath10k_htc_send_bundle()
673 skb_queue_head(&ep->tx_req_head, skb); in ath10k_htc_send_bundle()
675 skb_queue_tail(&ep->tx_complete_head, skb); in ath10k_htc_send_bundle()
684 ret, ep->eid, skb_queue_len(&ep->tx_req_head), cn, skb_len); in ath10k_htc_send_bundle()
688 static void ath10k_htc_send_one_skb(struct ath10k_htc_ep *ep, struct sk_buff *skb) in ath10k_htc_send_one_skb() argument
690 struct ath10k_htc *htc = ep->htc; in ath10k_htc_send_one_skb()
694 ret = ath10k_htc_send(htc, ep->eid, skb); in ath10k_htc_send_one_skb()
697 skb_queue_head(&ep->tx_req_head, skb); in ath10k_htc_send_one_skb()
700 ret, ep->eid, skb->len, skb_queue_len(&ep->tx_req_head)); in ath10k_htc_send_one_skb()
703 static int ath10k_htc_send_bundle_skbs(struct ath10k_htc_ep *ep) in ath10k_htc_send_bundle_skbs() argument
705 struct ath10k_htc *htc = ep->htc; in ath10k_htc_send_bundle_skbs()
715 if (ep->tx_credit_flow_enabled && in ath10k_htc_send_bundle_skbs()
716 ep->tx_credits < ATH10K_MIN_CREDIT_PER_HTC_TX_BUNDLE) in ath10k_htc_send_bundle_skbs()
719 bundles_left = ATH10K_MAX_MSG_PER_HTC_TX_BUNDLE * ep->tx_credit_size; in ath10k_htc_send_bundle_skbs()
729 skb = skb_dequeue(&ep->tx_req_head); in ath10k_htc_send_bundle_skbs()
735 credit_remainder = trans_len % ep->tx_credit_size; in ath10k_htc_send_bundle_skbs()
738 credit_pad = ep->tx_credit_size - credit_remainder; in ath10k_htc_send_bundle_skbs()
742 ret = ath10k_htc_consume_credit(ep, in ath10k_htc_send_bundle_skbs()
746 skb_queue_head(&ep->tx_req_head, skb); in ath10k_htc_send_bundle_skbs()
752 ret = ath10k_htc_send_bundle(ep, bundle_skb, &tx_save_head); in ath10k_htc_send_bundle_skbs()
755 skb_queue_head(&ep->tx_req_head, skb); in ath10k_htc_send_bundle_skbs()
759 if (skb_queue_len(&ep->tx_req_head) == 0) { in ath10k_htc_send_bundle_skbs()
760 ath10k_htc_send_one_skb(ep, skb); in ath10k_htc_send_bundle_skbs()
764 if (ep->tx_credit_flow_enabled && in ath10k_htc_send_bundle_skbs()
765 ep->tx_credits < ATH10K_MIN_CREDIT_PER_HTC_TX_BUNDLE) { in ath10k_htc_send_bundle_skbs()
766 skb_queue_head(&ep->tx_req_head, skb); in ath10k_htc_send_bundle_skbs()
771 ATH10K_MAX_MSG_PER_HTC_TX_BUNDLE * ep->tx_credit_size; in ath10k_htc_send_bundle_skbs()
775 skb_queue_head(&ep->tx_req_head, skb); in ath10k_htc_send_bundle_skbs()
783 ath10k_htc_prepare_tx_skb(ep, skb); in ath10k_htc_send_bundle_skbs()
796 ret = ath10k_htc_send_bundle(ep, bundle_skb, &tx_save_head); in ath10k_htc_send_bundle_skbs()
807 struct ath10k_htc_ep *ep; in ath10k_htc_bundle_tx_work() local
812 ep = &ar->htc.endpoint[i]; in ath10k_htc_bundle_tx_work()
814 if (!ep->bundle_tx) in ath10k_htc_bundle_tx_work()
818 ep->eid, skb_queue_len(&ep->tx_req_head)); in ath10k_htc_bundle_tx_work()
820 if (skb_queue_len(&ep->tx_req_head) >= in ath10k_htc_bundle_tx_work()
822 ath10k_htc_send_bundle_skbs(ep); in ath10k_htc_bundle_tx_work()
824 skb = skb_dequeue(&ep->tx_req_head); in ath10k_htc_bundle_tx_work()
828 ath10k_htc_send_one_skb(ep, skb); in ath10k_htc_bundle_tx_work()
836 struct ath10k_htc_ep *ep; in ath10k_htc_tx_complete_work() local
842 ep = &ar->htc.endpoint[i]; in ath10k_htc_tx_complete_work()
843 eid = ep->eid; in ath10k_htc_tx_complete_work()
844 if (ep->bundle_tx && eid == ar->htt.eid) { in ath10k_htc_tx_complete_work()
846 ep->eid, skb_queue_len(&ep->tx_complete_head)); in ath10k_htc_tx_complete_work()
849 skb = skb_dequeue(&ep->tx_complete_head); in ath10k_htc_tx_complete_work()
852 ath10k_htc_notify_tx_completion(ep, skb); in ath10k_htc_tx_complete_work()
862 struct ath10k_htc_ep *ep = &htc->endpoint[eid]; in ath10k_htc_send_hl() local
865 if (sizeof(struct ath10k_htc_hdr) + skb->len > ep->tx_credit_size) { in ath10k_htc_send_hl()
871 eid, ep->bundle_tx, skb_queue_len(&ep->tx_req_head), skb->len); in ath10k_htc_send_hl()
873 if (ep->bundle_tx) { in ath10k_htc_send_hl()
874 skb_queue_tail(&ep->tx_req_head, skb); in ath10k_htc_send_hl()
882 void ath10k_htc_setup_tx_req(struct ath10k_htc_ep *ep) in ath10k_htc_setup_tx_req() argument
884 if (ep->htc->max_msgs_per_htc_bundle >= ATH10K_MIN_MSG_PER_HTC_TX_BUNDLE && in ath10k_htc_setup_tx_req()
885 !ep->bundle_tx) { in ath10k_htc_setup_tx_req()
886 ep->bundle_tx = true; in ath10k_htc_setup_tx_req()
887 skb_queue_head_init(&ep->tx_req_head); in ath10k_htc_setup_tx_req()
888 skb_queue_head_init(&ep->tx_complete_head); in ath10k_htc_setup_tx_req()
894 struct ath10k_htc_ep *ep; in ath10k_htc_stop_hl() local
901 ep = &ar->htc.endpoint[i]; in ath10k_htc_stop_hl()
903 if (!ep->bundle_tx) in ath10k_htc_stop_hl()
907 ep->eid, skb_queue_len(&ep->tx_req_head)); in ath10k_htc_stop_hl()
909 skb_queue_purge(&ep->tx_req_head); in ath10k_htc_stop_hl()
1009 struct ath10k_htc_ep *ep = &ar->htc.endpoint[eid]; in ath10k_htc_change_tx_credit_flow() local
1011 ep->tx_credit_flow_enabled = enable; in ath10k_htc_change_tx_credit_flow()
1024 struct ath10k_htc_ep *ep; in ath10k_htc_connect_service() local
1105 "HTC Service %s connect response: status: 0x%x, assigned ep: 0x%x\n", in ath10k_htc_connect_service()
1130 ep = &htc->endpoint[assigned_eid]; in ath10k_htc_connect_service()
1131 ep->eid = assigned_eid; in ath10k_htc_connect_service()
1133 if (ep->service_id != ATH10K_HTC_SVC_ID_UNUSED) in ath10k_htc_connect_service()
1141 ep->service_id = conn_req->service_id; in ath10k_htc_connect_service()
1142 ep->max_tx_queue_depth = conn_req->max_send_queue_depth; in ath10k_htc_connect_service()
1143 ep->max_ep_message_len = __le16_to_cpu(resp_msg->max_msg_size); in ath10k_htc_connect_service()
1144 ep->tx_credits = tx_alloc; in ath10k_htc_connect_service()
1145 ep->tx_credit_size = htc->target_credit_size; in ath10k_htc_connect_service()
1149 ep->tx_credit_size = htc->alt_data_credit_size; in ath10k_htc_connect_service()
1152 ep->ep_ops = conn_req->ep_ops; in ath10k_htc_connect_service()
1155 ep->service_id, in ath10k_htc_connect_service()
1156 &ep->ul_pipe_id, in ath10k_htc_connect_service()
1157 &ep->dl_pipe_id); in ath10k_htc_connect_service()
1160 ep->service_id); in ath10k_htc_connect_service()
1166 htc_service_name(ep->service_id), ep->ul_pipe_id, in ath10k_htc_connect_service()
1167 ep->dl_pipe_id, ep->eid); in ath10k_htc_connect_service()
1169 if (disable_credit_flow_ctrl && ep->tx_credit_flow_enabled) { in ath10k_htc_connect_service()
1170 ep->tx_credit_flow_enabled = false; in ath10k_htc_connect_service()
1173 htc_service_name(ep->service_id), assigned_eid); in ath10k_htc_connect_service()