mac80211: use multi-queue master netdevice
[deliverable/linux.git] / net / mac80211 / util.c
index 790c32f894c0e784c77195871f9c6d47b218bfe1..4f7180b287dabb17134e15cc9745a7b8448a4018 100644 (file)
@@ -25,7 +25,8 @@
 #include <net/rtnetlink.h>
 
 #include "ieee80211_i.h"
-#include "ieee80211_rate.h"
+#include "rate.h"
+#include "mesh.h"
 #include "wme.h"
 
 /* privid for wiphys to determine whether they belong to us or not */
@@ -146,17 +147,35 @@ int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb)
 }
 EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
 
-void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx)
+int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
+{
+       int ae = meshhdr->flags & IEEE80211S_FLAGS_AE;
+       /* 7.1.3.5a.2 */
+       switch (ae) {
+       case 0:
+               return 6;
+       case 1:
+               return 12;
+       case 2:
+               return 18;
+       case 3:
+               return 24;
+       default:
+               return 6;
+       }
+}
+
+void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx)
 {
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data;
 
        hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
-       if (tx->u.tx.extra_frag) {
+       if (tx->extra_frag) {
                struct ieee80211_hdr *fhdr;
                int i;
-               for (i = 0; i < tx->u.tx.num_extra_frag; i++) {
+               for (i = 0; i < tx->num_extra_frag; i++) {
                        fhdr = (struct ieee80211_hdr *)
-                               tx->u.tx.extra_frag[i]->data;
+                               tx->extra_frag[i]->data;
                        fhdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
                }
        }
@@ -239,7 +258,7 @@ EXPORT_SYMBOL(ieee80211_generic_frame_duration);
 
 __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
                              struct ieee80211_vif *vif, size_t frame_len,
-                             const struct ieee80211_tx_control *frame_txctl)
+                             const struct ieee80211_tx_info *frame_txctl)
 {
        struct ieee80211_local *local = hw_to_local(hw);
        struct ieee80211_rate *rate;
@@ -247,10 +266,13 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
        bool short_preamble;
        int erp;
        u16 dur;
+       struct ieee80211_supported_band *sband;
+
+       sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
 
        short_preamble = sdata->bss_conf.use_short_preamble;
 
-       rate = frame_txctl->rts_cts_rate;
+       rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx];
 
        erp = 0;
        if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE)
@@ -273,7 +295,7 @@ EXPORT_SYMBOL(ieee80211_rts_duration);
 __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
                                    struct ieee80211_vif *vif,
                                    size_t frame_len,
-                                   const struct ieee80211_tx_control *frame_txctl)
+                                   const struct ieee80211_tx_info *frame_txctl)
 {
        struct ieee80211_local *local = hw_to_local(hw);
        struct ieee80211_rate *rate;
@@ -281,10 +303,13 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
        bool short_preamble;
        int erp;
        u16 dur;
+       struct ieee80211_supported_band *sband;
+
+       sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
 
        short_preamble = sdata->bss_conf.use_short_preamble;
 
-       rate = frame_txctl->rts_cts_rate;
+       rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx];
        erp = 0;
        if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE)
                erp = rate->flags & IEEE80211_RATE_ERP_G;
@@ -292,7 +317,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
        /* Data frame duration */
        dur = ieee80211_frame_duration(local, frame_len, rate->bitrate,
                                       erp, short_preamble);
-       if (!(frame_txctl->flags & IEEE80211_TXCTL_NO_ACK)) {
+       if (!(frame_txctl->flags & IEEE80211_TX_CTL_NO_ACK)) {
                /* ACK duration */
                dur += ieee80211_frame_duration(local, 10, rate->bitrate,
                                                erp, short_preamble);
@@ -306,17 +331,15 @@ void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue)
 {
        struct ieee80211_local *local = hw_to_local(hw);
 
-       if (test_and_clear_bit(IEEE80211_LINK_STATE_XOFF,
-                              &local->state[queue])) {
-               if (test_bit(IEEE80211_LINK_STATE_PENDING,
-                            &local->state[queue]))
-                       tasklet_schedule(&local->tx_pending_tasklet);
-               else
-                       if (!ieee80211_qdisc_installed(local->mdev)) {
-                               if (queue == 0)
-                                       netif_wake_queue(local->mdev);
-                       } else
-                               __netif_schedule(local->mdev);
+       if (test_bit(queue, local->queues_pending)) {
+               tasklet_schedule(&local->tx_pending_tasklet);
+       } else {
+               if (ieee80211_is_multiqueue(local)) {
+                       netif_wake_subqueue(local->mdev, queue);
+               } else {
+                       WARN_ON(queue != 0);
+                       netif_wake_queue(local->mdev);
+               }
        }
 }
 EXPORT_SYMBOL(ieee80211_wake_queue);
@@ -325,29 +348,20 @@ void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue)
 {
        struct ieee80211_local *local = hw_to_local(hw);
 
-       if (!ieee80211_qdisc_installed(local->mdev) && queue == 0)
+       if (ieee80211_is_multiqueue(local)) {
+               netif_stop_subqueue(local->mdev, queue);
+       } else {
+               WARN_ON(queue != 0);
                netif_stop_queue(local->mdev);
-       set_bit(IEEE80211_LINK_STATE_XOFF, &local->state[queue]);
+       }
 }
 EXPORT_SYMBOL(ieee80211_stop_queue);
 
-void ieee80211_start_queues(struct ieee80211_hw *hw)
-{
-       struct ieee80211_local *local = hw_to_local(hw);
-       int i;
-
-       for (i = 0; i < local->hw.queues; i++)
-               clear_bit(IEEE80211_LINK_STATE_XOFF, &local->state[i]);
-       if (!ieee80211_qdisc_installed(local->mdev))
-               netif_start_queue(local->mdev);
-}
-EXPORT_SYMBOL(ieee80211_start_queues);
-
 void ieee80211_stop_queues(struct ieee80211_hw *hw)
 {
        int i;
 
-       for (i = 0; i < hw->queues; i++)
+       for (i = 0; i < ieee80211_num_queues(hw); i++)
                ieee80211_stop_queue(hw, i);
 }
 EXPORT_SYMBOL(ieee80211_stop_queues);
@@ -356,7 +370,7 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw)
 {
        int i;
 
-       for (i = 0; i < hw->queues; i++)
+       for (i = 0; i < hw->queues + hw->ampdu_queues; i++)
                ieee80211_wake_queue(hw, i);
 }
 EXPORT_SYMBOL(ieee80211_wake_queues);
This page took 0.027031 seconds and 5 git commands to generate.