mac80211: 11h Infrastructure - Parsing
authorAssaf Krauss <assaf.krauss@intel.com>
Sun, 15 Jun 2008 15:23:29 +0000 (18:23 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 26 Jun 2008 20:49:14 +0000 (16:49 -0400)
This patch introduces parsing of 11h and 11d related elements from incoming
management frames.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
include/linux/ieee80211.h
net/mac80211/ieee80211_i.h
net/mac80211/mlme.c

index 2998e3b5f166bd245132d44578708ea3dd42c518..8546f09e462cc14179231b12cc36268f14358df6 100644 (file)
@@ -469,6 +469,40 @@ struct ieee80211s_hdr {
        u8 eaddr3[6];
 } __attribute__ ((packed));
 
+/**
+ * struct ieee80211_quiet_ie
+ *
+ * This structure refers to "Quiet information element"
+ */
+struct ieee80211_quiet_ie {
+       u8 count;
+       u8 period;
+       __le16 duration;
+       __le16 offset;
+} __attribute__ ((packed));
+
+/**
+ * struct ieee80211_msrment_ie
+ *
+ * This structure refers to "Measurement Request/Report information element"
+ */
+struct ieee80211_msrment_ie {
+       u8 token;
+       u8 mode;
+       u8 type;
+       u8 request[0];
+} __attribute__ ((packed));
+
+/**
+ * struct ieee80211_channel_sw_ie
+ *
+ * This structure refers to "Channel Switch Announcement information element"
+ */
+struct ieee80211_channel_sw_ie {
+       u8 mode;
+       u8 new_ch_num;
+       u8 count;
+} __attribute__ ((packed));
 
 struct ieee80211_mgmt {
        __le16 frame_control;
@@ -544,10 +578,15 @@ struct ieee80211_mgmt {
                                        u8 action_code;
                                        u8 element_id;
                                        u8 length;
-                                       u8 switch_mode;
-                                       u8 new_chan;
-                                       u8 switch_count;
+                                       struct ieee80211_channel_sw_ie sw_elem;
                                } __attribute__((packed)) chan_switch;
+                               struct{
+                                       u8 action_code;
+                                       u8 dialog_token;
+                                       u8 element_id;
+                                       u8 length;
+                                       struct ieee80211_msrment_ie msr_elem;
+                               } __attribute__((packed)) measurement;
                                struct{
                                        u8 action_code;
                                        u8 dialog_token;
@@ -875,6 +914,15 @@ enum ieee80211_category {
        WLAN_CATEGORY_WMM = 17,
 };
 
+/* SPECTRUM_MGMT action code */
+enum ieee80211_spectrum_mgmt_actioncode {
+       WLAN_ACTION_SPCT_MSR_REQ = 0,
+       WLAN_ACTION_SPCT_MSR_RPRT = 1,
+       WLAN_ACTION_SPCT_TPC_REQ = 2,
+       WLAN_ACTION_SPCT_TPC_RPRT = 3,
+       WLAN_ACTION_SPCT_CHL_SWITCH = 4,
+};
+
 /* BACK action code */
 enum ieee80211_back_actioncode {
        WLAN_ACTION_ADDBA_REQ = 0,
index 80a9e7c07b47e99c7230692461befabb6df83e18..af352c05c983bc363e37ee1ed35ef0203dab6e6b 100644 (file)
@@ -791,6 +791,10 @@ struct ieee802_11_elems {
        u8 *preq;
        u8 *prep;
        u8 *perr;
+       u8 *ch_switch_elem;
+       u8 *country_elem;
+       u8 *pwr_constr_elem;
+       u8 *quiet_elem;         /* first quite element */
 
        /* length of them, respectively */
        u8 ssid_len;
@@ -815,6 +819,11 @@ struct ieee802_11_elems {
        u8 preq_len;
        u8 prep_len;
        u8 perr_len;
+       u8 ch_switch_elem_len;
+       u8 country_elem_len;
+       u8 pwr_constr_elem_len;
+       u8 quiet_elem_len;
+       u8 num_of_quiet_elem;   /* can be more the one */
 };
 
 static inline struct ieee80211_local *hw_to_local(
index e06d6450f21598d94ef4fd4fdaade3d4a164d1a4..32453561fe326cb8e06e514c4b5b9faf7a4d31a6 100644 (file)
@@ -204,6 +204,25 @@ void ieee802_11_parse_elems(u8 *start, size_t len,
                        elems->perr = pos;
                        elems->perr_len = elen;
                        break;
+               case WLAN_EID_CHANNEL_SWITCH:
+                       elems->ch_switch_elem = pos;
+                       elems->ch_switch_elem_len = elen;
+                       break;
+               case WLAN_EID_QUIET:
+                       if (!elems->quiet_elem) {
+                               elems->quiet_elem = pos;
+                               elems->quiet_elem_len = elen;
+                       }
+                       elems->num_of_quiet_elem++;
+                       break;
+               case WLAN_EID_COUNTRY:
+                       elems->country_elem = pos;
+                       elems->country_elem_len = elen;
+                       break;
+               case WLAN_EID_PWR_CONSTRAINT:
+                       elems->pwr_constr_elem = pos;
+                       elems->pwr_constr_elem_len = elen;
+                       break;
                default:
                        break;
                }