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.

Dependency Surface

Detected Declarations

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

Implementation Notes