mac80211: fix the sparse warnings on endian handling in RANN propagation
[carl9170fw.git] / include / linux / ieee80211.h
index d2d4435610290efd3b6005fd277110149879ad95..592b67a1fb288fed8b009c5c6ac9b2b12d7172e1 100644 (file)
@@ -557,6 +557,15 @@ static inline unsigned int ieee80211_hdrlen(__le16 fc)
         return hdrlen;
 }
 
+/**
+ * ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set
+ * @seq_ctrl: frame sequence control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_first_frag(__le16 seq_ctrl)
+{
+       return (seq_ctrl & cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0;
+}
+
 struct ieee80211s_hdr {
        u8 flags;
        u8 ttl;
@@ -644,9 +653,9 @@ struct ieee80211_rann_ie {
        u8 rann_hopcount;
        u8 rann_ttl;
        u8 rann_addr[6];
-       u32 rann_seq;
-       u32 rann_interval;
-       u32 rann_metric;
+       __le32 rann_seq;
+       __le32 rann_interval;
+       __le32 rann_metric;
 } __attribute__ ((packed));
 
 enum ieee80211_rann_flags {
@@ -1028,13 +1037,13 @@ enum ieee80211_min_mpdu_spacing {
 };
 
 /**
- * struct ieee80211_ht_info - HT information
+ * struct ieee80211_ht_operation - HT operation IE
  *
- * This structure is the "HT information element" as
- * described in 802.11n D5.0 7.3.2.58
+ * This structure is the "HT operation element" as
+ * described in 802.11n-2009 7.3.2.57
  */
-struct ieee80211_ht_info {
-       u8 control_chan;
+struct ieee80211_ht_operation {
+       u8 primary_chan;
        u8 ht_param;
        __le16 operation_mode;
        __le16 stbc_param;
@@ -1048,8 +1057,6 @@ struct ieee80211_ht_info {
 #define                IEEE80211_HT_PARAM_CHA_SEC_BELOW        0x03
 #define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY              0x04
 #define IEEE80211_HT_PARAM_RIFS_MODE                   0x08
-#define IEEE80211_HT_PARAM_SPSMP_SUPPORT               0x10
-#define IEEE80211_HT_PARAM_SERV_INTERVAL_GRAN          0xE0
 
 /* for operation_mode */
 #define IEEE80211_HT_OP_MODE_PROTECTION                        0x0003
@@ -1322,7 +1329,7 @@ enum ieee80211_eid {
        WLAN_EID_EXT_SUPP_RATES = 50,
 
        WLAN_EID_HT_CAPABILITY = 45,
-       WLAN_EID_HT_INFORMATION = 61,
+       WLAN_EID_HT_OPERATION = 61,
 
        WLAN_EID_RSN = 48,
        WLAN_EID_MMIE = 76,
@@ -1724,6 +1731,23 @@ static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
        return false;
 }
 
+/**
+ * ieee80211_is_public_action - check if frame is a public action frame
+ * @hdr: the frame
+ * @len: length of the frame
+ */
+static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,
+                                             size_t len)
+{
+       struct ieee80211_mgmt *mgmt = (void *)hdr;
+
+       if (len < IEEE80211_MIN_ACTION_SIZE)
+               return false;
+       if (!ieee80211_is_action(hdr->frame_control))
+               return false;
+       return mgmt->u.action.category == WLAN_CATEGORY_PUBLIC;
+}
+
 /**
  * ieee80211_fhss_chan_to_freq - get channel frequency
  * @channel: the FHSS channel