Lines Matching +full:rcu +full:- +full:endian +full:- +full:offset

1 // SPDX-License-Identifier: GPL-2.0
48 #include "distributed-arp-table.h"
51 #include "hard-interface.h"
55 #include "network-coding.h"
59 #include "soft-interface.h"
61 #include "translation-table.h"
64 * list traversals just rcu-locked
127 return -ENOMEM; in batadv_init()
145 * batadv_mesh_init() - Initialize soft interface
155 spin_lock_init(&bat_priv->forw_bat_list_lock); in batadv_mesh_init()
156 spin_lock_init(&bat_priv->forw_bcast_list_lock); in batadv_mesh_init()
157 spin_lock_init(&bat_priv->tt.changes_list_lock); in batadv_mesh_init()
158 spin_lock_init(&bat_priv->tt.req_list_lock); in batadv_mesh_init()
159 spin_lock_init(&bat_priv->tt.roam_list_lock); in batadv_mesh_init()
160 spin_lock_init(&bat_priv->tt.last_changeset_lock); in batadv_mesh_init()
161 spin_lock_init(&bat_priv->tt.commit_lock); in batadv_mesh_init()
162 spin_lock_init(&bat_priv->gw.list_lock); in batadv_mesh_init()
164 spin_lock_init(&bat_priv->mcast.mla_lock); in batadv_mesh_init()
165 spin_lock_init(&bat_priv->mcast.want_lists_lock); in batadv_mesh_init()
167 spin_lock_init(&bat_priv->tvlv.container_list_lock); in batadv_mesh_init()
168 spin_lock_init(&bat_priv->tvlv.handler_list_lock); in batadv_mesh_init()
169 spin_lock_init(&bat_priv->softif_vlan_list_lock); in batadv_mesh_init()
170 spin_lock_init(&bat_priv->tp_list_lock); in batadv_mesh_init()
172 INIT_HLIST_HEAD(&bat_priv->forw_bat_list); in batadv_mesh_init()
173 INIT_HLIST_HEAD(&bat_priv->forw_bcast_list); in batadv_mesh_init()
174 INIT_HLIST_HEAD(&bat_priv->gw.gateway_list); in batadv_mesh_init()
176 INIT_HLIST_HEAD(&bat_priv->mcast.want_all_unsnoopables_list); in batadv_mesh_init()
177 INIT_HLIST_HEAD(&bat_priv->mcast.want_all_ipv4_list); in batadv_mesh_init()
178 INIT_HLIST_HEAD(&bat_priv->mcast.want_all_ipv6_list); in batadv_mesh_init()
180 INIT_LIST_HEAD(&bat_priv->tt.changes_list); in batadv_mesh_init()
181 INIT_HLIST_HEAD(&bat_priv->tt.req_list); in batadv_mesh_init()
182 INIT_LIST_HEAD(&bat_priv->tt.roam_list); in batadv_mesh_init()
184 INIT_HLIST_HEAD(&bat_priv->mcast.mla_list); in batadv_mesh_init()
186 INIT_HLIST_HEAD(&bat_priv->tvlv.container_list); in batadv_mesh_init()
187 INIT_HLIST_HEAD(&bat_priv->tvlv.handler_list); in batadv_mesh_init()
188 INIT_HLIST_HEAD(&bat_priv->softif_vlan_list); in batadv_mesh_init()
189 INIT_HLIST_HEAD(&bat_priv->tp_list); in batadv_mesh_init()
191 bat_priv->gw.generation = 0; in batadv_mesh_init()
195 atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING); in batadv_mesh_init()
201 atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING); in batadv_mesh_init()
207 atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING); in batadv_mesh_init()
213 atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING); in batadv_mesh_init()
219 atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING); in batadv_mesh_init()
225 atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING); in batadv_mesh_init()
232 atomic_set(&bat_priv->gw.reselect, 0); in batadv_mesh_init()
233 atomic_set(&bat_priv->mesh_state, BATADV_MESH_ACTIVE); in batadv_mesh_init()
249 atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE); in batadv_mesh_init()
255 * batadv_mesh_free() - Deinitialize soft interface
262 atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING); in batadv_mesh_free()
283 * freed and marked as empty. This ensures that no cleanup RCU callbacks in batadv_mesh_free()
290 free_percpu(bat_priv->bat_counters); in batadv_mesh_free()
291 bat_priv->bat_counters = NULL; in batadv_mesh_free()
293 atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE); in batadv_mesh_free()
297 * batadv_is_my_mac() - check if the given mac address belongs to any of the
311 if (hard_iface->if_status != BATADV_IF_ACTIVE) in batadv_is_my_mac()
314 if (hard_iface->soft_iface != bat_priv->soft_iface) in batadv_is_my_mac()
317 if (batadv_compare_eth(hard_iface->net_dev->dev_addr, addr)) { in batadv_is_my_mac()
327 * batadv_max_header_len() - calculate maximum encapsulation overhead for a
352 * batadv_skb_set_priority() - sets skb priority according to packet content
354 * @offset: offset to the packet content
359 void batadv_skb_set_priority(struct sk_buff *skb, int offset) in batadv_skb_set_priority() argument
368 if (skb->priority >= 256 && skb->priority <= 263) in batadv_skb_set_priority()
371 ethhdr = skb_header_pointer(skb, offset, sizeof(*ethhdr), &ethhdr_tmp); in batadv_skb_set_priority()
375 switch (ethhdr->h_proto) { in batadv_skb_set_priority()
377 vhdr = skb_header_pointer(skb, offset + sizeof(*vhdr), in batadv_skb_set_priority()
381 prio = ntohs(vhdr->h_vlan_TCI) & VLAN_PRIO_MASK; in batadv_skb_set_priority()
385 ip_hdr = skb_header_pointer(skb, offset + sizeof(*ethhdr), in batadv_skb_set_priority()
392 ip6_hdr = skb_header_pointer(skb, offset + sizeof(*ethhdr), in batadv_skb_set_priority()
402 skb->priority = prio + 256; in batadv_skb_set_priority()
418 * batadv_batman_skb_recv() - Handle incoming message from an hard interface
439 * shut down otherwise the packet may trigger de-reference errors in batadv_batman_skb_recv()
442 if (!kref_get_unless_zero(&hard_iface->refcount)) in batadv_batman_skb_recv()
456 if (unlikely(skb->mac_len != ETH_HLEN || !skb_mac_header(skb))) in batadv_batman_skb_recv()
459 if (!hard_iface->soft_iface) in batadv_batman_skb_recv()
462 bat_priv = netdev_priv(hard_iface->soft_iface); in batadv_batman_skb_recv()
464 if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE) in batadv_batman_skb_recv()
468 if (hard_iface->if_status != BATADV_IF_ACTIVE) in batadv_batman_skb_recv()
471 batadv_ogm_packet = (struct batadv_ogm_packet *)skb->data; in batadv_batman_skb_recv()
473 if (batadv_ogm_packet->version != BATADV_COMPAT_VERSION) { in batadv_batman_skb_recv()
476 batadv_ogm_packet->version); in batadv_batman_skb_recv()
481 memset(skb->cb, 0, sizeof(struct batadv_skb_cb)); in batadv_batman_skb_recv()
483 idx = batadv_ogm_packet->packet_type; in batadv_batman_skb_recv()
490 * routing-logical reasons. in batadv_batman_skb_recv()
550 * batadv_recv_handler_register() - Register handler for batman-adv packet type
567 return -EBUSY; in batadv_recv_handler_register()
574 * batadv_recv_handler_unregister() - Unregister handler for packet type
583 * batadv_skb_crc32() - calculate CRC32 of the whole packet and skip bytes in
592 * Return: big endian crc32c of the checksummed data
598 unsigned int to = skb->len; in batadv_skb_crc32()
604 from = (unsigned int)(payload_ptr - skb->data); in batadv_skb_crc32()
616 * batadv_get_vid() - extract the VLAN identifier from skb if any
625 struct ethhdr *ethhdr = (struct ethhdr *)(skb->data + header_len); in batadv_get_vid()
629 if (ethhdr->h_proto != htons(ETH_P_8021Q)) in batadv_get_vid()
635 vhdr = (struct vlan_ethhdr *)(skb->data + header_len); in batadv_get_vid()
636 vid = ntohs(vhdr->h_vlan_TCI) & VLAN_VID_MASK; in batadv_get_vid()
643 * batadv_vlan_ap_isola_get() - return AP isolation status for the given vlan
661 ap_isolation_enabled = atomic_read(&vlan->ap_isolation); in batadv_vlan_ap_isola_get()
669 * batadv_throw_uevent() - Send an uevent with batman-adv specific env data
681 int ret = -ENOMEM; in batadv_throw_uevent()
685 bat_kobj = &bat_priv->soft_iface->dev.kobj; in batadv_throw_uevent()