aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnna Neal <anna@cozybit.com>2008-12-09 16:23:45 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-12-12 14:45:13 -0500
commit6fb532527e2592f82ec07508df2e44f6c7ceff12 (patch)
tree561cd0dff0bcf1ba88a2d5243750ba2c0a6e3133
parentb77f483fcf0579de28873828897f53371a33a0ea (diff)
libertas: Create sysfs entry for changing the mesh probe response limit
This patch adds the ability to change the number of probe response retries sent by the mesh interface. In dense networks it is recommended to change this value to zero to reduce traffic congestion. Signed-off-by: Anna Neal <anna@cozybit.com> Signed-off-by: Andrey Yurovsky <andrey@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/libertas/host.h1
-rw-r--r--drivers/net/wireless/libertas/main.c60
2 files changed, 61 insertions, 0 deletions
diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h
index a17b778c172c..277ff1975bde 100644
--- a/drivers/net/wireless/libertas/host.h
+++ b/drivers/net/wireless/libertas/host.h
@@ -245,6 +245,7 @@ enum cmd_mesh_access_opts {
245 CMD_ACT_MESH_GET_ROUTE_EXP, 245 CMD_ACT_MESH_GET_ROUTE_EXP,
246 CMD_ACT_MESH_SET_AUTOSTART_ENABLED, 246 CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
247 CMD_ACT_MESH_GET_AUTOSTART_ENABLED, 247 CMD_ACT_MESH_GET_AUTOSTART_ENABLED,
248 CMD_ACT_MESH_SET_GET_PRB_RSP_LIMIT = 17,
248}; 249};
249 250
250/* Define actions and types for CMD_MESH_CONFIG */ 251/* Define actions and types for CMD_MESH_CONFIG */
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 241af7fe44bb..3dba83679444 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -257,6 +257,58 @@ static ssize_t lbs_anycast_set(struct device *dev,
257 return strlen(buf); 257 return strlen(buf);
258} 258}
259 259
260/**
261 * @brief Get function for sysfs attribute prb_rsp_limit
262 */
263static ssize_t lbs_prb_rsp_limit_get(struct device *dev,
264 struct device_attribute *attr, char *buf)
265{
266 struct lbs_private *priv = netdev_priv(to_net_dev(dev));
267 struct cmd_ds_mesh_access mesh_access;
268 int ret;
269 u32 retry_limit;
270
271 memset(&mesh_access, 0, sizeof(mesh_access));
272 mesh_access.data[0] = cpu_to_le32(CMD_ACT_GET);
273
274 ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_GET_PRB_RSP_LIMIT,
275 &mesh_access);
276 if (ret)
277 return ret;
278
279 retry_limit = le32_to_cpu(mesh_access.data[1]);
280 return snprintf(buf, 10, "%d\n", retry_limit);
281}
282
283/**
284 * @brief Set function for sysfs attribute prb_rsp_limit
285 */
286static ssize_t lbs_prb_rsp_limit_set(struct device *dev,
287 struct device_attribute *attr, const char *buf, size_t count)
288{
289 struct lbs_private *priv = netdev_priv(to_net_dev(dev));
290 struct cmd_ds_mesh_access mesh_access;
291 int ret;
292 unsigned long retry_limit;
293
294 memset(&mesh_access, 0, sizeof(mesh_access));
295 mesh_access.data[0] = cpu_to_le32(CMD_ACT_SET);
296
297 if (!strict_strtoul(buf, 10, &retry_limit))
298 return -ENOTSUPP;
299 if (retry_limit > 15)
300 return -ENOTSUPP;
301
302 mesh_access.data[1] = cpu_to_le32(retry_limit);
303
304 ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_GET_PRB_RSP_LIMIT,
305 &mesh_access);
306 if (ret)
307 return ret;
308
309 return strlen(buf);
310}
311
260static int lbs_add_rtap(struct lbs_private *priv); 312static int lbs_add_rtap(struct lbs_private *priv);
261static void lbs_remove_rtap(struct lbs_private *priv); 313static void lbs_remove_rtap(struct lbs_private *priv);
262static int lbs_add_mesh(struct lbs_private *priv); 314static int lbs_add_mesh(struct lbs_private *priv);
@@ -375,8 +427,16 @@ static DEVICE_ATTR(lbs_mesh, 0644, lbs_mesh_get, lbs_mesh_set);
375 */ 427 */
376static DEVICE_ATTR(anycast_mask, 0644, lbs_anycast_get, lbs_anycast_set); 428static DEVICE_ATTR(anycast_mask, 0644, lbs_anycast_get, lbs_anycast_set);
377 429
430/**
431 * prb_rsp_limit attribute to be exported per mshX interface
432 * through sysfs (/sys/class/net/mshX/prb_rsp_limit)
433 */
434static DEVICE_ATTR(prb_rsp_limit, 0644, lbs_prb_rsp_limit_get,
435 lbs_prb_rsp_limit_set);
436
378static struct attribute *lbs_mesh_sysfs_entries[] = { 437static struct attribute *lbs_mesh_sysfs_entries[] = {
379 &dev_attr_anycast_mask.attr, 438 &dev_attr_anycast_mask.attr,
439 &dev_attr_prb_rsp_limit.attr,
380 NULL, 440 NULL,
381}; 441};
382 442