Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Kalle Valo and committed by
John W. Linville
59d9cb07 4a40ccf8

+7 -32
-12
net/mac80211/Kconfig
··· 96 96 ---help--- 97 97 This option collects various mac80211 debug settings. 98 98 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 - 111 99 config MAC80211_NOINLINE 112 100 bool "Do not inline TX/RX handlers" 113 101 depends on MAC80211_DEBUG_MENU
+7 -20
net/mac80211/rx.c
··· 361 361 * boundary. In the case of regular frames, this simply means aligning the 362 362 * payload to a four-byte boundary (because either the IP header is directly 363 363 * 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. 365 367 * 366 368 * With A-MSDU frames, however, the payload data address must yield two modulo 367 369 * four because there are 14-byte 802.3 headers within the A-MSDU frames that ··· 377 375 */ 378 376 static void ieee80211_verify_alignment(struct ieee80211_rx_data *rx) 379 377 { 380 - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; 381 - int hdrlen; 382 - 383 - #ifndef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT 384 - return; 378 + #ifdef CONFIG_MAC80211_VERBOSE_DEBUG 379 + WARN_ONCE((unsigned long)rx->skb->data & 1, 380 + "unaligned packet at 0x%p\n", rx->skb->data); 385 381 #endif 386 - 387 - if (WARN_ONCE((unsigned long)rx->skb->data & 1, 388 - "unaligned packet at 0x%p\n", rx->skb->data)) 389 - return; 390 - 391 - if (!ieee80211_is_data_present(hdr->frame_control)) 392 - return; 393 - 394 - hdrlen = ieee80211_hdrlen(hdr->frame_control); 395 - if (rx->flags & IEEE80211_RX_AMSDU) 396 - hdrlen += ETH_HLEN; 397 - WARN_ONCE(((unsigned long)(rx->skb->data + hdrlen)) & 3, 398 - "unaligned IP payload at 0x%p\n", rx->skb->data + hdrlen); 399 382 } 400 383 401 384 ··· 1497 1510 if (skb) { 1498 1511 int align __maybe_unused; 1499 1512 1500 - #if defined(CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT) || !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) 1513 + #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS 1501 1514 /* 1502 1515 * 'align' will only take the values 0 or 2 here 1503 1516 * since all frames are required to be aligned