include/net/netns/mctp.h

Source file repositories/reference/linux-study-clean/include/net/netns/mctp.h

File Facts

System
Linux kernel
Corpus path
include/net/netns/mctp.h
Extension
.h
Size
1212 bytes
Lines
50
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct netns_mctp {
	/* Only updated under RTNL, entries freed via RCU */
	struct list_head routes;

	/* Bound sockets: hash table of sockets, keyed by
	 * (type, src_eid, dest_eid).
	 * Specific src_eid/dest_eid entries also have an entry for
	 * MCTP_ADDR_ANY. This list is updated from non-atomic contexts
	 * (under bind_lock), and read (under rcu) in packet rx.
	 */
	struct mutex bind_lock;
	DECLARE_HASHTABLE(binds, MCTP_BINDS_BITS);

	/* tag allocations. This list is read and updated from atomic contexts,
	 * but elements are free()ed after a RCU grace-period
	 */
	spinlock_t keys_lock;
	struct hlist_head keys;

	/* MCTP network */
	unsigned int default_net;

	/* neighbour table */
	struct mutex neigh_lock;
	struct list_head neighbours;
};

static inline u32 mctp_bind_hash(u8 type, u8 local_addr, u8 peer_addr)
{
	return hash_32(type | (u32)local_addr << 8 | (u32)peer_addr << 16,
		       MCTP_BINDS_BITS);
}

#endif /* __NETNS_MCTP_H__ */

Annotation

Implementation Notes