Lines Matching refs:bat_priv

56 struct batadv_orig_node *batadv_v_ogm_orig_get(struct batadv_priv *bat_priv,  in batadv_v_ogm_orig_get()  argument
62 orig_node = batadv_orig_hash_find(bat_priv, addr); in batadv_v_ogm_orig_get()
66 orig_node = batadv_orig_node_new(bat_priv, addr); in batadv_v_ogm_orig_get()
71 hash_added = batadv_hash_add(bat_priv->orig_hash, batadv_compare_orig, in batadv_v_ogm_orig_get()
102 static void batadv_v_ogm_start_timer(struct batadv_priv *bat_priv) in batadv_v_ogm_start_timer() argument
108 if (delayed_work_pending(&bat_priv->bat_v.ogm_wq)) in batadv_v_ogm_start_timer()
111 msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER; in batadv_v_ogm_start_timer()
113 queue_delayed_work(batadv_event_workqueue, &bat_priv->bat_v.ogm_wq, in batadv_v_ogm_start_timer()
125 struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); in batadv_v_ogm_send_to_if() local
130 batadv_inc_counter(bat_priv, BATADV_CNT_MGMT_TX); in batadv_v_ogm_send_to_if()
131 batadv_add_counter(bat_priv, BATADV_CNT_MGMT_TX_BYTES, in batadv_v_ogm_send_to_if()
241 struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); in batadv_v_ogm_queue_on_if() local
243 if (!atomic_read(&bat_priv->aggregated_ogms)) { in batadv_v_ogm_queue_on_if()
261 static void batadv_v_ogm_send_softif(struct batadv_priv *bat_priv) in batadv_v_ogm_send_softif() argument
271 lockdep_assert_held(&bat_priv->bat_v.ogm_buff_mutex); in batadv_v_ogm_send_softif()
273 if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_DEACTIVATING) in batadv_v_ogm_send_softif()
276 ogm_buff = bat_priv->bat_v.ogm_buff; in batadv_v_ogm_send_softif()
277 ogm_buff_len = bat_priv->bat_v.ogm_buff_len; in batadv_v_ogm_send_softif()
281 batadv_tt_local_commit_changes(bat_priv); in batadv_v_ogm_send_softif()
282 tvlv_len = batadv_tvlv_container_ogm_append(bat_priv, &ogm_buff, in batadv_v_ogm_send_softif()
286 bat_priv->bat_v.ogm_buff = ogm_buff; in batadv_v_ogm_send_softif()
287 bat_priv->bat_v.ogm_buff_len = ogm_buff_len; in batadv_v_ogm_send_softif()
297 ogm_packet->seqno = htonl(atomic_read(&bat_priv->bat_v.ogm_seqno)); in batadv_v_ogm_send_softif()
298 atomic_inc(&bat_priv->bat_v.ogm_seqno); in batadv_v_ogm_send_softif()
304 if (hard_iface->soft_iface != bat_priv->soft_iface) in batadv_v_ogm_send_softif()
328 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, "OGM2 from ourselves on %s suppressed: %s\n", in batadv_v_ogm_send_softif()
335 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, in batadv_v_ogm_send_softif()
357 batadv_v_ogm_start_timer(bat_priv); in batadv_v_ogm_send_softif()
369 struct batadv_priv *bat_priv; in batadv_v_ogm_send() local
372 bat_priv = container_of(bat_v, struct batadv_priv, bat_v); in batadv_v_ogm_send()
374 mutex_lock(&bat_priv->bat_v.ogm_buff_mutex); in batadv_v_ogm_send()
375 batadv_v_ogm_send_softif(bat_priv); in batadv_v_ogm_send()
376 mutex_unlock(&bat_priv->bat_v.ogm_buff_mutex); in batadv_v_ogm_send()
410 struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); in batadv_v_ogm_iface_enable() local
413 batadv_v_ogm_start_timer(bat_priv); in batadv_v_ogm_iface_enable()
437 struct batadv_priv *bat_priv = netdev_priv(primary_iface->soft_iface); in batadv_v_ogm_primary_iface_set() local
440 mutex_lock(&bat_priv->bat_v.ogm_buff_mutex); in batadv_v_ogm_primary_iface_set()
441 if (!bat_priv->bat_v.ogm_buff) in batadv_v_ogm_primary_iface_set()
444 ogm_packet = (struct batadv_ogm2_packet *)bat_priv->bat_v.ogm_buff; in batadv_v_ogm_primary_iface_set()
448 mutex_unlock(&bat_priv->bat_v.ogm_buff_mutex); in batadv_v_ogm_primary_iface_set()
474 static u32 batadv_v_forward_penalty(struct batadv_priv *bat_priv, in batadv_v_forward_penalty() argument
480 int hop_penalty = atomic_read(&bat_priv->hop_penalty); in batadv_v_forward_penalty()
517 static void batadv_v_ogm_forward(struct batadv_priv *bat_priv, in batadv_v_ogm_forward() argument
555 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, "ttl exceeded\n"); in batadv_v_ogm_forward()
579 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, in batadv_v_ogm_forward()
606 static int batadv_v_ogm_metric_update(struct batadv_priv *bat_priv, in batadv_v_ogm_metric_update() argument
627 batadv_window_protected(bat_priv, seq_diff, in batadv_v_ogm_metric_update()
631 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, in batadv_v_ogm_metric_update()
634 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, in batadv_v_ogm_metric_update()
657 path_throughput = batadv_v_forward_penalty(bat_priv, if_incoming, in batadv_v_ogm_metric_update()
687 static bool batadv_v_ogm_route_update(struct batadv_priv *bat_priv, in batadv_v_ogm_route_update() argument
705 orig_neigh_node = batadv_v_ogm_orig_get(bat_priv, ethhdr->h_source); in batadv_v_ogm_route_update()
717 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, in batadv_v_ogm_route_update()
727 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, in batadv_v_ogm_route_update()
759 batadv_update_route(bat_priv, orig_node, if_outgoing, neigh_node); in batadv_v_ogm_route_update()
781 batadv_v_ogm_process_per_outif(struct batadv_priv *bat_priv, in batadv_v_ogm_process_per_outif() argument
793 seqno_age = batadv_v_ogm_metric_update(bat_priv, ogm2, orig_node, in batadv_v_ogm_process_per_outif()
803 batadv_tvlv_containers_process(bat_priv, true, orig_node, in batadv_v_ogm_process_per_outif()
809 forward = batadv_v_ogm_route_update(bat_priv, ethhdr, ogm2, orig_node, in batadv_v_ogm_process_per_outif()
815 batadv_v_ogm_forward(bat_priv, ogm2, orig_node, neigh_node, in batadv_v_ogm_process_per_outif()
854 struct batadv_priv *bat_priv = netdev_priv(if_incoming->soft_iface); in batadv_v_ogm_process() local
869 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, in batadv_v_ogm_process()
876 if (batadv_is_my_mac(bat_priv, ogm_packet->orig)) { in batadv_v_ogm_process()
877 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, in batadv_v_ogm_process()
886 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, in batadv_v_ogm_process()
894 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, in batadv_v_ogm_process()
899 orig_node = batadv_v_ogm_orig_get(bat_priv, ogm_packet->orig); in batadv_v_ogm_process()
919 batadv_v_ogm_process_per_outif(bat_priv, ethhdr, ogm_packet, orig_node, in batadv_v_ogm_process()
928 if (hard_iface->soft_iface != bat_priv->soft_iface) in batadv_v_ogm_process()
955 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, "OGM2 packet from %pM on %s suppressed: %s\n", in batadv_v_ogm_process()
963 batadv_v_ogm_process_per_outif(bat_priv, ethhdr, ogm_packet, in batadv_v_ogm_process()
987 struct batadv_priv *bat_priv = netdev_priv(if_incoming->soft_iface); in batadv_v_ogm_packet_recv() local
997 if (strcmp(bat_priv->algo_ops->name, "BATMAN_V") != 0) in batadv_v_ogm_packet_recv()
1003 if (batadv_is_my_mac(bat_priv, ethhdr->h_source)) in batadv_v_ogm_packet_recv()
1006 batadv_inc_counter(bat_priv, BATADV_CNT_MGMT_RX); in batadv_v_ogm_packet_recv()
1007 batadv_add_counter(bat_priv, BATADV_CNT_MGMT_RX_BYTES, in batadv_v_ogm_packet_recv()
1041 int batadv_v_ogm_init(struct batadv_priv *bat_priv) in batadv_v_ogm_init() argument
1047 bat_priv->bat_v.ogm_buff_len = BATADV_OGM2_HLEN; in batadv_v_ogm_init()
1048 ogm_buff = kzalloc(bat_priv->bat_v.ogm_buff_len, GFP_ATOMIC); in batadv_v_ogm_init()
1052 bat_priv->bat_v.ogm_buff = ogm_buff; in batadv_v_ogm_init()
1062 atomic_set(&bat_priv->bat_v.ogm_seqno, random_seqno); in batadv_v_ogm_init()
1063 INIT_DELAYED_WORK(&bat_priv->bat_v.ogm_wq, batadv_v_ogm_send); in batadv_v_ogm_init()
1065 mutex_init(&bat_priv->bat_v.ogm_buff_mutex); in batadv_v_ogm_init()
1074 void batadv_v_ogm_free(struct batadv_priv *bat_priv) in batadv_v_ogm_free() argument
1076 cancel_delayed_work_sync(&bat_priv->bat_v.ogm_wq); in batadv_v_ogm_free()
1078 mutex_lock(&bat_priv->bat_v.ogm_buff_mutex); in batadv_v_ogm_free()
1080 kfree(bat_priv->bat_v.ogm_buff); in batadv_v_ogm_free()
1081 bat_priv->bat_v.ogm_buff = NULL; in batadv_v_ogm_free()
1082 bat_priv->bat_v.ogm_buff_len = 0; in batadv_v_ogm_free()
1084 mutex_unlock(&bat_priv->bat_v.ogm_buff_mutex); in batadv_v_ogm_free()