linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivo van Doorn <ivdoorn@gmail.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org, users@rt2x00.serialmonkey.com
Subject: [PATCH 02/21] rt2x00: Introduce beacon_update_locked that requires caller locking
Date: Sun, 30 Jan 2011 13:16:28 +0100	[thread overview]
Message-ID: <201101301316.29086.IvDoorn@gmail.com> (raw)
In-Reply-To: <201101301316.04044.IvDoorn@gmail.com>

From: Helmut Schaa <helmut.schaa@googlemail.com>

Introduce a beacon_update_locked function that does not acquire the
according beacon mutex to allow beacon updates from atomic context. The
caller has to take care of synchronization.

No functional changes. Just preparation for beacon updates from tasklet
context.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
 drivers/net/wireless/rt2x00/rt2x00lib.h   |   12 +++++++++++-
 drivers/net/wireless/rt2x00/rt2x00queue.c |   24 ++++++++++++++++--------
 2 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
index 6c6a8f1..2d94cba 100644
--- a/drivers/net/wireless/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -157,7 +157,8 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
 			       bool local);
 
 /**
- * rt2x00queue_update_beacon - Send new beacon from mac80211 to hardware
+ * rt2x00queue_update_beacon - Send new beacon from mac80211
+ *	to hardware. Handles locking by itself (mutex).
  * @rt2x00dev: Pointer to &struct rt2x00_dev.
  * @vif: Interface for which the beacon should be updated.
  */
@@ -165,6 +166,15 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
 			      struct ieee80211_vif *vif);
 
 /**
+ * rt2x00queue_update_beacon_locked - Send new beacon from mac80211
+ *	to hardware. Caller needs to ensure locking.
+ * @rt2x00dev: Pointer to &struct rt2x00_dev.
+ * @vif: Interface for which the beacon should be updated.
+ */
+int rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev,
+				     struct ieee80211_vif *vif);
+
+/**
  * rt2x00queue_clear_beacon - Clear beacon in hardware
  * @rt2x00dev: Pointer to &struct rt2x00_dev.
  * @vif: Interface for which the beacon should be updated.
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 24bcdb4..7d7fbe0 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -593,8 +593,8 @@ int rt2x00queue_clear_beacon(struct rt2x00_dev *rt2x00dev,
 	return 0;
 }
 
-int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
-			      struct ieee80211_vif *vif)
+int rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev,
+				     struct ieee80211_vif *vif)
 {
 	struct rt2x00_intf *intf = vif_to_intf(vif);
 	struct skb_frame_desc *skbdesc;
@@ -603,18 +603,14 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
 	if (unlikely(!intf->beacon))
 		return -ENOBUFS;
 
-	mutex_lock(&intf->beacon_skb_mutex);
-
 	/*
 	 * Clean up the beacon skb.
 	 */
 	rt2x00queue_free_skb(intf->beacon);
 
 	intf->beacon->skb = ieee80211_beacon_get(rt2x00dev->hw, vif);
-	if (!intf->beacon->skb) {
-		mutex_unlock(&intf->beacon_skb_mutex);
+	if (!intf->beacon->skb)
 		return -ENOMEM;
-	}
 
 	/*
 	 * Copy all TX descriptor information into txdesc,
@@ -635,9 +631,21 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
 	 */
 	rt2x00dev->ops->lib->write_beacon(intf->beacon, &txdesc);
 
+	return 0;
+
+}
+
+int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
+			      struct ieee80211_vif *vif)
+{
+	struct rt2x00_intf *intf = vif_to_intf(vif);
+	int ret;
+
+	mutex_lock(&intf->beacon_skb_mutex);
+	ret = rt2x00queue_update_beacon_locked(rt2x00dev, vif);
 	mutex_unlock(&intf->beacon_skb_mutex);
 
-	return 0;
+	return ret;
 }
 
 void rt2x00queue_for_each_entry(struct data_queue *queue,
-- 
1.7.2.3


  reply	other threads:[~2011-01-30 12:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-30 12:16 [PATCH 01/21] rt2x00: Refactor beacon code to make use of start- and stop_queue Ivo van Doorn
2011-01-30 12:16 ` Ivo van Doorn [this message]
2011-01-30 12:16   ` [PATCH 03/21] rt2x00: Limit beacon updates in bss_info_changed to USB devices Ivo van Doorn
2011-01-30 12:17     ` [PATCH 04/21] rt2x00: Make periodic beacon updates for PCI devices atomic Ivo van Doorn
2011-01-30 12:17       ` [PATCH 05/21] rt2x00: Introduce tasklets for interrupt handling Ivo van Doorn
2011-01-30 12:18         ` [PATCH 06/21] rt2x00: Disable txstatus tasklet by default Ivo van Doorn
2011-01-30 12:18           ` [PATCH 07/21] rt2x00: Convert rt2800pci to use tasklets Ivo van Doorn
2011-01-30 12:19             ` [PATCH 08/21] rt2x00: Convert rt61pci " Ivo van Doorn
2011-01-30 12:19               ` [PATCH 09/21] rt2x00: Convert rt2500pci interrupt handling " Ivo van Doorn
2011-01-30 12:20                 ` [PATCH 10/21] rt2x00: Convert rt2400pci " Ivo van Doorn
2011-01-30 12:20                   ` [PATCH 11/21] rt2x00: Remove interrupt thread registration Ivo van Doorn
2011-01-30 12:20                     ` [PATCH 12/21] rt2x00: Remove STATE_RADIO_IRQ_OFF_ISR and STATE_RADIO_IRQ_ON_ISR Ivo van Doorn
2011-01-30 12:21                       ` [PATCH 13/21] rt2x00: Correct initial value of US_CYC_CNT register for pcie interface Ivo van Doorn
2011-01-30 12:21                         ` [PATCH 14/21] rt2x00: Update MAINTAINERS Ivo van Doorn
2011-01-30 12:22                           ` [PATCH 15/21] Trivial typo fix in comment Ivo van Doorn
2011-01-30 12:22                             ` [PATCH 16/21] rt2x00: trivial: add \n to WARNING message Ivo van Doorn
2011-01-30 12:22                               ` [PATCH 17/21] rt2x00: Fix WPA TKIP Michael MIC failures Ivo van Doorn
2011-01-30 12:23                                 ` [PATCH 18/21] rt2x00: Copy the MAC address to the WCID entry properly Ivo van Doorn
2011-01-30 12:23                                   ` [PATCH 19/21] rt2x00: Fix FIXME comments in rt61pci and rt73usb on Michael MIC Ivo van Doorn
2011-01-30 12:23                                     ` [PATCH 20/21] rt2x00: Kill all tasklets during device removal Ivo van Doorn
2011-01-30 12:24                                       ` [PATCH 21/21] rt2x00: Move TX/RX work into dedicated workqueue Ivo van Doorn
2011-02-17 18:16                                 ` [PATCH 17/21] rt2x00: Fix WPA TKIP Michael MIC failures Rafał Miłecki

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=201101301316.29086.IvDoorn@gmail.com \
    --to=ivdoorn@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=users@rt2x00.serialmonkey.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).