diff options
author | Luis Carlos Cobo <luisca@cozybit.com> | 2007-08-02 11:52:29 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:49:52 -0400 |
commit | a9f38d023b65c9fe2602303c1101c868be4fcbcc (patch) | |
tree | 949dfedfd36ae68fe860886d498d73f3d56b8926 /drivers/net/wireless/libertas/main.c | |
parent | f455eb1a4ba2bf0ff1bde7844bf3a811269d2d79 (diff) |
[PATCH] Support for mesh autostart deactivation through sysfs
echo 0 > /sys/class/net/mshX/autostart_enabled
This is supported from Marvell firmware version 5.110.16.p0 (to be released).
Signed-off-by: Luis Carlos Cobo <luisca@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/main.c')
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index b4e2cd19c3bc..717b33616ea8 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -252,6 +252,50 @@ static ssize_t libertas_anycast_set(struct device * dev, | |||
252 | */ | 252 | */ |
253 | static DEVICE_ATTR(anycast_mask, 0644, libertas_anycast_get, libertas_anycast_set); | 253 | static DEVICE_ATTR(anycast_mask, 0644, libertas_anycast_get, libertas_anycast_set); |
254 | 254 | ||
255 | static ssize_t libertas_autostart_enabled_get(struct device * dev, | ||
256 | struct device_attribute *attr, char * buf) | ||
257 | { | ||
258 | struct cmd_ds_mesh_access mesh_access; | ||
259 | |||
260 | memset(&mesh_access, 0, sizeof(mesh_access)); | ||
261 | libertas_prepare_and_send_command(to_net_dev(dev)->priv, | ||
262 | CMD_MESH_ACCESS, | ||
263 | CMD_ACT_MESH_GET_AUTOSTART_ENABLED, | ||
264 | CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); | ||
265 | |||
266 | return sprintf(buf, "%d\n", le32_to_cpu(mesh_access.data[0])); | ||
267 | } | ||
268 | |||
269 | static ssize_t libertas_autostart_enabled_set(struct device * dev, | ||
270 | struct device_attribute *attr, const char * buf, size_t count) | ||
271 | { | ||
272 | struct cmd_ds_mesh_access mesh_access; | ||
273 | uint32_t datum; | ||
274 | |||
275 | memset(&mesh_access, 0, sizeof(mesh_access)); | ||
276 | sscanf(buf, "%d", &datum); | ||
277 | mesh_access.data[0] = cpu_to_le32(datum); | ||
278 | |||
279 | libertas_prepare_and_send_command((to_net_dev(dev))->priv, | ||
280 | CMD_MESH_ACCESS, | ||
281 | CMD_ACT_MESH_SET_AUTOSTART_ENABLED, | ||
282 | CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); | ||
283 | return strlen(buf); | ||
284 | } | ||
285 | |||
286 | static DEVICE_ATTR(autostart_enabled, 0644, | ||
287 | libertas_autostart_enabled_get, libertas_autostart_enabled_set); | ||
288 | |||
289 | static struct attribute *libertas_mesh_sysfs_entries[] = { | ||
290 | &dev_attr_anycast_mask.attr, | ||
291 | &dev_attr_autostart_enabled.attr, | ||
292 | NULL, | ||
293 | }; | ||
294 | |||
295 | static struct attribute_group libertas_mesh_attr_group = { | ||
296 | .attrs = libertas_mesh_sysfs_entries, | ||
297 | }; | ||
298 | |||
255 | /** | 299 | /** |
256 | * @brief Check if the device can be open and wait if necessary. | 300 | * @brief Check if the device can be open and wait if necessary. |
257 | * | 301 | * |
@@ -1250,7 +1294,7 @@ int libertas_add_mesh(wlan_private *priv, struct device *dev) | |||
1250 | goto err_free; | 1294 | goto err_free; |
1251 | } | 1295 | } |
1252 | 1296 | ||
1253 | ret = device_create_file(&(mesh_dev->dev), &dev_attr_anycast_mask); | 1297 | ret = sysfs_create_group(&(mesh_dev->dev.kobj), &libertas_mesh_attr_group); |
1254 | if (ret) | 1298 | if (ret) |
1255 | goto err_unregister; | 1299 | goto err_unregister; |
1256 | 1300 | ||
@@ -1359,7 +1403,7 @@ void libertas_remove_mesh(wlan_private *priv) | |||
1359 | netif_stop_queue(mesh_dev); | 1403 | netif_stop_queue(mesh_dev); |
1360 | netif_carrier_off(priv->mesh_dev); | 1404 | netif_carrier_off(priv->mesh_dev); |
1361 | 1405 | ||
1362 | device_remove_file(&(mesh_dev->dev), &dev_attr_anycast_mask); | 1406 | sysfs_remove_group(&(mesh_dev->dev.kobj), &libertas_mesh_attr_group); |
1363 | unregister_netdev(mesh_dev); | 1407 | unregister_netdev(mesh_dev); |
1364 | 1408 | ||
1365 | priv->mesh_dev = NULL ; | 1409 | priv->mesh_dev = NULL ; |