drivers/net/ethernet/marvell/prestera/prestera_switchdev.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/prestera/prestera_switchdev.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/marvell/prestera/prestera_switchdev.c- Extension
.c- Size
- 46596 bytes
- Lines
- 1919
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- 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/if_bridge.hlinux/if_vlan.hlinux/kernel.hlinux/module.hlinux/notifier.hnet/netevent.hnet/switchdev.hprestera.hprestera_hw.hprestera_switchdev.h
Detected Declarations
struct prestera_fdb_event_workstruct prestera_switchdevstruct prestera_bridgestruct prestera_bridge_portstruct prestera_bridge_vlanstruct prestera_port_vlanstruct prestera_br_mdb_portstruct prestera_br_mdb_entryfunction prestera_bridge_findfunction __prestera_bridge_port_findfunction prestera_bridge_port_findfunction prestera_br_port_flags_resetfunction prestera_br_port_flags_setfunction prestera_bridge_vlan_createfunction prestera_bridge_vlan_destroyfunction prestera_bridge_vlan_by_vidfunction list_for_each_entryfunction prestera_bridge_vlan_port_countfunction list_for_each_entryfunction prestera_bridge_vlan_putfunction prestera_port_vlan_by_vidfunction list_for_each_entryfunction prestera_port_vlan_createfunction prestera_fdb_addfunction prestera_fdb_delfunction prestera_fdb_flush_port_vlanfunction prestera_fdb_flush_portfunction prestera_mdb_port_delfunction prestera_br_mdb_entry_putfunction prestera_br_mdb_port_delfunction list_for_each_entry_safefunction prestera_mdb_flush_bridge_portfunction list_for_each_entry_safefunction prestera_port_vlan_bridge_leavefunction prestera_port_vlan_destroyfunction prestera_bridge_createfunction prestera_bridge_destroyfunction prestera_bridge_putfunction __prestera_bridge_port_by_devfunction list_for_each_entryfunction prestera_match_upper_bridge_devfunction prestera_bridge_port_by_devfunction prestera_bridge_port_createfunction prestera_bridge_port_destroyfunction prestera_bridge_port_getfunction prestera_bridge_port_putfunction prestera_bridge_port_addfunction prestera_bridge_1d_port_join
Annotated Snippet
struct prestera_fdb_event_work {
struct work_struct work;
struct switchdev_notifier_fdb_info fdb_info;
struct net_device *dev;
unsigned long event;
};
struct prestera_switchdev {
struct prestera_switch *sw;
struct list_head bridge_list;
bool bridge_8021q_exists;
struct notifier_block swdev_nb_blk;
struct notifier_block swdev_nb;
};
struct prestera_bridge {
struct list_head head;
struct net_device *dev;
struct prestera_switchdev *swdev;
struct list_head port_list;
struct list_head br_mdb_entry_list;
bool mrouter_exist;
bool vlan_enabled;
bool multicast_enabled;
u16 bridge_id;
};
struct prestera_bridge_port {
struct list_head head;
struct net_device *dev;
struct prestera_bridge *bridge;
struct list_head vlan_list;
struct list_head br_mdb_port_list;
refcount_t ref_count;
unsigned long flags;
bool mrouter;
u8 stp_state;
};
struct prestera_bridge_vlan {
struct list_head head;
struct list_head port_vlan_list;
u16 vid;
};
struct prestera_port_vlan {
struct list_head br_vlan_head;
struct list_head port_head;
struct prestera_port *port;
struct prestera_bridge_port *br_port;
u16 vid;
};
struct prestera_br_mdb_port {
struct prestera_bridge_port *br_port;
struct list_head br_mdb_port_node;
};
/* Software representation of MDB table. */
struct prestera_br_mdb_entry {
struct prestera_bridge *bridge;
struct prestera_mdb_entry *mdb;
struct list_head br_mdb_port_list;
struct list_head br_mdb_entry_node;
bool enabled;
};
static struct workqueue_struct *swdev_wq;
static void prestera_bridge_port_put(struct prestera_bridge_port *br_port);
static int prestera_port_vid_stp_set(struct prestera_port *port, u16 vid,
u8 state);
static struct prestera_bridge *
prestera_bridge_find(const struct prestera_switch *sw,
const struct net_device *br_dev)
{
struct prestera_bridge *bridge;
list_for_each_entry(bridge, &sw->swdev->bridge_list, head)
if (bridge->dev == br_dev)
return bridge;
return NULL;
}
static struct prestera_bridge_port *
__prestera_bridge_port_find(const struct prestera_bridge *bridge,
const struct net_device *brport_dev)
Annotation
- Immediate include surface: `linux/if_bridge.h`, `linux/if_vlan.h`, `linux/kernel.h`, `linux/module.h`, `linux/notifier.h`, `net/netevent.h`, `net/switchdev.h`, `prestera.h`.
- Detected declarations: `struct prestera_fdb_event_work`, `struct prestera_switchdev`, `struct prestera_bridge`, `struct prestera_bridge_port`, `struct prestera_bridge_vlan`, `struct prestera_port_vlan`, `struct prestera_br_mdb_port`, `struct prestera_br_mdb_entry`, `function prestera_bridge_find`, `function __prestera_bridge_port_find`.
- Atlas domain: Driver Families / drivers/net.
- 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.