mac80211: manage carrier state in mesh
authorJohannes Berg <johannes.berg@intel.com>
Mon, 30 Jul 2012 17:44:12 +0000 (19:44 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 31 Jul 2012 14:18:59 +0000 (16:18 +0200)
Instead of assuming the carrier is on all
the time in mesh manage it with joining
and leaving the mesh.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/iface.c
net/mac80211/mesh.c

index fc8ba83e2c33955aa71c925934b3e5264c9ddfc6..c65a03ba809f8b3d14b1f257b96da4dca0f386b0 100644 (file)
@@ -539,12 +539,16 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up)
                changed |= ieee80211_reset_erp_info(sdata);
                ieee80211_bss_info_change_notify(sdata, changed);
 
-               if (sdata->vif.type == NL80211_IFTYPE_STATION ||
-                   sdata->vif.type == NL80211_IFTYPE_ADHOC ||
-                   sdata->vif.type == NL80211_IFTYPE_AP)
+               switch (sdata->vif.type) {
+               case NL80211_IFTYPE_STATION:
+               case NL80211_IFTYPE_ADHOC:
+               case NL80211_IFTYPE_AP:
+               case NL80211_IFTYPE_MESH_POINT:
                        netif_carrier_off(dev);
-               else
+                       break;
+               default:
                        netif_carrier_on(dev);
+               }
 
                /*
                 * set default queue parameters so drivers don't
index 03f1696d7d98d4ac2ed5de4176b29cca8b673a78..571d5183060e1b3642ef253d5b3c23f4197f9a31 100644 (file)
@@ -610,6 +610,8 @@ void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
                                                BSS_CHANGED_HT |
                                                BSS_CHANGED_BASIC_RATES |
                                                BSS_CHANGED_BEACON_INT);
+
+       netif_carrier_on(sdata->dev);
 }
 
 void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
@@ -617,6 +619,8 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
 
+       netif_carrier_off(sdata->dev);
+
        ifmsh->mesh_id_len = 0;
        ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED);
        sta_info_flush(local, NULL);