diff options
author | Daniel Drake <dsd@laptop.org> | 2011-07-20 12:53:56 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-07-20 15:04:41 -0400 |
commit | d931998669c3e0e917bd9983880f3498c27de0af (patch) | |
tree | 927b6529e158a70ffd5a06766970015363dd9861 /drivers/net/wireless/libertas/mesh.c | |
parent | 3db4f989384c90f5f6be14e88c19732bfb0ac331 (diff) |
libertas: only enable mesh when interface is active
Previously, the mesh was running whenever the appropriate hardware
and firmware was present.
Now we only run the mesh when the interface is running.
Also simplifies interface management a little.
Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/mesh.c')
-rw-r--r-- | drivers/net/wireless/libertas/mesh.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/net/wireless/libertas/mesh.c b/drivers/net/wireless/libertas/mesh.c index ffe9c1e400cf..1d33c5dd91d2 100644 --- a/drivers/net/wireless/libertas/mesh.c +++ b/drivers/net/wireless/libertas/mesh.c | |||
@@ -269,17 +269,11 @@ static ssize_t lbs_mesh_set(struct device *dev, | |||
269 | { | 269 | { |
270 | struct lbs_private *priv = to_net_dev(dev)->ml_priv; | 270 | struct lbs_private *priv = to_net_dev(dev)->ml_priv; |
271 | int enable; | 271 | int enable; |
272 | int ret, action = CMD_ACT_MESH_CONFIG_STOP; | ||
273 | 272 | ||
274 | sscanf(buf, "%x", &enable); | 273 | sscanf(buf, "%x", &enable); |
275 | enable = !!enable; | 274 | enable = !!enable; |
276 | if (enable == !!priv->mesh_dev) | 275 | if (enable == !!priv->mesh_dev) |
277 | return count; | 276 | return count; |
278 | if (enable) | ||
279 | action = CMD_ACT_MESH_CONFIG_START; | ||
280 | ret = lbs_mesh_config(priv, action, priv->channel); | ||
281 | if (ret) | ||
282 | return ret; | ||
283 | 277 | ||
284 | if (enable) | 278 | if (enable) |
285 | lbs_add_mesh(priv); | 279 | lbs_add_mesh(priv); |
@@ -822,8 +816,6 @@ int lbs_init_mesh(struct lbs_private *priv) | |||
822 | 816 | ||
823 | lbs_deb_enter(LBS_DEB_MESH); | 817 | lbs_deb_enter(LBS_DEB_MESH); |
824 | 818 | ||
825 | priv->mesh_connect_status = LBS_DISCONNECTED; | ||
826 | |||
827 | /* Determine mesh_fw_ver from fwrelease and fwcapinfo */ | 819 | /* Determine mesh_fw_ver from fwrelease and fwcapinfo */ |
828 | /* 5.0.16p0 9.0.0.p0 is known to NOT support any mesh */ | 820 | /* 5.0.16p0 9.0.0.p0 is known to NOT support any mesh */ |
829 | /* 5.110.22 have mesh command with 0xa3 command id */ | 821 | /* 5.110.22 have mesh command with 0xa3 command id */ |
@@ -863,6 +855,8 @@ int lbs_init_mesh(struct lbs_private *priv) | |||
863 | priv->mesh_tlv = 0; | 855 | priv->mesh_tlv = 0; |
864 | } | 856 | } |
865 | 857 | ||
858 | /* Stop meshing until interface is brought up */ | ||
859 | lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_STOP, priv->channel); | ||
866 | 860 | ||
867 | if (priv->mesh_tlv) { | 861 | if (priv->mesh_tlv) { |
868 | sprintf(priv->mesh_ssid, "mesh"); | 862 | sprintf(priv->mesh_ssid, "mesh"); |
@@ -909,10 +903,9 @@ static int lbs_mesh_stop(struct net_device *dev) | |||
909 | struct lbs_private *priv = dev->ml_priv; | 903 | struct lbs_private *priv = dev->ml_priv; |
910 | 904 | ||
911 | lbs_deb_enter(LBS_DEB_MESH); | 905 | lbs_deb_enter(LBS_DEB_MESH); |
912 | spin_lock_irq(&priv->driver_lock); | 906 | lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_STOP, priv->channel); |
913 | 907 | ||
914 | priv->mesh_open = 0; | 908 | spin_lock_irq(&priv->driver_lock); |
915 | priv->mesh_connect_status = LBS_DISCONNECTED; | ||
916 | 909 | ||
917 | netif_stop_queue(dev); | 910 | netif_stop_queue(dev); |
918 | netif_carrier_off(dev); | 911 | netif_carrier_off(dev); |
@@ -942,18 +935,20 @@ static int lbs_mesh_dev_open(struct net_device *dev) | |||
942 | 935 | ||
943 | if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) { | 936 | if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) { |
944 | ret = -EBUSY; | 937 | ret = -EBUSY; |
938 | spin_unlock_irq(&priv->driver_lock); | ||
945 | goto out; | 939 | goto out; |
946 | } | 940 | } |
947 | 941 | ||
948 | priv->mesh_open = 1; | ||
949 | priv->mesh_connect_status = LBS_CONNECTED; | ||
950 | netif_carrier_on(dev); | 942 | netif_carrier_on(dev); |
951 | 943 | ||
952 | if (!priv->tx_pending_len) | 944 | if (!priv->tx_pending_len) |
953 | netif_wake_queue(dev); | 945 | netif_wake_queue(dev); |
954 | out: | ||
955 | 946 | ||
956 | spin_unlock_irq(&priv->driver_lock); | 947 | spin_unlock_irq(&priv->driver_lock); |
948 | |||
949 | ret = lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START, priv->channel); | ||
950 | |||
951 | out: | ||
957 | lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); | 952 | lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); |
958 | return ret; | 953 | return ret; |
959 | } | 954 | } |