All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nathaniel J. Smith" <njs@pobox.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org, wey-yi.w.guy@intel.com,
	ilw@linux.intel.com, "Nathaniel J. Smith" <njs@pobox.com>
Subject: [PATCH 2/5] iwlwifi: Convert the tx queue high_mark to an atomic_t
Date: Sun, 13 Feb 2011 09:56:39 -0800	[thread overview]
Message-ID: <1297619803-2832-3-git-send-email-njs@pobox.com> (raw)
In-Reply-To: <1297619803-2832-1-git-send-email-njs@pobox.com>

This patch should cause no behavioral change whatsoever.

Signed-off-by: Nathaniel J. Smith <njs@pobox.com>
---
 drivers/net/wireless/iwlwifi/iwl-3945.c     |    2 +-
 drivers/net/wireless/iwlwifi/iwl-4965.c     |    4 ++--
 drivers/net/wireless/iwlwifi/iwl-agn-lib.c  |    4 ++--
 drivers/net/wireless/iwlwifi/iwl-agn-tx.c   |    8 +++++---
 drivers/net/wireless/iwlwifi/iwl-dev.h      |    5 +++--
 drivers/net/wireless/iwlwifi/iwl-tx.c       |    7 ++++---
 drivers/net/wireless/iwlwifi/iwl3945-base.c |    5 +++--
 7 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 6d2fb06..63999ae 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -294,7 +294,7 @@ static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv,
 		priv->cfg->ops->lib->txq_free_tfd(priv, txq);
 	}
 
-	if (iwl_queue_space(q) > q->high_mark && (txq_id >= 0) &&
+	if (iwl_queue_space(q) > atomic_read(&q->high_mark) && (txq_id >= 0) &&
 			(txq_id != IWL39_CMD_QUEUE_NUM) &&
 			priv->mac80211_registered)
 		iwl_wake_queue(priv, txq);
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index b8955d7..548cbe9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2230,7 +2230,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
 						       tid, freed);
 
 			if (priv->mac80211_registered &&
-			    (iwl_queue_space(&txq->q) > txq->q.high_mark) &&
+			    (iwl_queue_space(&txq->q) > atomic_read(&txq->q.high_mark)) &&
 			    (agg->state != IWL_EMPTYING_HW_QUEUE_DELBA))
 				iwl_wake_queue(priv, txq);
 		}
@@ -2255,7 +2255,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
 			IWL_DEBUG_TX_REPLY(priv, "Station not known\n");
 
 		if (priv->mac80211_registered &&
-		    (iwl_queue_space(&txq->q) > txq->q.high_mark))
+		    (iwl_queue_space(&txq->q) > atomic_read(&txq->q.high_mark)))
 			iwl_wake_queue(priv, txq);
 	}
 	if (qc && likely(sta_id != IWL_INVALID_STATION))
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index f229543..b2b841f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -445,7 +445,7 @@ static void iwlagn_rx_reply_tx(struct iwl_priv *priv,
 			iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
 
 			if (priv->mac80211_registered &&
-			    (iwl_queue_space(&txq->q) > txq->q.high_mark) &&
+			    (iwl_queue_space(&txq->q) > atomic_read(&txq->q.high_mark)) &&
 			    (agg->state != IWL_EMPTYING_HW_QUEUE_DELBA))
 				iwl_wake_queue(priv, txq);
 		}
@@ -455,7 +455,7 @@ static void iwlagn_rx_reply_tx(struct iwl_priv *priv,
 		iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
 
 		if (priv->mac80211_registered &&
-		    (iwl_queue_space(&txq->q) > txq->q.high_mark))
+		    (iwl_queue_space(&txq->q) > atomic_read(&txq->q.high_mark)))
 			iwl_wake_queue(priv, txq);
 	}
 
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index bffba7e..0c808f0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -31,6 +31,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/sched.h>
+#include <linux/time.h>
 
 #include "iwl-dev.h"
 #include "iwl-core.h"
@@ -637,7 +638,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 	txq = &priv->txq[txq_id];
 	q = &txq->q;
 
