aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas
diff options
context:
space:
mode:
authorLuis Carlos Cobo <luisca@cozybit.com>2007-08-02 11:52:29 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:49:52 -0400
commita9f38d023b65c9fe2602303c1101c868be4fcbcc (patch)
tree949dfedfd36ae68fe860886d498d73f3d56b8926 /drivers/net/wireless/libertas
parentf455eb1a4ba2bf0ff1bde7844bf3a811269d2d79 (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')
-rw-r--r--drivers/net/wireless/libertas/host.h2
-rw-r--r--drivers/net/wireless/libertas/main.c48
2 files changed, 48 insertions, 2 deletions
diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h
index 308ccdbed344..12d5dd9af40c 100644
--- a/drivers/net/wireless/libertas/host.h
+++ b/drivers/net/wireless/libertas/host.h
@@ -320,6 +320,8 @@ enum cmd_mesh_access_opts {
320 CMD_ACT_MESH_GET_RREQ_DELAY, 320 CMD_ACT_MESH_GET_RREQ_DELAY,
321 CMD_ACT_MESH_SET_ROUTE_EXP, 321 CMD_ACT_MESH_SET_ROUTE_EXP,
322 CMD_ACT_MESH_GET_ROUTE_EXP, 322 CMD_ACT_MESH_GET_ROUTE_EXP,
323 CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
324 CMD_ACT_MESH_GET_AUTOSTART_ENABLED,
323}; 325};
324 326
325/** Card Event definition */ 327/** Card Event definition */
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 */
253static DEVICE_ATTR(anycast_mask, 0644, libertas_anycast_get, libertas_anycast_set); 253static DEVICE_ATTR(anycast_mask, 0644, libertas_anycast_get, libertas_anycast_set);
254 254
255static 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
269static 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
286static DEVICE_ATTR(autostart_enabled, 0644,
287 libertas_autostart_enabled_get, libertas_autostart_enabled_set);
288
289static struct attribute *libertas_mesh_sysfs_entries[] = {
290 &dev_attr_anycast_mask.attr,
291 &dev_attr_autostart_enabled.attr,
292 NULL,
293};
294
295static 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 ;