ieee80211: add ieee80211_hdrlen helper from cfg80211.h
authorChristian Lamparter <chunkeey@googlemail.com>
Sun, 16 Jan 2011 00:05:08 +0000 (01:05 +0100)
committerChristian Lamparter <chunkeey@googlemail.com>
Sun, 16 Jan 2011 00:05:08 +0000 (01:05 +0100)
ieee80211_hdrlen is a non-standard extenstion,
therefore it has to go into a separate commit.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
include/linux/ieee80211.h

index 112e85971797661477a71367e11db6cc98de889a..e60b271203ee10cfcc27f035d3ed492e3cf1d943 100644 (file)
@@ -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;