Skip to content

Commit 59d9cb0

Browse files
Kalle Valolinvjw
authored andcommitted
mac80211: remove payload alignment warning
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> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 4a40ccf commit 59d9cb0

2 files changed

Lines changed: 7 additions & 32 deletions

File tree

‎net/mac80211/Kconfig‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,6 @@ menuconfig MAC80211_DEBUG_MENU
9696
---help---
9797
This option collects various mac80211 debug settings.
9898

99-
config MAC80211_DEBUG_PACKET_ALIGNMENT
100-
bool "Enable packet alignment debugging"
101-
depends on MAC80211_DEBUG_MENU
102-
---help---
103-
This option is recommended for driver authors and strongly
104-
discouraged for everybody else, it will trigger a warning
105-
when a driver hands mac80211 a buffer that is aligned in
106-
a way that will cause problems with the IP stack on some
107-
architectures.
108-
109-
Say N unless you're writing a mac80211 based driver.
110-
11199
config MAC80211_NOINLINE
112100
bool "Do not inline TX/RX handlers"
113101
depends on MAC80211_DEBUG_MENU

‎net/mac80211/rx.c‎

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,9 @@ static void ieee80211_parse_qos(struct ieee80211_rx_data *rx)
361361
* boundary. In the case of regular frames, this simply means aligning the
362362
* payload to a four-byte boundary (because either the IP header is directly
363363
* contained, or IV/RFC1042 headers that have a length divisible by four are
364-
* in front of it).
364+
* in front of it). If the payload data is not properly aligned and the
365+
* architecture doesn't support efficient unaligned operations, mac80211
366+
* will align the data.
365367
*
366368
* With A-MSDU frames, however, the payload data address must yield two modulo
367369
* 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)
375377
*/
376378
static void ieee80211_verify_alignment(struct ieee80211_rx_data *rx)
377379
{
378-
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
379-
int hdrlen;
380-
381-
#ifndef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT
382-
return;
380+
#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
381+
WARN_ONCE((unsigned long)rx->skb->data & 1,
382+
"unaligned packet at 0x%p\n", rx->skb->data);
383383
#endif
384-
385-
if (WARN_ONCE((unsigned long)rx->skb->data & 1,
386-
"unaligned packet at 0x%p\n", rx->skb->data))
387-
return;
388-
389-
if (!ieee80211_is_data_present(hdr->frame_control))
390-
return;
391-
392-
hdrlen = ieee80211_hdrlen(hdr->frame_control);
393-
if (rx->flags & IEEE80211_RX_AMSDU)
394-
hdrlen += ETH_HLEN;
395-
WARN_ONCE(((unsigned long)(rx->skb->data + hdrlen)) & 3,
396-
"unaligned IP payload at 0x%p\n", rx->skb->data + hdrlen);
397384
}
398385

399386

@@ -1510,7 +1497,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
15101497
if (skb) {
15111498
int align __maybe_unused;
15121499

1513-
#if defined(CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT) || !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
1500+
#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
15141501
/*
15151502
* 'align' will only take the values 0 or 2 here
15161503
* since all frames are required to be aligned

0 commit comments

Comments
 (0)