drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c- Extension
.c- Size
- 136194 bytes
- Lines
- 5168
- 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/init.hlinux/module.hlinux/platform_device.hlinux/etherdevice.hlinux/of_net.hlinux/interrupt.hlinux/kthread.hlinux/iommu.hlinux/fsl/mc.hlinux/bpf.hlinux/bpf_trace.hlinux/fsl/ptp_qoriq.hlinux/ptp_classify.hnet/pkt_cls.hnet/sock.hnet/tso.hnet/xdp_sock_drv.hdpaa2-eth.hdpaa2-eth-trace.h
Detected Declarations
function dpaa2_eth_detect_featuresfunction dpaa2_update_ptp_onestep_indirectfunction dpaa2_update_ptp_onestep_directfunction dpaa2_ptp_onestep_reg_update_methodfunction dpaa2_eth_validate_rx_csumfunction dpaa2_eth_free_rx_fdfunction dpaa2_eth_free_bufsfunction dpaa2_eth_recycle_buffunction dpaa2_eth_xdp_flushfunction dpaa2_eth_xdp_tx_flushfunction dpaa2_eth_xdp_enqueuefunction dpaa2_eth_run_xdpfunction dpaa2_eth_receive_skbfunction dpaa2_eth_rxfunction dpaa2_eth_rx_errfunction overwritefunction dpaa2_eth_ptp_parsefunction dpaa2_eth_enable_tx_tstampfunction dpaa2_eth_sgt_recyclefunction dpaa2_eth_build_sg_fdfunction dpaa2_eth_build_sg_fd_single_buffunction dpaa2_eth_build_single_fdfunction dpaa2_eth_tx_conffunction dpaa2_eth_build_gso_fdfunction __dpaa2_eth_txfunction dpaa2_eth_tx_onestep_tstampfunction dpaa2_eth_txfunction dpaa2_eth_tx_conffunction dpaa2_eth_set_rx_vlan_filteringfunction dpaa2_eth_set_rx_csumfunction dpaa2_eth_set_tx_csumfunction dpaa2_eth_add_bufsfunction dpaa2_eth_seed_poolfunction dpaa2_eth_seed_poolsfunction dpaa2_eth_drain_bufsfunction dpaa2_eth_drain_poolfunction dpaa2_eth_drain_poolsfunction dpaa2_eth_refill_poolfunction dpaa2_eth_sgt_cache_drainfunction for_each_possible_cpufunction dpaa2_eth_pull_channelfunction dpaa2_eth_pollfunction dpaa2_eth_enable_ch_napifunction dpaa2_eth_disable_ch_napifunction dpaa2_eth_set_rx_taildropfunction dpaa2_eth_link_state_updatefunction dpaa2_eth_openfunction dpaa2_eth_ingress_fq_count
Annotated Snippet
static const struct net_device_ops dpaa2_eth_ops = {
.ndo_open = dpaa2_eth_open,
.ndo_start_xmit = dpaa2_eth_tx,
.ndo_stop = dpaa2_eth_stop,
.ndo_set_mac_address = dpaa2_eth_set_addr,
.ndo_get_stats64 = dpaa2_eth_get_stats,
.ndo_set_rx_mode = dpaa2_eth_set_rx_mode,
.ndo_set_features = dpaa2_eth_set_features,
.ndo_eth_ioctl = dpaa2_eth_ioctl,
.ndo_change_mtu = dpaa2_eth_change_mtu,
.ndo_bpf = dpaa2_eth_xdp,
.ndo_xdp_xmit = dpaa2_eth_xdp_xmit,
.ndo_xsk_wakeup = dpaa2_xsk_wakeup,
.ndo_setup_tc = dpaa2_eth_setup_tc,
.ndo_vlan_rx_add_vid = dpaa2_eth_rx_add_vid,
.ndo_vlan_rx_kill_vid = dpaa2_eth_rx_kill_vid,
.ndo_hwtstamp_get = dpaa2_eth_hwtstamp_get,
.ndo_hwtstamp_set = dpaa2_eth_hwtstamp_set,
};
static void dpaa2_eth_cdan_cb(struct dpaa2_io_notification_ctx *ctx)
{
struct dpaa2_eth_channel *ch;
ch = container_of(ctx, struct dpaa2_eth_channel, nctx);
/* Update NAPI statistics */
ch->stats.cdan++;
/* NAPI can also be scheduled from the AF_XDP Tx path. Mark a missed
* so that it can be rescheduled again.
*/
if (!napi_if_scheduled_mark_missed(&ch->napi))
napi_schedule(&ch->napi);
}
/* Allocate and configure a DPCON object */
static struct fsl_mc_device *dpaa2_eth_setup_dpcon(struct dpaa2_eth_priv *priv)
{
struct fsl_mc_device *dpcon;
struct device *dev = priv->net_dev->dev.parent;
int err;
err = fsl_mc_object_allocate(to_fsl_mc_device(dev),
FSL_MC_POOL_DPCON, &dpcon);
if (err) {
if (err == -ENXIO) {
dev_dbg(dev, "Waiting for DPCON\n");
err = -EPROBE_DEFER;
} else {
dev_info(dev, "Not enough DPCONs, will go on as-is\n");
}
return ERR_PTR(err);
}
err = dpcon_open(priv->mc_io, 0, dpcon->obj_desc.id, &dpcon->mc_handle);
if (err) {
dev_err(dev, "dpcon_open() failed\n");
goto free;
}
err = dpcon_reset(priv->mc_io, 0, dpcon->mc_handle);
if (err) {
dev_err(dev, "dpcon_reset() failed\n");
goto close;
}
err = dpcon_enable(priv->mc_io, 0, dpcon->mc_handle);
if (err) {
dev_err(dev, "dpcon_enable() failed\n");
goto close;
}
return dpcon;
close:
dpcon_close(priv->mc_io, 0, dpcon->mc_handle);
free:
fsl_mc_object_free(dpcon);
return ERR_PTR(err);
}
static void dpaa2_eth_free_dpcon(struct dpaa2_eth_priv *priv,
struct fsl_mc_device *dpcon)
{
dpcon_disable(priv->mc_io, 0, dpcon->mc_handle);
dpcon_close(priv->mc_io, 0, dpcon->mc_handle);
fsl_mc_object_free(dpcon);
}
Annotation
- Immediate include surface: `linux/init.h`, `linux/module.h`, `linux/platform_device.h`, `linux/etherdevice.h`, `linux/of_net.h`, `linux/interrupt.h`, `linux/kthread.h`, `linux/iommu.h`.
- Detected declarations: `function dpaa2_eth_detect_features`, `function dpaa2_update_ptp_onestep_indirect`, `function dpaa2_update_ptp_onestep_direct`, `function dpaa2_ptp_onestep_reg_update_method`, `function dpaa2_eth_validate_rx_csum`, `function dpaa2_eth_free_rx_fd`, `function dpaa2_eth_free_bufs`, `function dpaa2_eth_recycle_buf`, `function dpaa2_eth_xdp_flush`, `function dpaa2_eth_xdp_tx_flush`.
- 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.