mac80211: convert to %pM away from print_mac
[deliverable/linux.git] / net / mac80211 / rx.c
index 8c3dda5f00b2c223d184c1f3f56c851aaea82cff..39aaf210e9f56345cad6860d721bdcc413e0d12a 100644 (file)
@@ -650,31 +650,25 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
        return result;
 }
 
-static void ap_sta_ps_start(struct net_device *dev, struct sta_info *sta)
+static void ap_sta_ps_start(struct sta_info *sta)
 {
-       struct ieee80211_sub_if_data *sdata;
-       DECLARE_MAC_BUF(mac);
-
-       sdata = sta->sdata;
+       struct ieee80211_sub_if_data *sdata = sta->sdata;
 
        atomic_inc(&sdata->bss->num_sta_ps);
        set_and_clear_sta_flags(sta, WLAN_STA_PS, WLAN_STA_PSPOLL);
 #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
-       printk(KERN_DEBUG "%s: STA %s aid %d enters power save mode\n",
-              dev->name, print_mac(mac, sta->addr), sta->aid);
+       printk(KERN_DEBUG "%s: STA %pM aid %d enters power save mode\n",
+              sdata->dev->name, sta->sta.addr, sta->sta.aid);
 #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
 }
 
-static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
+static int ap_sta_ps_end(struct sta_info *sta)
 {
-       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+       struct ieee80211_sub_if_data *sdata = sta->sdata;
+       struct ieee80211_local *local = sdata->local;
        struct sk_buff *skb;
        int sent = 0;
-       struct ieee80211_sub_if_data *sdata;
        struct ieee80211_tx_info *info;
-       DECLARE_MAC_BUF(mac);
-
-       sdata = sta->sdata;
 
        atomic_dec(&sdata->bss->num_sta_ps);
 
@@ -684,8 +678,8 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
                sta_info_clear_tim_bit(sta);
 
 #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
-       printk(KERN_DEBUG "%s: STA %s aid %d exits power save mode\n",
-              dev->name, print_mac(mac, sta->addr), sta->aid);
+       printk(KERN_DEBUG "%s: STA %pM aid %d exits power save mode\n",
+              sdata->dev->name, sta->sta.addr, sta->sta.aid);
 #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
 
        /* Send all buffered frames to the station */
@@ -700,9 +694,9 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
                local->total_ps_buffered--;
                sent++;
 #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
-               printk(KERN_DEBUG "%s: STA %s aid %d send PS frame "
-                      "since STA not sleeping anymore\n", dev->name,
-                      print_mac(mac, sta->addr), sta->aid);
+               printk(KERN_DEBUG "%s: STA %pM aid %d send PS frame "
+                      "since STA not sleeping anymore\n", sdata->dev->name,
+                      sta->sta.addr, sta->sta.aid);
 #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
                info->flags |= IEEE80211_TX_CTL_REQUEUE;
                dev_queue_xmit(skb);
@@ -715,7 +709,6 @@ static ieee80211_rx_result debug_noinline
 ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
 {
        struct sta_info *sta = rx->sta;
-       struct net_device *dev = rx->dev;
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
 
        if (!sta)
@@ -757,10 +750,10 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
                 * exchange sequence */
                if (test_sta_flags(sta, WLAN_STA_PS) &&
                    !ieee80211_has_pm(hdr->frame_control))
-                       rx->sent_ps_buffered += ap_sta_ps_end(dev, sta);
+                       rx->sent_ps_buffered += ap_sta_ps_end(sta);
                else if (!test_sta_flags(sta, WLAN_STA_PS) &&
                         ieee80211_has_pm(hdr->frame_control))
-                       ap_sta_ps_start(dev, sta);
+                       ap_sta_ps_start(sta);
        }
 
        /* Drop data::nullfunc frames silently, since they are used only to
@@ -794,15 +787,12 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata,
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
                struct ieee80211_hdr *hdr =
                        (struct ieee80211_hdr *) entry->skb_list.next->data;
-               DECLARE_MAC_BUF(mac);
-               DECLARE_MAC_BUF(mac2);
                printk(KERN_DEBUG "%s: RX reassembly removed oldest "
                       "fragment entry (idx=%d age=%lu seq=%d last_frag=%d "
-                      "addr1=%s addr2=%s\n",
+                      "addr1=%pM addr2=%pM\n",
                       sdata->dev->name, idx,
                       jiffies - entry->first_frag_time, entry->seq,
-                      entry->last_frag, print_mac(mac, hdr->addr1),
-                      print_mac(mac2, hdr->addr2));
+                      entry->last_frag, hdr->addr1, hdr->addr2);
 #endif
                __skb_queue_purge(&entry->skb_list);
        }
@@ -871,7 +861,6 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
        unsigned int frag, seq;
        struct ieee80211_fragment_entry *entry;
        struct sk_buff *skb;
-       DECLARE_MAC_BUF(mac);
 
        hdr = (struct ieee80211_hdr *)rx->skb->data;
        fc = hdr->frame_control;
@@ -975,7 +964,6 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx)
        struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev);
        struct sk_buff *skb;
        int no_pending_pkts;
-       DECLARE_MAC_BUF(mac);
        __le16 fc = ((struct ieee80211_hdr *)rx->skb->data)->frame_control;
 
        if (likely(!rx->sta || !ieee80211_is_pspoll(fc) ||
@@ -1006,8 +994,8 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx)
                set_sta_flags(rx->sta, WLAN_STA_PSPOLL);
 
 #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
-               printk(KERN_DEBUG "STA %s aid %d: PS Poll (entries after %d)\n",
-                      print_mac(mac, rx->sta->addr), rx->sta->aid,
+               printk(KERN_DEBUG "STA %pM aid %d: PS Poll (entries after %d)\n",
+                      rx->sta->sta.addr, rx->sta->sta.aid,
                       skb_queue_len(&rx->sta->ps_tx_buf));
 #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
 
@@ -1030,9 +1018,9 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx)
                 *        Should we send it a null-func frame indicating we
                 *        have nothing buffered for it?
                 */
-               printk(KERN_DEBUG "%s: STA %s sent PS Poll even "
+               printk(KERN_DEBUG "%s: STA %pM sent PS Poll even "
                       "though there are no buffered frames for it\n",
-                      rx->dev->name, print_mac(mac, rx->sta->addr));
+                      rx->dev->name, rx->sta->sta.addr);
 #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
        }
 
