mac80211: mlme.c use new frame control helpers
authorHarvey Harrison <harvey.harrison@gmail.com>
Sun, 22 Jun 2008 23:45:32 +0000 (16:45 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 27 Jun 2008 13:09:18 +0000 (09:09 -0400)
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/mlme.c

index 75c4e9743fb4a4a30f0ff9ea28e2ad190c9d118f..7b4d4d46843b4eebaa9bd98af6a8f363d88620bf 100644 (file)
@@ -3271,33 +3271,32 @@ ieee80211_sta_rx_scan(struct net_device *dev, struct sk_buff *skb,
                      struct ieee80211_rx_status *rx_status)
 {
        struct ieee80211_mgmt *mgmt;
-       u16 fc;
+       __le16 fc;
 
        if (skb->len < 2)
                return RX_DROP_UNUSABLE;
 
        mgmt = (struct ieee80211_mgmt *) skb->data;
-       fc = le16_to_cpu(mgmt->frame_control);
+       fc = mgmt->frame_control;
 
-       if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL)
+       if (ieee80211_is_ctl(fc))
                return RX_CONTINUE;
 
        if (skb->len < 24)
                return RX_DROP_MONITOR;
 
-       if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) {
-               if ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_RESP) {
-                       ieee80211_rx_mgmt_probe_resp(dev, mgmt,
-                                                    skb->len, rx_status);
-                       dev_kfree_skb(skb);
-                       return RX_QUEUED;
-               } else if ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON) {
-                       ieee80211_rx_mgmt_beacon(dev, mgmt, skb->len,
-                                                rx_status);
-                       dev_kfree_skb(skb);
-                       return RX_QUEUED;
-               }
+       if (ieee80211_is_probe_resp(fc)) {
+               ieee80211_rx_mgmt_probe_resp(dev, mgmt, skb->len, rx_status);
+               dev_kfree_skb(skb);
+               return RX_QUEUED;
        }
+
+       if (ieee80211_is_beacon(fc)) {
+               ieee80211_rx_mgmt_beacon(dev, mgmt, skb->len, rx_status);
+               dev_kfree_skb(skb);
+               return RX_QUEUED;
+       }
+
        return RX_CONTINUE;
 }
 
@@ -3875,7 +3874,7 @@ static void ieee80211_send_nullfunc(struct ieee80211_local *local,
 {
        struct sk_buff *skb;
        struct ieee80211_hdr *nullfunc;
-       u16 fc;
+       __le16 fc;
 
        skb = dev_alloc_skb(local->hw.extra_tx_headroom + 24);
        if (!skb) {
@@ -3887,11 +3886,11 @@ static void ieee80211_send_nullfunc(struct ieee80211_local *local,
 
        nullfunc = (struct ieee80211_hdr *) skb_put(skb, 24);
        memset(nullfunc, 0, 24);
-       fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC |
-            IEEE80211_FCTL_TODS;
+       fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC |
+                        IEEE80211_FCTL_TODS);
        if (powersave)
-               fc |= IEEE80211_FCTL_PM;
-       nullfunc->frame_control = cpu_to_le16(fc);
+               fc |= cpu_to_le16(IEEE80211_FCTL_PM);
+       nullfunc->frame_control = fc;
        memcpy(nullfunc->addr1, sdata->u.sta.bssid, ETH_ALEN);
        memcpy(nullfunc->addr2, sdata->dev->dev_addr, ETH_ALEN);
        memcpy(nullfunc->addr3, sdata->u.sta.bssid, ETH_ALEN);