net/batman-adv/translation-table.c
Source file repositories/reference/linux-study-clean/net/batman-adv/translation-table.c
File Facts
- System
- Linux kernel
- Corpus path
net/batman-adv/translation-table.c- Extension
.c- Size
- 128090 bytes
- Lines
- 4287
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
translation-table.hmain.hlinux/atomic.hlinux/bitops.hlinux/bug.hlinux/build_bug.hlinux/byteorder/generic.hlinux/cache.hlinux/compiler.hlinux/container_of.hlinux/crc32.hlinux/err.hlinux/errno.hlinux/etherdevice.hlinux/gfp.hlinux/if_ether.hlinux/init.hlinux/jhash.hlinux/jiffies.hlinux/kref.hlinux/list.hlinux/lockdep.hlinux/net.hlinux/netdevice.hlinux/netlink.hlinux/overflow.hlinux/rculist.hlinux/rcupdate.hlinux/skbuff.hlinux/slab.hlinux/spinlock.hlinux/stddef.h
Detected Declarations
function batadv_compare_ttfunction batadv_choose_ttfunction batadv_tt_hash_findfunction batadv_tt_local_hash_findfunction batadv_tt_global_hash_findfunction batadv_tt_local_entry_releasefunction batadv_tt_local_entry_putfunction batadv_tt_global_entry_releasefunction batadv_tt_global_hash_countfunction batadv_tt_local_size_modfunction batadv_tt_local_size_incfunction batadv_tt_local_size_decfunction batadv_tt_global_size_modfunction batadv_tt_global_size_incfunction batadv_tt_global_size_decfunction batadv_tt_orig_list_entry_releasefunction batadv_tt_orig_list_entry_putfunction batadv_tt_local_eventfunction batadv_tt_lenfunction batadv_tt_entriesfunction batadv_tt_local_table_transmit_sizefunction batadv_tt_local_initfunction batadv_tt_global_freefunction batadv_tt_local_addfunction hlist_for_each_entry_rcufunction batadv_tt_prepare_tvlv_global_datafunction batadv_tt_prepare_tvlv_local_datafunction batadv_tt_tvlv_container_updatefunction list_for_each_entry_safefunction batadv_tt_local_dump_entryfunction batadv_tt_local_dump_bucketfunction hlist_for_each_entryfunction batadv_tt_local_dumpfunction batadv_tt_local_set_pendingfunction batadv_tt_local_removefunction batadv_tt_local_purge_listfunction hlist_for_each_entry_safefunction batadv_tt_local_purgefunction batadv_tt_local_table_freefunction hlist_for_each_entry_safefunction batadv_tt_global_initfunction batadv_tt_changes_list_freefunction list_for_each_entry_safefunction batadv_tt_global_orig_entry_findfunction batadv_tt_global_entry_has_origfunction batadv_tt_global_sync_flagsfunction batadv_tt_global_orig_entry_addfunction batadv_tt_global_add
Annotated Snippet
if (!hlist_unhashed(&vlan->list)) {
hlist_del_init_rcu(&vlan->list);
batadv_orig_node_vlan_put(vlan);
}
spin_unlock_bh(&orig_node->vlan_list_lock);
}
batadv_orig_node_vlan_put(vlan);
}
/**
* batadv_tt_global_size_inc() - increase by one the global table size for the
* given vid
* @orig_node: the originator which global table size has to be decreased
* @vid: the vlan identifier
*/
static void batadv_tt_global_size_inc(struct batadv_orig_node *orig_node,
unsigned short vid)
{
batadv_tt_global_size_mod(orig_node, vid, 1);
}
/**
* batadv_tt_global_size_dec() - decrease by one the global table size for the
* given vid
* @orig_node: the originator which global table size has to be decreased
* @vid: the vlan identifier
*/
static void batadv_tt_global_size_dec(struct batadv_orig_node *orig_node,
unsigned short vid)
{
batadv_tt_global_size_mod(orig_node, vid, -1);
}
/**
* batadv_tt_orig_list_entry_release() - release tt orig entry from lists and
* queue for free after rcu grace period
* @ref: kref pointer of the tt orig entry
*/
static void batadv_tt_orig_list_entry_release(struct kref *ref)
{
struct batadv_tt_orig_list_entry *orig_entry;
orig_entry = container_of(ref, struct batadv_tt_orig_list_entry,
refcount);
batadv_orig_node_put(orig_entry->orig_node);
kfree_rcu(orig_entry, rcu);
}
/**
* batadv_tt_orig_list_entry_put() - decrement the tt orig entry refcounter and
* possibly release it
* @orig_entry: tt orig entry to be free'd
*/
static void
batadv_tt_orig_list_entry_put(struct batadv_tt_orig_list_entry *orig_entry)
{
if (!orig_entry)
return;
kref_put(&orig_entry->refcount, batadv_tt_orig_list_entry_release);
}
/**
* batadv_tt_local_event() - store a local TT event (ADD/DEL)
* @bat_priv: the bat priv with all the mesh interface information
* @tt_local_entry: the TT entry involved in the event
* @event_flags: flags to store in the event structure
*/
static void batadv_tt_local_event(struct batadv_priv *bat_priv,
struct batadv_tt_local_entry *tt_local_entry,
u8 event_flags)
{
struct batadv_tt_change_node *tt_change_node, *entry, *safe;
struct batadv_tt_common_entry *common = &tt_local_entry->common;
u8 flags = common->flags | event_flags;
bool del_op_requested, del_op_entry;
size_t changes;
tt_change_node = kmem_cache_alloc(batadv_tt_change_cache, GFP_ATOMIC);
if (!tt_change_node)
return;
tt_change_node->change.flags = flags;
memset(tt_change_node->change.reserved, 0,
sizeof(tt_change_node->change.reserved));
ether_addr_copy(tt_change_node->change.addr, common->addr);
tt_change_node->change.vid = htons(common->vid);
Annotation
- Immediate include surface: `translation-table.h`, `main.h`, `linux/atomic.h`, `linux/bitops.h`, `linux/bug.h`, `linux/build_bug.h`, `linux/byteorder/generic.h`, `linux/cache.h`.
- Detected declarations: `function batadv_compare_tt`, `function batadv_choose_tt`, `function batadv_tt_hash_find`, `function batadv_tt_local_hash_find`, `function batadv_tt_global_hash_find`, `function batadv_tt_local_entry_release`, `function batadv_tt_local_entry_put`, `function batadv_tt_global_entry_release`, `function batadv_tt_global_hash_count`, `function batadv_tt_local_size_mod`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.