Author: adrian
Date: Tue May 26 04:25:11 2015
New Revision: 283555
URL: https://svnweb.freebsd.org/changeset/base/283555

Log:
  Migrate the 802.11s locks out into ieee80211_freebsd.h, so they can be
  defined as platform specific bits.
  
  This is to help make OS portability easier.

Modified:
  head/sys/net80211/ieee80211_freebsd.h
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_mesh.h

Modified: head/sys/net80211/ieee80211_freebsd.h
==============================================================================
--- head/sys/net80211/ieee80211_freebsd.h       Tue May 26 03:58:18 2015        
(r283554)
+++ head/sys/net80211/ieee80211_freebsd.h       Tue May 26 04:25:11 2015        
(r283555)
@@ -184,6 +184,27 @@ typedef struct mtx ieee80211_scan_table_
 #define        IEEE80211_SCAN_TABLE_UNLOCK(_st)        
mtx_unlock(&(_st)->st_lock)
 
 /*
+ * Mesh node/routing definitions.
+ */
+typedef struct mtx ieee80211_rte_lock_t;
+#define        MESH_RT_ENTRY_LOCK_INIT(_rt, _name) \
+       mtx_init(&(rt)->rt_lock, _name, "802.11s route entry", MTX_DEF)
+#define        MESH_RT_ENTRY_LOCK_DESTROY(_rt) \
+       mtx_destroy(&(_rt)->rt_lock)
+#define        MESH_RT_ENTRY_LOCK(rt)  mtx_lock(&(rt)->rt_lock)
+#define        MESH_RT_ENTRY_LOCK_ASSERT(rt) mtx_assert(&(rt)->rt_lock, 
MA_OWNED)
+#define        MESH_RT_ENTRY_UNLOCK(rt)        mtx_unlock(&(rt)->rt_lock)
+
+typedef struct mtx ieee80211_rt_lock_t;
+#define        MESH_RT_LOCK(ms)        mtx_lock(&(ms)->ms_rt_lock)
+#define        MESH_RT_LOCK_ASSERT(ms) mtx_assert(&(ms)->ms_rt_lock, MA_OWNED)
+#define        MESH_RT_UNLOCK(ms)      mtx_unlock(&(ms)->ms_rt_lock)
+#define        MESH_RT_LOCK_INIT(ms, name) \
+       mtx_init(&(ms)->ms_rt_lock, name, "802.11s routing table", MTX_DEF)
+#define        MESH_RT_LOCK_DESTROY(ms) \
+       mtx_destroy(&(ms)->ms_rt_lock)
+
+/*
  * Node reference counting definitions.
  *
  * ieee80211_node_initref      initialize the reference count to 1

Modified: head/sys/net80211/ieee80211_mesh.c
==============================================================================
--- head/sys/net80211/ieee80211_mesh.c  Tue May 26 03:58:18 2015        
(r283554)
+++ head/sys/net80211/ieee80211_mesh.c  Tue May 26 04:25:11 2015        
(r283555)
@@ -162,14 +162,6 @@ static const struct ieee80211_mesh_proto
 static struct ieee80211_mesh_proto_path                mesh_proto_paths[4];
 static struct ieee80211_mesh_proto_metric      mesh_proto_metrics[4];
 
-#define        RT_ENTRY_LOCK(rt)       mtx_lock(&(rt)->rt_lock)
-#define        RT_ENTRY_LOCK_ASSERT(rt) mtx_assert(&(rt)->rt_lock, MA_OWNED)
-#define        RT_ENTRY_UNLOCK(rt)     mtx_unlock(&(rt)->rt_lock)
-
-#define        MESH_RT_LOCK(ms)        mtx_lock(&(ms)->ms_rt_lock)
-#define        MESH_RT_LOCK_ASSERT(ms) mtx_assert(&(ms)->ms_rt_lock, MA_OWNED)
-#define        MESH_RT_UNLOCK(ms)      mtx_unlock(&(ms)->ms_rt_lock)
-
 MALLOC_DEFINE(M_80211_MESH_PREQ, "80211preq", "802.11 MESH Path Request 
frame");
 MALLOC_DEFINE(M_80211_MESH_PREP, "80211prep", "802.11 MESH Path Reply frame");
 MALLOC_DEFINE(M_80211_MESH_PERR, "80211perr", "802.11 MESH Path Error frame");
@@ -218,7 +210,7 @@ mesh_rt_add_locked(struct ieee80211vap *
                rt->rt_vap = vap;
                IEEE80211_ADDR_COPY(rt->rt_dest, dest);
                rt->rt_priv = (void *)ALIGN(&rt[1]);
-               mtx_init(&rt->rt_lock, "MBSS_RT", "802.11s route entry", 
MTX_DEF);
+               MESH_RT_ENTRY_LOCK_INIT(rt, "MBSS_RT");
                callout_init(&rt->rt_discovery, 1);
                rt->rt_updtime = ticks; /* create time */
                TAILQ_INSERT_TAIL(&ms->ms_routes, rt, rt_next);
