* [PATCH] mac80211: make alignment warning optional
@ 2008-01-29 15:57 Johannes Berg
0 siblings, 0 replies; only message in thread
From: Johannes Berg @ 2008-01-29 15:57 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
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>
---
net/mac80211/Kconfig | 12 ++++++++++++
net/mac80211/rx.c | 7 +++++++
2 files changed, 19 insertions(+)
--- everything.orig/net/mac80211/Kconfig 2008-01-29 16:32:55.825603299 +0100
+++ everything/net/mac80211/Kconfig 2008-01-29 16:45:26.295590658 +0100
@@ -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
--- everything.orig/net/mac80211/rx.c 2008-01-29 16:34:31.155617079 +0100
+++ everything/net/mac80211/rx.c 2008-01-29 16:43:22.635589573 +0100
@@ -325,11 +325,15 @@ static u32 ieee80211_rx_load_stats(struc
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-
@@ -356,11 +360,14 @@ ieee80211_rx_h_verify_ip_alignment(struc
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
};
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-01-29 17:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-29 15:57 [PATCH] mac80211: make alignment warning optional Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox