Commit dfa0104c authored by Kalle Valo's avatar Kalle Valo

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: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 06033760
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#define CALC_TXRX_PADDED_LEN(dev, len) (__ALIGN_MASK((len), (dev)->block_mask)) #define CALC_TXRX_PADDED_LEN(dev, len) (__ALIGN_MASK((len), (dev)->block_mask))
static void ath6kl_htc_buf_align(u8 **buf, unsigned long len) static void ath6kl_htc_tx_buf_align(u8 **buf, unsigned long len)
{ {
u8 *align_addr; u8 *align_addr;
...@@ -33,8 +33,8 @@ static void ath6kl_htc_buf_align(u8 **buf, unsigned long len) ...@@ -33,8 +33,8 @@ static void ath6kl_htc_buf_align(u8 **buf, unsigned long len)
} }
} }
static void htc_prep_send_pkt(struct htc_packet *packet, u8 flags, int ctrl0, static void ath6kl_htc_tx_prep_pkt(struct htc_packet *packet, u8 flags,
int ctrl1) int ctrl0, int ctrl1)
{ {
struct htc_frame_hdr *hdr; struct htc_frame_hdr *hdr;
...@@ -178,7 +178,8 @@ static void htc_async_tx_scat_complete(struct htc_target *target, ...@@ -178,7 +178,8 @@ static void htc_async_tx_scat_complete(struct htc_target *target,
htc_tx_complete(endpoint, &tx_compq); htc_tx_complete(endpoint, &tx_compq);
} }
static int htc_issue_send(struct htc_target *target, struct htc_packet *packet) static int ath6kl_htc_tx_issue(struct htc_target *target,
struct htc_packet *packet)
{ {
int status; int status;
bool sync = false; bool sync = false;
...@@ -276,7 +277,7 @@ static int htc_check_credits(struct htc_target *target, ...@@ -276,7 +277,7 @@ static int htc_check_credits(struct htc_target *target,
return 0; return 0;
} }
static void htc_tx_pkts_get(struct htc_target *target, static void ath6kl_htc_tx_pkts_get(struct htc_target *target,
struct htc_endpoint *endpoint, struct htc_endpoint *endpoint,
struct list_head *queue) struct list_head *queue)
{ {
...@@ -357,7 +358,7 @@ static int htc_get_credit_padding(unsigned int cred_sz, int *len, ...@@ -357,7 +358,7 @@ static int htc_get_credit_padding(unsigned int cred_sz, int *len,
return cred_pad; return cred_pad;
} }
static int htc_setup_send_scat_list(struct htc_target *target, static int ath6kl_htc_tx_setup_scat_list(struct htc_target *target,
struct htc_endpoint *endpoint, struct htc_endpoint *endpoint,
struct hif_scatter_req *scat_req, struct hif_scatter_req *scat_req,
int n_scat, int n_scat,
...@@ -393,11 +394,11 @@ static int htc_setup_send_scat_list(struct htc_target *target, ...@@ -393,11 +394,11 @@ static int htc_setup_send_scat_list(struct htc_target *target,
scat_req->scat_list[i].packet = packet; scat_req->scat_list[i].packet = packet;
/* prepare packet and flag message as part of a send bundle */ /* prepare packet and flag message as part of a send bundle */
htc_prep_send_pkt(packet, ath6kl_htc_tx_prep_pkt(packet,
packet->info.tx.flags | HTC_FLAGS_SEND_BUNDLE, packet->info.tx.flags | HTC_FLAGS_SEND_BUNDLE,
cred_pad, packet->info.tx.seqno); cred_pad, packet->info.tx.seqno);
/* Make sure the buffer is 4-byte aligned */ /* Make sure the buffer is 4-byte aligned */
ath6kl_htc_buf_align(&packet->buf, ath6kl_htc_tx_buf_align(&packet->buf,
packet->act_len + HTC_HDR_LENGTH); packet->act_len + HTC_HDR_LENGTH);
scat_req->scat_list[i].buf = packet->buf; scat_req->scat_list[i].buf = packet->buf;
scat_req->scat_list[i].len = len; scat_req->scat_list[i].len = len;
...@@ -425,16 +426,15 @@ static int htc_setup_send_scat_list(struct htc_target *target, ...@@ -425,16 +426,15 @@ static int htc_setup_send_scat_list(struct htc_target *target,
} }
/* /*
* htc_issue_send_bundle: drain a queue and send as bundles * Drain a queue and send as bundles this function may return without fully
* this function may return without fully draining the queue * draining the queue when
* when
* *
* 1. scatter resources are exhausted * 1. scatter resources are exhausted
* 2. a message that will consume a partial credit will stop the * 2. a message that will consume a partial credit will stop the
* bundling process early * bundling process early
* 3. we drop below the minimum number of messages for a bundle * 3. we drop below the minimum number of messages for a bundle
*/ */
static void htc_issue_send_bundle(struct htc_endpoint *endpoint, static void ath6kl_htc_tx_bundle(struct htc_endpoint *endpoint,
struct list_head *queue, struct list_head *queue,
int *sent_bundle, int *n_bundle_pkts) int *sent_bundle, int *n_bundle_pkts)
{ {
...@@ -467,8 +467,9 @@ static void htc_issue_send_bundle(struct htc_endpoint *endpoint, ...@@ -467,8 +467,9 @@ static void htc_issue_send_bundle(struct htc_endpoint *endpoint,
scat_req->len = 0; scat_req->len = 0;
scat_req->scat_entries = 0; scat_req->scat_entries = 0;
status = htc_setup_send_scat_list(target, endpoint, status = ath6kl_htc_tx_setup_scat_list(target, endpoint,
scat_req, n_scat, queue); scat_req, n_scat,
queue);
if (status == -EAGAIN) { if (status == -EAGAIN) {
hif_scatter_req_add(target->dev->ar, scat_req); hif_scatter_req_add(target->dev->ar, scat_req);
break; break;
...@@ -490,13 +491,13 @@ static void htc_issue_send_bundle(struct htc_endpoint *endpoint, ...@@ -490,13 +491,13 @@ static void htc_issue_send_bundle(struct htc_endpoint *endpoint,
*sent_bundle = n_sent_bundle; *sent_bundle = n_sent_bundle;
*n_bundle_pkts = tot_pkts_bundle; *n_bundle_pkts = tot_pkts_bundle;
ath6kl_dbg(ATH6KL_DBG_HTC_SEND, "htc_issue_send_bundle (sent:%d)\n", ath6kl_dbg(ATH6KL_DBG_HTC_SEND, "%s (sent:%d)\n",
n_sent_bundle); __func__, n_sent_bundle);
return; return;
} }
static void htc_tx_from_ep_txq(struct htc_target *target, static void ath6kl_htc_tx_from_queue(struct htc_target *target,
struct htc_endpoint *endpoint) struct htc_endpoint *endpoint)
{ {
struct list_head txq; struct list_head txq;
...@@ -525,7 +526,7 @@ static void htc_tx_from_ep_txq(struct htc_target *target, ...@@ -525,7 +526,7 @@ static void htc_tx_from_ep_txq(struct htc_target *target,
if (list_empty(&endpoint->txq)) if (list_empty(&endpoint->txq))
break; break;
htc_tx_pkts_get(target, endpoint, &txq); ath6kl_htc_tx_pkts_get(target, endpoint, &txq);
if (list_empty(&txq)) if (list_empty(&txq))
break; break;
...@@ -542,7 +543,7 @@ static void htc_tx_from_ep_txq(struct htc_target *target, ...@@ -542,7 +543,7 @@ static void htc_tx_from_ep_txq(struct htc_target *target,
HTC_MIN_HTC_MSGS_TO_BUNDLE)) { HTC_MIN_HTC_MSGS_TO_BUNDLE)) {
int temp1 = 0, temp2 = 0; int temp1 = 0, temp2 = 0;
htc_issue_send_bundle(endpoint, &txq, ath6kl_htc_tx_bundle(endpoint, &txq,
&temp1, &temp2); &temp1, &temp2);
bundle_sent += temp1; bundle_sent += temp1;
n_pkts_bundle += temp2; n_pkts_bundle += temp2;
...@@ -555,9 +556,9 @@ static void htc_tx_from_ep_txq(struct htc_target *target, ...@@ -555,9 +556,9 @@ static void htc_tx_from_ep_txq(struct htc_target *target,
list); list);
list_del(&packet->list); list_del(&packet->list);
htc_prep_send_pkt(packet, packet->info.tx.flags, ath6kl_htc_tx_prep_pkt(packet, packet->info.tx.flags,
0, packet->info.tx.seqno); 0, packet->info.tx.seqno);
htc_issue_send(target, packet); ath6kl_htc_tx_issue(target, packet);
} }
spin_lock_bh(&target->tx_lock); spin_lock_bh(&target->tx_lock);
...@@ -570,7 +571,7 @@ static void htc_tx_from_ep_txq(struct htc_target *target, ...@@ -570,7 +571,7 @@ static void htc_tx_from_ep_txq(struct htc_target *target,
spin_unlock_bh(&target->tx_lock); spin_unlock_bh(&target->tx_lock);
} }
static bool htc_try_send(struct htc_target *target, static bool ath6kl_htc_tx_try(struct htc_target *target,
struct htc_endpoint *endpoint, struct htc_endpoint *endpoint,
struct htc_packet *tx_pkt) struct htc_packet *tx_pkt)
{ {
...@@ -608,7 +609,7 @@ static bool htc_try_send(struct htc_target *target, ...@@ -608,7 +609,7 @@ static bool htc_try_send(struct htc_target *target,
list_add_tail(&tx_pkt->list, &endpoint->txq); list_add_tail(&tx_pkt->list, &endpoint->txq);
spin_unlock_bh(&target->tx_lock); spin_unlock_bh(&target->tx_lock);
htc_tx_from_ep_txq(target, endpoint); ath6kl_htc_tx_from_queue(target, endpoint);
return true; return true;
} }
...@@ -642,7 +643,7 @@ static void htc_chk_ep_txq(struct htc_target *target) ...@@ -642,7 +643,7 @@ static void htc_chk_ep_txq(struct htc_target *target)
* chance to reclaim credits from lower priority * chance to reclaim credits from lower priority
* ones. * ones.
*/ */
htc_tx_from_ep_txq(target, endpoint); ath6kl_htc_tx_from_queue(target, endpoint);
spin_lock_bh(&target->tx_lock); spin_lock_bh(&target->tx_lock);
} }
spin_unlock_bh(&target->tx_lock); spin_unlock_bh(&target->tx_lock);
...@@ -694,8 +695,8 @@ static int htc_setup_tx_complete(struct htc_target *target) ...@@ -694,8 +695,8 @@ static int htc_setup_tx_complete(struct htc_target *target)
/* we want synchronous operation */ /* we want synchronous operation */
send_pkt->completion = NULL; send_pkt->completion = NULL;
htc_prep_send_pkt(send_pkt, 0, 0, 0); ath6kl_htc_tx_prep_pkt(send_pkt, 0, 0, 0);
status = htc_issue_send(target, send_pkt); status = ath6kl_htc_tx_issue(target, send_pkt);
if (send_pkt != NULL) if (send_pkt != NULL)
htc_reclaim_txctrl_buf(target, send_pkt); htc_reclaim_txctrl_buf(target, send_pkt);
...@@ -747,7 +748,7 @@ int ath6kl_htc_tx(struct htc_target *target, struct htc_packet *packet) ...@@ -747,7 +748,7 @@ int ath6kl_htc_tx(struct htc_target *target, struct htc_packet *packet)
endpoint = &target->endpoint[packet->endpoint]; endpoint = &target->endpoint[packet->endpoint];
if (!htc_try_send(target, endpoint, packet)) { if (!ath6kl_htc_tx_try(target, endpoint, packet)) {
packet->status = (target->htc_flags & HTC_OP_STATE_STOPPING) ? packet->status = (target->htc_flags & HTC_OP_STATE_STOPPING) ?
-ECANCELED : -ENOSPC; -ECANCELED : -ENOSPC;
INIT_LIST_HEAD(&queue); INIT_LIST_HEAD(&queue);
...@@ -2048,8 +2049,8 @@ int ath6kl_htc_conn_service(struct htc_target *target, ...@@ -2048,8 +2049,8 @@ int ath6kl_htc_conn_service(struct htc_target *target,
/* we want synchronous operation */ /* we want synchronous operation */
tx_pkt->completion = NULL; tx_pkt->completion = NULL;
htc_prep_send_pkt(tx_pkt, 0, 0, 0); ath6kl_htc_tx_prep_pkt(tx_pkt, 0, 0, 0);
status = htc_issue_send(target, tx_pkt); status = ath6kl_htc_tx_issue(target, tx_pkt);
if (status) if (status)
goto fail_tx; goto fail_tx;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment