From: Christian Lamparter Date: Sun, 16 Jan 2011 00:05:08 +0000 (+0100) Subject: ieee80211: add ieee80211_hdrlen helper from cfg80211.h X-Git-Tag: 1.9.3~20 X-Git-Url: https://jxself.org/git/?p=carl9170fw.git;a=commitdiff_plain;h=b844396830984319ab330abd1bcc47ebf651e581 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 --- 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;