]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
libertas: Create sysfs entry for changing the mesh probe response limit
authorAnna Neal <anna@cozybit.com>
Tue, 9 Dec 2008 21:23:45 +0000 (13:23 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 12 Dec 2008 19:45:13 +0000 (14:45 -0500)
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>
drivers/net/wireless/libertas/host.h
drivers/net/wireless/libertas/main.c

index a17b778c172c378e6e5a7eebb6a5806fb8f2f7de..277ff1975bde8e22ea1009268cf45f94920f39f5 100644 (file)
@@ -245,6 +245,7 @@ enum cmd_mesh_access_opts {
        CMD_ACT_MESH_GET_ROUTE_EXP,
        CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
        CMD_ACT_MESH_GET_AUTOSTART_ENABLED,
+       CMD_ACT_MESH_SET_GET_PRB_RSP_LIMIT = 17,
 };
 
 /* Define actions and types for CMD_MESH_CONFIG */
index 241af7fe44bb6320485899f1ccca561f1a08ca60..3dba836794443b9cc39879df2462c1123d5156d1 100644 (file)
@@ -257,6 +257,58 @@ static ssize_t lbs_anycast_set(struct device *dev,
        return strlen(buf);
 }
 
+/**
+ * @brief Get function for sysfs attribute prb_rsp_limit
+ */
+static ssize_t lbs_prb_rsp_limit_get(struct device *dev,
+               struct device_attribute *attr, char *buf)
+{
+       struct lbs_private *priv = netdev_priv(to_net_dev(dev));
+       struct cmd_ds_mesh_access mesh_access;
+       int ret;
+       u32 retry_limit;
+
+       memset(&mesh_access, 0, sizeof(mesh_access));
+       mesh_access.data[0] = cpu_to_le32(CMD_ACT_GET);
+
+       ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_GET_PRB_RSP_LIMIT,
+                       &mesh_access);
+       if (ret)
+               return ret;
+
+       retry_limit = le32_to_cpu(mesh_access.data[1]);
+       return snprintf(buf, 10, "%d\n", retry_limit);
+}
+
+/**
+ * @brief Set function for sysfs attribute prb_rsp_limit
+ */
+static ssize_t lbs_prb_rsp_limit_set(struct device *dev,
+               struct device_attribute *attr, const char *buf, size_t count)
+{
+       struct lbs_private *priv = netdev_priv(to_net_dev(dev));
+       struct cmd_ds_mesh_access mesh_access;
+       int ret;
+       unsigned long retry_limit;
+
+       memset(&mesh_access, 0, sizeof(mesh_access));
+       mesh_access.data[0] = cpu_to_le32(CMD_ACT_SET);
+
+       if (!strict_strtoul(buf, 10, &retry_limit))
+               return -ENOTSUPP;
+       if (retry_limit > 15)
+               return -ENOTSUPP;
+
+       mesh_access.data[1] = cpu_to_le32(retry_limit);
+
+       ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_GET_PRB_RSP_LIMIT,
+                       &mesh_access);
+       if (ret)
+               return ret;
+
+       return strlen(buf);
+}
+
 static int lbs_add_rtap(struct lbs_private *priv);
 static void lbs_remove_rtap(struct lbs_private *priv);
 static int lbs_add_mesh(struct lbs_private *priv);
@@ -375,8 +427,16 @@ static DEVICE_ATTR(lbs_mesh, 0644, lbs_mesh_get, lbs_mesh_set);
  */
 static DEVICE_ATTR(anycast_mask, 0644, lbs_anycast_get, lbs_anycast_set);
 
+/**
+ * prb_rsp_limit attribute to be exported per mshX interface
+ * through sysfs (/sys/class/net/mshX/prb_rsp_limit)
+ */
+static DEVICE_ATTR(prb_rsp_limit, 0644, lbs_prb_rsp_limit_get,
+               lbs_prb_rsp_limit_set);
+
 static struct attribute *lbs_mesh_sysfs_entries[] = {
        &dev_attr_anycast_mask.attr,
+       &dev_attr_prb_rsp_limit.attr,
        NULL,
 };