drivers/net/dsa/mxl862xx/mxl862xx.c
Source file repositories/reference/linux-study-clean/drivers/net/dsa/mxl862xx/mxl862xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/dsa/mxl862xx/mxl862xx.c- Extension
.c- Size
- 65797 bytes
- Lines
- 2214
- 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/bitfield.hlinux/delay.hlinux/etherdevice.hlinux/if_bridge.hlinux/module.hlinux/of_device.hlinux/of_mdio.hlinux/phy.hlinux/phylink.hnet/dsa.hmxl862xx.hmxl862xx-api.hmxl862xx-cmd.hmxl862xx-host.hmxl862xx-phylink.h
Detected Declarations
struct mxl862xx_mib_descstruct mxl862xx_evlan_rule_descenum mxl862xx_evlan_actionfunction mxl862xx_get_tag_protocolfunction mxl862xx_phy_read_mmdfunction mxl862xx_phy_write_mmdfunction mxl862xx_phy_read_mii_busfunction mxl862xx_phy_write_mii_busfunction mxl862xx_phy_read_c45_mii_busfunction mxl862xx_phy_write_c45_mii_busfunction mxl862xx_wait_readyfunction mxl862xx_setup_mdiofunction mxl862xx_bridge_config_fwdfunction mxl862xx_setup_drop_meterfunction mxl862xx_set_bridge_portfunction dsa_switch_for_each_bridge_memberfunction vlan_filteringfunction mxl862xx_sync_bridge_membersfunction dsa_switch_for_each_bridge_memberfunction mxl862xx_evlan_block_allocfunction mxl862xx_vf_block_allocfunction mxl862xx_vf_entry_discardfunction mxl862xx_vf_allocfunction mxl862xx_allocate_bridgefunction mxl862xx_free_bridgefunction mxl862xx_setupfunction mxl862xx_port_statefunction mxl862xx_port_enablefunction mxl862xx_port_disablefunction mxl862xx_port_fast_agefunction mxl862xx_configure_ctp_portfunction mxl862xx_configure_sp_tag_protofunction mxl862xx_evlan_write_rulefunction mxl862xx_evlan_deactivate_entryfunction mxl862xx_evlan_write_final_rulesfunction mxl862xx_vf_entry_setfunction mxl862xx_vf_add_vidfunction mxl862xx_vf_del_vidfunction mxl862xx_evlan_program_ingressfunction mxl862xx_evlan_program_egressfunction list_for_each_entryfunction mxl862xx_port_vlan_filteringfunction mxl862xx_port_vlan_addfunction mxl862xx_port_vlan_delfunction mxl862xx_setup_cpu_bridgefunction mxl862xx_port_bridge_joinfunction mxl862xx_port_bridge_leavefunction mxl862xx_port_setup
Annotated Snippet
struct mxl862xx_mib_desc {
unsigned int size;
unsigned int offset;
const char *name;
};
#define MIB_DESC(_size, _name, _element) \
{ \
.size = _size, \
.name = _name, \
.offset = offsetof(struct mxl862xx_rmon_port_cnt, _element) \
}
/* Hardware-specific counters not covered by any standardized stats callback. */
static const struct mxl862xx_mib_desc mxl862xx_mib[] = {
MIB_DESC(1, "TxAcmDroppedPkts", tx_acm_dropped_pkts),
MIB_DESC(1, "RxFilteredPkts", rx_filtered_pkts),
MIB_DESC(1, "RxExtendedVlanDiscardPkts", rx_extended_vlan_discard_pkts),
MIB_DESC(1, "MtuExceedDiscardPkts", mtu_exceed_discard_pkts),
MIB_DESC(2, "RxBadBytes", rx_bad_bytes),
};
static const struct ethtool_rmon_hist_range mxl862xx_rmon_ranges[] = {
{ 0, 64 },
{ 65, 127 },
{ 128, 255 },
{ 256, 511 },
{ 512, 1023 },
{ 1024, 10240 },
{}
};
#define MXL862XX_SDMA_PCTRLP(p) (0xbc0 + ((p) * 0x6))
#define MXL862XX_SDMA_PCTRL_EN BIT(0)
#define MXL862XX_FDMA_PCTRLP(p) (0xa80 + ((p) * 0x6))
#define MXL862XX_FDMA_PCTRL_EN BIT(0)
#define MXL862XX_READY_TIMEOUT_MS 10000
#define MXL862XX_READY_POLL_MS 100
#define MXL862XX_TCM_INST_SEL 0xe00
#define MXL862XX_TCM_CBS 0xe12
#define MXL862XX_TCM_EBS 0xe13
static const int mxl862xx_flood_meters[] = {
MXL862XX_BRIDGE_PORT_EGRESS_METER_UNKNOWN_UC,
MXL862XX_BRIDGE_PORT_EGRESS_METER_UNKNOWN_MC_IP,
MXL862XX_BRIDGE_PORT_EGRESS_METER_UNKNOWN_MC_NON_IP,
MXL862XX_BRIDGE_PORT_EGRESS_METER_BROADCAST,
};
enum mxl862xx_evlan_action {
EVLAN_ACCEPT, /* pass-through, no tag removal */
EVLAN_STRIP_IF_UNTAGGED, /* remove 1 tag if entry's untagged flag set */
EVLAN_PVID_OR_DISCARD, /* insert PVID tag or discard if no PVID */
EVLAN_STRIP1_AND_PVID_OR_DISCARD,/* strip 1 tag + insert PVID, or discard */
};
struct mxl862xx_evlan_rule_desc {
u8 outer_type; /* enum mxl862xx_extended_vlan_filter_type */
u8 inner_type; /* enum mxl862xx_extended_vlan_filter_type */
u8 outer_tpid; /* enum mxl862xx_extended_vlan_filter_tpid */
u8 inner_tpid; /* enum mxl862xx_extended_vlan_filter_tpid */
bool match_vid; /* true: match on VID from the vid parameter */
u8 action; /* enum mxl862xx_evlan_action */
};
/* Shorthand constants for readability */
#define FT_NORMAL MXL862XX_EXTENDEDVLAN_FILTER_TYPE_NORMAL
#define FT_NO_FILTER MXL862XX_EXTENDEDVLAN_FILTER_TYPE_NO_FILTER
#define FT_DEFAULT MXL862XX_EXTENDEDVLAN_FILTER_TYPE_DEFAULT
#define FT_NO_TAG MXL862XX_EXTENDEDVLAN_FILTER_TYPE_NO_TAG
#define TP_NONE MXL862XX_EXTENDEDVLAN_FILTER_TPID_NO_FILTER
#define TP_8021Q MXL862XX_EXTENDEDVLAN_FILTER_TPID_8021Q
/*
* VLAN-aware ingress: 7 final catchall rules.
*
* VLAN Filter handles VID membership for tagged frames, so the
* Extended VLAN ingress block only needs to handle:
* - Priority-tagged (VID=0): strip + insert PVID
* - Untagged: insert PVID or discard
* - Standard 802.1Q VID>0: pass through (VF handles membership)
* - Non-8021Q TPID (0x88A8 etc.): treat as untagged
*
* Rule ordering is critical: the EVLAN engine scans entries in
* ascending index order and stops at the first match.
*
* The 802.1Q ACCEPT rules (indices 3--4) must appear BEFORE the
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/delay.h`, `linux/etherdevice.h`, `linux/if_bridge.h`, `linux/module.h`, `linux/of_device.h`, `linux/of_mdio.h`, `linux/phy.h`.
- Detected declarations: `struct mxl862xx_mib_desc`, `struct mxl862xx_evlan_rule_desc`, `enum mxl862xx_evlan_action`, `function mxl862xx_get_tag_protocol`, `function mxl862xx_phy_read_mmd`, `function mxl862xx_phy_write_mmd`, `function mxl862xx_phy_read_mii_bus`, `function mxl862xx_phy_write_mii_bus`, `function mxl862xx_phy_read_c45_mii_bus`, `function mxl862xx_phy_write_c45_mii_bus`.
- 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.