Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Daniel Drake and committed by
John W. Linville
d9319986 3db4f989

+11 -25
-2
drivers/net/wireless/libertas/dev.h
··· 44 44 /* Mesh */ 45 45 struct net_device *mesh_dev; /* Virtual device */ 46 46 #ifdef CONFIG_LIBERTAS_MESH 47 - u32 mesh_connect_status; 48 47 struct lbs_mesh_stats mstats; 49 - int mesh_open; 50 48 uint16_t mesh_tlv; 51 49 u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1]; 52 50 u8 mesh_ssid_len;
+1 -1
drivers/net/wireless/libertas/main.c
··· 511 511 if (priv->connect_status == LBS_CONNECTED) 512 512 netif_wake_queue(priv->dev); 513 513 if (priv->mesh_dev && 514 - lbs_mesh_connected(priv)) 514 + netif_running(priv->mesh_dev)) 515 515 netif_wake_queue(priv->mesh_dev); 516 516 } 517 517 }
+9 -14
drivers/net/wireless/libertas/mesh.c
··· 269 269 { 270 270 struct lbs_private *priv = to_net_dev(dev)->ml_priv; 271 271 int enable; 272 - int ret, action = CMD_ACT_MESH_CONFIG_STOP; 273 272 274 273 sscanf(buf, "%x", &enable); 275 274 enable = !!enable; 276 275 if (enable == !!priv->mesh_dev) 277 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 278 if (enable) 285 279 lbs_add_mesh(priv); ··· 816 822 817 823 lbs_deb_enter(LBS_DEB_MESH); 818 824 819 - priv->mesh_connect_status = LBS_DISCONNECTED; 820 - 821 825 /* Determine mesh_fw_ver from fwrelease and fwcapinfo */ 822 826 /* 5.0.16p0 9.0.0.p0 is known to NOT support any mesh */ 823 827 /* 5.110.22 have mesh command with 0xa3 command id */ ··· 855 863 priv->mesh_tlv = 0; 856 864 } 857 865 866 + /* Stop meshing until interface is brought up */ 867 + lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_STOP, priv->channel); 858 868 859 869 if (priv->mesh_tlv) { 860 870 sprintf(priv->mesh_ssid, "mesh"); ··· 903 909 struct lbs_private *priv = dev->ml_priv; 904 910 905 911 lbs_deb_enter(LBS_DEB_MESH); 906 - spin_lock_irq(&priv->driver_lock); 912 + lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_STOP, priv->channel); 907 913 908 - priv->mesh_open = 0; 909 - priv->mesh_connect_status = LBS_DISCONNECTED; 914 + spin_lock_irq(&priv->driver_lock); 910 915 911 916 netif_stop_queue(dev); 912 917 netif_carrier_off(dev); ··· 935 942 936 943 if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) { 937 944 ret = -EBUSY; 945 + spin_unlock_irq(&priv->driver_lock); 938 946 goto out; 939 947 } 940 948 941 - priv->mesh_open = 1; 942 - priv->mesh_connect_status = LBS_CONNECTED; 943 949 netif_carrier_on(dev); 944 950 945 951 if (!priv->tx_pending_len) 946 952 netif_wake_queue(dev); 947 - out: 948 953 949 954 spin_unlock_irq(&priv->driver_lock); 955 + 956 + ret = lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START, priv->channel); 957 + 958 + out: 950 959 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); 951 960 return ret; 952 961 }
-7
drivers/net/wireless/libertas/mesh.h
··· 63 63 uint32_t stringset, uint8_t *s); 64 64 65 65 66 - /* Accessors */ 67 - 68 - #define lbs_mesh_open(priv) (priv->mesh_open) 69 - #define lbs_mesh_connected(priv) (priv->mesh_connect_status == LBS_CONNECTED) 70 - 71 66 #else 72 67 73 68 #define lbs_init_mesh(priv) ··· 72 77 #define lbs_mesh_set_dev(priv, dev, rxpd) (dev) 73 78 #define lbs_mesh_set_txpd(priv, dev, txpd) 74 79 #define lbs_mesh_config(priv, enable, chan) 75 - #define lbs_mesh_open(priv) (0) 76 - #define lbs_mesh_connected(priv) (0) 77 80 78 81 #endif 79 82
+1 -1
drivers/net/wireless/libertas/tx.c
··· 198 198 if (priv->connect_status == LBS_CONNECTED) 199 199 netif_wake_queue(priv->dev); 200 200 201 - if (priv->mesh_dev && lbs_mesh_connected(priv)) 201 + if (priv->mesh_dev && netif_running(priv->mesh_dev)) 202 202 netif_wake_queue(priv->mesh_dev); 203 203 } 204 204 EXPORT_SYMBOL_GPL(lbs_send_tx_feedback);