aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00queue.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00queue.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c60
1 files changed, 44 insertions, 16 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index ca82b3a91697..fa17c83b9685 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -566,13 +566,10 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
566 return 0; 566 return 0;
567} 567}
568 568
569int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev, 569int rt2x00queue_clear_beacon(struct rt2x00_dev *rt2x00dev,
570 struct ieee80211_vif *vif, 570 struct ieee80211_vif *vif)
571 const bool enable_beacon)
572{ 571{
573 struct rt2x00_intf *intf = vif_to_intf(vif); 572 struct rt2x00_intf *intf = vif_to_intf(vif);
574 struct skb_frame_desc *skbdesc;
575 struct txentry_desc txdesc;
576 573
577 if (unlikely(!intf->beacon)) 574 if (unlikely(!intf->beacon))
578 return -ENOBUFS; 575 return -ENOBUFS;
@@ -584,17 +581,36 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
584 */ 581 */
585 rt2x00queue_free_skb(intf->beacon); 582 rt2x00queue_free_skb(intf->beacon);
586 583
587 if (!enable_beacon) { 584 /*
588 rt2x00queue_stop_queue(intf->beacon->queue); 585 * Clear beacon (single bssid devices don't need to clear the beacon
589 mutex_unlock(&intf->beacon_skb_mutex); 586 * since the beacon queue will get stopped anyway).
590 return 0; 587 */
591 } 588 if (rt2x00dev->ops->lib->clear_beacon)
589 rt2x00dev->ops->lib->clear_beacon(intf->beacon);
590
591 mutex_unlock(&intf->beacon_skb_mutex);
592
593 return 0;
594}
595
596int rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev,
597 struct ieee80211_vif *vif)
598{
599 struct rt2x00_intf *intf = vif_to_intf(vif);
600 struct skb_frame_desc *skbdesc;
601 struct txentry_desc txdesc;
602
603 if (unlikely(!intf->beacon))
604 return -ENOBUFS;
605
606 /*
607 * Clean up the beacon skb.
608 */
609 rt2x00queue_free_skb(intf->beacon);
592 610
593 intf->beacon->skb = ieee80211_beacon_get(rt2x00dev->hw, vif); 611 intf->beacon->skb = ieee80211_beacon_get(rt2x00dev->hw, vif);
594 if (!intf->beacon->skb) { 612 if (!intf->beacon->skb)
595 mutex_unlock(&intf->beacon_skb_mutex);
596 return -ENOMEM; 613 return -ENOMEM;
597 }
598 614
599 /* 615 /*
600 * Copy all TX descriptor information into txdesc, 616 * Copy all TX descriptor information into txdesc,
@@ -611,13 +627,25 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
611 skbdesc->entry = intf->beacon; 627 skbdesc->entry = intf->beacon;
612 628
613 /* 629 /*
614 * Send beacon to hardware and enable beacon genaration.. 630 * Send beacon to hardware.
615 */ 631 */
616 rt2x00dev->ops->lib->write_beacon(intf->beacon, &txdesc); 632 rt2x00dev->ops->lib->write_beacon(intf->beacon, &txdesc);
617 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);
618 mutex_unlock(&intf->beacon_skb_mutex); 646 mutex_unlock(&intf->beacon_skb_mutex);
619 647
620 return 0; 648 return ret;
621} 649}
622 650
623void rt2x00queue_for_each_entry(struct data_queue *queue, 651void rt2x00queue_for_each_entry(struct data_queue *queue,
@@ -885,7 +913,7 @@ void rt2x00queue_flush_queue(struct data_queue *queue, bool drop)
885 * The queue flush has failed... 913 * The queue flush has failed...
886 */ 914 */
887 if (unlikely(!rt2x00queue_empty(queue))) 915 if (unlikely(!rt2x00queue_empty(queue)))
888 WARNING(queue->rt2x00dev, "Queue %d failed to flush", queue->qid); 916 WARNING(queue->rt2x00dev, "Queue %d failed to flush\n", queue->qid);
889 917
890 /* 918 /*
891 * Restore the queue to the previous status 919 * Restore the queue to the previous status