• Home
  • Raw
  • Download

Lines Matching refs:bat_priv

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