linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: remove payload alignment warning
@ 2009-11-30 10:39 Kalle Valo
  2009-11-30 11:51 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Kalle Valo @ 2009-11-30 10:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes

From: Kalle Valo <kalle.valo@nokia.com>

The payload alignment warning enabled by MAC80211_DEBUG_PACKET_ALIGNMENT is
difficult. To fix it, a firmware change is needed but in most cases that's
very difficult. So the benefit from the warning is low and most probably
it just creates more confusion for people who just enable all warnings
(like it did for me).

Remove the unaligned IP payload warning and the kconfig option. But
leave the unlialigned packet warning, it will be enabled with
MAC80211_VERBOSE_DEBUG.

Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
---
 net/mac80211/Kconfig |   12 ------------
 net/mac80211/rx.c    |   27 +++++++--------------------
 2 files changed, 7 insertions(+), 32 deletions(-)

diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index a10d508..a952b7f 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -96,18 +96,6 @@ menuconfig MAC80211_DEBUG_MENU
 	---help---
 	  This option collects various mac80211 debug settings.
 
-config MAC80211_DEBUG_PACKET_ALIGNMENT
-	bool "Enable packet alignment debugging"
-	depends on MAC80211_DEBUG_MENU
-	---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_NOINLINE
 	bool "Do not inline TX/RX handlers"
 	depends on MAC80211_DEBUG_MENU
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 57b8a0a..18a0248 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -361,7 +361,9 @@ static void ieee80211_parse_qos(struct ieee80211_rx_data *rx)
  * boundary. In the case of regular frames, this simply means aligning the
  * payload to a four-byte boundary (because either the IP header is directly
  * contained, or IV/RFC1042 headers that have a length divisible by four are
- * in front of it).
+ * in front of it).  If the payload data is not properly aligned and the
+ * architecture doesn't support efficient unaligned operations, mac80211
+ * will align the data.
  *
  * With A-MSDU frames, however, the payload data address must yield two modulo
  * four because there are 14-byte 802.3 headers within the A-MSDU frames that
@@ -375,25 +377,10 @@ static void ieee80211_parse_qos(struct ieee80211_rx_data *rx)
  */
 static void ieee80211_verify_alignment(struct ieee80211_rx_data *rx)
 {
-	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
-	int hdrlen;
-
-#ifndef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT
-	return;
+#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
+	WARN_ONCE((unsigned long)rx->skb->data & 1,
+		  "unaligned packet at 0x%p\n", rx->skb->data);
 #endif
-
-	if (WARN_ONCE((unsigned long)rx->skb->data & 1,
-		      "unaligned packet at 0x%p\n", rx->skb->data))
-		return;
-
-	if (!ieee80211_is_data_present(hdr->frame_control))
-		return;
-
-	hdrlen = ieee80211_hdrlen(hdr->frame_control);
-	if (rx->flags & IEEE80211_RX_AMSDU)
-		hdrlen += ETH_HLEN;
-	WARN_ONCE(((unsigned long)(rx->skb->data + hdrlen)) & 3,
-		  "unaligned IP payload at 0x%p\n", rx->skb->data + hdrlen);
 }
 
 
