]> err.no Git - linux-2.6/blobdiff - net/mac80211/tx.c
mac80211: remove useless tid assignment for management and control frames
[linux-2.6] / net / mac80211 / tx.c
index bf3600a047763baebd3ef7f7ca9c0657b6f81639..9bd9faac3c3c365848f8bf5d0cd432b32c22d520 100644 (file)
@@ -85,8 +85,8 @@ static inline void ieee80211_dump_frame(const char *ifname, const char *title,
 }
 #endif /* CONFIG_MAC80211_LOWTX_FRAME_DUMP */
 
-static u16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr,
-                             int next_frag_len)
+static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr,
+                                int next_frag_len)
 {
        int rate, mrate, erp, dur, i;
        struct ieee80211_rate *txrate;
@@ -138,7 +138,7 @@ static u16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr,
 
        /* data/mgmt */
        if (0 /* FIX: data/mgmt during CFP */)
-               return 32768;
+               return cpu_to_le16(32768);
 
        if (group_addr) /* Group address as the destination - no ACK */
                return 0;
@@ -208,7 +208,7 @@ static u16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr,
                                tx->sdata->bss_conf.use_short_preamble);
        }
 
-       return dur;
+       return cpu_to_le16(dur);
 }
 
 static int inline is_ieee80211_device(struct net_device *dev,
@@ -220,7 +220,7 @@ static int inline is_ieee80211_device(struct net_device *dev,
 
 /* tx handlers */
 
-static ieee80211_tx_result
+static ieee80211_tx_result debug_noinline
 ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
 {
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
@@ -274,7 +274,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
        return TX_CONTINUE;
 }
 
-static ieee80211_tx_result
+static ieee80211_tx_result debug_noinline
 ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
 {
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
@@ -327,8 +327,10 @@ static void purge_old_ps_buffers(struct ieee80211_local *local)
        rcu_read_unlock();
 
        local->total_ps_buffered = total;
+#ifdef MAC80211_VERBOSE_PS_DEBUG
        printk(KERN_DEBUG "%s: PS buffers full - purged %d frames\n",
               wiphy_name(local->hw.wiphy), purged);
+#endif
 }
 
 static ieee80211_tx_result
@@ -358,11 +360,13 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
                        purge_old_ps_buffers(tx->local);
                if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >=
                    AP_MAX_BC_BUFFER) {
+#ifdef MAC80211_VERBOSE_PS_DEBUG
                        if (net_ratelimit()) {
                                printk(KERN_DEBUG "%s: BC TX buffer full - "
                                       "dropping the oldest frame\n",
                                       tx->dev->name);
                        }
+#endif
                        dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf));
                } else
                        tx->local->total_ps_buffered++;
@@ -403,11 +407,13 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
                        purge_old_ps_buffers(tx->local);
                if (skb_queue_len(&sta->ps_tx_buf) >= STA_MAX_TX_BUFFER) {
                        struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf);
+#ifdef MAC80211_VERBOSE_PS_DEBUG
                        if (net_ratelimit()) {
                                printk(KERN_DEBUG "%s: STA %s TX "
                                       "buffer full - dropping oldest frame\n",
                                       tx->dev->name, print_mac(mac, sta->addr));
                        }
+#endif
                        dev_kfree_skb(old);
                } else
                        tx->local->total_ps_buffered++;
@@ -432,7 +438,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
        return TX_CONTINUE;
 }
 
-static ieee80211_tx_result
+static ieee80211_tx_result debug_noinline
 ieee80211_tx_h_ps_buf(struct ieee80211_tx_data *tx)
 {
        if (unlikely(tx->flags & IEEE80211_TX_PS_BUFFERED))
@@ -444,7 +450,7 @@ ieee80211_tx_h_ps_buf(struct ieee80211_tx_data *tx)
                return ieee80211_tx_h_multicast_ps_buf(tx);
 }
 
-static ieee80211_tx_result
+static ieee80211_tx_result debug_noinline
 ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
 {
        struct ieee80211_key *key;
@@ -493,7 +499,7 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
        return TX_CONTINUE;
 }
 