-	if (unlikely(iwl_queue_space(q) <= q->high_mark)) {
+	if (unlikely(iwl_queue_space(q) <= atomic_read(&q->high_mark))) {
 		spin_unlock(&priv->sta_lock);
 		goto drop_unlock;
 	}
@@ -788,7 +789,8 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 	if (sta_priv && sta_priv->client && !is_agg)
 		atomic_inc(&sta_priv->pending_frames);
 
-	if ((iwl_queue_space(q) <= q->high_mark) && priv->mac80211_registered) {
+	if ((iwl_queue_space(q) <= atomic_read(&q->high_mark))
+	     && priv->mac80211_registered) {
 		if (wait_write_ptr) {
 			spin_lock_irqsave(&priv->lock, flags);
 			txq->need_update = 1;
@@ -1431,7 +1433,7 @@ void iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
 		int freed = iwlagn_tx_queue_reclaim(priv, scd_flow, index);
 		iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
 
-		if ((iwl_queue_space(&txq->q) > txq->q.high_mark) &&
+		if ((iwl_queue_space(&txq->q) > atomic_read(&txq->q.high_mark)) &&
 		    priv->mac80211_registered &&
 		    (agg->state != IWL_EMPTYING_HW_QUEUE_DELBA))
 			iwl_wake_queue(priv, txq);
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index eb6586d..cf9807c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -37,6 +37,7 @@
 #include <linux/wait.h>
 #include <linux/leds.h>
 #include <net/ieee80211_radiotap.h>
+#include <linux/time.h>
 
 #include "iwl-eeprom.h"
 #include "iwl-csr.h"
@@ -134,8 +135,8 @@ struct iwl_queue {
 	dma_addr_t dma_addr;   /* physical addr for BD's */
 	int n_window;	       /* safe queue window */
 	u32 id;
-	int high_mark;         /* high watermark, stop queue if free
-				* space less than this */
+	atomic_t high_mark;    /* high watermark, stop queue if free
+				* space less than or equal to this */
 };
 
 /* One for each TFD */
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 78a9896..1867f99 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -30,6 +30,7 @@
 #include <linux/etherdevice.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/time.h>
 #include <net/mac80211.h>
 #include "iwl-eeprom.h"
 #include "iwl-dev.h"
@@ -254,9 +255,9 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
 	 * get_cmd_index is broken. */
 	BUG_ON(!is_power_of_2(slots_num));
 
-	q->high_mark = q->n_window / 8;
-	if (q->high_mark < 2)
-		q->high_mark = 2;
+	atomic_set(&q->high_mark, q->n_window / 8);
+	if (atomic_read(&q->high_mark) < 2)
+		atomic_set(&q->high_mark, 2);
 
 	q->write_ptr = q->read_ptr = 0;
 
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index e0d4c83..b3f8f3e 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -44,6 +44,7 @@
 #include <linux/firmware.h>
 #include <linux/etherdevice.h>
 #include <linux/if_arp.h>
+#include <linux/time.h>
 
 #include <net/ieee80211_radiotap.h>
 #include <net/mac80211.h>
@@ -536,7 +537,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 	txq = &priv->txq[txq_id];
 	q = &txq->q;
 
-	if ((iwl_queue_space(q) <= q->high_mark))
+	if ((iwl_queue_space(q) <= atomic_read(&q->high_mark)))
 		goto drop;
 
 	spin_lock_irqsave(&priv->lock, flags);
@@ -646,7 +647,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 	iwl_txq_update_write_ptr(priv, txq);
 	spin_unlock_irqrestore(&priv->lock, flags);
 
-	if ((iwl_queue_space(q) <= q->high_mark)
+	if ((iwl_queue_space(q) <= atomic_read(&q->high_mark))
 	    && priv->mac80211_registered) {
 		if (wait_write_ptr) {
 			spin_lock_irqsave(&priv->lock, flags);
-- 
1.7.1


  parent reply	other threads:[~2011-02-13 17:57 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-13 17:56 [PATCH 0/5] iwlwifi: Auto-tune tx queue size to maintain latency under load Nathaniel J. Smith
2011-02-13 17:56 ` [PATCH 1/5] iwlwifi: Simplify tx queue management Nathaniel J. Smith
2011-02-14  9:57   ` Johannes Berg
2011-02-14 22:17     ` Nathaniel Smith
2011-02-14 22:45       ` wwguy
2011-02-15  0:15         ` Dave Täht
2011-02-16  9:16         ` Stanislaw Gruszka
2011-02-16 14:41           ` John W. Linville
2011-02-16 15:13             ` wwguy
2011-02-15 12:11       ` Johannes Berg
2011-02-14 15:33   ` wwguy
2011-02-13 17:56 ` Nathaniel J. Smith [this message]
2011-02-14 12:16   ` [PATCH 2/5] iwlwifi: Convert the tx queue high_mark to an atomic_t Johannes Berg
2011-02-14 22:35     ` Nathaniel Smith
2011-02-15 12:08       ` Johannes Berg
2011-02-15 17:37         ` Nathaniel Smith
2011-02-13 17:56 ` [PATCH 3/5] iwlwifi: Invert the sense of the queue high_mark Nathaniel J. Smith
2011-02-13 17:56 ` [PATCH 4/5] iwlwifi: auto-tune tx queue size to minimize latency Nathaniel J. Smith
2011-02-14 12:17   ` Johannes Berg
2011-02-14 21:58     ` Nathaniel Smith
2011-02-15 12:13       ` Johannes Berg
2011-02-15 15:03         ` John W. Linville
2011-02-16  8:59           ` Johannes Berg
2011-02-15 17:31         ` Nathaniel Smith
2011-02-14 15:46   ` wwguy
2011-02-13 17:56 ` [PATCH 5/5] iwlwifi: make current tx queue sizes visible in debugfs Nathaniel J. Smith
2011-02-14  0:32 ` [PATCH 0/5] iwlwifi: Auto-tune tx queue size to maintain latency under load Julian Calaby
2011-02-14  3:28   ` Nathaniel Smith
2011-02-16 15:50 ` John W. Linville
2011-02-16 23:08   ` Nathaniel Smith
2011-02-16 23:42     ` wwguy
2011-02-17  1:49 ` [RFC] mac80211: implement eBDP algorithm to fight bufferbloat John W. Linville
2011-02-17  3:31   ` Ben Greear
2011-02-17  4:26   ` Nathaniel Smith
2011-02-17  8:31   ` Johannes Berg
2011-02-18 21:21   ` [RFC v2] " John W. Linville
2011-02-19  3:44     ` Nathaniel Smith
2011-02-21 18:47       ` John W. Linville
2011-02-21 23:26         ` Nathaniel Smith
2011-02-23 22:28           ` John W. Linville
2011-02-25 18:21             ` Nathaniel Smith
2011-02-25 18:27               ` Nathaniel Smith
2011-02-20  0:37     ` Nathaniel Smith
2011-02-21 18:52       ` John W. Linville
2011-02-21 15:28     ` Johannes Berg
2011-02-21 19:06       ` John W. Linville
2011-02-21 20:26         ` Tianji Li
2011-02-28 13:07         ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1297619803-2832-3-git-send-email-njs@pobox.com \
    --to=njs@pobox.com \
    --cc=ilw@linux.intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=wey-yi.w.guy@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.