Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 291449
b: refs/heads/master
c: b29072c
h: refs/heads/master
i:
  291447: 919847d
v: v3
  • Loading branch information
Chilam Ng authored and Kalle Valo committed Feb 8, 2012
1 parent 50ad9db commit 198e1e1
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1b2df4073447234034e2329f0df584c6346a8ec3
refs/heads/master: b29072cc7b0e08ace48ab709c40cf6246fb2e8b0
2 changes: 2 additions & 0 deletions trunk/drivers/net/wireless/ath/ath6kl/hif.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ struct hif_scatter_req {
u8 *virt_dma_buf;

struct hif_scatter_item scat_list[1];

u32 scat_q_depth;
};

struct ath6kl_irq_proc_registers {
Expand Down
77 changes: 70 additions & 7 deletions trunk/drivers/net/wireless/ath/ath6kl/htc.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

#define CALC_TXRX_PADDED_LEN(dev, len) (__ALIGN_MASK((len), (dev)->block_mask))

/* threshold to re-enable Tx bundling for an AC*/
#define TX_RESUME_BUNDLE_THRESHOLD 1500

/* Functions for Tx credit handling */
static void ath6kl_credit_deposit(struct ath6kl_htc_credit_info *cred_info,
struct htc_endpoint_credit_dist *ep_dist,
Expand Down Expand Up @@ -745,6 +748,12 @@ static void ath6kl_htc_tx_bundle(struct htc_endpoint *endpoint,
struct hif_scatter_req *scat_req = NULL;
int n_scat, n_sent_bundle = 0, tot_pkts_bundle = 0;
int status;
u32 txb_mask;
u8 ac = WMM_NUM_AC;

if ((HTC_CTRL_RSVD_SVC != endpoint->svc_id) ||
(WMI_CONTROL_SVC != endpoint->svc_id))
ac = target->dev->ar->ep2ac_map[endpoint->eid];

while (true) {
status = 0;
Expand All @@ -764,6 +773,31 @@ static void ath6kl_htc_tx_bundle(struct htc_endpoint *endpoint,
break;
}

if ((ac < WMM_NUM_AC) && (ac != WMM_AC_BK)) {
if (WMM_AC_BE == ac)
/*
* BE, BK have priorities and bit
* positions reversed
*/
txb_mask = (1 << WMM_AC_BK);
else
/*
* any AC with priority lower than
* itself
*/
txb_mask = ((1 << ac) - 1);
/*
* when the scatter request resources drop below a
* certain threshold, disable Tx bundling for all
* AC's with priority lower than the current requesting
* AC. Otherwise re-enable Tx bundling for them
*/
if (scat_req->scat_q_depth < ATH6KL_SCATTER_REQS)
target->tx_bndl_mask &= ~txb_mask;
else
target->tx_bndl_mask |= txb_mask;
}

ath6kl_dbg(ATH6KL_DBG_HTC, "htc tx pkts to scatter: %d\n",
n_scat);

Expand Down Expand Up @@ -807,6 +841,7 @@ static void ath6kl_htc_tx_from_queue(struct htc_target *target,
struct htc_packet *packet;
int bundle_sent;
int n_pkts_bundle;
u8 ac = WMM_NUM_AC;

spin_lock_bh(&target->tx_lock);

Expand All @@ -824,6 +859,10 @@ static void ath6kl_htc_tx_from_queue(struct htc_target *target,
*/
INIT_LIST_HEAD(&txq);

if ((HTC_CTRL_RSVD_SVC != endpoint->svc_id) ||
(WMI_CONTROL_SVC != endpoint->svc_id))
ac = target->dev->ar->ep2ac_map[endpoint->eid];

while (true) {

if (list_empty(&endpoint->txq))
Expand All @@ -841,15 +880,18 @@ static void ath6kl_htc_tx_from_queue(struct htc_target *target,

while (true) {
/* try to send a bundle on each pass */
if ((target->tx_bndl_enable) &&
if ((target->tx_bndl_mask) &&
(get_queue_depth(&txq) >=
HTC_MIN_HTC_MSGS_TO_BUNDLE)) {
int temp1 = 0, temp2 = 0;

ath6kl_htc_tx_bundle(endpoint, &txq,
&temp1, &temp2);
bundle_sent += temp1;
n_pkts_bundle += temp2;
/* check if bundling is enabled for an AC */
if (target->tx_bndl_mask & (1 << ac)) {
ath6kl_htc_tx_bundle(endpoint, &txq,
&temp1, &temp2);
bundle_sent += temp1;
n_pkts_bundle += temp2;
}
}

if (list_empty(&txq))
Expand All @@ -868,6 +910,26 @@ static void ath6kl_htc_tx_from_queue(struct htc_target *target,

endpoint->ep_st.tx_bundles += bundle_sent;
endpoint->ep_st.tx_pkt_bundled += n_pkts_bundle;

/*
* if an AC has bundling disabled and no tx bundling
* has occured continously for a certain number of TX,
* enable tx bundling for this AC
*/
if (!bundle_sent) {
if (!(target->tx_bndl_mask & (1 << ac)) &&
(ac < WMM_NUM_AC)) {
if (++target->ac_tx_count[ac] >=
TX_RESUME_BUNDLE_THRESHOLD) {
target->ac_tx_count[ac] = 0;
target->tx_bndl_mask |= (1 << ac);
}
}
} else {
/* tx bundling will reset the counter */
if (ac < WMM_NUM_AC)
target->ac_tx_count[ac] = 0;
}
}

endpoint->tx_proc_cnt = 0;
Expand Down Expand Up @@ -2518,7 +2580,8 @@ static void htc_setup_msg_bndl(struct htc_target *target)
target->max_rx_bndl_sz, target->max_tx_bndl_sz);

if (target->max_tx_bndl_sz)
target->tx_bndl_enable = true;
/* tx_bndl_mask is enabled per AC, each has 1 bit */
target->tx_bndl_mask = (1 << WMM_NUM_AC) - 1;

if (target->max_rx_bndl_sz)
target->rx_bndl_enable = true;
Expand All @@ -2533,7 +2596,7 @@ static void htc_setup_msg_bndl(struct htc_target *target)
* padding will spill into the next credit buffer
* which is fatal.
*/
target->tx_bndl_enable = false;
target->tx_bndl_mask = 0;
}
}

Expand Down
7 changes: 6 additions & 1 deletion trunk/drivers/net/wireless/ath/ath6kl/htc.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
#define WMI_DATA_VO_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 4)
#define WMI_MAX_SERVICES 5

#define WMM_NUM_AC 4

/* reserved and used to flush ALL packets */
#define HTC_TX_PACKET_TAG_ALL 0
#define HTC_SERVICE_TX_PACKET_TAG 1
Expand Down Expand Up @@ -532,7 +534,7 @@ struct htc_target {
/* max messages per bundle for HTC */
int msg_per_bndl_max;

bool tx_bndl_enable;
u32 tx_bndl_mask;
int rx_bndl_enable;
int max_rx_bndl_sz;
int max_tx_bndl_sz;
Expand All @@ -544,6 +546,9 @@ struct htc_target {
int max_xfer_szper_scatreq;

int chk_irq_status_cnt;

/* counts the number of Tx without bundling continously per AC */
u32 ac_tx_count[WMM_NUM_AC];
};

void *ath6kl_htc_create(struct ath6kl *ar);
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/net/wireless/ath/ath6kl/sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,8 @@ static struct hif_scatter_req *ath6kl_sdio_scatter_req_get(struct ath6kl *ar)
node = list_first_entry(&ar_sdio->scat_req,
struct hif_scatter_req, list);
list_del(&node->list);

node->scat_q_depth = get_queue_depth(&ar_sdio->scat_req);
}

spin_unlock_bh(&ar_sdio->scat_lock);
Expand Down

0 comments on commit 198e1e1

Please sign in to comment.