Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 171387
b: refs/heads/master
c: 88de754
h: refs/heads/master
i:
  171385: e426539
  171383: 8e1b9b1
v: v3
  • Loading branch information
Lennert Buytenhek authored and John W. Linville committed Nov 4, 2009
1 parent 403918f commit bab4857
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 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: c2c357ce309221b85fd36e50aade66d01a556cde
refs/heads/master: 88de754ad59025eba797e7a8375807755577f450
37 changes: 15 additions & 22 deletions trunk/drivers/net/wireless/mwl8k.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,14 @@ struct mwl8k_priv {
struct mutex fw_mutex;
struct task_struct *fw_mutex_owner;
int fw_mutex_depth;
struct completion *tx_wait;
struct completion *hostcmd_wait;

/* lock held over TX and TX reap */
spinlock_t tx_lock;

/* TX quiesce completion, protected by fw_mutex and tx_lock */
struct completion *tx_wait;

struct ieee80211_vif *vif;

struct ieee80211_channel *current_channel;
Expand Down Expand Up @@ -1064,11 +1066,6 @@ static inline void mwl8k_tx_start(struct mwl8k_priv *priv)
ioread32(priv->regs + MWL8K_HIU_INT_CODE);
}

static inline int mwl8k_txq_busy(struct mwl8k_priv *priv)
{
return priv->pending_tx_pkts;
}

struct mwl8k_txq_info {
u32 fw_owned;
u32 drv_owned;
Expand All @@ -1088,7 +1085,6 @@ static int mwl8k_scan_tx_ring(struct mwl8k_priv *priv,

memset(txinfo, 0, MWL8K_TX_QUEUES * sizeof(struct mwl8k_txq_info));

spin_lock_bh(&priv->tx_lock);
for (count = 0; count < MWL8K_TX_QUEUES; count++) {
txq = priv->txq + count;
txinfo[count].len = txq->tx_stats.len;
Expand All @@ -1107,51 +1103,47 @@ static int mwl8k_scan_tx_ring(struct mwl8k_priv *priv,
txinfo[count].unused++;
}
}
spin_unlock_bh(&priv->tx_lock);

return ndescs;
}

/*
* Must be called with hw->fw_mutex held and tx queues stopped.
* Must be called with priv->fw_mutex held and tx queues stopped.
*/
static int mwl8k_tx_wait_empty(struct ieee80211_hw *hw)
{
struct mwl8k_priv *priv = hw->priv;
DECLARE_COMPLETION_ONSTACK(cmd_wait);
DECLARE_COMPLETION_ONSTACK(tx_wait);
u32 count;
unsigned long timeout;

might_sleep();

spin_lock_bh(&priv->tx_lock);
count = mwl8k_txq_busy(priv);
if (count) {
priv->tx_wait = &cmd_wait;
if (priv->radio_on)
mwl8k_tx_start(priv);
}
count = priv->pending_tx_pkts;
if (count)
priv->tx_wait = &tx_wait;
spin_unlock_bh(&priv->tx_lock);

if (count) {
struct mwl8k_txq_info txinfo[MWL8K_TX_QUEUES];
int index;
int newcount;

timeout = wait_for_completion_timeout(&cmd_wait,
timeout = wait_for_completion_timeout(&tx_wait,
msecs_to_jiffies(5000));
if (timeout)
return 0;

spin_lock_bh(&priv->tx_lock);
priv->tx_wait = NULL;
newcount = mwl8k_txq_busy(priv);
newcount = priv->pending_tx_pkts;
mwl8k_scan_tx_ring(priv, txinfo);
spin_unlock_bh(&priv->tx_lock);

printk(KERN_ERR "%s(%u) TIMEDOUT:5000ms Pend:%u-->%u\n",
__func__, __LINE__, count, newcount);

mwl8k_scan_tx_ring(priv, txinfo);
for (index = 0; index < MWL8K_TX_QUEUES; index++)
printk(KERN_ERR "TXQ:%u L:%u H:%u T:%u FW:%u "
"DRV:%u U:%u\n",
Expand Down Expand Up @@ -2397,7 +2389,7 @@ static irqreturn_t mwl8k_interrupt(int irq, void *dev_id)

if (status & MWL8K_A2H_INT_QUEUE_EMPTY) {
if (!mutex_is_locked(&priv->fw_mutex) &&
priv->radio_on && mwl8k_txq_busy(priv))
priv->radio_on && priv->pending_tx_pkts)
mwl8k_tx_start(priv);
}

Expand Down Expand Up @@ -2800,7 +2792,7 @@ static void mwl8k_tx_reclaim_handler(unsigned long data)
for (i = 0; i < MWL8K_TX_QUEUES; i++)
mwl8k_txq_reclaim(hw, i, 0);

if (priv->tx_wait != NULL && mwl8k_txq_busy(priv) == 0) {
if (priv->tx_wait != NULL && !priv->pending_tx_pkts) {
complete(priv->tx_wait);
priv->tx_wait = NULL;
}
Expand Down Expand Up @@ -2932,11 +2924,12 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev,
mutex_init(&priv->fw_mutex);
priv->fw_mutex_owner = NULL;
priv->fw_mutex_depth = 0;
priv->tx_wait = NULL;
priv->hostcmd_wait = NULL;

spin_lock_init(&priv->tx_lock);

priv->tx_wait = NULL;

for (i = 0; i < MWL8K_TX_QUEUES; i++) {
rc = mwl8k_txq_init(hw, i);
if (rc)
Expand Down

0 comments on commit bab4857

Please sign in to comment.