diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00mac.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00mac.c | 95 |
1 files changed, 88 insertions, 7 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index 661c6baad2b9..93bec140e598 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -119,7 +119,7 @@ void rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
119 | * Use the ATIM queue if appropriate and present. | 119 | * Use the ATIM queue if appropriate and present. |
120 | */ | 120 | */ |
121 | if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM && | 121 | if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM && |
122 | test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags)) | 122 | test_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags)) |
123 | qid = QID_ATIM; | 123 | qid = QID_ATIM; |
124 | 124 | ||
125 | queue = rt2x00queue_get_tx_queue(rt2x00dev, qid); | 125 | queue = rt2x00queue_get_tx_queue(rt2x00dev, qid); |
@@ -158,7 +158,7 @@ void rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
158 | return; | 158 | return; |
159 | 159 | ||
160 | exit_fail: | 160 | exit_fail: |
161 | ieee80211_stop_queue(rt2x00dev->hw, qid); | 161 | rt2x00queue_pause_queue(queue); |
162 | dev_kfree_skb_any(skb); | 162 | dev_kfree_skb_any(skb); |
163 | } | 163 | } |
164 | EXPORT_SYMBOL_GPL(rt2x00mac_tx); | 164 | EXPORT_SYMBOL_GPL(rt2x00mac_tx); |
@@ -411,11 +411,11 @@ void rt2x00mac_configure_filter(struct ieee80211_hw *hw, | |||
411 | * of different types, but has no a separate filter for PS Poll frames, | 411 | * of different types, but has no a separate filter for PS Poll frames, |
412 | * FIF_CONTROL flag implies FIF_PSPOLL. | 412 | * FIF_CONTROL flag implies FIF_PSPOLL. |
413 | */ | 413 | */ |
414 | if (!test_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags)) { | 414 | if (!test_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags)) { |
415 | if (*total_flags & FIF_CONTROL || *total_flags & FIF_PSPOLL) | 415 | if (*total_flags & FIF_CONTROL || *total_flags & FIF_PSPOLL) |
416 | *total_flags |= FIF_CONTROL | FIF_PSPOLL; | 416 | *total_flags |= FIF_CONTROL | FIF_PSPOLL; |
417 | } | 417 | } |
418 | if (!test_bit(DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL, &rt2x00dev->flags)) { | 418 | if (!test_bit(CAPABILITY_CONTROL_FILTER_PSPOLL, &rt2x00dev->cap_flags)) { |
419 | if (*total_flags & FIF_CONTROL) | 419 | if (*total_flags & FIF_CONTROL) |
420 | *total_flags |= FIF_PSPOLL; | 420 | *total_flags |= FIF_PSPOLL; |
421 | } | 421 | } |
@@ -496,7 +496,7 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
496 | 496 | ||
497 | if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) | 497 | if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) |
498 | return 0; | 498 | return 0; |
499 | else if (!test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) | 499 | else if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags)) |
500 | return -EOPNOTSUPP; | 500 | return -EOPNOTSUPP; |
501 | else if (key->keylen > 32) | 501 | else if (key->keylen > 32) |
502 | return -ENOSPC; | 502 | return -ENOSPC; |
@@ -562,7 +562,7 @@ EXPORT_SYMBOL_GPL(rt2x00mac_set_key); | |||
562 | void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw) | 562 | void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw) |
563 | { | 563 | { |
564 | struct rt2x00_dev *rt2x00dev = hw->priv; | 564 | struct rt2x00_dev *rt2x00dev = hw->priv; |
565 | __set_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags); | 565 | set_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags); |
566 | rt2x00link_stop_tuner(rt2x00dev); | 566 | rt2x00link_stop_tuner(rt2x00dev); |
567 | } | 567 | } |
568 | EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_start); | 568 | EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_start); |
@@ -570,7 +570,7 @@ EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_start); | |||
570 | void rt2x00mac_sw_scan_complete(struct ieee80211_hw *hw) | 570 | void rt2x00mac_sw_scan_complete(struct ieee80211_hw *hw) |
571 | { | 571 | { |
572 | struct rt2x00_dev *rt2x00dev = hw->priv; | 572 | struct rt2x00_dev *rt2x00dev = hw->priv; |
573 | __clear_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags); | 573 | clear_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags); |
574 | rt2x00link_start_tuner(rt2x00dev); | 574 | rt2x00link_start_tuner(rt2x00dev); |
575 | } | 575 | } |
576 | EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_complete); | 576 | EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_complete); |
@@ -737,3 +737,84 @@ void rt2x00mac_flush(struct ieee80211_hw *hw, bool drop) | |||
737 | rt2x00queue_flush_queue(queue, drop); | 737 | rt2x00queue_flush_queue(queue, drop); |
738 | } | 738 | } |
739 | EXPORT_SYMBOL_GPL(rt2x00mac_flush); | 739 | EXPORT_SYMBOL_GPL(rt2x00mac_flush); |
740 | |||
741 | int rt2x00mac_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) | ||
742 | { | ||
743 | struct rt2x00_dev *rt2x00dev = hw->priv; | ||
744 | struct link_ant *ant = &rt2x00dev->link.ant; | ||
745 | struct antenna_setup *def = &rt2x00dev->default_ant; | ||
746 | struct antenna_setup setup; | ||
747 | |||
748 | // The antenna value is not supposed to be 0, | ||
749 | // or exceed the maximum number of antenna's. | ||
750 | if (!tx_ant || (tx_ant & ~3) || !rx_ant || (rx_ant & ~3)) | ||
751 | return -EINVAL; | ||
752 | |||
753 | // When the client tried to configure the antenna to or from | ||
754 | // diversity mode, we must reset the default antenna as well | ||
755 | // as that controls the diversity switch. | ||
756 | if (ant->flags & ANTENNA_TX_DIVERSITY && tx_ant != 3) | ||
757 | ant->flags &= ~ANTENNA_TX_DIVERSITY; | ||
758 | if (ant->flags & ANTENNA_RX_DIVERSITY && rx_ant != 3) | ||
759 | ant->flags &= ~ANTENNA_RX_DIVERSITY; | ||
760 | |||
761 | // If diversity is being enabled, check if we need hardware | ||
762 | // or software diversity. In the latter case, reset the value, | ||
763 | // and make sure we update the antenna flags to have the | ||
764 | // link tuner pick up the diversity tuning. | ||
765 | if (tx_ant == 3 && def->tx == ANTENNA_SW_DIVERSITY) { | ||
766 | tx_ant = ANTENNA_SW_DIVERSITY; | ||
767 | ant->flags |= ANTENNA_TX_DIVERSITY; | ||
768 | } | ||
769 | |||
770 | if (rx_ant == 3 && def->rx == ANTENNA_SW_DIVERSITY) { | ||
771 | rx_ant = ANTENNA_SW_DIVERSITY; | ||
772 | ant->flags |= ANTENNA_RX_DIVERSITY; | ||
773 | } | ||
774 | |||
775 | setup.tx = tx_ant; | ||
776 | setup.rx = rx_ant; | ||
777 | |||
778 | rt2x00lib_config_antenna(rt2x00dev, setup); | ||
779 | |||
780 | return 0; | ||
781 | } | ||
782 | EXPORT_SYMBOL_GPL(rt2x00mac_set_antenna); | ||
783 | |||
784 | int rt2x00mac_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant) | ||
785 | { | ||
786 | struct rt2x00_dev *rt2x00dev = hw->priv; | ||
787 | struct link_ant *ant = &rt2x00dev->link.ant; | ||
788 | struct antenna_setup *active = &rt2x00dev->link.ant.active; | ||
789 | |||
790 | // When software diversity is active, we must report this to the | ||
791 | // client and not the current active antenna state. | ||
792 | if (ant->flags & ANTENNA_TX_DIVERSITY) | ||
793 | *tx_ant = ANTENNA_HW_DIVERSITY; | ||
794 | else | ||
795 | *tx_ant = active->tx; | ||
796 | |||
797 | if (ant->flags & ANTENNA_RX_DIVERSITY) | ||
798 | *rx_ant = ANTENNA_HW_DIVERSITY; | ||
799 | else | ||
800 | *rx_ant = active->rx; | ||
801 | |||
802 | return 0; | ||
803 | } | ||
804 | EXPORT_SYMBOL_GPL(rt2x00mac_get_antenna); | ||
805 | |||
806 | void rt2x00mac_get_ringparam(struct ieee80211_hw *hw, | ||
807 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) | ||
808 | { | ||
809 | struct rt2x00_dev *rt2x00dev = hw->priv; | ||
810 | struct data_queue *queue; | ||
811 | |||
812 | tx_queue_for_each(rt2x00dev, queue) { | ||
813 | *tx += queue->length; | ||
814 | *tx_max += queue->limit; | ||
815 | } | ||
816 | |||
817 | *rx = rt2x00dev->rx->length; | ||
818 | *rx_max = rt2x00dev->rx->limit; | ||
819 | } | ||
820 | EXPORT_SYMBOL_GPL(rt2x00mac_get_ringparam); | ||