Lines Matching refs:bat_priv
75 * @bat_priv: the bat priv with all the soft interface information
80 batadv_gw_get_selected_gw_node(struct batadv_priv *bat_priv)
85 gw_node = rcu_dereference(bat_priv->gw.curr_gw);
99 * @bat_priv: the bat priv with all the soft interface information
104 batadv_gw_get_selected_orig(struct batadv_priv *bat_priv)
109 gw_node = batadv_gw_get_selected_gw_node(bat_priv);
129 static void batadv_gw_select(struct batadv_priv *bat_priv,
134 spin_lock_bh(&bat_priv->gw.list_lock);
139 curr_gw_node = rcu_replace_pointer(bat_priv->gw.curr_gw, new_gw_node,
145 spin_unlock_bh(&bat_priv->gw.list_lock);
150 * @bat_priv: the bat priv with all the soft interface information
159 void batadv_gw_reselect(struct batadv_priv *bat_priv)
161 atomic_set(&bat_priv->gw.reselect, 1);
166 * @bat_priv: the bat priv with all the soft interface information
172 void batadv_gw_check_client_stop(struct batadv_priv *bat_priv)
176 if (atomic_read(&bat_priv->gw.mode) != BATADV_GW_MODE_CLIENT)
179 curr_gw = batadv_gw_get_selected_gw_node(bat_priv);
186 batadv_gw_select(bat_priv, NULL);
191 batadv_throw_uevent(bat_priv, BATADV_UEV_GW, BATADV_UEV_DEL, NULL);
198 * @bat_priv: the bat priv with all the soft interface information
200 void batadv_gw_election(struct batadv_priv *bat_priv)
208 if (atomic_read(&bat_priv->gw.mode) != BATADV_GW_MODE_CLIENT)
211 if (!bat_priv->algo_ops->gw.get_best_gw_node)
214 curr_gw = batadv_gw_get_selected_gw_node(bat_priv);
216 if (!batadv_atomic_dec_not_zero(&bat_priv->gw.reselect) && curr_gw)
223 next_gw = bat_priv->algo_ops->gw.get_best_gw_node(bat_priv);
234 batadv_gw_reselect(bat_priv);
241 batadv_gw_reselect(bat_priv);
247 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
249 batadv_throw_uevent(bat_priv, BATADV_UEV_GW, BATADV_UEV_DEL,
252 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
260 batadv_throw_uevent(bat_priv, BATADV_UEV_GW, BATADV_UEV_ADD,
263 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
271 batadv_throw_uevent(bat_priv, BATADV_UEV_GW, BATADV_UEV_CHANGE,
275 batadv_gw_select(bat_priv, next_gw);
290 * @bat_priv: the bat priv with all the soft interface information
293 void batadv_gw_check_election(struct batadv_priv *bat_priv,
301 if (!bat_priv->algo_ops->gw.is_eligible)
304 curr_gw_orig = batadv_gw_get_selected_orig(bat_priv);
312 if (!bat_priv->algo_ops->gw.is_eligible(bat_priv, curr_gw_orig,
317 batadv_gw_reselect(bat_priv);
325 * @bat_priv: the bat priv with all the soft interface information
332 static void batadv_gw_node_add(struct batadv_priv *bat_priv,
338 lockdep_assert_held(&bat_priv->gw.list_lock);
355 hlist_add_head_rcu(&gw_node->list, &bat_priv->gw.gateway_list);
356 bat_priv->gw.generation++;
358 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
372 * @bat_priv: the bat priv with all the soft interface information
377 struct batadv_gw_node *batadv_gw_node_get(struct batadv_priv *bat_priv,
383 hlist_for_each_entry_rcu(gw_node_tmp, &bat_priv->gw.gateway_list,
402 * @bat_priv: the bat priv with all the soft interface information
406 void batadv_gw_node_update(struct batadv_priv *bat_priv,
412 spin_lock_bh(&bat_priv->gw.list_lock);
413 gw_node = batadv_gw_node_get(bat_priv, orig_node);
415 batadv_gw_node_add(bat_priv, orig_node, gateway);
416 spin_unlock_bh(&bat_priv->gw.list_lock);
419 spin_unlock_bh(&bat_priv->gw.list_lock);
425 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
441 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
448 spin_lock_bh(&bat_priv->gw.list_lock);
452 bat_priv->gw.generation++;
454 spin_unlock_bh(&bat_priv->gw.list_lock);
456 curr_gw = batadv_gw_get_selected_gw_node(bat_priv);
458 batadv_gw_reselect(bat_priv);
471 * @bat_priv: the bat priv with all the soft interface information
474 void batadv_gw_node_delete(struct batadv_priv *bat_priv,
482 batadv_gw_node_update(bat_priv, orig_node, &gateway);
487 * @bat_priv: the bat priv with all the soft interface information
489 void batadv_gw_node_free(struct batadv_priv *bat_priv)
494 spin_lock_bh(&bat_priv->gw.list_lock);
496 &bat_priv->gw.gateway_list, list) {
499 bat_priv->gw.generation++;
501 spin_unlock_bh(&bat_priv->gw.list_lock);
516 struct batadv_priv *bat_priv = netdev_priv(net_dev);
526 bat_priv->algo_ops->name);
530 if (!bat_priv->algo_ops->gw.print) {
536 bat_priv->algo_ops->gw.print(bat_priv, seq);
554 struct batadv_priv *bat_priv;
569 bat_priv = netdev_priv(soft_iface);
571 primary_if = batadv_primary_if_get_selected(bat_priv);
577 if (!bat_priv->algo_ops->gw.dump) {
582 bat_priv->algo_ops->gw.dump(msg, cb, bat_priv);
719 * @bat_priv: the bat priv with all the soft interface information
732 bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
751 orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source,
756 gw_node = batadv_gw_node_get(bat_priv, orig_dst_node);
760 switch (atomic_read(&bat_priv->gw.mode)) {
768 curr_gw = batadv_gw_get_selected_gw_node(bat_priv);
780 neigh_curr = batadv_find_router(bat_priv, curr_gw->orig_node,
799 neigh_old = batadv_find_router(bat_priv, orig_dst_node, NULL);