Lines Matching refs:bat_priv
36 batadv_bla_send_announce(struct batadv_priv *bat_priv,
142 *batadv_claim_hash_find(struct batadv_priv *bat_priv, in batadv_claim_hash_find() argument
145 struct batadv_hashtable *hash = bat_priv->bla.claim_hash; in batadv_claim_hash_find()
182 batadv_backbone_hash_find(struct batadv_priv *bat_priv, in batadv_backbone_hash_find() argument
185 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; in batadv_backbone_hash_find()
228 hash = backbone_gw->bat_priv->bla.claim_hash; in batadv_bla_del_backbone_claims()
259 static void batadv_bla_send_claim(struct batadv_priv *bat_priv, uint8_t *mac, in batadv_bla_send_claim() argument
270 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_bla_send_claim()
274 memcpy(&local_claim_dest, &bat_priv->bla.claim_dest, in batadv_bla_send_claim()
309 batadv_dbg(BATADV_DBG_BLA, bat_priv, in batadv_bla_send_claim()
318 batadv_dbg(BATADV_DBG_BLA, bat_priv, in batadv_bla_send_claim()
327 batadv_dbg(BATADV_DBG_BLA, bat_priv, in batadv_bla_send_claim()
338 batadv_dbg(BATADV_DBG_BLA, bat_priv, in batadv_bla_send_claim()
351 batadv_inc_counter(bat_priv, BATADV_CNT_RX); in batadv_bla_send_claim()
352 batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES, in batadv_bla_send_claim()
372 batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, uint8_t *orig, in batadv_bla_get_backbone_gw() argument
379 entry = batadv_backbone_hash_find(bat_priv, orig, vid); in batadv_bla_get_backbone_gw()
384 batadv_dbg(BATADV_DBG_BLA, bat_priv, in batadv_bla_get_backbone_gw()
395 entry->bat_priv = bat_priv; in batadv_bla_get_backbone_gw()
403 hash_added = batadv_hash_add(bat_priv->bla.backbone_hash, in batadv_bla_get_backbone_gw()
415 orig_node = batadv_orig_hash_find(bat_priv, orig); in batadv_bla_get_backbone_gw()
417 batadv_tt_global_del_orig(bat_priv, orig_node, vid, in batadv_bla_get_backbone_gw()
423 batadv_bla_send_announce(bat_priv, entry); in batadv_bla_get_backbone_gw()
428 atomic_inc(&bat_priv->bla.num_requests); in batadv_bla_get_backbone_gw()
438 batadv_bla_update_own_backbone_gw(struct batadv_priv *bat_priv, in batadv_bla_update_own_backbone_gw() argument
444 backbone_gw = batadv_bla_get_backbone_gw(bat_priv, in batadv_bla_update_own_backbone_gw()
462 static void batadv_bla_answer_request(struct batadv_priv *bat_priv, in batadv_bla_answer_request() argument
472 batadv_dbg(BATADV_DBG_BLA, bat_priv, in batadv_bla_answer_request()
475 backbone_gw = batadv_backbone_hash_find(bat_priv, in batadv_bla_answer_request()
481 hash = bat_priv->bla.claim_hash; in batadv_bla_answer_request()
491 batadv_bla_send_claim(bat_priv, claim->addr, claim->vid, in batadv_bla_answer_request()
498 batadv_bla_send_announce(bat_priv, backbone_gw); in batadv_bla_answer_request()
515 batadv_dbg(BATADV_DBG_BLA, backbone_gw->bat_priv, in batadv_bla_send_request()
519 batadv_bla_send_claim(backbone_gw->bat_priv, backbone_gw->orig, in batadv_bla_send_request()
524 atomic_inc(&backbone_gw->bat_priv->bla.num_requests); in batadv_bla_send_request()
537 static void batadv_bla_send_announce(struct batadv_priv *bat_priv, in batadv_bla_send_announce() argument
547 batadv_bla_send_claim(bat_priv, mac, backbone_gw->vid, in batadv_bla_send_announce()
558 static void batadv_bla_add_claim(struct batadv_priv *bat_priv, in batadv_bla_add_claim() argument
568 claim = batadv_claim_hash_find(bat_priv, &search_claim); in batadv_bla_add_claim()
582 batadv_dbg(BATADV_DBG_BLA, bat_priv, in batadv_bla_add_claim()
585 hash_added = batadv_hash_add(bat_priv->bla.claim_hash, in batadv_bla_add_claim()
601 batadv_dbg(BATADV_DBG_BLA, bat_priv, in batadv_bla_add_claim()
622 static void batadv_bla_del_claim(struct batadv_priv *bat_priv, in batadv_bla_del_claim() argument
629 claim = batadv_claim_hash_find(bat_priv, &search_claim); in batadv_bla_del_claim()
633 batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla_del_claim(): %pM, vid %d\n", in batadv_bla_del_claim()
636 batadv_hash_remove(bat_priv->bla.claim_hash, batadv_compare_claim, in batadv_bla_del_claim()
647 static int batadv_handle_announce(struct batadv_priv *bat_priv, in batadv_handle_announce() argument
657 backbone_gw = batadv_bla_get_backbone_gw(bat_priv, backbone_addr, vid, in batadv_handle_announce()
668 batadv_dbg(BATADV_DBG_BLA, bat_priv, in batadv_handle_announce()
673 batadv_dbg(BATADV_DBG_BLA, backbone_gw->bat_priv, in batadv_handle_announce()
685 atomic_dec(&backbone_gw->bat_priv->bla.num_requests); in batadv_handle_announce()
695 static int batadv_handle_request(struct batadv_priv *bat_priv, in batadv_handle_request() argument
710 batadv_dbg(BATADV_DBG_BLA, bat_priv, in batadv_handle_request()
714 batadv_bla_answer_request(bat_priv, primary_if, vid); in batadv_handle_request()
719 static int batadv_handle_unclaim(struct batadv_priv *bat_priv, in batadv_handle_unclaim() argument
729 batadv_bla_send_claim(bat_priv, claim_addr, vid, in batadv_handle_unclaim()
732 backbone_gw = batadv_backbone_hash_find(bat_priv, backbone_addr, vid); in batadv_handle_unclaim()
738 batadv_dbg(BATADV_DBG_BLA, bat_priv, in batadv_handle_unclaim()
742 batadv_bla_del_claim(bat_priv, claim_addr, vid); in batadv_handle_unclaim()
748 static int batadv_handle_claim(struct batadv_priv *bat_priv, in batadv_handle_claim() argument
757 backbone_gw = batadv_bla_get_backbone_gw(bat_priv, backbone_addr, vid, in batadv_handle_claim()
764 batadv_bla_add_claim(bat_priv, claim_addr, vid, backbone_gw); in batadv_handle_claim()
766 batadv_bla_send_claim(bat_priv, claim_addr, vid, in batadv_handle_claim()
791 static int batadv_check_claim_group(struct batadv_priv *bat_priv, in batadv_check_claim_group() argument
801 bla_dst_own = &bat_priv->bla.claim_dest; in batadv_check_claim_group()
828 orig_node = batadv_orig_hash_find(bat_priv, backbone_addr); in batadv_check_claim_group()
838 batadv_dbg(BATADV_DBG_BLA, bat_priv, in batadv_check_claim_group()
860 static int batadv_bla_process_claim(struct batadv_priv *bat_priv, in batadv_bla_process_claim() argument
928 bla_dst_own = &bat_priv->bla.claim_dest; in batadv_bla_process_claim()
943 ret = batadv_check_claim_group(bat_priv, primary_if, hw_src, hw_dst, in batadv_bla_process_claim()
946 batadv_dbg(BATADV_DBG_BLA, bat_priv, in batadv_bla_process_claim()
955 batadv_bla_update_own_backbone_gw(bat_priv, primary_if, vid); in batadv_bla_process_claim()
960 if (batadv_handle_claim(bat_priv, primary_if, hw_src, in batadv_bla_process_claim()
965 if (batadv_handle_unclaim(bat_priv, primary_if, in batadv_bla_process_claim()
971 if (batadv_handle_announce(bat_priv, hw_src, ethhdr->h_source, in batadv_bla_process_claim()
976 if (batadv_handle_request(bat_priv, primary_if, hw_src, ethhdr, in batadv_bla_process_claim()
982 batadv_dbg(BATADV_DBG_BLA, bat_priv, in batadv_bla_process_claim()
991 static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now) in batadv_bla_purge_backbone_gw() argument
1000 hash = bat_priv->bla.backbone_hash; in batadv_bla_purge_backbone_gw()
1017 batadv_dbg(BATADV_DBG_BLA, backbone_gw->bat_priv, in batadv_bla_purge_backbone_gw()
1024 atomic_dec(&bat_priv->bla.num_requests); in batadv_bla_purge_backbone_gw()
1044 static void batadv_bla_purge_claims(struct batadv_priv *bat_priv, in batadv_bla_purge_claims() argument
1053 hash = bat_priv->bla.claim_hash; in batadv_bla_purge_claims()
1071 batadv_dbg(BATADV_DBG_BLA, bat_priv, in batadv_bla_purge_claims()
1076 batadv_handle_unclaim(bat_priv, primary_if, in batadv_bla_purge_claims()
1092 void batadv_bla_update_orig_address(struct batadv_priv *bat_priv, in batadv_bla_update_orig_address() argument
1104 bat_priv->bla.claim_dest.group = group; in batadv_bla_update_orig_address()
1107 if (!atomic_read(&bat_priv->bridge_loop_avoidance)) in batadv_bla_update_orig_address()
1111 batadv_bla_purge_claims(bat_priv, NULL, 1); in batadv_bla_update_orig_address()
1112 batadv_bla_purge_backbone_gw(bat_priv, 1); in batadv_bla_update_orig_address()
1116 hash = bat_priv->bla.backbone_hash; in batadv_bla_update_orig_address()
1135 batadv_bla_send_announce(bat_priv, backbone_gw); in batadv_bla_update_orig_address()
1148 struct batadv_priv *bat_priv; in batadv_bla_periodic_work() local
1158 bat_priv = container_of(priv_bla, struct batadv_priv, bla); in batadv_bla_periodic_work()
1159 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_bla_periodic_work()
1163 batadv_bla_purge_claims(bat_priv, primary_if, 0); in batadv_bla_periodic_work()
1164 batadv_bla_purge_backbone_gw(bat_priv, 0); in batadv_bla_periodic_work()
1166 if (!atomic_read(&bat_priv->bridge_loop_avoidance)) in batadv_bla_periodic_work()
1169 hash = bat_priv->bla.backbone_hash; in batadv_bla_periodic_work()
1184 batadv_bla_send_announce(bat_priv, backbone_gw); in batadv_bla_periodic_work()
1201 atomic_dec(&backbone_gw->bat_priv->bla.num_requests); in batadv_bla_periodic_work()
1210 queue_delayed_work(batadv_event_workqueue, &bat_priv->bla.work, in batadv_bla_periodic_work()
1223 int batadv_bla_init(struct batadv_priv *bat_priv) in batadv_bla_init() argument
1231 spin_lock_init(&bat_priv->bla.bcast_duplist_lock); in batadv_bla_init()
1233 batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla hash registering\n"); in batadv_bla_init()
1236 memcpy(&bat_priv->bla.claim_dest.magic, claim_dest, 3); in batadv_bla_init()
1237 bat_priv->bla.claim_dest.type = 0; in batadv_bla_init()
1238 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_bla_init()
1241 bat_priv->bla.claim_dest.group = htons(crc); in batadv_bla_init()
1244 bat_priv->bla.claim_dest.group = 0; /* will be set later */ in batadv_bla_init()
1250 bat_priv->bla.bcast_duplist[i].entrytime = entrytime; in batadv_bla_init()
1251 bat_priv->bla.bcast_duplist_curr = 0; in batadv_bla_init()
1253 if (bat_priv->bla.claim_hash) in batadv_bla_init()
1256 bat_priv->bla.claim_hash = batadv_hash_new(128); in batadv_bla_init()
1257 bat_priv->bla.backbone_hash = batadv_hash_new(32); in batadv_bla_init()
1259 if (!bat_priv->bla.claim_hash || !bat_priv->bla.backbone_hash) in batadv_bla_init()
1262 batadv_hash_set_lock_class(bat_priv->bla.claim_hash, in batadv_bla_init()
1264 batadv_hash_set_lock_class(bat_priv->bla.backbone_hash, in batadv_bla_init()
1267 batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla hashes initialized\n"); in batadv_bla_init()
1269 INIT_DELAYED_WORK(&bat_priv->bla.work, batadv_bla_periodic_work); in batadv_bla_init()
1271 queue_delayed_work(batadv_event_workqueue, &bat_priv->bla.work, in batadv_bla_init()
1290 int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, in batadv_bla_check_bcast_duplist() argument
1303 spin_lock_bh(&bat_priv->bla.bcast_duplist_lock); in batadv_bla_check_bcast_duplist()
1306 curr = (bat_priv->bla.bcast_duplist_curr + i); in batadv_bla_check_bcast_duplist()
1308 entry = &bat_priv->bla.bcast_duplist[curr]; in batadv_bla_check_bcast_duplist()
1332 curr = (bat_priv->bla.bcast_duplist_curr + BATADV_DUPLIST_SIZE - 1); in batadv_bla_check_bcast_duplist()
1334 entry = &bat_priv->bla.bcast_duplist[curr]; in batadv_bla_check_bcast_duplist()
1338 bat_priv->bla.bcast_duplist_curr = curr; in batadv_bla_check_bcast_duplist()
1341 spin_unlock_bh(&bat_priv->bla.bcast_duplist_lock); in batadv_bla_check_bcast_duplist()
1358 bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig, in batadv_bla_is_backbone_gw_orig() argument
1361 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; in batadv_bla_is_backbone_gw_orig()
1366 if (!atomic_read(&bat_priv->bridge_loop_avoidance)) in batadv_bla_is_backbone_gw_orig()
1406 if (!atomic_read(&orig_node->bat_priv->bridge_loop_avoidance)) in batadv_bla_is_backbone_gw()
1416 backbone_gw = batadv_backbone_hash_find(orig_node->bat_priv, in batadv_bla_is_backbone_gw()
1426 void batadv_bla_free(struct batadv_priv *bat_priv) in batadv_bla_free() argument
1430 cancel_delayed_work_sync(&bat_priv->bla.work); in batadv_bla_free()
1431 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_bla_free()
1433 if (bat_priv->bla.claim_hash) { in batadv_bla_free()
1434 batadv_bla_purge_claims(bat_priv, primary_if, 1); in batadv_bla_free()
1435 batadv_hash_destroy(bat_priv->bla.claim_hash); in batadv_bla_free()
1436 bat_priv->bla.claim_hash = NULL; in batadv_bla_free()
1438 if (bat_priv->bla.backbone_hash) { in batadv_bla_free()
1439 batadv_bla_purge_backbone_gw(bat_priv, 1); in batadv_bla_free()
1440 batadv_hash_destroy(bat_priv->bla.backbone_hash); in batadv_bla_free()
1441 bat_priv->bla.backbone_hash = NULL; in batadv_bla_free()
1462 int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, in batadv_bla_rx() argument
1472 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_bla_rx()
1476 if (!atomic_read(&bat_priv->bridge_loop_avoidance)) in batadv_bla_rx()
1480 if (unlikely(atomic_read(&bat_priv->bla.num_requests))) in batadv_bla_rx()
1487 claim = batadv_claim_hash_find(bat_priv, &search_claim); in batadv_bla_rx()
1493 batadv_handle_claim(bat_priv, primary_if, in batadv_bla_rx()
1521 batadv_handle_claim(bat_priv, primary_if, in batadv_bla_rx()
1527 batadv_bla_update_own_backbone_gw(bat_priv, primary_if, vid); in batadv_bla_rx()
1559 int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, in batadv_bla_tx() argument
1567 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_bla_tx()
1571 if (!atomic_read(&bat_priv->bridge_loop_avoidance)) in batadv_bla_tx()
1574 if (batadv_bla_process_claim(bat_priv, primary_if, skb)) in batadv_bla_tx()
1579 if (unlikely(atomic_read(&bat_priv->bla.num_requests))) in batadv_bla_tx()
1587 claim = batadv_claim_hash_find(bat_priv, &search_claim); in batadv_bla_tx()
1599 batadv_handle_unclaim(bat_priv, primary_if, in batadv_bla_tx()
1618 batadv_bla_update_own_backbone_gw(bat_priv, primary_if, vid); in batadv_bla_tx()
1634 struct batadv_priv *bat_priv = netdev_priv(net_dev); in batadv_bla_claim_table_seq_print_text() local
1635 struct batadv_hashtable *hash = bat_priv->bla.claim_hash; in batadv_bla_claim_table_seq_print_text()
1651 ntohs(bat_priv->bla.claim_dest.group)); in batadv_bla_claim_table_seq_print_text()
1678 struct batadv_priv *bat_priv = netdev_priv(net_dev); in batadv_bla_backbone_table_seq_print_text() local
1679 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; in batadv_bla_backbone_table_seq_print_text()
1696 ntohs(bat_priv->bla.claim_dest.group)); in batadv_bla_backbone_table_seq_print_text()