diff options
-rw-r--r-- | drivers/net/wireless/libertas/host.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 60 |
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 | */ | ||
263 | static 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 | */ | ||
286 | static 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 | |||
260 | static int lbs_add_rtap(struct lbs_private *priv); | 312 | static int lbs_add_rtap(struct lbs_private *priv); |
261 | static void lbs_remove_rtap(struct lbs_private *priv); | 313 | static void lbs_remove_rtap(struct lbs_private *priv); |
262 | static int lbs_add_mesh(struct lbs_private *priv); | 314 | 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); | |||
375 | */ | 427 | */ |
376 | static DEVICE_ATTR(anycast_mask, 0644, lbs_anycast_get, lbs_anycast_set); | 428 | static 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 | */ | ||
434 | static DEVICE_ATTR(prb_rsp_limit, 0644, lbs_prb_rsp_limit_get, | ||
435 | lbs_prb_rsp_limit_set); | ||
436 | |||
378 | static struct attribute *lbs_mesh_sysfs_entries[] = { | 437 | static 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 | ||