-static ieee80211_tx_result
+static ieee80211_tx_result debug_noinline
 ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
 {
        struct rate_selection rsel;
@@ -537,11 +543,10 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
        return TX_CONTINUE;
 }
 
-static ieee80211_tx_result
+static ieee80211_tx_result debug_noinline
 ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
 {
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
-       u16 dur;
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
        struct ieee80211_supported_band *sband;
 
@@ -599,14 +604,6 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
                info->flags |= IEEE80211_TX_CTL_SHORT_PREAMBLE;
        }
 
-       /* Setup duration field for the first fragment of the frame. Duration
-        * for remaining fragments will be updated when they are being sent
-        * to low-level driver in ieee80211_tx(). */
-       dur = ieee80211_duration(tx, is_multicast_ether_addr(hdr->addr1),
-                                (tx->flags & IEEE80211_TX_FRAGMENTED) ?
-                                tx->extra_frag[0]->len : 0);
-       hdr->duration_id = cpu_to_le16(dur);
-
        if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) ||
            (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) {
                struct ieee80211_rate *rate;
@@ -641,7 +638,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
        return TX_CONTINUE;
 }
 
-static ieee80211_tx_result
+static ieee80211_tx_result debug_noinline
 ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
 {
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
@@ -708,6 +705,8 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
                fhdr->seq_ctrl = cpu_to_le16(seq | ((i + 1) & IEEE80211_SCTL_FRAG));
                copylen = left > per_fragm ? per_fragm : left;
                memcpy(skb_put(frag, copylen), pos, copylen);
+               memcpy(frag->cb, first->cb, sizeof(frag->cb));
+               skb_copy_queue_mapping(frag, first);
 
                pos += copylen;
                left -= copylen;
@@ -720,7 +719,6 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
        return TX_CONTINUE;
 
  fail:
-       printk(KERN_DEBUG "%s: failed to fragment frame\n", tx->dev->name);
        if (frags) {
                for (i = 0; i < num_fragm - 1; i++)
                        if (frags[i])
@@ -731,7 +729,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
        return TX_DROP;
 }
 
-static ieee80211_tx_result
+static ieee80211_tx_result debug_noinline
 ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx)
 {
        if (!tx->key)
@@ -751,7 +749,37 @@ ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx)
        return TX_DROP;
 }
 
-static ieee80211_tx_result
+static ieee80211_tx_result debug_noinline
+ieee80211_tx_h_calculate_duration(struct ieee80211_tx_data *tx)
+{
+       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
+       int next_len, i;
+       int group_addr = is_multicast_ether_addr(hdr->addr1);
+
+       if (!(tx->flags & IEEE80211_TX_FRAGMENTED)) {
+               hdr->duration_id = ieee80211_duration(tx, group_addr, 0);
+               return TX_CONTINUE;
+       }
+
+       hdr->duration_id = ieee80211_duration(tx, group_addr,
+                                             tx->extra_frag[0]->len);
+
+       for (i = 0; i < tx->num_extra_frag; i++) {
+               if (i + 1 < tx->num_extra_frag) {
+                       next_len = tx->extra_frag[i + 1]->len;
+               } else {
+                       next_len = 0;
+                       tx->rate_idx = tx->last_frag_rate_idx;
+               }
+
+               hdr = (struct ieee80211_hdr *)tx->extra_frag[i]->data;
+               hdr->duration_id = ieee80211_duration(tx, 0, next_len);
+       }
+
+       return TX_CONTINUE;
+}
+
+static ieee80211_tx_result debug_noinline
 ieee80211_tx_h_stats(struct ieee80211_tx_data *tx)
 {
        int i;
@@ -772,23 +800,6 @@ ieee80211_tx_h_stats(struct ieee80211_tx_data *tx)
 }
 
 
