aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHelmut Schaa <helmut.schaa@googlemail.com>2011-01-30 07:16:28 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-01-31 15:06:22 -0500
commit8414ff07ac8802e282683812514ef5b0ea133cb8 (patch)
treee66fb2450d04f68e6455d0341ebb3ce100535d7d /drivers
parent69cf36a4523be026bc16743c5c989c5e82edb7d9 (diff)
rt2x00: Introduce beacon_update_locked that requires caller locking
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> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00lib.h12
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c24
2 files changed, 27 insertions, 9 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
index 6c6a8f15870e..2d94cbaf5f4a 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,
157 bool local); 157 bool local);
158 158
159/** 159/**
160 * rt2x00queue_update_beacon - Send new beacon from mac80211 to hardware 160 * rt2x00queue_update_beacon - Send new beacon from mac80211
161 * to hardware. Handles locking by itself (mutex).
161 * @rt2x00dev: Pointer to &struct rt2x00_dev. 162 * @rt2x00dev: Pointer to &struct rt2x00_dev.
162 * @vif: Interface for which the beacon should be updated. 163 * @vif: Interface for which the beacon should be updated.
163 */ 164 */
@@ -165,6 +166,15 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
165 struct ieee80211_vif *vif); 166 struct ieee80211_vif *vif);
166 167
167/** 168/**
169 * rt2x00queue_update_beacon_locked - Send new beacon from mac80211
170 * to hardware. Caller needs to ensure locking.
171 * @rt2x00dev: Pointer to &struct rt2x00_dev.
172 * @vif: Interface for which the beacon should be updated.
173 */
174int rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev,
175 struct ieee80211_vif *vif);
176
177/**
168 * rt2x00queue_clear_beacon - Clear beacon in hardware 178 * rt2x00queue_clear_beacon - Clear beacon in hardware
169 * @rt2x00dev: Pointer to &struct rt2x00_dev. 179 * @rt2x00dev: Pointer to &struct rt2x00_dev.
170 * @vif: Interface for which the beacon should be updated. 180 * @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 24bcdb47a465..7d7fbe0315af 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,
593 return 0; 593 return 0;
594} 594}
595 595
596int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev, 596int rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev,
597 struct ieee80211_vif *vif) 597 struct ieee80211_vif *vif)
598{ 598{
599 struct rt2x00_intf *intf = vif_to_intf(vif); 599 struct rt2x00_intf *intf = vif_to_intf(vif);
600 struct skb_frame_desc *skbdesc; 600 struct skb_frame_desc *skbdesc;
@@ -603,18 +603,14 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
603 if (unlikely(!intf->beacon)) 603 if (unlikely(!intf->beacon))
604 return -ENOBUFS; 604 return -ENOBUFS;
605 605
606 mutex_lock(&intf->beacon_skb_mutex);
607
608 /* 606 /*
609 * Clean up the beacon skb. 607 * Clean up the beacon skb.
610 */ 608 */
611 rt2x00queue_free_skb(intf->beacon); 609 rt2x00queue_free_skb(intf->beacon);
612 610
613 intf->beacon->skb = ieee80211_beacon_get(rt2x00dev->hw, vif); 611 intf->beacon->skb = ieee80211_beacon_get(rt2x00dev->hw, vif);
614 if (!intf->beacon->skb) { 612 if (!intf->beacon->skb)
615 mutex_unlock(&intf->beacon_skb_mutex);
616 return -ENOMEM; 613 return -ENOMEM;
617 }
618 614
619 /* 615 /*
620 * Copy all TX descriptor information into txdesc, 616 * Copy all TX descriptor information into txdesc,
@@ -635,9 +631,21 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
635 */ 631 */
636 rt2x00dev->ops->lib->write_beacon(intf->beacon, &txdesc); 632 rt2x00dev->ops->lib->write_beacon(intf->beacon, &txdesc);
637 633
634 return 0;
635
636}
637
638int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
639 struct ieee80211_vif *vif)
640{
641 struct rt2x00_intf *intf = vif_to_intf(vif);
642 int ret;
643
644 mutex_lock(&intf->beacon_skb_mutex);
645 ret = rt2x00queue_update_beacon_locked(rt2x00dev, vif);
638 mutex_unlock(&intf->beacon_skb_mutex); 646 mutex_unlock(&intf->beacon_skb_mutex);
639 647
640 return 0; 648 return ret;
641} 649}
642 650
643void rt2x00queue_for_each_entry(struct data_queue *queue, 651void rt2x00queue_for_each_entry(struct data_queue *queue,