net/tipc/monitor.c
Source file repositories/reference/linux-study-clean/net/tipc/monitor.c
File Facts
- System
- Linux kernel
- Corpus path
net/tipc/monitor.c- Extension
.c- Size
- 22721 bytes
- Lines
- 876
- 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.
- 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
net/genetlink.hcore.haddr.hmonitor.hbearer.h
Detected Declarations
struct tipc_mon_domainstruct tipc_peerstruct tipc_monitorfunction mon_cpu_to_le16function mon_cpu_to_le32function mon_cpu_to_le64function mon_le16_to_cpufunction mon_le32_to_cpufunction mon_le64_to_cpufunction dom_rec_lenfunction dom_sizefunction map_setfunction map_getfunction hlist_for_each_entryfunction tipc_mon_is_activefunction mon_identify_lost_membersfunction mon_apply_domainfunction mon_update_local_domainfunction mon_update_neighborsfunction mon_assign_rolesfunction tipc_mon_remove_peerfunction list_for_each_entryfunction tipc_mon_add_peerfunction tipc_mon_peer_upfunction tipc_mon_peer_downfunction tipc_mon_rcvfunction tipc_mon_prepfunction tipc_mon_get_statefunction mon_timeoutfunction tipc_mon_createfunction tipc_mon_deletefunction tipc_mon_reinit_selffunction tipc_nl_monitor_set_thresholdfunction tipc_nl_monitor_get_thresholdfunction __tipc_nl_add_monitor_peerfunction tipc_nl_add_monitor_peerfunction __tipc_nl_add_monitor
Annotated Snippet
struct tipc_mon_domain {
u16 len;
u16 gen;
u16 ack_gen;
u16 member_cnt;
u64 up_map;
u32 members[MAX_MON_DOMAIN];
};
/* struct tipc_peer: state of a peer node and its domain
* @addr: tipc node identity of peer
* @head_map: shows which other nodes currently consider peer 'up'
* @domain: most recent domain record from peer
* @hash: position in hashed lookup list
* @list: position in linked list, in circular ascending order by 'addr'
* @applied: number of reported domain members applied on this monitor list
* @is_up: peer is up as seen from this node
* @is_head: peer is assigned domain head as seen from this node
* @is_local: peer is in local domain and should be continuously monitored
* @down_cnt: - numbers of other peers which have reported this on lost
*/
struct tipc_peer {
u32 addr;
struct tipc_mon_domain *domain;
struct hlist_node hash;
struct list_head list;
u8 applied;
u8 down_cnt;
bool is_up;
bool is_head;
bool is_local;
};
struct tipc_monitor {
struct hlist_head peers[NODE_HTABLE_SIZE];
int peer_cnt;
struct tipc_peer *self;
rwlock_t lock;
struct tipc_mon_domain cache;
u16 list_gen;
u16 dom_gen;
struct net *net;
struct timer_list timer;
unsigned long timer_intv;
};
static struct tipc_monitor *tipc_monitor(struct net *net, int bearer_id)
{
return tipc_net(net)->monitors[bearer_id];
}
const int tipc_max_domain_size = sizeof(struct tipc_mon_domain);
static inline u16 mon_cpu_to_le16(u16 val)
{
return (__force __u16)htons(val);
}
static inline u32 mon_cpu_to_le32(u32 val)
{
return (__force __u32)htonl(val);
}
static inline u64 mon_cpu_to_le64(u64 val)
{
return (__force __u64)cpu_to_be64(val);
}
static inline u16 mon_le16_to_cpu(u16 val)
{
return ntohs((__force __be16)val);
}
static inline u32 mon_le32_to_cpu(u32 val)
{
return ntohl((__force __be32)val);
}
static inline u64 mon_le64_to_cpu(u64 val)
{
return be64_to_cpu((__force __be64)val);
}
/* dom_rec_len(): actual length of domain record for transport
*/
static int dom_rec_len(struct tipc_mon_domain *dom, u16 mcnt)
{
return (offsetof(struct tipc_mon_domain, members)) + (mcnt * sizeof(u32));
}
Annotation
- Immediate include surface: `net/genetlink.h`, `core.h`, `addr.h`, `monitor.h`, `bearer.h`.
- Detected declarations: `struct tipc_mon_domain`, `struct tipc_peer`, `struct tipc_monitor`, `function mon_cpu_to_le16`, `function mon_cpu_to_le32`, `function mon_cpu_to_le64`, `function mon_le16_to_cpu`, `function mon_le32_to_cpu`, `function mon_le64_to_cpu`, `function dom_rec_len`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
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.