diff options
author | Michal Kazior <michal.kazior@tieto.com> | 2012-02-29 15:15:33 +0100 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-05-22 11:06:49 +0200 |
commit | 1780db0bfde8da1b36c5c2087407ef9ea8744d23 (patch) | |
tree | 58dc1ac5a1633fb3666e9e2806db0d6bfc1df763 | |
parent | d1ca211045ac275be0351dcdd5fd5677f20af9ab (diff) |
cw1200: fix queue locking
Fixes a very rare BUG_ON in cw1200_tx by reserving extra queue slots for
an overflow scenario.
It's possible for a parallel TX to happen when in softap since there are
two interfaces (wlan1 and mon.wlan1). Softirq may switch from one thread
to another asynchronously. In such a case __ieee80211_tx may call driver
tx callback just before a queue is locked.
ST-Ericsson ID: 413677
ST-Ericsson FOSS-OUT: NA
Change-Id: I2f8a9fa556c718797bd832644e46b984f038b958
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/46444
Reviewed-by: Bartosz MARKOWSKI <bartosz.markowski@tieto.com>
-rw-r--r-- | drivers/staging/cw1200/queue.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/staging/cw1200/queue.c b/drivers/staging/cw1200/queue.c index 19db63aa5bf..ba2cc436eaf 100644 --- a/drivers/staging/cw1200/queue.c +++ b/drivers/staging/cw1200/queue.c @@ -319,7 +319,13 @@ int cw1200_queue_put(struct cw1200_queue *queue, ++stats->link_map_cache[txpriv->link_id]; spin_unlock_bh(&stats->lock); - if (queue->num_queued >= queue->capacity) { + /* + * TX may happen in parallel sometimes. + * Leave extra queue slots so we don't overflow. + */ + if (queue->overfull == false && + queue->num_queued >= + (queue->capacity - (num_present_cpus() - 1))) { queue->overfull = true; __cw1200_queue_lock(queue); mod_timer(&queue->gc, jiffies); |