aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/sysfs.c
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2013-04-23 09:39:58 -0400
committerAntonio Quartulli <antonio@meshcoding.com>2013-10-09 15:22:27 -0400
commit414254e342a0d58144de40c3da777521ebaeeb07 (patch)
treea292367d064dd72f4b7a095382e11a9974d685af /net/batman-adv/sysfs.c
parentef26157747d42254453f6b3ac2bd8bd3c53339c3 (diff)
batman-adv: tvlv - gateway download/upload bandwidth container
Prior to this patch batman-adv read the advertised uplink bandwidth from userspace and compressed this information into a single byte called "gateway class". Now the download & upload bandwidth information is sent as-is. No userspace change is necessary since the sysfs API always allowed to specify a bandwidth. Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Spyros Gasteratos <morfeas3000@gmail.com> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Diffstat (limited to 'net/batman-adv/sysfs.c')
-rw-r--r--net/batman-adv/sysfs.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c
index 4114b961bc2c..68793f53f182 100644
--- a/net/batman-adv/sysfs.c
+++ b/net/batman-adv/sysfs.c
@@ -390,6 +390,7 @@ static ssize_t batadv_store_gw_mode(struct kobject *kobj,
390 */ 390 */
391 batadv_gw_check_client_stop(bat_priv); 391 batadv_gw_check_client_stop(bat_priv);
392 atomic_set(&bat_priv->gw_mode, (unsigned int)gw_mode_tmp); 392 atomic_set(&bat_priv->gw_mode, (unsigned int)gw_mode_tmp);
393 batadv_gw_tvlv_container_update(bat_priv);
393 return count; 394 return count;
394} 395}
395 396
@@ -397,15 +398,13 @@ static ssize_t batadv_show_gw_bwidth(struct kobject *kobj,
397 struct attribute *attr, char *buff) 398 struct attribute *attr, char *buff)
398{ 399{
399 struct batadv_priv *bat_priv = batadv_kobj_to_batpriv(kobj); 400 struct batadv_priv *bat_priv = batadv_kobj_to_batpriv(kobj);
400 int down, up; 401 uint32_t down, up;
401 int gw_bandwidth = atomic_read(&bat_priv->gw_bandwidth); 402
402 403 down = atomic_read(&bat_priv->gw.bandwidth_down);
403 batadv_gw_bandwidth_to_kbit(gw_bandwidth, &down, &up); 404 up = atomic_read(&bat_priv->gw.bandwidth_up);
404 return sprintf(buff, "%i%s/%i%s\n", 405
405 (down > 2048 ? down / 1024 : down), 406 return sprintf(buff, "%u.%u/%u.%u MBit\n", down / 10,
406 (down > 2048 ? "MBit" : "KBit"), 407 down % 10, up / 10, up % 10);
407 (up > 2048 ? up / 1024 : up),
408 (up > 2048 ? "MBit" : "KBit"));
409} 408}
410 409
411static ssize_t batadv_store_gw_bwidth(struct kobject *kobj, 410static ssize_t batadv_store_gw_bwidth(struct kobject *kobj,