aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/batman-adv/bat_sysfs.c4
-rw-r--r--net/batman-adv/gateway_client.c12
-rw-r--r--net/batman-adv/gateway_common.c7
-rw-r--r--net/batman-adv/gateway_common.h5
4 files changed, 16 insertions, 12 deletions
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c
index 31d23dbccc38..a8fb66095d83 100644
--- a/net/batman-adv/bat_sysfs.c
+++ b/net/batman-adv/bat_sysfs.c
@@ -409,7 +409,7 @@ static ssize_t show_gw_bwidth(struct kobject *kobj, struct attribute *attr,
409 int down, up; 409 int down, up;
410 int gw_bandwidth = atomic_read(&bat_priv->gw_bandwidth); 410 int gw_bandwidth = atomic_read(&bat_priv->gw_bandwidth);
411 411
412 gw_bandwidth_to_kbit(gw_bandwidth, &down, &up); 412 batadv_gw_bandwidth_to_kbit(gw_bandwidth, &down, &up);
413 return sprintf(buff, "%i%s/%i%s\n", 413 return sprintf(buff, "%i%s/%i%s\n",
414 (down > 2048 ? down / 1024 : down), 414 (down > 2048 ? down / 1024 : down),
415 (down > 2048 ? "MBit" : "KBit"), 415 (down > 2048 ? "MBit" : "KBit"),
@@ -425,7 +425,7 @@ static ssize_t store_gw_bwidth(struct kobject *kobj, struct attribute *attr,
425 if (buff[count - 1] == '\n') 425 if (buff[count - 1] == '\n')
426 buff[count - 1] = '\0'; 426 buff[count - 1] = '\0';
427 427
428 return gw_bandwidth_set(net_dev, buff, count); 428 return batadv_gw_bandwidth_set(net_dev, buff, count);
429} 429}
430 430
431BAT_ATTR_SIF_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL); 431BAT_ATTR_SIF_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL);
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index a28d9ce86812..a3f944b6ac53 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -116,13 +116,15 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv)
116 uint32_t max_gw_factor = 0, tmp_gw_factor = 0; 116 uint32_t max_gw_factor = 0, tmp_gw_factor = 0;
117 uint8_t max_tq = 0; 117 uint8_t max_tq = 0;
118 int down, up; 118 int down, up;
119 struct orig_node *orig_node;
119 120
120 rcu_read_lock(); 121 rcu_read_lock();
121 hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw_list, list) { 122 hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw_list, list) {
122 if (gw_node->deleted) 123 if (gw_node->deleted)
123 continue; 124 continue;
124 125
125 router = orig_node_get_router(gw_node->orig_node); 126 orig_node = gw_node->orig_node;
127 router = orig_node_get_router(orig_node);
126 if (!router) 128 if (!router)
127 continue; 129 continue;
128 130
@@ -131,8 +133,8 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv)
131 133
132 switch (atomic_read(&bat_priv->gw_sel_class)) { 134 switch (atomic_read(&bat_priv->gw_sel_class)) {
133 case 1: /* fast connection */ 135 case 1: /* fast connection */
134 gw_bandwidth_to_kbit(gw_node->orig_node->gw_flags, 136 batadv_gw_bandwidth_to_kbit(orig_node->gw_flags,
135 &down, &up); 137 &down, &up);
136 138
137 tmp_gw_factor = (router->tq_avg * router->tq_avg * 139 tmp_gw_factor = (router->tq_avg * router->tq_avg *
138 down * 100 * 100) / 140 down * 100 * 100) /
@@ -319,7 +321,7 @@ static void gw_node_add(struct bat_priv *bat_priv,
319 hlist_add_head_rcu(&gw_node->list, &bat_priv->gw_list); 321 hlist_add_head_rcu(&gw_node->list, &bat_priv->gw_list);
320 spin_unlock_bh(&bat_priv->gw_list_lock); 322 spin_unlock_bh(&bat_priv->gw_list_lock);
321 323
322 gw_bandwidth_to_kbit(new_gwflags, &down, &up); 324 batadv_gw_bandwidth_to_kbit(new_gwflags, &down, &up);
323 bat_dbg(DBG_BATMAN, bat_priv, 325 bat_dbg(DBG_BATMAN, bat_priv,
324 "Found new gateway %pM -> gw_class: %i - %i%s/%i%s\n", 326 "Found new gateway %pM -> gw_class: %i - %i%s/%i%s\n",
325 orig_node->orig, new_gwflags, 327 orig_node->orig, new_gwflags,
@@ -434,7 +436,7 @@ static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq,
434 struct neigh_node *router; 436 struct neigh_node *router;
435 int down, up, ret = -1; 437 int down, up, ret = -1;
436 438
437 gw_bandwidth_to_kbit(gw_node->orig_node->gw_flags, &down, &up); 439 batadv_gw_bandwidth_to_kbit(gw_node->orig_node->gw_flags, &down, &up);
438 440
439 router = orig_node_get_router(gw_node->orig_node); 441 router = orig_node_get_router(gw_node->orig_node);
440 if (!router) 442 if (!router)
diff --git a/net/batman-adv/gateway_common.c b/net/batman-adv/gateway_common.c
index a0b0f52d961a..722c93282442 100644
--- a/net/batman-adv/gateway_common.c
+++ b/net/batman-adv/gateway_common.c
@@ -59,7 +59,7 @@ static void kbit_to_gw_bandwidth(int down, int up, long *gw_srv_class)
59} 59}
60 60
61/* returns the up and downspeeds in kbit, calculated from the class */ 61/* returns the up and downspeeds in kbit, calculated from the class */
62void gw_bandwidth_to_kbit(uint8_t gw_srv_class, int *down, int *up) 62void batadv_gw_bandwidth_to_kbit(uint8_t gw_srv_class, int *down, int *up)
63{ 63{
64 int sbit = (gw_srv_class & 0x80) >> 7; 64 int sbit = (gw_srv_class & 0x80) >> 7;
65 int dpart = (gw_srv_class & 0x78) >> 3; 65 int dpart = (gw_srv_class & 0x78) >> 3;
@@ -136,7 +136,8 @@ static bool parse_gw_bandwidth(struct net_device *net_dev, char *buff,
136 return true; 136 return true;
137} 137}
138 138
139ssize_t gw_bandwidth_set(struct net_device *net_dev, char *buff, size_t count) 139ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,
140 size_t count)
140{ 141{
141 struct bat_priv *bat_priv = netdev_priv(net_dev); 142 struct bat_priv *bat_priv = netdev_priv(net_dev);
142 long gw_bandwidth_tmp = 0; 143 long gw_bandwidth_tmp = 0;
@@ -160,7 +161,7 @@ ssize_t gw_bandwidth_set(struct net_device *net_dev, char *buff, size_t count)
160 * speeds, hence we need to calculate it back to show the number 161 * speeds, hence we need to calculate it back to show the number
161 * that is going to be propagated 162 * that is going to be propagated
162 **/ 163 **/
163 gw_bandwidth_to_kbit((uint8_t)gw_bandwidth_tmp, &down, &up); 164 batadv_gw_bandwidth_to_kbit((uint8_t)gw_bandwidth_tmp, &down, &up);
164 165
165 if (atomic_read(&bat_priv->gw_bandwidth) == gw_bandwidth_tmp) 166 if (atomic_read(&bat_priv->gw_bandwidth) == gw_bandwidth_tmp)
166 return count; 167 return count;
diff --git a/net/batman-adv/gateway_common.h b/net/batman-adv/gateway_common.h
index b8fb11c4f927..e256040760bf 100644
--- a/net/batman-adv/gateway_common.h
+++ b/net/batman-adv/gateway_common.h
@@ -32,7 +32,8 @@ enum gw_modes {
32#define GW_MODE_CLIENT_NAME "client" 32#define GW_MODE_CLIENT_NAME "client"
33#define GW_MODE_SERVER_NAME "server" 33#define GW_MODE_SERVER_NAME "server"
34 34
35void gw_bandwidth_to_kbit(uint8_t gw_class, int *down, int *up); 35void batadv_gw_bandwidth_to_kbit(uint8_t gw_class, int *down, int *up);
36ssize_t gw_bandwidth_set(struct net_device *net_dev, char *buff, size_t count); 36ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,
37 size_t count);
37 38
38#endif /* _NET_BATMAN_ADV_GATEWAY_COMMON_H_ */ 39#endif /* _NET_BATMAN_ADV_GATEWAY_COMMON_H_ */