net/bridge/br_mrp.c
Source file repositories/reference/linux-study-clean/net/bridge/br_mrp.c
File Facts
- System
- Linux kernel
- Corpus path
net/bridge/br_mrp.c- Extension
.c- Size
- 32990 bytes
- Lines
- 1261
- 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
linux/mrp_bridge.hbr_private_mrp.h
Detected Declarations
function br_mrp_is_ring_portfunction br_mrp_is_in_portfunction list_for_each_entryfunction hlist_for_each_entry_rcufunction hlist_for_each_entry_rcufunction br_mrp_unique_ifindexfunction hlist_for_each_entry_rcufunction hlist_for_each_entry_rcufunction br_mrp_next_seqfunction br_mrp_skb_tlvfunction br_mrp_skb_commonfunction br_mrp_test_work_expiredfunction br_mrp_in_test_work_expiredfunction br_mrp_del_implfunction br_mrp_addfunction br_mrp_port_delfunction br_mrp_delfunction br_mrp_set_port_statefunction br_mrp_set_port_rolefunction br_mrp_set_ring_statefunction MRCfunction br_mrp_start_testfunction br_mrp_set_in_statefunction MICfunction br_mrp_start_in_testfunction br_mrp_ring_framefunction br_mrp_in_framefunction br_mrp_mrm_processfunction br_mrp_test_better_than_ownfunction br_mrp_mra_processfunction br_mrp_mim_processfunction br_mrp_get_frame_typefunction br_mrp_mrm_behaviourfunction br_mrp_mrc_behaviourfunction br_mrp_rcvfunction br_mrp_processfunction br_mrp_enabled
Annotated Snippet
if (port->dev->ifindex == ifindex) {
res = port;
break;
}
}
return res;
}
static struct br_mrp *br_mrp_find_id(struct net_bridge *br, u32 ring_id)
{
struct br_mrp *res = NULL;
struct br_mrp *mrp;
hlist_for_each_entry_rcu(mrp, &br->mrp_list, list,
lockdep_rtnl_is_held()) {
if (mrp->ring_id == ring_id) {
res = mrp;
break;
}
}
return res;
}
static struct br_mrp *br_mrp_find_in_id(struct net_bridge *br, u32 in_id)
{
struct br_mrp *res = NULL;
struct br_mrp *mrp;
hlist_for_each_entry_rcu(mrp, &br->mrp_list, list,
lockdep_rtnl_is_held()) {
if (mrp->in_id == in_id) {
res = mrp;
break;
}
}
return res;
}
static bool br_mrp_unique_ifindex(struct net_bridge *br, u32 ifindex)
{
struct br_mrp *mrp;
hlist_for_each_entry_rcu(mrp, &br->mrp_list, list,
lockdep_rtnl_is_held()) {
struct net_bridge_port *p;
p = rtnl_dereference(mrp->p_port);
if (p && p->dev->ifindex == ifindex)
return false;
p = rtnl_dereference(mrp->s_port);
if (p && p->dev->ifindex == ifindex)
return false;
p = rtnl_dereference(mrp->i_port);
if (p && p->dev->ifindex == ifindex)
return false;
}
return true;
}
static struct br_mrp *br_mrp_find_port(struct net_bridge *br,
struct net_bridge_port *p)
{
struct br_mrp *res = NULL;
struct br_mrp *mrp;
hlist_for_each_entry_rcu(mrp, &br->mrp_list, list,
lockdep_rtnl_is_held()) {
if (rcu_access_pointer(mrp->p_port) == p ||
rcu_access_pointer(mrp->s_port) == p ||
rcu_access_pointer(mrp->i_port) == p) {
res = mrp;
break;
}
}
return res;
}
static int br_mrp_next_seq(struct br_mrp *mrp)
{
mrp->seq_id++;
return mrp->seq_id;
}
Annotation
- Immediate include surface: `linux/mrp_bridge.h`, `br_private_mrp.h`.
- Detected declarations: `function br_mrp_is_ring_port`, `function br_mrp_is_in_port`, `function list_for_each_entry`, `function hlist_for_each_entry_rcu`, `function hlist_for_each_entry_rcu`, `function br_mrp_unique_ifindex`, `function hlist_for_each_entry_rcu`, `function hlist_for_each_entry_rcu`, `function br_mrp_next_seq`, `function br_mrp_skb_tlv`.
- 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.