From b844396830984319ab330abd1bcc47ebf651e581 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sun, 16 Jan 2011 01:05:08 +0100 Subject: [PATCH] ieee80211: add ieee80211_hdrlen helper from cfg80211.h ieee80211_hdrlen is a non-standard extenstion, therefore it has to go into a separate commit. Signed-off-by: Christian Lamparter --- include/linux/ieee80211.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 112e859..e60b271 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -527,6 +527,22 @@ static inline int ieee80211_is_qos_nullfunc(__le16 fc) cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC); } +static inline unsigned int ieee80211_hdrlen(__le16 fc) +{ + unsigned int hdrlen = 24; + + if (ieee80211_has_a4(fc)) + hdrlen = 30; + + if (ieee80211_is_data_qos(fc)) { + hdrlen += IEEE80211_QOS_CTL_LEN; + if (ieee80211_has_order(fc)) + hdrlen += IEEE80211_HT_CTL_LEN; + } + + return hdrlen; +} + struct ieee80211s_hdr { u8 flags; u8 ttl; -- 2.31.1