aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/gateway_client.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv/gateway_client.c')
-rw-r--r--net/batman-adv/gateway_client.c12
1 files changed, 7 insertions, 5 deletions
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)