drivers/net/dsa/yt921x.c
Source file repositories/reference/linux-study-clean/drivers/net/dsa/yt921x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/dsa/yt921x.c- Extension
.c- Size
- 122806 bytes
- Lines
- 4983
- 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.
- 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/dcbnl.hlinux/etherdevice.hlinux/if_bridge.hlinux/if_hsr.hlinux/if_vlan.hlinux/iopoll.hlinux/mdio.hlinux/module.hlinux/of.hlinux/of_mdio.hlinux/of_net.hlinux/sort.hnet/dsa.hnet/dscp.hnet/ieee8021q.hnet/pkt_cls.hyt921x.h
Detected Declarations
struct yt921x_mib_descstruct yt921x_infostruct yt921x_reg_mdiostruct yt921x_markerstruct yt921x_acl_rule_extfunction ethaddr_hi4_to_u32function ethaddr_lo2_to_u32function yt921x_reg_readfunction yt921x_reg_writefunction yt921x_reg_waitfunction yt921x_reg_update_bitsfunction yt921x_reg_set_bitsfunction yt921x_reg_clear_bitsfunction yt921x_reg_toggle_bitsfunction update_ctrls_unalignedfunction yt921x_regs_readfunction yt921x_regs_writefunction yt921x_regs_update_bitsfunction yt921x_regs_clear_bitsfunction yt921x_reg64_writefunction yt921x_reg64_update_bitsfunction yt921x_reg64_clear_bitsfunction yt921x_reg96_writefunction yt921x_reg_mdio_readfunction yt921x_reg_mdio_writefunction yt921x_intif_waitfunction yt921x_intif_readfunction yt921x_intif_writefunction yt921x_mbus_int_readfunction yt921x_mbus_int_writefunction yt921x_mbus_int_initfunction yt921x_extif_waitfunction yt921x_extif_readfunction yt921x_extif_writefunction yt921x_mbus_ext_readfunction yt921x_mbus_ext_writefunction yt921x_mbus_ext_initfunction yt921x_read_mibfunction yt921x_poll_mibfunction yt921x_dsa_get_stringsfunction yt921x_dsa_get_ethtool_statsfunction yt921x_dsa_get_sset_countfunction yt921x_dsa_get_eth_mac_statsfunction yt921x_dsa_get_eth_ctrl_statsfunction yt921x_dsa_get_rmon_statsfunction yt921x_dsa_get_stats64function yt921x_dsa_get_pause_statsfunction yt921x_set_eee
Annotated Snippet
struct yt921x_mib_desc {
unsigned int size;
unsigned int offset;
const char *name;
};
#define MIB_DESC(_size, _offset, _name) \
{_size, _offset, _name}
/* Must agree with yt921x_mib
*
* Unstructured fields (name != NULL) will appear in get_ethtool_stats(),
* structured go to their *_stats() methods, but we need their sizes and offsets
* to perform 32bit MIB overflow wraparound.
*/
static const struct yt921x_mib_desc yt921x_mib_descs[] = {
MIB_DESC(1, YT921X_MIB_DATA_RX_BROADCAST, NULL),
MIB_DESC(1, YT921X_MIB_DATA_RX_PAUSE, NULL),
MIB_DESC(1, YT921X_MIB_DATA_RX_MULTICAST, NULL),
MIB_DESC(1, YT921X_MIB_DATA_RX_CRC_ERR, NULL),
MIB_DESC(1, YT921X_MIB_DATA_RX_ALIGN_ERR, NULL),
MIB_DESC(1, YT921X_MIB_DATA_RX_UNDERSIZE_ERR, NULL),
MIB_DESC(1, YT921X_MIB_DATA_RX_FRAG_ERR, NULL),
MIB_DESC(1, YT921X_MIB_DATA_RX_PKT_SZ_64, NULL),
MIB_DESC(1, YT921X_MIB_DATA_RX_PKT_SZ_65_TO_127, NULL),
MIB_DESC(1, YT921X_MIB_DATA_RX_PKT_SZ_128_TO_255, NULL),
MIB_DESC(1, YT921X_MIB_DATA_RX_PKT_SZ_256_TO_511, NULL),
MIB_DESC(1, YT921X_MIB_DATA_RX_PKT_SZ_512_TO_1023, NULL),
MIB_DESC(1, YT921X_MIB_DATA_RX_PKT_SZ_1024_TO_1518, NULL),
MIB_DESC(1, YT921X_MIB_DATA_RX_PKT_SZ_1519_TO_MAX, NULL),
MIB_DESC(2, YT921X_MIB_DATA_RX_GOOD_BYTES, NULL),
MIB_DESC(2, YT921X_MIB_DATA_RX_BAD_BYTES, "RxBadBytes"),
MIB_DESC(1, YT921X_MIB_DATA_RX_OVERSIZE_ERR, NULL),
MIB_DESC(1, YT921X_MIB_DATA_RX_DROPPED, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_BROADCAST, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_PAUSE, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_MULTICAST, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_UNDERSIZE_ERR, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_PKT_SZ_64, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_PKT_SZ_65_TO_127, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_PKT_SZ_128_TO_255, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_PKT_SZ_256_TO_511, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_PKT_SZ_512_TO_1023, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_PKT_SZ_1024_TO_1518, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_PKT_SZ_1519_TO_MAX, NULL),
MIB_DESC(2, YT921X_MIB_DATA_TX_GOOD_BYTES, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_COLLISION, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_EXCESSIVE_COLLISION, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_MULTIPLE_COLLISION, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_SINGLE_COLLISION, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_PKT, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_DEFERRED, NULL),
MIB_DESC(1, YT921X_MIB_DATA_TX_LATE_COLLISION, NULL),
MIB_DESC(1, YT921X_MIB_DATA_RX_OAM, "RxOAM"),
MIB_DESC(1, YT921X_MIB_DATA_TX_OAM, "TxOAM"),
};
struct yt921x_info {
const char *name;
u16 major;
/* Unknown, seems to be plain enumeration */
u8 mode;
u8 extmode;
/* Ports with integral GbE PHYs, not including MCU Port 10 */
u16 internal_mask;
/* TODO: see comments in yt921x_dsa_phylink_get_caps() */
u16 external_mask;
};
#define YT921X_PORT_MASK_INTn(port) BIT(port)
#define YT921X_PORT_MASK_INT0_n(n) GENMASK((n) - 1, 0)
#define YT921X_PORT_MASK_EXT0 BIT(8)
#define YT921X_PORT_MASK_EXT1 BIT(9)
static const struct yt921x_info yt921x_infos[] = {
{
"YT9215SC", YT9215_MAJOR, 1, 0,
YT921X_PORT_MASK_INT0_n(5),
YT921X_PORT_MASK_EXT0 | YT921X_PORT_MASK_EXT1,
},
Annotation
- Immediate include surface: `linux/dcbnl.h`, `linux/etherdevice.h`, `linux/if_bridge.h`, `linux/if_hsr.h`, `linux/if_vlan.h`, `linux/iopoll.h`, `linux/mdio.h`, `linux/module.h`.
- Detected declarations: `struct yt921x_mib_desc`, `struct yt921x_info`, `struct yt921x_reg_mdio`, `struct yt921x_marker`, `struct yt921x_acl_rule_ext`, `function ethaddr_hi4_to_u32`, `function ethaddr_lo2_to_u32`, `function yt921x_reg_read`, `function yt921x_reg_write`, `function yt921x_reg_wait`.
- Atlas domain: Driver Families / drivers/net.
- 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.