@@ -1102,20 +1090,12 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
        u8 src[ETH_ALEN] __aligned(2);
        struct sk_buff *skb = rx->skb;
        struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-       DECLARE_MAC_BUF(mac);
-       DECLARE_MAC_BUF(mac2);
-       DECLARE_MAC_BUF(mac3);
-       DECLARE_MAC_BUF(mac4);
 
        if (unlikely(!ieee80211_is_data_present(hdr->frame_control)))
                return -1;
 
        hdrlen = ieee80211_hdrlen(hdr->frame_control);
 
-       if (ieee80211_vif_is_mesh(&sdata->vif))
-               hdrlen += ieee80211_get_mesh_hdrlen(
-                               (struct ieee80211s_hdr *) (skb->data + hdrlen));
-
        /* convert IEEE 802.11 header + possible LLC headers into Ethernet
         * header
         * IEEE 802.11 address fields:
@@ -1139,6 +1119,15 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
                if (unlikely(sdata->vif.type != NL80211_IFTYPE_WDS &&
                             sdata->vif.type != NL80211_IFTYPE_MESH_POINT))
                        return -1;
+               if (ieee80211_vif_is_mesh(&sdata->vif)) {
+                       struct ieee80211s_hdr *meshdr = (struct ieee80211s_hdr *)
+                               (skb->data + hdrlen);
+                       hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
+                       if (meshdr->flags & MESH_FLAGS_AE_A5_A6) {
+                               memcpy(dst, meshdr->eaddr1, ETH_ALEN);
+                               memcpy(src, meshdr->eaddr2, ETH_ALEN);
+                       }
+               }
                break;
        case __constant_cpu_to_le16(IEEE80211_FCTL_FROMDS):
                if (sdata->vif.type != NL80211_IFTYPE_STATION ||
@@ -1279,7 +1268,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
        int remaining, err;
        u8 dst[ETH_ALEN];
        u8 src[ETH_ALEN];
-       DECLARE_MAC_BUF(mac);
 
        if (unlikely(!ieee80211_is_data(fc)))
                return RX_CONTINUE;
@@ -1379,7 +1367,8 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
        return RX_QUEUED;
 }
 
-static ieee80211_rx_result debug_noinline
+#ifdef CONFIG_MAC80211_MESH
+static ieee80211_rx_result
 ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 {
        struct ieee80211_hdr *hdr;
@@ -1398,6 +1387,25 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
                /* illegal frame */
                return RX_DROP_MONITOR;
 
