aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath6kl/htc.c
diff options
context:
space:
mode:
authorKalle Valo <kvalo@qca.qualcomm.com>2011-09-06 04:10:49 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2011-09-06 04:10:49 -0400
commitdfa0104c2a2699e73a49b4ca10bbb99796b05889 (patch)
tree2a6da1a78c802b55f7d3387739cc56a92b4e667c /drivers/net/wireless/ath/ath6kl/htc.c
parent060337604577e55c5bf3246bcaf161929c603d54 (diff)
ath6kl: unify tx function names in htc.c
This is to make it easier follow tx code path inside htc.No functional changes. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath6kl/htc.c')
-rw-r--r--drivers/net/wireless/ath/ath6kl/htc.c87
1 files changed, 44 insertions, 43 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/htc.c b/drivers/net/wireless/ath/ath6kl/htc.c
index 77e548ce2c03..46c6efbcd31b 100644
--- a/drivers/net/wireless/ath/ath6kl/htc.c
+++ b/drivers/net/wireless/ath/ath6kl/htc.c
@@ -22,7 +22,7 @@
22 22
23#define CALC_TXRX_PADDED_LEN(dev, len) (__ALIGN_MASK((len), (dev)->block_mask)) 23#define CALC_TXRX_PADDED_LEN(dev, len) (__ALIGN_MASK((len), (dev)->block_mask))
24 24
25static void ath6kl_htc_buf_align(u8 **buf, unsigned long len) 25static void ath6kl_htc_tx_buf_align(u8 **buf, unsigned long len)
26{ 26{
27 u8 *align_addr; 27 u8 *align_addr;
28 28
@@ -33,8 +33,8 @@ static void ath6kl_htc_buf_align(u8 **buf, unsigned long len)
33 } 33 }
34} 34}
35 35
36static void htc_prep_send_pkt(struct htc_packet *packet, u8 flags, int ctrl0, 36static void ath6kl_htc_tx_prep_pkt(struct htc_packet *packet, u8 flags,
37 int ctrl1) 37 int ctrl0, int ctrl1)
38{ 38{
39 struct htc_frame_hdr *hdr; 39 struct htc_frame_hdr *hdr;
40 40
@@ -178,7 +178,8 @@ static void htc_async_tx_scat_complete(struct htc_target *target,
178 htc_tx_complete(endpoint, &tx_compq); 178 htc_tx_complete(endpoint, &tx_compq);
179} 179}
180 180
181static int htc_issue_send(struct htc_target *target, struct htc_packet *packet) 181static int ath6kl_htc_tx_issue(struct htc_target *target,
182 struct htc_packet *packet)
182{ 183{
183 int status; 184 int status;
184 bool sync = false; 185 bool sync = false;
@@ -276,9 +277,9 @@ static int htc_check_credits(struct htc_target *target,
276 return 0; 277 return 0;
277} 278}
278 279
279static void htc_tx_pkts_get(struct htc_target *target, 280static void ath6kl_htc_tx_pkts_get(struct htc_target *target,
280 struct htc_endpoint *endpoint, 281 struct htc_endpoint *endpoint,
281 struct list_head *queue) 282 struct list_head *queue)
282{ 283{
283 int req_cred; 284 int req_cred;
284 u8 flags; 285 u8 flags;
@@ -357,11 +358,11 @@ static int htc_get_credit_padding(unsigned int cred_sz, int *len,
357 return cred_pad; 358 return cred_pad;
358} 359}
359 360
360static int htc_setup_send_scat_list(struct htc_target *target, 361static int ath6kl_htc_tx_setup_scat_list(struct htc_target *target,
361 struct htc_endpoint *endpoint, 362 struct htc_endpoint *endpoint,
362 struct hif_scatter_req *scat_req, 363 struct hif_scatter_req *scat_req,
363 int n_scat, 364 int n_scat,
364 struct list_head *queue) 365 struct list_head *queue)
365{ 366{
366 struct htc_packet *packet; 367 struct htc_packet *packet;
367 int i, len, rem_scat, cred_pad; 368 int i, len, rem_scat, cred_pad;
@@ -393,12 +394,12 @@ static int htc_setup_send_scat_list(struct htc_target *target,
393 394
394 scat_req->scat_list[i].packet = packet; 395 scat_req->scat_list[i].packet = packet;
395 /* prepare packet and flag message as part of a send bundle */ 396 /* prepare packet and flag message as part of a send bundle */
396 htc_prep_send_pkt(packet, 397 ath6kl_htc_tx_prep_pkt(packet,
397 packet->info.tx.flags | HTC_FLAGS_SEND_BUNDLE, 398 packet->info.tx.flags | HTC_FLAGS_SEND_BUNDLE,
398 cred_pad, packet->info.tx.seqno); 399 cred_pad, packet->info.tx.seqno);
399 /* Make sure the buffer is 4-byte aligned */ 400 /* Make sure the buffer is 4-byte aligned */
400 ath6kl_htc_buf_align(&packet->buf, 401 ath6kl_htc_tx_buf_align(&packet->buf,
401 packet->act_len + HTC_HDR_LENGTH); 402 packet->act_len + HTC_HDR_LENGTH);
402 scat_req->scat_list[i].buf = packet->buf; 403 scat_req->scat_list[i].buf = packet->buf;
403 scat_req->scat_list[i].len = len; 404 scat_req->scat_list[i].len = len;
404 405
@@ -425,18 +426,17 @@ static int htc_setup_send_scat_list(struct htc_target *target,
425} 426}
426 427
427/* 428/*
428 * htc_issue_send_bundle: drain a queue and send as bundles 429 * Drain a queue and send as bundles this function may return without fully
429 * this function may return without fully draining the queue 430 * draining the queue when
430 * when
431 * 431 *
432 * 1. scatter resources are exhausted 432 * 1. scatter resources are exhausted
433 * 2. a message that will consume a partial credit will stop the 433 * 2. a message that will consume a partial credit will stop the
434 * bundling process early 434 * bundling process early
435 * 3. we drop below the minimum number of messages for a bundle 435 * 3. we drop below the minimum number of messages for a bundle
436 */ 436 */
437static void htc_issue_send_bundle(struct htc_endpoint *endpoint, 437static void ath6kl_htc_tx_bundle(struct htc_endpoint *endpoint,
438 struct list_head *queue, 438 struct list_head *queue,
439 int *sent_bundle, int *n_bundle_pkts) 439 int *sent_bundle, int *n_bundle_pkts)
440{ 440{
441 struct htc_target *target = endpoint->target; 441 struct htc_target *target = endpoint->target;
442 struct hif_scatter_req *scat_req = NULL; 442 struct hif_scatter_req *scat_req = NULL;
@@ -467,8 +467,9 @@ static void htc_issue_send_bundle(struct htc_endpoint *endpoint,
467 scat_req->len = 0; 467 scat_req->len = 0;
468 scat_req->scat_entries = 0; 468 scat_req->scat_entries = 0;
469 469
470 status = htc_setup_send_scat_list(target, endpoint, 470 status = ath6kl_htc_tx_setup_scat_list(target, endpoint,
471 scat_req, n_scat, queue); 471 scat_req, n_scat,
472 queue);
472 if (status == -EAGAIN) { 473 if (status == -EAGAIN) {
473 hif_scatter_req_add(target->dev->ar, scat_req); 474 hif_scatter_req_add(target->dev->ar, scat_req);
474 break; 475 break;
@@ -490,14 +491,14 @@ static void htc_issue_send_bundle(struct htc_endpoint *endpoint,
490 491
491 *sent_bundle = n_sent_bundle; 492 *sent_bundle = n_sent_bundle;
492 *n_bundle_pkts = tot_pkts_bundle; 493 *n_bundle_pkts = tot_pkts_bundle;
493 ath6kl_dbg(ATH6KL_DBG_HTC_SEND, "htc_issue_send_bundle (sent:%d)\n", 494 ath6kl_dbg(ATH6KL_DBG_HTC_SEND, "%s (sent:%d)\n",
494 n_sent_bundle); 495 __func__, n_sent_bundle);
495 496
496 return; 497 return;
497} 498}
498 499
499static void htc_tx_from_ep_txq(struct htc_target *target, 500static void ath6kl_htc_tx_from_queue(struct htc_target *target,
500 struct htc_endpoint *endpoint) 501 struct htc_endpoint *endpoint)
501{ 502{
502 struct list_head txq; 503 struct list_head txq;
503 struct htc_packet *packet; 504 struct htc_packet *packet;
@@ -525,7 +526,7 @@ static void htc_tx_from_ep_txq(struct htc_target *target,
525 if (list_empty(&endpoint->txq)) 526 if (list_empty(&endpoint->txq))
526 break; 527 break;
527 528
528 htc_tx_pkts_get(target, endpoint, &txq); 529 ath6kl_htc_tx_pkts_get(target, endpoint, &txq);
529 530
530 if (list_empty(&txq)) 531 if (list_empty(&txq))
531 break; 532 break;
@@ -542,8 +543,8 @@ static void htc_tx_from_ep_txq(struct htc_target *target,
542 HTC_MIN_HTC_MSGS_TO_BUNDLE)) { 543 HTC_MIN_HTC_MSGS_TO_BUNDLE)) {
543 int temp1 = 0, temp2 = 0; 544 int temp1 = 0, temp2 = 0;
544 545
545 htc_issue_send_bundle(endpoint, &txq, 546 ath6kl_htc_tx_bundle(endpoint, &txq,
546 &temp1, &temp2); 547 &temp1, &temp2);
547 bundle_sent += temp1; 548 bundle_sent += temp1;
548 n_pkts_bundle += temp2; 549 n_pkts_bundle += temp2;
549 } 550 }
@@ -555,9 +556,9 @@ static void htc_tx_from_ep_txq(struct htc_target *target,
555 list); 556 list);
556 list_del(&packet->list); 557 list_del(&packet->list);
557 558
558 htc_prep_send_pkt(packet, packet->info.tx.flags, 559 ath6kl_htc_tx_prep_pkt(packet, packet->info.tx.flags,
559 0, packet->info.tx.seqno); 560 0, packet->info.tx.seqno);
560 htc_issue_send(target, packet); 561 ath6kl_htc_tx_issue(target, packet);
561 } 562 }
562 563
563 spin_lock_bh(&target->tx_lock); 564 spin_lock_bh(&target->tx_lock);
@@ -570,9 +571,9 @@ static void htc_tx_from_ep_txq(struct htc_target *target,
570 spin_unlock_bh(&target->tx_lock); 571 spin_unlock_bh(&target->tx_lock);
571} 572}
572 573
573static bool htc_try_send(struct htc_target *target, 574static bool ath6kl_htc_tx_try(struct htc_target *target,
574 struct htc_endpoint *endpoint, 575 struct htc_endpoint *endpoint,
575 struct htc_packet *tx_pkt) 576 struct htc_packet *tx_pkt)
576{ 577{
577 struct htc_ep_callbacks ep_cb; 578 struct htc_ep_callbacks ep_cb;
578 int txq_depth; 579 int txq_depth;
@@ -608,7 +609,7 @@ static bool htc_try_send(struct htc_target *target,
608 list_add_tail(&tx_pkt->list, &endpoint->txq); 609 list_add_tail(&tx_pkt->list, &endpoint->txq);
609 spin_unlock_bh(&target->tx_lock); 610 spin_unlock_bh(&target->tx_lock);
610 611
611 htc_tx_from_ep_txq(target, endpoint); 612 ath6kl_htc_tx_from_queue(target, endpoint);
612 613
613 return true; 614 return true;
614} 615}
@@ -642,7 +643,7 @@ static void htc_chk_ep_txq(struct htc_target *target)
642 * chance to reclaim credits from lower priority 643 * chance to reclaim credits from lower priority
643 * ones. 644 * ones.
644 */ 645 */
645 htc_tx_from_ep_txq(target, endpoint); 646 ath6kl_htc_tx_from_queue(target, endpoint);
646 spin_lock_bh(&target->tx_lock); 647 spin_lock_bh(&target->tx_lock);
647 } 648 }
648 spin_unlock_bh(&target->tx_lock); 649 spin_unlock_bh(&target->tx_lock);
@@ -694,8 +695,8 @@ static int htc_setup_tx_complete(struct htc_target *target)
694 695
695 /* we want synchronous operation */ 696 /* we want synchronous operation */
696 send_pkt->completion = NULL; 697 send_pkt->completion = NULL;
697 htc_prep_send_pkt(send_pkt, 0, 0, 0); 698 ath6kl_htc_tx_prep_pkt(send_pkt, 0, 0, 0);
698 status = htc_issue_send(target, send_pkt); 699 status = ath6kl_htc_tx_issue(target, send_pkt);
699 700
700 if (send_pkt != NULL) 701 if (send_pkt != NULL)
701 htc_reclaim_txctrl_buf(target, send_pkt); 702 htc_reclaim_txctrl_buf(target, send_pkt);
@@ -747,7 +748,7 @@ int ath6kl_htc_tx(struct htc_target *target, struct htc_packet *packet)
747 748
748 endpoint = &target->endpoint[packet->endpoint]; 749 endpoint = &target->endpoint[packet->endpoint];
749 750
750 if (!htc_try_send(target, endpoint, packet)) { 751 if (!ath6kl_htc_tx_try(target, endpoint, packet)) {
751 packet->status = (target->htc_flags & HTC_OP_STATE_STOPPING) ? 752 packet->status = (target->htc_flags & HTC_OP_STATE_STOPPING) ?
752 -ECANCELED : -ENOSPC; 753 -ECANCELED : -ENOSPC;
753 INIT_LIST_HEAD(&queue); 754 INIT_LIST_HEAD(&queue);
@@ -2048,8 +2049,8 @@ int ath6kl_htc_conn_service(struct htc_target *target,
2048 2049
2049 /* we want synchronous operation */ 2050 /* we want synchronous operation */
2050 tx_pkt->completion = NULL; 2051 tx_pkt->completion = NULL;
2051 htc_prep_send_pkt(tx_pkt, 0, 0, 0); 2052 ath6kl_htc_tx_prep_pkt(tx_pkt, 0, 0, 0);
2052 status = htc_issue_send(target, tx_pkt); 2053 status = ath6kl_htc_tx_issue(target, tx_pkt);
2053 2054
2054 if (status) 2055 if (status)
2055 goto fail_tx; 2056 goto fail_tx;