static bool length_check(struct dma_desc *desc)
{
- volatile struct carl9170_tx_superframe *super = DESC_PAYLOAD(desc);
+ volatile struct carl9170_tx_superframe *super = __get_super(desc);
if (unlikely(desc->totalLen < sizeof(struct carl9170_tx_superdesc)))
return false;
* is _SW ( handle_download_exception )
*/
- for_each_desc_bits(desc, &fw.pta.down_queue, AR9170_OWN_BITS_SE) {
+ for_each_desc_not_bits(desc, &fw.pta.down_queue, AR9170_OWN_BITS_HW) {
if (unlikely((length_check(desc) == false))) {
/*
* There is no easy way of telling what was lost.
* timeout mechanism.
*/
+ wlan_tx_complete(__get_super(desc), false);
dma_reclaim(&fw.pta.down_queue, desc);
down_trigger();
} else {
}
/* generate _aggregated_ tx_status for the host */
-static void wlan_tx_complete(struct carl9170_tx_superframe *super,
- bool txs)
+void wlan_tx_complete(struct carl9170_tx_superframe *super,
+ bool txs)
{
struct carl9170_tx_status *status;
*/
status->cookie = super->s.cookie;
status->queue = super->s.queue;
+ super->s.cookie = 0;
/*
* This field holds the number of tries of the rate in
success = true;
/* update hangcheck */
- fw.wlan.last_tx_desc_num[qidx] = 0;
+ fw.wlan.last_super_num[qidx] = 0;
if (!!(desc->ctrl & AR9170_CTRL_FAIL)) {
txfail = !!(desc->ctrl & AR9170_CTRL_TXFAIL);
#undef HANDLER
}
+enum {
+ CARL9170FW_TX_MAC_BUMP = 4,
+ CARL9170FW_TX_MAC_DEBUG = 6,
+ CARL9170FW_TX_MAC_RESET = 7,
+};
+
static void wlan_check_hang(void)
{
struct dma_desc *desc;
desc = get_wlan_txq_addr(i);
/* Stuck frame detection */
- if (unlikely(desc == fw.wlan.last_tx_desc[i])) {
- fw.wlan.last_tx_desc_num[i]++;
+ if (unlikely(DESC_PAYLOAD(desc) == fw.wlan.last_super[i])) {
+ fw.wlan.last_super_num[i]++;
- if (unlikely(fw.wlan.last_tx_desc_num[i] > 6)) {
+ if (unlikely(fw.wlan.last_super_num[i] >= CARL9170FW_TX_MAC_RESET)) {
/*
* schedule MAC reset (aka OFF/ON => dead)
*
}
#ifdef CONFIG_CARL9170FW_DEBUG
- if (unlikely(fw.wlan.last_tx_desc_num[i] > 5)) {
+ if (unlikely(fw.wlan.last_super_num[i] >= CARL9170FW_TX_MAC_DEBUG)) {
/*
* Sigh, the queue is almost certainly
* dead. Dump the queue content to the
#endif /* CONFIG_CARL9170FW_DEBUG */
#ifdef CONFIG_CARL9170FW_DMA_QUEUE_BUMP
- if (unlikely(fw.wlan.last_tx_desc_num[i] > 3)) {
+ if (unlikely(fw.wlan.last_super_num[i] >= CARL9170FW_TX_MAC_BUMP)) {
/*
* Hrrm, bump the queue a bit.
* maybe this will get it going again.
#endif /* CONFIG_CARL9170FW_DMA_QUEUE_BUMP */
} else {
/* Nothing stuck */
- fw.wlan.last_tx_desc[i] = desc;
- fw.wlan.last_tx_desc_num[i] = 0;
+ fw.wlan.last_super[i] = DESC_PAYLOAD(desc);
+ fw.wlan.last_super_num[i] = 0;
}
}
}
__for_each_desc_bits(iter, &fw.wlan.tx_queue[i], AR9170_OWN_BITS_SW);
+ /* kill the stuck frame */
+ if (!is_terminator(&fw.wlan.tx_queue[i], iter) &&
+ fw.wlan.last_super_num[i] >= CARL9170FW_TX_MAC_RESET &&
+ fw.wlan.last_super[i] == DESC_PAYLOAD(iter)) {
+ struct carl9170_tx_superframe *super = get_super(iter);
+
+ iter->status = AR9170_OWN_BITS_SW;
+ /*
+ * Mark the frame as failed.
+ * The BAFAIL flag allows the frame to sail through
+ * wlan_tx_status without much "unstuck" trouble.
+ */
+ iter->ctrl &= ~(AR9170_CTRL_FAIL);
+ iter->ctrl |= AR9170_CTRL_BAFAIL;
+
+ super->s.cnt = CARL9170_TX_MAX_RATE_TRIES;
+ super->s.rix = CARL9170_TX_MAX_RETRY_RATES;
+
+ fw.wlan.last_super_num[i] = 0;
+ fw.wlan.last_super[i] = NULL;
+ iter = iter->lastAddr->nextAddr;
+ }
+
set_wlan_txq_dma_addr(i, (uint32_t) iter);
if (!is_terminator(&fw.wlan.tx_queue[i], iter))
val |= BIT(i);