net/batman-adv/bat_v_ogm.c
Source file repositories/reference/linux-study-clean/net/batman-adv/bat_v_ogm.c
File Facts
- System
- Linux kernel
- Corpus path
net/batman-adv/bat_v_ogm.c- Extension
.c- Size
- 33876 bytes
- Lines
- 1094
- 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
bat_v_ogm.hmain.hlinux/atomic.hlinux/bug.hlinux/byteorder/generic.hlinux/compiler.hlinux/container_of.hlinux/errno.hlinux/etherdevice.hlinux/gfp.hlinux/if_ether.hlinux/jiffies.hlinux/kref.hlinux/list.hlinux/lockdep.hlinux/minmax.hlinux/mutex.hlinux/netdevice.hlinux/random.hlinux/rcupdate.hlinux/skbuff.hlinux/slab.hlinux/spinlock.hlinux/stddef.hlinux/string.hlinux/types.hlinux/workqueue.huapi/linux/batadv_packet.hhard-interface.hhash.hlog.horiginator.h
Detected Declarations
function batadv_v_ogm_orig_getfunction batadv_v_ogm_start_queue_timerfunction batadv_v_ogm_start_timerfunction batadv_v_ogm_send_to_iffunction batadv_v_ogm_lenfunction batadv_v_ogm_queue_leftfunction batadv_v_ogm_aggr_list_freefunction batadv_v_ogm_aggr_sendfunction batadv_v_ogm_queue_on_iffunction batadv_v_ogm_send_meshiffunction batadv_v_ogm_sendfunction batadv_v_ogm_aggr_workfunction batadv_v_ogm_iface_enablefunction batadv_v_ogm_iface_disablefunction batadv_v_ogm_primary_iface_setfunction batadv_v_forward_penaltyfunction batadv_v_ogm_forwardfunction batadv_v_ogm_metric_updatefunction batadv_v_ogm_route_updatefunction batadv_v_ogm_process_per_outiffunction batadv_v_ogm_aggr_packetfunction batadv_v_ogm_processfunction batadv_v_ogm_packet_recvfunction batadv_v_ogm_initfunction batadv_v_ogm_free
Annotated Snippet
if (ret) {
char *type;
switch (ret) {
case BATADV_HARDIF_BCAST_NORECIPIENT:
type = "no neighbor";
break;
case BATADV_HARDIF_BCAST_DUPFWD:
type = "single neighbor is source";
break;
case BATADV_HARDIF_BCAST_DUPORIG:
type = "single neighbor is originator";
break;
default:
type = "unknown";
}
batadv_dbg(BATADV_DBG_BATMAN, bat_priv, "OGM2 from ourselves on %s suppressed: %s\n",
hard_iface->net_dev->name, type);
batadv_hardif_put(hard_iface);
continue;
}
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Sending own OGM2 packet (originator %pM, seqno %u, throughput %u, TTL %d) on interface %s [%pM]\n",
ogm_packet->orig, ntohl(ogm_packet->seqno),
ntohl(ogm_packet->throughput), ogm_packet->ttl,
hard_iface->net_dev->name,
hard_iface->net_dev->dev_addr);
/* this skb gets consumed by batadv_v_ogm_send_to_if() */
skb_tmp = skb_clone(skb, GFP_ATOMIC);
if (!skb_tmp) {
batadv_hardif_put(hard_iface);
break;
}
batadv_v_ogm_queue_on_if(bat_priv, skb_tmp, hard_iface);
batadv_hardif_put(hard_iface);
}
rcu_read_unlock();
consume_skb(skb);
reschedule:
batadv_v_ogm_start_timer(bat_priv);
out:
return;
}
/**
* batadv_v_ogm_send() - periodic worker broadcasting the own OGM
* @work: work queue item
*/
static void batadv_v_ogm_send(struct work_struct *work)
{
struct batadv_priv_bat_v *bat_v;
struct batadv_priv *bat_priv;
bat_v = container_of(work, struct batadv_priv_bat_v, ogm_wq.work);
bat_priv = container_of(bat_v, struct batadv_priv, bat_v);
mutex_lock(&bat_priv->bat_v.ogm_buff_mutex);
batadv_v_ogm_send_meshif(bat_priv);
mutex_unlock(&bat_priv->bat_v.ogm_buff_mutex);
}
/**
* batadv_v_ogm_aggr_work() - OGM queue periodic task per interface
* @work: work queue item
*
* Emits aggregated OGM messages in regular intervals.
*/
void batadv_v_ogm_aggr_work(struct work_struct *work)
{
struct batadv_hard_iface_bat_v *batv;
struct batadv_hard_iface *hard_iface;
struct batadv_priv *bat_priv;
batv = container_of(work, struct batadv_hard_iface_bat_v, aggr_wq.work);
hard_iface = container_of(batv, struct batadv_hard_iface, bat_v);
bat_priv = netdev_priv(hard_iface->mesh_iface);
spin_lock_bh(&hard_iface->bat_v.aggr_list.lock);
batadv_v_ogm_aggr_send(bat_priv, hard_iface);
spin_unlock_bh(&hard_iface->bat_v.aggr_list.lock);
batadv_v_ogm_start_queue_timer(hard_iface);
}
Annotation
- Immediate include surface: `bat_v_ogm.h`, `main.h`, `linux/atomic.h`, `linux/bug.h`, `linux/byteorder/generic.h`, `linux/compiler.h`, `linux/container_of.h`, `linux/errno.h`.
- Detected declarations: `function batadv_v_ogm_orig_get`, `function batadv_v_ogm_start_queue_timer`, `function batadv_v_ogm_start_timer`, `function batadv_v_ogm_send_to_if`, `function batadv_v_ogm_len`, `function batadv_v_ogm_queue_left`, `function batadv_v_ogm_aggr_list_free`, `function batadv_v_ogm_aggr_send`, `function batadv_v_ogm_queue_on_if`, `function batadv_v_ogm_send_meshif`.
- 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.