Lines Matching refs:bat_priv

100 static u64 batadv_sum_counter(struct batadv_priv *bat_priv,  size_t idx)  in batadv_sum_counter()  argument
106 counters = per_cpu_ptr(bat_priv->bat_counters, cpu); in batadv_sum_counter()
115 struct batadv_priv *bat_priv = netdev_priv(dev); in batadv_interface_stats() local
118 stats->tx_packets = batadv_sum_counter(bat_priv, BATADV_CNT_TX); in batadv_interface_stats()
119 stats->tx_bytes = batadv_sum_counter(bat_priv, BATADV_CNT_TX_BYTES); in batadv_interface_stats()
120 stats->tx_dropped = batadv_sum_counter(bat_priv, BATADV_CNT_TX_DROPPED); in batadv_interface_stats()
121 stats->rx_packets = batadv_sum_counter(bat_priv, BATADV_CNT_RX); in batadv_interface_stats()
122 stats->rx_bytes = batadv_sum_counter(bat_priv, BATADV_CNT_RX_BYTES); in batadv_interface_stats()
128 struct batadv_priv *bat_priv = netdev_priv(dev); in batadv_interface_set_mac_addr() local
140 if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE) in batadv_interface_set_mac_addr()
144 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_interface_set_mac_addr()
145 batadv_tt_local_remove(bat_priv, old_addr, vlan->vid, in batadv_interface_set_mac_addr()
182 struct batadv_priv *bat_priv = netdev_priv(soft_iface); in batadv_interface_tx() local
205 if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE) in batadv_interface_tx()
239 if (batadv_bla_tx(bat_priv, skb, vid)) in batadv_interface_tx()
256 batadv_dat_snoop_outgoing_dhcp_ack(bat_priv, skb, proto, vid); in batadv_interface_tx()
270 gw_mode = atomic_read(&bat_priv->gw.mode); in batadv_interface_tx()
303 forw_mode = batadv_mcast_forw_mode(bat_priv, skb, in batadv_interface_tx()
319 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_interface_tx()
327 if (batadv_dat_snoop_outgoing_arp_request(bat_priv, skb)) in batadv_interface_tx()
348 seqno = atomic_inc_return(&bat_priv->bcast_seqno); in batadv_interface_tx()
351 batadv_send_bcast_packet(bat_priv, skb, brd_delay, true); in batadv_interface_tx()
356 ret = batadv_gw_out_of_range(bat_priv, skb); in batadv_interface_tx()
359 ret = batadv_send_skb_via_gw(bat_priv, skb, vid); in batadv_interface_tx()
361 ret = batadv_mcast_forw_send_orig(bat_priv, skb, vid, in batadv_interface_tx()
364 ret = batadv_mcast_forw_send(bat_priv, skb, vid, in batadv_interface_tx()
367 if (batadv_dat_snoop_outgoing_arp_request(bat_priv, in batadv_interface_tx()
371 batadv_dat_snoop_outgoing_arp_reply(bat_priv, skb); in batadv_interface_tx()
373 ret = batadv_send_skb_via_tt(bat_priv, skb, dst_hint, in batadv_interface_tx()
380 batadv_inc_counter(bat_priv, BATADV_CNT_TX); in batadv_interface_tx()
381 batadv_add_counter(bat_priv, BATADV_CNT_TX_BYTES, data_len); in batadv_interface_tx()
387 batadv_inc_counter(bat_priv, BATADV_CNT_TX_DROPPED); in batadv_interface_tx()
416 struct batadv_priv *bat_priv = netdev_priv(soft_iface); in batadv_interface_rx() local
459 batadv_inc_counter(bat_priv, BATADV_CNT_RX); in batadv_interface_rx()
460 batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES, in batadv_interface_rx()
466 if (batadv_bla_rx(bat_priv, skb, vid, packet_type)) in batadv_interface_rx()
470 batadv_tt_add_temporary_global_entry(bat_priv, orig_node, in batadv_interface_rx()
477 if (batadv_vlan_ap_isola_get(bat_priv, vid) && in batadv_interface_rx()
478 batadv_tt_global_is_isolated(bat_priv, ethhdr->h_source, in batadv_interface_rx()
483 skb->mark &= ~bat_priv->isolation_mark_mask; in batadv_interface_rx()
484 skb->mark |= bat_priv->isolation_mark; in batadv_interface_rx()
486 } else if (batadv_is_ap_isolated(bat_priv, ethhdr->h_source, in batadv_interface_rx()
511 spin_lock_bh(&vlan->bat_priv->softif_vlan_list_lock); in batadv_softif_vlan_release()
513 spin_unlock_bh(&vlan->bat_priv->softif_vlan_list_lock); in batadv_softif_vlan_release()
526 struct batadv_softif_vlan *batadv_softif_vlan_get(struct batadv_priv *bat_priv, in batadv_softif_vlan_get() argument
532 hlist_for_each_entry_rcu(vlan_tmp, &bat_priv->softif_vlan_list, list) { in batadv_softif_vlan_get()
554 int batadv_softif_create_vlan(struct batadv_priv *bat_priv, unsigned short vid) in batadv_softif_create_vlan() argument
558 spin_lock_bh(&bat_priv->softif_vlan_list_lock); in batadv_softif_create_vlan()
560 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_softif_create_vlan()
563 spin_unlock_bh(&bat_priv->softif_vlan_list_lock); in batadv_softif_create_vlan()
569 spin_unlock_bh(&bat_priv->softif_vlan_list_lock); in batadv_softif_create_vlan()
573 vlan->bat_priv = bat_priv; in batadv_softif_create_vlan()
580 hlist_add_head_rcu(&vlan->list, &bat_priv->softif_vlan_list); in batadv_softif_create_vlan()
581 spin_unlock_bh(&bat_priv->softif_vlan_list_lock); in batadv_softif_create_vlan()
586 batadv_tt_local_add(bat_priv->soft_iface, in batadv_softif_create_vlan()
587 bat_priv->soft_iface->dev_addr, vid, in batadv_softif_create_vlan()
601 static void batadv_softif_destroy_vlan(struct batadv_priv *bat_priv, in batadv_softif_destroy_vlan() argument
607 batadv_tt_local_remove(bat_priv, bat_priv->soft_iface->dev_addr, in batadv_softif_destroy_vlan()
627 struct batadv_priv *bat_priv = netdev_priv(dev); in batadv_interface_add_vid() local
644 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_interface_add_vid()
646 return batadv_softif_create_vlan(bat_priv, vid); in batadv_interface_add_vid()
652 batadv_tt_local_add(bat_priv->soft_iface, in batadv_interface_add_vid()
653 bat_priv->soft_iface->dev_addr, vid, in batadv_interface_add_vid()
674 struct batadv_priv *bat_priv = netdev_priv(dev); in batadv_interface_kill_vid() local
683 vlan = batadv_softif_vlan_get(bat_priv, vid | BATADV_VLAN_HAS_TAG); in batadv_interface_kill_vid()
687 batadv_softif_destroy_vlan(bat_priv, vlan); in batadv_interface_kill_vid()
733 struct batadv_priv *bat_priv; in batadv_softif_init_late() local
740 bat_priv = netdev_priv(dev); in batadv_softif_init_late()
741 bat_priv->soft_iface = dev; in batadv_softif_init_late()
746 bat_priv->bat_counters = __alloc_percpu(cnt_len, __alignof__(u64)); in batadv_softif_init_late()
747 if (!bat_priv->bat_counters) in batadv_softif_init_late()
750 atomic_set(&bat_priv->aggregated_ogms, 1); in batadv_softif_init_late()
751 atomic_set(&bat_priv->bonding, 0); in batadv_softif_init_late()
753 atomic_set(&bat_priv->bridge_loop_avoidance, 1); in batadv_softif_init_late()
756 atomic_set(&bat_priv->distributed_arp_table, 1); in batadv_softif_init_late()
759 atomic_set(&bat_priv->multicast_mode, 1); in batadv_softif_init_late()
760 atomic_set(&bat_priv->multicast_fanout, 16); in batadv_softif_init_late()
761 atomic_set(&bat_priv->mcast.num_want_all_unsnoopables, 0); in batadv_softif_init_late()
762 atomic_set(&bat_priv->mcast.num_want_all_ipv4, 0); in batadv_softif_init_late()
763 atomic_set(&bat_priv->mcast.num_want_all_ipv6, 0); in batadv_softif_init_late()
765 atomic_set(&bat_priv->gw.mode, BATADV_GW_MODE_OFF); in batadv_softif_init_late()
766 atomic_set(&bat_priv->gw.bandwidth_down, 100); in batadv_softif_init_late()
767 atomic_set(&bat_priv->gw.bandwidth_up, 20); in batadv_softif_init_late()
768 atomic_set(&bat_priv->orig_interval, 1000); in batadv_softif_init_late()
769 atomic_set(&bat_priv->hop_penalty, 30); in batadv_softif_init_late()
771 atomic_set(&bat_priv->log_level, 0); in batadv_softif_init_late()
773 atomic_set(&bat_priv->fragmentation, 1); in batadv_softif_init_late()
774 atomic_set(&bat_priv->packet_size_max, ETH_DATA_LEN); in batadv_softif_init_late()
775 atomic_set(&bat_priv->bcast_queue_left, BATADV_BCAST_QUEUE_LEN); in batadv_softif_init_late()
776 atomic_set(&bat_priv->batman_queue_left, BATADV_BATMAN_QUEUE_LEN); in batadv_softif_init_late()
778 atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE); in batadv_softif_init_late()
779 atomic_set(&bat_priv->bcast_seqno, 1); in batadv_softif_init_late()
780 atomic_set(&bat_priv->tt.vn, 0); in batadv_softif_init_late()
781 atomic_set(&bat_priv->tt.local_changes, 0); in batadv_softif_init_late()
782 atomic_set(&bat_priv->tt.ogm_append_cnt, 0); in batadv_softif_init_late()
784 atomic_set(&bat_priv->bla.num_requests, 0); in batadv_softif_init_late()
786 atomic_set(&bat_priv->tp_num, 0); in batadv_softif_init_late()
788 bat_priv->tt.last_changeset = NULL; in batadv_softif_init_late()
789 bat_priv->tt.last_changeset_len = 0; in batadv_softif_init_late()
790 bat_priv->isolation_mark = 0; in batadv_softif_init_late()
791 bat_priv->isolation_mark_mask = 0; in batadv_softif_init_late()
795 atomic_set(&bat_priv->frag_seqno, random_seqno); in batadv_softif_init_late()
797 bat_priv->primary_if = NULL; in batadv_softif_init_late()
799 batadv_nc_init_bat_priv(bat_priv); in batadv_softif_init_late()
801 if (!bat_priv->algo_ops) { in batadv_softif_init_late()
802 ret = batadv_algo_select(bat_priv, batadv_routing_algo); in batadv_softif_init_late()
814 free_percpu(bat_priv->bat_counters); in batadv_softif_init_late()
815 bat_priv->bat_counters = NULL; in batadv_softif_init_late()
957 struct batadv_priv *bat_priv = netdev_priv(dev); in batadv_get_ethtool_stats() local
961 data[i] = batadv_sum_counter(bat_priv, i); in batadv_get_ethtool_stats()
1060 struct batadv_priv *bat_priv = netdev_priv(dev); in batadv_softif_newlink() local
1066 err = batadv_algo_select(bat_priv, algo_name); in batadv_softif_newlink()
1083 struct batadv_priv *bat_priv = netdev_priv(soft_iface); in batadv_softif_destroy_netlink() local
1093 vlan = batadv_softif_vlan_get(bat_priv, BATADV_NO_FLAGS); in batadv_softif_destroy_netlink()
1095 batadv_softif_destroy_vlan(bat_priv, vlan); in batadv_softif_destroy_netlink()