]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
mac80211: make alignment warning optional
authorJohannes Berg <johannes@sipsolutions.net>
Tue, 29 Jan 2008 15:57:51 +0000 (16:57 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 1 Feb 2008 21:12:24 +0000 (16:12 -0500)
Driver authors should be aware of the alignment requirements, but
not everybody cares about the warning. This patch makes it depend
on a new Kconfig symbol MAC80211_DEBUG_PACKET_ALIGNMENT which can
be enabled regardless of MAC80211_DEBUG and is recommended for
driver authors (only). This also restricts the warning to data
packets so other packets need not be realigned to not trigger the
warning.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/Kconfig
net/mac80211/rx.c

index 09c255002e565dcba6606937d0c1a14409537212..e77592d050ce8a33a777ab12e6c384b84bc524b1 100644 (file)
@@ -98,6 +98,18 @@ config MAC80211_DEBUGFS
 
          Say N unless you know you need this.
 
+config MAC80211_DEBUG_PACKET_ALIGNMENT
+       bool "Enable packet alignment debugging"
+       depends on MAC80211
+       help
+         This option is recommended for driver authors and strongly
+         discouraged for everybody else, it will trigger a warning
+         when a driver hands mac80211 a buffer that is aligned in
+         a way that will cause problems with the IP stack on some
+         architectures.
+
+         Say N unless you're writing a mac80211 based driver.
+
 config MAC80211_DEBUG
        bool "Enable debugging output"
        depends on MAC80211
index d44c87269bcb782d697e0370ef21fcc3c2ea15e4..535407d07fa40890a4731648f85157a00fb39dc8 100644 (file)
@@ -340,11 +340,15 @@ static u32 ieee80211_rx_load_stats(struct ieee80211_local *local,
        return load;
 }
 
+#ifdef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT
 static ieee80211_txrx_result
 ieee80211_rx_h_verify_ip_alignment(struct ieee80211_txrx_data *rx)
 {
        int hdrlen;
 
+       if (!WLAN_FC_DATA_PRESENT(rx->fc))
+               return TXRX_CONTINUE;
+
        /*
         * Drivers are required to align the payload data in a way that
         * guarantees that the contained IP header is aligned to a four-
@@ -371,11 +375,14 @@ ieee80211_rx_h_verify_ip_alignment(struct ieee80211_txrx_data *rx)
 
        return TXRX_CONTINUE;
 }
+#endif
 
 ieee80211_rx_handler ieee80211_rx_pre_handlers[] =
 {
        ieee80211_rx_h_parse_qos,
+#ifdef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT
        ieee80211_rx_h_verify_ip_alignment,
+#endif
        NULL
 };