-typedef ieee80211_tx_result (*ieee80211_tx_handler)(struct ieee80211_tx_data *);
-static ieee80211_tx_handler ieee80211_tx_handlers[] =
-{
-       ieee80211_tx_h_check_assoc,
-       ieee80211_tx_h_sequence,
-       ieee80211_tx_h_ps_buf,
-       ieee80211_tx_h_select_key,
-       ieee80211_tx_h_michael_mic_add,
-       ieee80211_tx_h_rate_ctrl,
-       ieee80211_tx_h_misc,
-       ieee80211_tx_h_fragment,
-       /* handlers after fragment must be aware of tx info fragmentation! */
-       ieee80211_tx_h_encrypt,
-       ieee80211_tx_h_stats,
-       NULL
-};
-
 /* actual transmit path */
 
 /*
@@ -1086,20 +1097,32 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
  */
 static int invoke_tx_handlers(struct ieee80211_tx_data *tx)
 {
-       struct ieee80211_local *local = tx->local;
        struct sk_buff *skb = tx->skb;
-       ieee80211_tx_handler *handler;
        ieee80211_tx_result res = TX_DROP;
        int i;
 
-       for (handler = ieee80211_tx_handlers; *handler != NULL; handler++) {
-               res = (*handler)(tx);
-               if (res != TX_CONTINUE)
-                       break;
-       }
+#define CALL_TXH(txh)          \
+       res = txh(tx);          \
+       if (res != TX_CONTINUE) \
+               goto txh_done;
+
+       CALL_TXH(ieee80211_tx_h_check_assoc)
+       CALL_TXH(ieee80211_tx_h_sequence)
+       CALL_TXH(ieee80211_tx_h_ps_buf)
+       CALL_TXH(ieee80211_tx_h_select_key)
+       CALL_TXH(ieee80211_tx_h_michael_mic_add)
+       CALL_TXH(ieee80211_tx_h_rate_ctrl)
+       CALL_TXH(ieee80211_tx_h_misc)
+       CALL_TXH(ieee80211_tx_h_fragment)
+       /* handlers after fragment must be aware of tx info fragmentation! */
+       CALL_TXH(ieee80211_tx_h_encrypt)
+       CALL_TXH(ieee80211_tx_h_calculate_duration)
+       CALL_TXH(ieee80211_tx_h_stats)
+#undef CALL_TXH
 
+ txh_done:
        if (unlikely(res == TX_DROP)) {
-               I802_DEBUG_INC(local->tx_handlers_drop);
+               I802_DEBUG_INC(tx->local->tx_handlers_drop);
                dev_kfree_skb(skb);
                for (i = 0; i < tx->num_extra_frag; i++)
                        if (tx->extra_frag[i])
@@ -1107,7 +1130,7 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx)
                kfree(tx->extra_frag);
                return -1;
        } else if (unlikely(res == TX_QUEUED)) {
-               I802_DEBUG_INC(local->tx_handlers_queued);
+               I802_DEBUG_INC(tx->local->tx_handlers_queued);
                return -1;
        }
 
@@ -1151,24 +1174,6 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb)
        if (invoke_tx_handlers(&tx))
                goto out;
 
-       if (tx.extra_frag) {
-               for (i = 0; i < tx.num_extra_frag; i++) {
-                       int next_len, dur;
-                       struct ieee80211_hdr *hdr =
-                               (struct ieee80211_hdr *)
-                               tx.extra_frag[i]->data;
-
-                       if (i + 1 < tx.num_extra_frag) {
-                               next_len = tx.extra_frag[i + 1]->len;
-                       } else {
-                               next_len = 0;
-                               tx.rate_idx = tx.last_frag_rate_idx;
-                       }
-                       dur = ieee80211_duration(&tx, 0, next_len);
-                       hdr->duration_id = cpu_to_le16(dur);
-               }
-       }
-
 retry:
        ret = __ieee80211_tx(local, skb, &tx);
        if (ret) {
@@ -1404,8 +1409,6 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
 
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
        if (unlikely(skb->len < ETH_HLEN)) {
-               printk(KERN_DEBUG "%s: short skb (len=%d)\n",
-                      dev->name, skb->len);
                ret = 0;
                goto fail;
        }