aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-05-16 18:57:13 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-21 21:48:13 -0400
commiteefce91a384a64c7bbf913eb08c4adfb911c3639 (patch)
treeac091cd36f7739d9934a7ee01950a9da3e7cfc8b
parente93048825face354ecb0cb3ac00190c764a44f45 (diff)
mac80211: dont allow fragmentation and requeuing on A-MPDU queues
There really is no reason for a driver to reject a frame on an A-MPDU queue when it can stop that queue for any period of time and is given frames one by one. Hence, disallow it with a big warning and reduce mac80211-internal state. Also add a warning when we try to fragment a frame destined for an A-MPDU queue and drop it, the actual bug needs to be fixed elsewhere but I'm not exactly sure how to yet. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Cc: Ron Rindjunsky <ron.rindjunsky@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--include/net/mac80211.h6
-rw-r--r--net/mac80211/ieee80211_i.h2
-rw-r--r--net/mac80211/tx.c23
3 files changed, 26 insertions, 5 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 54960b83db79..4df39eb9115f 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -986,8 +986,10 @@ enum ieee80211_ampdu_mlme_action {
986 * @tx: Handler that 802.11 module calls for each transmitted frame. 986 * @tx: Handler that 802.11 module calls for each transmitted frame.
987 * skb contains the buffer starting from the IEEE 802.11 header. 987 * skb contains the buffer starting from the IEEE 802.11 header.
988 * The low-level driver should send the frame out based on 988 * The low-level driver should send the frame out based on
989 * configuration in the TX control data. Must be implemented and 989 * configuration in the TX control data. This handler should,
990 * atomic. 990 * preferably, never fail and stop queues appropriately, more
991 * importantly, however, it must never fail for A-MPDU-queues.
992 * Must be implemented and atomic.
991 * 993 *
992 * @start: Called before the first netdevice attached to the hardware 994 * @start: Called before the first netdevice attached to the hardware
993 * is enabled. This should turn on the hardware and must turn on 995 * is enabled. This should turn on the hardware and must turn on
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 79a65b3ee02b..86a861251e8c 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -595,7 +595,7 @@ struct ieee80211_local {
595 struct timer_list sta_cleanup; 595 struct timer_list sta_cleanup;
596 596
597 unsigned long state[IEEE80211_MAX_QUEUES + IEEE80211_MAX_AMPDU_QUEUES]; 597 unsigned long state[IEEE80211_MAX_QUEUES + IEEE80211_MAX_AMPDU_QUEUES];
598 struct ieee80211_tx_stored_packet pending_packet[IEEE80211_MAX_QUEUES + IEEE80211_MAX_AMPDU_QUEUES]; 598 struct ieee80211_tx_stored_packet pending_packet[IEEE80211_MAX_QUEUES];
599 struct tasklet_struct tx_pending_tasklet; 599 struct tasklet_struct tx_pending_tasklet;
600 600
601 /* number of interfaces with corresponding IFF_ flags */ 601 /* number of interfaces with corresponding IFF_ flags */
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index ac9a4af7ad42..6268bbca148e 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -673,6 +673,16 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
673 if (!(tx->flags & IEEE80211_TX_FRAGMENTED)) 673 if (!(tx->flags & IEEE80211_TX_FRAGMENTED))
674 return TX_CONTINUE; 674 return TX_CONTINUE;
675 675
676 /*
677 * Warn when submitting a fragmented A-MPDU frame and drop it.
678 * This is an error and needs to be fixed elsewhere, but when
679 * done needs to take care of monitor interfaces (injection)
680 * etc.
681 */
682 if (WARN_ON(tx->flags & IEEE80211_TX_CTL_AMPDU ||
683 IEEE80211_SKB_CB(tx->skb)->queue >= tx->local->hw.queues))
684 return TX_DROP;
685
676 first = tx->skb; 686 first = tx->skb;
677 687
678 hdrlen = ieee80211_get_hdrlen(tx->fc); 688 hdrlen = ieee80211_get_hdrlen(tx->fc);
@@ -1216,8 +1226,17 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb)
1216retry: 1226retry:
1217 ret = __ieee80211_tx(local, skb, &tx); 1227 ret = __ieee80211_tx(local, skb, &tx);
1218 if (ret) { 1228 if (ret) {
1219 struct ieee80211_tx_stored_packet *store = 1229 struct ieee80211_tx_stored_packet *store;
1220 &local->pending_packet[info->queue]; 1230
1231 /*
1232 * Since there are no fragmented frames on A-MPDU
1233 * queues, there's no reason for a driver to reject
1234 * a frame there, warn and drop it.
1235 */
1236 if (WARN_ON(queue >= local->hw.queues))
1237 goto drop;
1238
1239 store = &local->pending_packet[queue];
1221 1240
1222 if (ret == IEEE80211_TX_FRAG_AGAIN) 1241 if (ret == IEEE80211_TX_FRAG_AGAIN)
1223 skb = NULL; 1242 skb = NULL;