mac80211: clean up mesh code

Various cleanups, reducing the #ifdef mess and other things.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index cc4a896..d0018fc 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -20,9 +20,7 @@
 
 #include "ieee80211_i.h"
 #include "ieee80211_led.h"
-#ifdef CONFIG_MAC80211_MESH
 #include "mesh.h"
-#endif
 #include "wep.h"
 #include "wpa.h"
 #include "tkip.h"
@@ -439,6 +437,13 @@
 	else
 		return RX_CONTINUE;
 }
+#undef msh_h_get
+#else
+static inline ieee80211_rx_result
+ieee80211_rx_mesh_check(struct ieee80211_txrx_data *rx)
+{
+	return RX_CONTINUE;
+}
 #endif
 
 
@@ -477,10 +482,8 @@
 	 * responsible for filtering on both auth and assoc states.
 	 */
 
-#ifdef CONFIG_MAC80211_MESH
-	if (rx->sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT)
+	if (ieee80211_vif_is_mesh(&rx->sdata->vif))
 		return ieee80211_rx_mesh_check(rx);
-#endif
 
 	if (unlikely(((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA ||
 		      ((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL &&
@@ -1111,8 +1114,7 @@
 
 	hdrlen = ieee80211_get_hdrlen(fc);
 
-#ifdef CONFIG_MAC80211_MESH
-	if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) {
+	if (ieee80211_vif_is_mesh(&sdata->vif)) {
 		int meshhdrlen = ieee80211_get_mesh_hdrlen(
 				(struct ieee80211s_hdr *) (skb->data + hdrlen));
 		/* Copy on cb:
@@ -1126,7 +1128,6 @@
 		memcpy(MESH_PREQ(skb), hdr->addr2, ETH_ALEN);
 		hdrlen += meshhdrlen;
 	}
-#endif
 
 	/* convert IEEE 802.11 header + possible LLC headers into Ethernet
 	 * header
@@ -1306,9 +1307,8 @@
 		}
 	}
 
-#ifdef CONFIG_MAC80211_MESH
 	/* Mesh forwarding */
-	if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) {
+	if (ieee80211_vif_is_mesh(&sdata->vif)) {
 		u8 *mesh_ttl = &((struct ieee80211s_hdr *)skb->cb)->ttl;
 		(*mesh_ttl)--;
 
@@ -1321,12 +1321,13 @@
 				else
 					xmit_skb->pkt_type = PACKET_OTHERHOST;
 			} else
-				sdata->u.sta.mshstats.dropped_frames_ttl++;
-
+				IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.sta,
+							     dropped_frames_ttl);
 		} else if (skb->pkt_type != PACKET_OTHERHOST &&
 			compare_ether_addr(dev->dev_addr, skb->data) != 0) {
 			if (*mesh_ttl == 0) {
-				sdata->u.sta.mshstats.dropped_frames_ttl++;
+				IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.sta,
+							     dropped_frames_ttl);
 				dev_kfree_skb(skb);
 				skb = NULL;
 			} else {
@@ -1337,7 +1338,6 @@
 			}
 		}
 	}
-#endif
 
 	if (skb) {
 		/* deliver to local stack */