@@ -271,11 +263,11 @@ ieee80211_mesh_rt_update(struct ieee8021
        KASSERT(rt != NULL, ("route is NULL"));
 
        now = ticks;
-       RT_ENTRY_LOCK(rt);
+       MESH_RT_ENTRY_LOCK(rt);
 
        /* dont clobber a proxy entry gated by us */
        if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY && rt->rt_nhops == 0) {
-               RT_ENTRY_UNLOCK(rt);
+               MESH_RT_ENTRY_UNLOCK(rt);
                return rt->rt_lifetime;
        }
 
@@ -296,7 +288,7 @@ ieee80211_mesh_rt_update(struct ieee8021
                        new_lifetime, rt->rt_lifetime);
        }
        lifetime = rt->rt_lifetime;
-       RT_ENTRY_UNLOCK(rt);
+       MESH_RT_ENTRY_UNLOCK(rt);
 
        return lifetime;
 }
@@ -358,9 +350,9 @@ mesh_rt_del(struct ieee80211_mesh_state 
         * Grab the lock before destroying it, to be sure no one else
         * is holding the route.
         */
-       RT_ENTRY_LOCK(rt);
+       MESH_RT_ENTRY_LOCK(rt);
        callout_drain(&rt->rt_discovery);
-       mtx_destroy(&rt->rt_lock);
+       MESH_RT_ENTRY_LOCK_DESTROY(rt);
        IEEE80211_FREE(rt, M_80211_MESH_RT);
 }
 
@@ -653,7 +645,7 @@ mesh_vdetach(struct ieee80211vap *vap)
        ieee80211_iterate_nodes(&vap->iv_ic->ic_sta, mesh_vdetach_peers,
            NULL);
        ieee80211_mesh_rt_flush(vap);
-       mtx_destroy(&ms->ms_rt_lock);
+       MESH_RT_LOCK_DESTROY(ms);
        ms->ms_ppath->mpp_vdetach(vap);
        IEEE80211_FREE(vap->iv_mesh, M_80211_VAP);
        vap->iv_mesh = NULL;
@@ -680,7 +672,7 @@ mesh_vattach(struct ieee80211vap *vap)
        ms->ms_ttl = IEEE80211_MESH_DEFAULT_TTL;
        TAILQ_INIT(&ms->ms_known_gates);
        TAILQ_INIT(&ms->ms_routes);
-       mtx_init(&ms->ms_rt_lock, "MBSS", "802.11s routing table", MTX_DEF);
+       MESH_RT_LOCK_INIT(ms, "MBSS");
        callout_init(&ms->ms_cleantimer, 1);
        callout_init(&ms->ms_gatetimer, 1);
        ms->ms_gateseq = 0;

Modified: head/sys/net80211/ieee80211_mesh.h
==============================================================================
--- head/sys/net80211/ieee80211_mesh.h  Tue May 26 03:58:18 2015        
(r283554)
+++ head/sys/net80211/ieee80211_mesh.h  Tue May 26 04:25:11 2015        
(r283555)
@@ -418,7 +418,7 @@ MALLOC_DECLARE(M_80211_MESH_GT_RT);
 struct ieee80211_mesh_route {
        TAILQ_ENTRY(ieee80211_mesh_route)       rt_next;
        struct ieee80211vap     *rt_vap;
-       struct mtx              rt_lock;        /* fine grained route lock */
+       ieee80211_rte_lock_t    rt_lock;        /* fine grained route lock */
        struct callout          rt_discovery;   /* discovery timeout */
        int                     rt_updtime;     /* last update time */
        uint8_t                 rt_dest[IEEE80211_ADDR_LEN];
@@ -515,7 +515,7 @@ struct ieee80211_mesh_state {
 #define IEEE80211_MESHFLAGS_FWD                0x04    /* forward packets */
 #define IEEE80211_MESHFLAGS_ROOT       0x08    /* configured as root */
        uint8_t                         ms_flags;
-       struct mtx                      ms_rt_lock;
+       ieee80211_rt_lock_t             ms_rt_lock;
        struct callout                  ms_cleantimer;
        struct callout                  ms_gatetimer;
        ieee80211_mesh_seq              ms_gateseq;
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to