drivers/net/dsa/realtek/realtek.h

Source file repositories/reference/linux-study-clean/drivers/net/dsa/realtek/realtek.h

File Facts

System
Linux kernel
Corpus path
drivers/net/dsa/realtek/realtek.h
Extension
.h
Size
6386 bytes
Lines
194
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 rtl8366_mib_counter {
	unsigned int	base;
	unsigned int	offset;
	unsigned int	length;
	const char	*name;
};

/*
 * struct rtl8366_vlan_mc - Virtual LAN member configuration
 */
struct rtl8366_vlan_mc {
	u16	vid;
	u16	untag;
	u16	member;
	u8	fid;
	u8	priority;
};

struct rtl8366_vlan_4k {
	u16	vid;
	u16	untag;
	u16	member;
	u8	fid;
};

struct realtek_fdb_entry {
	u8 mac_addr[ETH_ALEN];
	u16 vid;
	bool is_static;
};

struct realtek_priv {
	struct device		*dev;
	struct reset_control    *reset_ctl;
	struct gpio_desc	*reset;
	struct gpio_desc	*mdc;
	struct gpio_desc	*mdio;
	struct regmap		*map;
	struct regmap		*map_nolock;
	struct mutex		map_lock;
	/* vlan_lock protects against concurrent Read-Modify-Write operations
	 * on the global VLAN 4K and VLANMC tables, such as when adding or
	 * deleting port VLAN memberships and PVID configurations.
	 */
	struct mutex		vlan_lock;
	/* l2_lock is used to prevent concurrent modifications of L2 table
	 * entries while another function is reading it. l2_(add,del)_mc
	 * is an example that first read current table entry and then
	 * create/update it. l2_(add|del)_uc uses a single table op and,
	 * internally, it might not need this lock. However, altering FDB
	 * may still collide, as well as l2_flush, with fdb_dump iterating
	 * over FDB.
	 */
	struct mutex		l2_lock;
	struct mii_bus		*user_mii_bus;
	struct mii_bus		*bus;
	int			mdio_addr;

	const struct realtek_variant *variant;

	spinlock_t		lock; /* Locks around command writes */
	struct dsa_switch	ds;
	struct irq_domain	*irqdomain;
	bool			leds_disabled;

	unsigned int		cpu_port;
	unsigned int		num_ports;
	unsigned int		num_vlan_mc;
	unsigned int		num_mib_counters;
	struct rtl8366_mib_counter *mib_counters;

	const struct realtek_ops *ops;
	int			(*write_reg_noack)(void *ctx, u32 addr, u32 data);

	int			vlan_enabled;
	int			vlan4k_enabled;

	char			buf[4096];
	void			*chip_data; /* Per-chip extra variant data */
};

/*
 * struct realtek_ops - vtable for the per-SMI-chiptype operations
 * @detect: detects the chiptype
 */
struct realtek_ops {
	int	(*detect)(struct realtek_priv *priv);
	int	(*reset_chip)(struct realtek_priv *priv);
	int	(*setup)(struct realtek_priv *priv);
	int	(*get_mib_counter)(struct realtek_priv *priv,

Annotation

Implementation Notes