@@ -1512,7 +1499,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
 	if (skb) {
 		int align __maybe_unused;
 
-#if defined(CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT) || !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
+#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
 		/*
 		 * 'align' will only take the values 0 or 2 here
 		 * since all frames are required to be aligned


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mac80211: remove payload alignment warning
  2009-11-30 10:39 [PATCH] mac80211: remove payload alignment warning Kalle Valo
@ 2009-11-30 11:51 ` Johannes Berg
  0 siblings, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2009-11-30 11:51 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless

[-- Attachment #1: Type: text/plain, Size: 4002 bytes --]

On Mon, 2009-11-30 at 12:39 +0200, Kalle Valo wrote:
> From: Kalle Valo <kalle.valo@nokia.com>
> 
> The payload alignment warning enabled by MAC80211_DEBUG_PACKET_ALIGNMENT is
> difficult. To fix it, a firmware change is needed but in most cases that's
> very difficult. So the benefit from the warning is low and most probably
> it just creates more confusion for people who just enable all warnings
> (like it did for me).
> 
> Remove the unaligned IP payload warning and the kconfig option. But
> leave the unlialigned packet warning, it will be enabled with
> MAC80211_VERBOSE_DEBUG.
> 
> Signed-off-by: Kalle Valo <kalle.valo@nokia.com>

Thanks.

Acked-by: Johannes Berg <johannes@sipsolutions.net>

> ---
>  net/mac80211/Kconfig |   12 ------------
>  net/mac80211/rx.c    |   27 +++++++--------------------
>  2 files changed, 7 insertions(+), 32 deletions(-)
> 
> diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
> index a10d508..a952b7f 100644
> --- a/net/mac80211/Kconfig
> +++ b/net/mac80211/Kconfig
> @@ -96,18 +96,6 @@ menuconfig MAC80211_DEBUG_MENU
>  	---help---
>  	  This option collects various mac80211 debug settings.
>  
> -config MAC80211_DEBUG_PACKET_ALIGNMENT
> -	bool "Enable packet alignment debugging"
> -	depends on MAC80211_DEBUG_MENU
> -	---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_NOINLINE
>  	bool "Do not inline TX/RX handlers"
>  	depends on MAC80211_DEBUG_MENU
> diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
> index 57b8a0a..18a0248 100644
> --- a/net/mac80211/rx.c
> +++ b/net/mac80211/rx.c
> @@ -361,7 +361,9 @@ static void ieee80211_parse_qos(struct ieee80211_rx_data *rx)
>   * boundary. In the case of regular frames, this simply means aligning the
>   * payload to a four-byte boundary (because either the IP header is directly
>   * contained, or IV/RFC1042 headers that have a length divisible by four are
> - * in front of it).
> + * in front of it).  If the payload data is not properly aligned and the
> + * architecture doesn't support efficient unaligned operations, mac80211
> + * will align the data.
>   *
>   * With A-MSDU frames, however, the payload data address must yield two modulo
>   * four because there are 14-byte 802.3 headers within the A-MSDU frames that
> @@ -375,25 +377,10 @@ static void ieee80211_parse_qos(struct ieee80211_rx_data *rx)
>   */
>  static void ieee80211_verify_alignment(struct ieee80211_rx_data *rx)
>  {
> -	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
> -	int hdrlen;
> -
> -#ifndef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT
> -	return;
> +#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
> +	WARN_ONCE((unsigned long)rx->skb->data & 1,
> +		  "unaligned packet at 0x%p\n", rx->skb->data);
>  #endif
> -
> -	if (WARN_ONCE((unsigned long)rx->skb->data & 1,
> -		      "unaligned packet at 0x%p\n", rx->skb->data))
> -		return;
> -
> -	if (!ieee80211_is_data_present(hdr->frame_control))
> -		return;
> -
> -	hdrlen = ieee80211_hdrlen(hdr->frame_control);
> -	if (rx->flags & IEEE80211_RX_AMSDU)
> -		hdrlen += ETH_HLEN;
> -	WARN_ONCE(((unsigned long)(rx->skb->data + hdrlen)) & 3,
> -		  "unaligned IP payload at 0x%p\n", rx->skb->data + hdrlen);
>  }
>  
> 
> @@ -1512,7 +1499,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
>  	if (skb) {
>  		int align __maybe_unused;
>  
> -#if defined(CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT) || !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
> +#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
>  		/*
>  		 * 'align' will only take the values 0 or 2 here
>  		 * since all frames are required to be aligned
> 
> 


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] mac80211: remove payload alignment warning
       [not found] <20091216214319.17614.72837.stgit@tikku>
@ 2009-12-17 12:54 ` Johannes Berg
  0 siblings, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2009-12-17 12:54 UTC (permalink / raw)
  To: John Linville; +Cc: Kalle Valo, linux-wireless

From: Kalle Valo <kalle.valo@nokia.com>

The payload alignment warning enabled by MAC80211_DEBUG_PACKET_ALIGNMENT is
difficult. To fix it, a firmware change is needed but in most cases that's
very difficult. So the benefit from the warning is low and most probably
it just creates more confusion for people who just enable all warnings
(like it did for me).

Remove the unaligned IP payload warning and the kconfig option. But
leave the unaligned packet warning, it will be enabled with
MAC80211_VERBOSE_DEBUG.

Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 net/mac80211/Kconfig |   12 ------------
 net/mac80211/rx.c    |   27 +++++++--------------------
 2 files changed, 7 insertions(+), 32 deletions(-)

--- wireless-testing.orig/net/mac80211/Kconfig	2009-11-16 19:41:00.000000000 +0100
+++ wireless-testing/net/mac80211/Kconfig	2009-12-17 13:51:17.000000000 +0100
@@ -96,18 +96,6 @@ menuconfig MAC80211_DEBUG_MENU
 	---help---
 	  This option collects various mac80211 debug settings.
 
-config MAC80211_DEBUG_PACKET_ALIGNMENT
-	bool "Enable packet alignment debugging"
-	depends on MAC80211_DEBUG_MENU
-	---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_NOINLINE
 	bool "Do not inline TX/RX handlers"
 	depends on MAC80211_DEBUG_MENU
--- wireless-testing.orig/net/mac80211/rx.c	2009-12-12 16:29:09.000000000 +0100
+++ wireless-testing/net/mac80211/rx.c	2009-12-17 13:51:17.000000000 +0100
@@ -361,7 +361,9 @@ static void ieee80211_parse_qos(struct i
  * boundary. In the case of regular frames, this simply means aligning the
  * payload to a four-byte boundary (because either the IP header is directly
  * contained, or IV/RFC1042 headers that have a length divisible by four are
- * in front of it).
+ * in front of it).  If the payload data is not properly aligned and the
+ * architecture doesn't support efficient unaligned operations, mac80211
+ * will align the data.
  *
  * With A-MSDU frames, however, the payload data address must yield two modulo
  * four because there are 14-byte 802.3 headers within the A-MSDU frames that
@@ -375,25 +377,10 @@ static void ieee80211_parse_qos(struct i
  */
 static void ieee80211_verify_alignment(struct ieee80211_rx_data *rx)
 {
-	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
-	int hdrlen;
-
-#ifndef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT
-	return;
+#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
+	WARN_ONCE((unsigned long)rx->skb->data & 1,
+		  "unaligned packet at 0x%p\n", rx->skb->data);
 #endif
-
-	if (WARN_ONCE((unsigned long)rx->skb->data & 1,
-		      "unaligned packet at 0x%p\n", rx->skb->data))
-		return;
-
-	if (!ieee80211_is_data_present(hdr->frame_control))
-		return;
-
-	hdrlen = ieee80211_hdrlen(hdr->frame_control);
-	if (rx->flags & IEEE80211_RX_AMSDU)
-		hdrlen += ETH_HLEN;
-	WARN_ONCE(((unsigned long)(rx->skb->data + hdrlen)) & 3,
-		  "unaligned IP payload at 0x%p\n", rx->skb->data + hdrlen);
 }
 
 
@@ -1510,7 +1497,7 @@ ieee80211_deliver_skb(struct ieee80211_r
 	if (skb) {
 		int align __maybe_unused;
 
-#if defined(CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT) || !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
+#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
 		/*
 		 * 'align' will only take the values 0 or 2 here
 		 * since all frames are required to be aligned



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-12-17 12:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-30 10:39 [PATCH] mac80211: remove payload alignment warning Kalle Valo
2009-11-30 11:51 ` Johannes Berg
     [not found] <20091216214319.17614.72837.stgit@tikku>
2009-12-17 12:54 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).