mac80211: implement the meshconf formation info field
authorRui Paulo <rpaulo@gmail.com>
Mon, 9 Nov 2009 23:46:41 +0000 (23:46 +0000)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 11 Nov 2009 20:23:57 +0000 (15:23 -0500)
The Mesh Configuration Formation Info field contains the number of
neighbors.  This means that the beacon must be updated every time a
peer joins or leaves.

Signed-off-by: Rui Paulo <rpaulo@gmail.com>
Signed-off-by: Javier Cardona <rpaulo@gmail.com>
Reviewed-by: Andrey Yurovsky <andrey@cozybit.com>
Tested-by: Brian Cavagnolo <brian@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/mesh.c
net/mac80211/mesh_plink.c

index a49a3374acb1a37643c847fa79bd598a7a8f4f7e..79425182c2903a70f355f1bdb34fe9fe8239fe05 100644 (file)
@@ -223,6 +223,7 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
        struct ieee80211_supported_band *sband;
        u8 *pos;
        int len, i, rate;
+       u8 neighbors;
 
        sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
        len = sband->n_bitrates;
@@ -271,9 +272,11 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
        /* Authentication Protocol identifier */
        *pos++ = sdata->u.mesh.mesh_auth_id;
 
-       /* Mesh Formation Info */
-       memset(pos, 0x00, 1);
-       pos += 1;
+       /* Mesh Formation Info - number of neighbors */
+       neighbors = atomic_read(&sdata->u.mesh.mshstats.estab_plinks);
+       /* Number of neighbor mesh STAs or 15 whichever is smaller */
+       neighbors = (neighbors > 15) ? 15 : neighbors;
+       *pos++ = neighbors << 1;
 
        /* Mesh capability */
        sdata->u.mesh.accepting_plinks = mesh_plink_availables(sdata);
index ffcbad75e09bce2959f8ba04b96e28a6063b55e6..f98c8d23f58152180ba579f66d5949537e94da96 100644 (file)
@@ -65,6 +65,7 @@ void mesh_plink_inc_estab_count(struct ieee80211_sub_if_data *sdata)
 {
        atomic_inc(&sdata->u.mesh.mshstats.estab_plinks);
        mesh_accept_plinks_update(sdata);
+       ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON);
 }
 
 static inline
@@ -72,6 +73,7 @@ void mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata)
 {
        atomic_dec(&sdata->u.mesh.mshstats.estab_plinks);
        mesh_accept_plinks_update(sdata);
+       ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON);
 }
 
 /**