net/batman-adv/bat_v.c
Source file repositories/reference/linux-study-clean/net/batman-adv/bat_v.c
File Facts
- System
- Linux kernel
- Corpus path
net/batman-adv/bat_v.c- Extension
.c- Size
- 23274 bytes
- Lines
- 890
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
bat_v.hmain.hlinux/cache.hlinux/compiler.hlinux/errno.hlinux/if_ether.hlinux/init.hlinux/jiffies.hlinux/kref.hlinux/limits.hlinux/list.hlinux/minmax.hlinux/netdevice.hlinux/netlink.hlinux/rculist.hlinux/rcupdate.hlinux/skbuff.hlinux/spinlock.hlinux/stddef.hlinux/types.hlinux/workqueue.hnet/genetlink.hnet/netlink.huapi/linux/batadv_packet.huapi/linux/batman_adv.hbat_algo.hbat_v_elp.hbat_v_ogm.hgateway_client.hhard-interface.hhash.hlog.h
Detected Declarations
function batadv_v_iface_activatefunction batadv_v_iface_enablefunction batadv_v_iface_disablefunction batadv_v_primary_iface_setfunction batadv_v_iface_update_macfunction batadv_v_hardif_neigh_initfunction batadv_v_neigh_dump_neighfunction batadv_v_neigh_dump_hardiffunction hlist_for_each_entry_rcufunction batadv_v_neigh_dumpfunction netdev_for_each_lower_private_rcufunction batadv_v_orig_dump_subentryfunction batadv_v_orig_dump_entryfunction hlist_for_each_entry_rcufunction batadv_v_orig_dump_bucketfunction batadv_v_orig_dumpfunction batadv_v_neigh_cmpfunction batadv_v_neigh_is_sobfunction batadv_v_init_sel_classfunction batadv_v_gw_throughput_getfunction batadv_v_gw_get_best_gw_nodefunction batadv_v_gw_is_eligiblefunction batadv_v_gw_dump_entryfunction batadv_v_gw_dumpfunction hlist_for_each_entryfunction batadv_v_hardif_initfunction batadv_v_mesh_initfunction batadv_v_mesh_freefunction batadv_v_init
Annotated Snippet
if (batadv_v_neigh_dump_neigh(msg, portid, seq, hardif_neigh)) {
*idx_s = idx - 1;
return -EMSGSIZE;
}
}
*idx_s = 0;
return 0;
}
/**
* batadv_v_neigh_dump() - Dump the neighbours of a hard interface into a
* message
* @msg: Netlink message to dump into
* @cb: Control block containing additional options
* @bat_priv: The bat priv with all the mesh interface information
* @single_hardif: Limit dumping to this hard interface
*/
static void
batadv_v_neigh_dump(struct sk_buff *msg, struct netlink_callback *cb,
struct batadv_priv *bat_priv,
struct batadv_hard_iface *single_hardif)
{
struct batadv_hard_iface *hard_iface;
struct list_head *iter;
int i_hardif = 0;
int i_hardif_s = cb->args[0];
int idx = cb->args[1];
int portid = NETLINK_CB(cb->skb).portid;
rcu_read_lock();
if (single_hardif) {
if (i_hardif_s == 0) {
if (batadv_v_neigh_dump_hardif(msg, portid,
cb->nlh->nlmsg_seq,
bat_priv, single_hardif,
&idx) == 0)
i_hardif++;
}
} else {
netdev_for_each_lower_private_rcu(bat_priv->mesh_iface, hard_iface, iter) {
if (i_hardif++ < i_hardif_s)
continue;
if (batadv_v_neigh_dump_hardif(msg, portid,
cb->nlh->nlmsg_seq,
bat_priv, hard_iface,
&idx)) {
i_hardif--;
break;
}
}
}
rcu_read_unlock();
cb->args[0] = i_hardif;
cb->args[1] = idx;
}
/**
* batadv_v_orig_dump_subentry() - Dump an originator subentry into a message
* @msg: Netlink message to dump into
* @portid: Port making netlink request
* @seq: Sequence number of netlink message
* @bat_priv: The bat priv with all the mesh interface information
* @if_outgoing: Limit dump to entries with this outgoing interface
* @orig_node: Originator to dump
* @neigh_node: Single hops neighbour
* @best: Is the best originator
*
* Return: Error code, or 0 on success
*/
static int
batadv_v_orig_dump_subentry(struct sk_buff *msg, u32 portid, u32 seq,
struct batadv_priv *bat_priv,
struct batadv_hard_iface *if_outgoing,
struct batadv_orig_node *orig_node,
struct batadv_neigh_node *neigh_node,
bool best)
{
struct batadv_neigh_ifinfo *n_ifinfo;
unsigned int last_seen_msecs;
u32 throughput;
void *hdr;
n_ifinfo = batadv_neigh_ifinfo_get(neigh_node, if_outgoing);
if (!n_ifinfo)
return 0;
throughput = n_ifinfo->bat_v.throughput * 100;
Annotation
- Immediate include surface: `bat_v.h`, `main.h`, `linux/cache.h`, `linux/compiler.h`, `linux/errno.h`, `linux/if_ether.h`, `linux/init.h`, `linux/jiffies.h`.
- Detected declarations: `function batadv_v_iface_activate`, `function batadv_v_iface_enable`, `function batadv_v_iface_disable`, `function batadv_v_primary_iface_set`, `function batadv_v_iface_update_mac`, `function batadv_v_hardif_neigh_init`, `function batadv_v_neigh_dump_neigh`, `function batadv_v_neigh_dump_hardif`, `function hlist_for_each_entry_rcu`, `function batadv_v_neigh_dump`.
- 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.