Regardless of what header features they use, or if they align the IP
header or not, 802.11 packets from all drivers guarantee a 2-byte
alignment (and there's a debug WARN_ON in case they don't).
Annotate packet structs with __aligned(2) to allow the compiler to use
16-bit load/store operations on platforms with extremely inefficient
unaligned access (e.g. MIPS).
This reduces code size and improves performance on affected platforms
and causes no binary code change on others.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
u8 addr3[6];
__le16 seq_ctrl;
u8 addr4[6];
u8 addr3[6];
__le16 seq_ctrl;
u8 addr4[6];
+} __packed __aligned(2);
struct ieee80211_hdr_3addr {
__le16 frame_control;
struct ieee80211_hdr_3addr {
__le16 frame_control;
u8 addr2[6];
u8 addr3[6];
__le16 seq_ctrl;
u8 addr2[6];
u8 addr3[6];
__le16 seq_ctrl;
+} __packed __aligned(2);
struct ieee80211_qos_hdr {
__le16 frame_control;
struct ieee80211_qos_hdr {
__le16 frame_control;
u8 addr3[6];
__le16 seq_ctrl;
__le16 qos_ctrl;
u8 addr3[6];
__le16 seq_ctrl;
__le16 qos_ctrl;
+} __packed __aligned(2);
/**
* ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set
/**
* ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set
__le32 seqnum;
u8 eaddr1[6];
u8 eaddr2[6];
__le32 seqnum;
u8 eaddr1[6];
u8 eaddr2[6];
+} __packed __aligned(2);
/* Mesh flags */
#define MESH_FLAGS_AE_A4 0x1
/* Mesh flags */
#define MESH_FLAGS_AE_A4 0x1
} u;
} __packed action;
} u;
} u;
} __packed action;
} u;
+} __packed __aligned(2);
/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
__le16 duration;
u8 ra[6];
u8 ta[6];
__le16 duration;
u8 ra[6];
u8 ta[6];
+} __packed __aligned(2);
struct ieee80211_cts {
__le16 frame_control;
__le16 duration;
u8 ra[6];
struct ieee80211_cts {
__le16 frame_control;
__le16 duration;
u8 ra[6];
+} __packed __aligned(2);
struct ieee80211_pspoll {
__le16 frame_control;
__le16 aid;
u8 bssid[6];
u8 ta[6];
struct ieee80211_pspoll {
__le16 frame_control;
__le16 aid;
u8 bssid[6];
u8 ta[6];
+} __packed __aligned(2);