batman-adv: make struct batadv_neigh_node algorithm agnostic
some of the fields in struct batadv_neigh_node are strictly related to the B.A.T.M.A.N. IV algorithm. In order to make the struct usable by any routing algorithm it has to be split and made more generic Signed-off-by: Antonio Quartulli <antonio@open-mesh.com> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
This commit is contained in:

committed by
Antonio Quartulli

parent
47d4ab91e4
commit
0538f75991
@@ -137,7 +137,7 @@ batadv_gw_get_best_gw_node(struct batadv_priv *bat_priv)
|
||||
if (!atomic_inc_not_zero(&gw_node->refcount))
|
||||
goto next;
|
||||
|
||||
tq_avg = router->tq_avg;
|
||||
tq_avg = router->bat_iv.tq_avg;
|
||||
|
||||
switch (atomic_read(&bat_priv->gw_sel_class)) {
|
||||
case 1: /* fast connection */
|
||||
@@ -256,7 +256,7 @@ void batadv_gw_election(struct batadv_priv *bat_priv)
|
||||
next_gw->bandwidth_down / 10,
|
||||
next_gw->bandwidth_down % 10,
|
||||
next_gw->bandwidth_up / 10,
|
||||
next_gw->bandwidth_up % 10, router->tq_avg);
|
||||
next_gw->bandwidth_up % 10, router->bat_iv.tq_avg);
|
||||
batadv_throw_uevent(bat_priv, BATADV_UEV_GW, BATADV_UEV_ADD,
|
||||
gw_addr);
|
||||
} else {
|
||||
@@ -266,7 +266,7 @@ void batadv_gw_election(struct batadv_priv *bat_priv)
|
||||
next_gw->bandwidth_down / 10,
|
||||
next_gw->bandwidth_down % 10,
|
||||
next_gw->bandwidth_up / 10,
|
||||
next_gw->bandwidth_up % 10, router->tq_avg);
|
||||
next_gw->bandwidth_up % 10, router->bat_iv.tq_avg);
|
||||
batadv_throw_uevent(bat_priv, BATADV_UEV_GW, BATADV_UEV_CHANGE,
|
||||
gw_addr);
|
||||
}
|
||||
@@ -305,8 +305,8 @@ void batadv_gw_check_election(struct batadv_priv *bat_priv,
|
||||
if (!router_orig)
|
||||
goto out;
|
||||
|
||||
gw_tq_avg = router_gw->tq_avg;
|
||||
orig_tq_avg = router_orig->tq_avg;
|
||||
gw_tq_avg = router_gw->bat_iv.tq_avg;
|
||||
orig_tq_avg = router_orig->bat_iv.tq_avg;
|
||||
|
||||
/* the TQ value has to be better */
|
||||
if (orig_tq_avg < gw_tq_avg)
|
||||
@@ -528,7 +528,7 @@ static int batadv_write_buffer_text(struct batadv_priv *bat_priv,
|
||||
ret = seq_printf(seq, "%s %pM (%3i) %pM [%10s]: %u.%u/%u.%u MBit\n",
|
||||
(curr_gw == gw_node ? "=>" : " "),
|
||||
gw_node->orig_node->orig,
|
||||
router->tq_avg, router->addr,
|
||||
router->bat_iv.tq_avg, router->addr,
|
||||
router->if_incoming->net_dev->name,
|
||||
gw_node->bandwidth_down / 10,
|
||||
gw_node->bandwidth_down % 10,
|
||||
@@ -792,7 +792,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
|
||||
if (!neigh_curr)
|
||||
goto out;
|
||||
|
||||
curr_tq_avg = neigh_curr->tq_avg;
|
||||
curr_tq_avg = neigh_curr->bat_iv.tq_avg;
|
||||
break;
|
||||
case BATADV_GW_MODE_OFF:
|
||||
default:
|
||||
@@ -803,7 +803,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
|
||||
if (!neigh_old)
|
||||
goto out;
|
||||
|
||||
if (curr_tq_avg - neigh_old->tq_avg > BATADV_GW_THRESHOLD)
|
||||
if (curr_tq_avg - neigh_old->bat_iv.tq_avg > BATADV_GW_THRESHOLD)
|
||||
out_of_range = true;
|
||||
|
||||
out:
|
||||
|
Reference in New Issue
Block a user