From 6feeb8aad7925b4c00f785eac3039c772629b42f Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 29 Jan 2008 16:57:51 +0100 Subject: mac80211: make alignment warning optional 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 Signed-off-by: John W. Linville --- net/mac80211/Kconfig | 12 ++++++++++++ net/mac80211/rx.c | 7 +++++++ 2 files changed, 19 insertions(+) (limited to 'net') diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig index 09c255002e5..e77592d050c 100644 --- a/net/mac80211/Kconfig +++ b/net/mac80211/Kconfig @@ -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 diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index d44c87269bc..535407d07fa 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -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 }; -- cgit v1.2.3 From f0b9205cfb77d992e8c0f727de3099159c80dbbd Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Thu, 31 Jan 2008 19:31:57 +0100 Subject: mac80211 rate control: fix section mismatch When the rate control algorithms are built-in, their exit functions can be called from mac80211's init function so they cannot be marked __exit. Signed-off-by: Johannes Berg Acked-by: Stefano Brivio Signed-off-by: John W. Linville --- net/mac80211/rc80211_pid_algo.c | 2 +- net/mac80211/rc80211_simple.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'net') diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c index 554c4baed6f..c339571632b 100644 --- a/net/mac80211/rc80211_pid_algo.c +++ b/net/mac80211/rc80211_pid_algo.c @@ -538,7 +538,7 @@ int __init rc80211_pid_init(void) return ieee80211_rate_control_register(&mac80211_rcpid); } -void __exit rc80211_pid_exit(void) +void rc80211_pid_exit(void) { ieee80211_rate_control_unregister(&mac80211_rcpid); } diff --git a/net/mac80211/rc80211_simple.c b/net/mac80211/rc80211_simple.c index 934676d687d..9a78b116acf 100644 --- a/net/mac80211/rc80211_simple.c +++ b/net/mac80211/rc80211_simple.c @@ -389,7 +389,7 @@ int __init rc80211_simple_init(void) return ieee80211_rate_control_register(&mac80211_rcsimple); } -void __exit rc80211_simple_exit(void) +void rc80211_simple_exit(void) { ieee80211_rate_control_unregister(&mac80211_rcsimple); } -- cgit v1.2.3 From 3eadf5f4f635ed6a6cd921195c320d58b5f9a185 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Thu, 31 Jan 2008 19:33:53 +0100 Subject: mac80211: fix initialisation error path The error handling in ieee80211_init() is broken when any of the built-in rate control algorithms fail to initialise, fix it and rename the error labels. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- net/mac80211/ieee80211.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'net') diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index 5dcc2d61551..67b7c75c430 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c @@ -1344,17 +1344,17 @@ static int __init ieee80211_init(void) ret = rc80211_simple_init(); if (ret) - goto fail; + goto out; ret = rc80211_pid_init(); if (ret) - goto fail_simple; + goto out_cleanup_simple; ret = ieee80211_wme_register(); if (ret) { printk(KERN_DEBUG "ieee80211_init: failed to " "initialize WME (err=%d)\n", ret); - goto fail_pid; + goto out_cleanup_pid; } ieee80211_debugfs_netdev_init(); @@ -1362,11 +1362,11 @@ static int __init ieee80211_init(void) return 0; - fail_pid: - rc80211_simple_exit(); - fail_simple: + out_cleanup_pid: rc80211_pid_exit(); - fail: + out_cleanup_simple: + rc80211_simple_exit(); + out: return ret; } -- cgit v1.2.3