+       if (mesh_hdr->flags & MESH_FLAGS_AE_A5_A6){
+               struct ieee80211_sub_if_data *sdata;
+               struct mesh_path *mppath;
+
+               sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev);
+               rcu_read_lock();
+               mppath = mpp_path_lookup(mesh_hdr->eaddr2, sdata);
+               if (!mppath) {
+                       mpp_path_add(mesh_hdr->eaddr2, hdr->addr4, sdata);
+               } else {
+                       spin_lock_bh(&mppath->state_lock);
+                       mppath->exp_time = jiffies;
+                       if (compare_ether_addr(mppath->mpp, hdr->addr4) != 0)
+                               memcpy(mppath->mpp, hdr->addr4, ETH_ALEN);
+                       spin_unlock_bh(&mppath->state_lock);
+               }
+               rcu_read_unlock();
+       }
+
        if (compare_ether_addr(rx->dev->dev_addr, hdr->addr3) == 0)
                return RX_CONTINUE;
 
@@ -1434,7 +1442,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
        else
                return RX_DROP_MONITOR;
 }
-
+#endif
 
 static ieee80211_rx_result debug_noinline
 ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
@@ -1538,7 +1546,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
         */
        if (sdata->vif.type != NL80211_IFTYPE_STATION &&
            sdata->vif.type != NL80211_IFTYPE_ADHOC)
-               return RX_DROP_MONITOR;
+               return RX_CONTINUE;
 
        switch (mgmt->u.action.category) {
        case WLAN_CATEGORY_BACK:
@@ -1612,8 +1620,6 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev,
 {
        int keyidx;
        unsigned int hdrlen;
-       DECLARE_MAC_BUF(mac);
-       DECLARE_MAC_BUF(mac2);
 
        hdrlen = ieee80211_hdrlen(hdr->frame_control);
        if (rx->skb->len >= hdrlen + 4)
@@ -1761,8 +1767,10 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata,
        /* must be after MMIC verify so header is counted in MPDU mic */
        CALL_RXH(ieee80211_rx_h_remove_qos_control)
        CALL_RXH(ieee80211_rx_h_amsdu)
+#ifdef CONFIG_MAC80211_MESH
        if (ieee80211_vif_is_mesh(&sdata->vif))
                CALL_RXH(ieee80211_rx_h_mesh_fwding);
+#endif
        CALL_RXH(ieee80211_rx_h_data)
        CALL_RXH(ieee80211_rx_h_ctrl)
        CALL_RXH(ieee80211_rx_h_action)
@@ -2140,7 +2148,7 @@ static u8 ieee80211_rx_reorder_ampdu(struct ieee80211_local *local,
        /* if this mpdu is fragmented - terminate rx aggregation session */
        sc = le16_to_cpu(hdr->seq_ctrl);
        if (sc & IEEE80211_SCTL_FRAG) {
-               ieee80211_sta_stop_rx_ba_session(sta->sdata, sta->addr,
+               ieee80211_sta_stop_rx_ba_session(sta->sdata, sta->sta.addr,
                        tid, 0, WLAN_REASON_QSTA_REQUIRE_SETUP);
                ret = 1;
                goto end_reorder;
This page took 0.032831 seconds and 5 git commands to generate.