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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/phy.hlinux/platform_device.hlinux/gpio/consumer.hnet/dsa.hlinux/reset.h
Detected Declarations
struct phylink_mac_opsstruct realtek_opsstruct rtl8366_mib_counterstruct rtl8366_vlan_mcstruct rtl8366_vlan_4kstruct realtek_fdb_entrystruct realtek_privstruct realtek_opsstruct realtek_variant
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
- Immediate include surface: `linux/phy.h`, `linux/platform_device.h`, `linux/gpio/consumer.h`, `net/dsa.h`, `linux/reset.h`.
- Detected declarations: `struct phylink_mac_ops`, `struct realtek_ops`, `struct rtl8366_mib_counter`, `struct rtl8366_vlan_mc`, `struct rtl8366_vlan_4k`, `struct realtek_fdb_entry`, `struct realtek_priv`, `struct realtek_ops`, `struct realtek_variant`.
- 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.