drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c- Extension
.c- Size
- 219370 bytes
- Lines
- 7919
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/acpi.hlinux/kernel.hlinux/netdevice.hlinux/etherdevice.hlinux/platform_device.hlinux/skbuff.hlinux/inetdevice.hlinux/mbus.hlinux/module.hlinux/mfd/syscon.hlinux/interrupt.hlinux/cpumask.hlinux/of.hlinux/of_irq.hlinux/of_mdio.hlinux/of_net.hlinux/of_address.hlinux/phy.hlinux/phylink.hlinux/phy/phy.hlinux/ptp_classify.hlinux/clk.hlinux/hrtimer.hlinux/ktime.hlinux/regmap.huapi/linux/ppp_defs.hnet/ip.hnet/ipv6.hnet/page_pool/helpers.hnet/tso.hlinux/bpf_trace.hmvpp2.h
Detected Declarations
struct mvpp2_ethtool_counterenum mvpp2_bm_pool_log_numfunction mvpp2_writefunction mvpp2_readfunction mvpp2_read_relaxedfunction mvpp2_cpu_to_threadfunction mvpp2_cm3_writefunction mvpp2_cm3_readfunction mvpp2_create_page_poolfunction MVPP2_BM_PHY_ALLOC_REGfunction mvpp2_thread_readfunction mvpp2_thread_write_relaxedfunction mvpp2_thread_read_relaxedfunction mvpp2_txdesc_dma_addr_getfunction mvpp2_txdesc_dma_addr_setfunction mvpp2_txdesc_size_getfunction mvpp2_txdesc_size_setfunction mvpp2_txdesc_txq_setfunction mvpp2_txdesc_cmd_setfunction mvpp2_txdesc_offset_getfunction mvpp2_rxdesc_dma_addr_getfunction mvpp2_rxdesc_cookie_getfunction mvpp2_rxdesc_size_getfunction mvpp2_rxdesc_status_getfunction mvpp2_txq_inc_getfunction mvpp2_txq_inc_putfunction mvpp2_get_nrxqsfunction mvpp2_egress_portfunction mvpp2_txq_physfunction mvpp2_frag_freefunction mvpp2_bm_pool_createfunction mvpp2_bm_pool_bufsize_setfunction mvpp2_bm_bufs_get_addrsfunction mvpp2_bm_bufs_freefunction mvpp2_check_hw_buf_numfunction mvpp2_bm_pool_destroyfunction mvpp2_bm_pools_initfunction mvpp23_bm_set_8pool_modefunction mvpp2_bm_pool_cleanupfunction mvpp2_bm_initfunction mvpp2_setup_bm_poolfunction mvpp2_rxq_long_pool_setfunction mvpp2_rxq_short_pool_setfunction mvpp2_rxq_enable_fcfunction mvpp2_rxq_disable_fcfunction mvpp2_bm_pool_update_fcfunction emptyfunction mvpp2_bm_pool_update_priv_fc
Annotated Snippet
static const struct net_device_ops mvpp2_netdev_ops = {
.ndo_open = mvpp2_open,
.ndo_stop = mvpp2_stop,
.ndo_start_xmit = mvpp2_tx,
.ndo_set_rx_mode = mvpp2_set_rx_mode,
.ndo_set_mac_address = mvpp2_set_mac_address,
.ndo_change_mtu = mvpp2_change_mtu,
.ndo_get_stats64 = mvpp2_get_stats64,
.ndo_eth_ioctl = mvpp2_ioctl,
.ndo_vlan_rx_add_vid = mvpp2_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = mvpp2_vlan_rx_kill_vid,
.ndo_set_features = mvpp2_set_features,
.ndo_bpf = mvpp2_xdp,
.ndo_xdp_xmit = mvpp2_xdp_xmit,
.ndo_hwtstamp_get = mvpp2_hwtstamp_get,
.ndo_hwtstamp_set = mvpp2_hwtstamp_set,
};
static const struct ethtool_ops mvpp2_eth_tool_ops = {
.rxfh_max_num_contexts = MVPP22_N_RSS_TABLES,
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
ETHTOOL_COALESCE_MAX_FRAMES,
.nway_reset = mvpp2_ethtool_nway_reset,
.get_link = ethtool_op_get_link,
.get_ts_info = mvpp2_ethtool_get_ts_info,
.set_coalesce = mvpp2_ethtool_set_coalesce,
.get_coalesce = mvpp2_ethtool_get_coalesce,
.get_drvinfo = mvpp2_ethtool_get_drvinfo,
.get_ringparam = mvpp2_ethtool_get_ringparam,
.set_ringparam = mvpp2_ethtool_set_ringparam,
.get_strings = mvpp2_ethtool_get_strings,
.get_ethtool_stats = mvpp2_ethtool_get_stats,
.get_sset_count = mvpp2_ethtool_get_sset_count,
.get_pauseparam = mvpp2_ethtool_get_pause_param,
.set_pauseparam = mvpp2_ethtool_set_pause_param,
.get_link_ksettings = mvpp2_ethtool_get_link_ksettings,
.set_link_ksettings = mvpp2_ethtool_set_link_ksettings,
.get_rx_ring_count = mvpp2_ethtool_get_rx_ring_count,
.get_rxnfc = mvpp2_ethtool_get_rxnfc,
.set_rxnfc = mvpp2_ethtool_set_rxnfc,
.get_rxfh_indir_size = mvpp2_ethtool_get_rxfh_indir_size,
.get_rxfh = mvpp2_ethtool_get_rxfh,
.set_rxfh = mvpp2_ethtool_set_rxfh,
.get_rxfh_fields = mvpp2_ethtool_get_rxfh_fields,
.set_rxfh_fields = mvpp2_ethtool_set_rxfh_fields,
.create_rxfh_context = mvpp2_create_rxfh_context,
.modify_rxfh_context = mvpp2_modify_rxfh_context,
.remove_rxfh_context = mvpp2_remove_rxfh_context,
.get_eee = mvpp2_ethtool_get_eee,
.set_eee = mvpp2_ethtool_set_eee,
};
/* Used for PPv2.1, or PPv2.2 with the old Device Tree binding that
* had a single IRQ defined per-port.
*/
static int mvpp2_simple_queue_vectors_init(struct mvpp2_port *port,
struct device_node *port_node)
{
struct mvpp2_queue_vector *v = &port->qvecs[0];
v->first_rxq = 0;
v->nrxqs = port->nrxqs;
v->type = MVPP2_QUEUE_VECTOR_SHARED;
v->sw_thread_id = 0;
v->sw_thread_mask = *cpumask_bits(cpu_online_mask);
v->port = port;
v->irq = irq_of_parse_and_map(port_node, 0);
if (v->irq <= 0)
return -EINVAL;
netif_napi_add(port->dev, &v->napi, mvpp2_poll);
port->nqvecs = 1;
return 0;
}
static int mvpp2_multi_queue_vectors_init(struct mvpp2_port *port,
struct device_node *port_node)
{
struct mvpp2 *priv = port->priv;
struct mvpp2_queue_vector *v;
int i, ret;
switch (queue_mode) {
case MVPP2_QDIST_SINGLE_MODE:
port->nqvecs = priv->nthreads + 1;
break;
case MVPP2_QDIST_MULTI_MODE:
port->nqvecs = priv->nthreads;
break;
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/kernel.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/platform_device.h`, `linux/skbuff.h`, `linux/inetdevice.h`, `linux/mbus.h`.
- Detected declarations: `struct mvpp2_ethtool_counter`, `enum mvpp2_bm_pool_log_num`, `function mvpp2_write`, `function mvpp2_read`, `function mvpp2_read_relaxed`, `function mvpp2_cpu_to_thread`, `function mvpp2_cm3_write`, `function mvpp2_cm3_read`, `function mvpp2_create_page_pool`, `function MVPP2_BM_PHY_ALLOC_REG`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.