drivers/net/ethernet/renesas/ravb_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/renesas/ravb_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/renesas/ravb_main.c- Extension
.c- Size
- 86356 bytes
- Lines
- 3330
- 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/cache.hlinux/clk.hlinux/delay.hlinux/dma-mapping.hlinux/err.hlinux/etherdevice.hlinux/ethtool.hlinux/if_vlan.hlinux/kernel.hlinux/list.hlinux/module.hlinux/net_tstamp.hlinux/of.hlinux/of_mdio.hlinux/of_net.hlinux/platform_device.hlinux/pm_runtime.hlinux/slab.hlinux/spinlock.hlinux/reset.hlinux/math64.hnet/ip.hnet/page_pool/helpers.hravb.h
Detected Declarations
function Copyrightfunction ravb_waitfunction ravb_set_opmodefunction ravb_set_rate_gbethfunction ravb_set_rate_rcarfunction ravb_read_mac_addressfunction ravb_mdio_ctrlfunction ravb_set_mdcfunction ravb_set_mdio_dirfunction ravb_set_mdio_datafunction ravb_get_mdio_datafunction ravb_rx_get_descfunction ravb_tx_freefunction ravb_rx_ring_freefunction ravb_ring_freefunction ravb_alloc_rx_bufferfunction ravb_rx_ring_refillfunction ravb_ring_formatfunction ravb_ring_initfunction ravb_csum_init_gbethfunction ravb_emac_init_gbethfunction ravb_emac_init_rcarfunction ravb_emac_init_rcar_gen4function ravb_emac_initfunction ravb_dmac_init_gbethfunction ravb_dmac_init_rcarfunction ravb_dmac_initfunction ravb_get_tx_tstampfunction list_for_each_entry_safefunction ravb_rx_csum_gbethfunction ravb_rx_csumfunction ravb_rx_gbethfunction ravb_rx_rcar_hwstampfunction ravb_rx_rcarfunction ravb_rxfunction ravb_rcv_snd_disablefunction ravb_rcv_snd_enablefunction ravb_stop_dmafunction ravb_emac_interrupt_unlockedfunction ravb_emac_interruptfunction ravb_error_interruptfunction ravb_queue_interruptfunction ravb_timestamp_interruptfunction ravb_interruptfunction ravb_multi_interruptfunction ravb_dma_interruptfunction ravb_be_interruptfunction ravb_nc_interrupt
Annotated Snippet
static const struct net_device_ops ravb_netdev_ops = {
.ndo_open = ravb_open,
.ndo_stop = ravb_close,
.ndo_start_xmit = ravb_start_xmit,
.ndo_select_queue = ravb_select_queue,
.ndo_get_stats = ravb_get_stats,
.ndo_set_rx_mode = ravb_set_rx_mode,
.ndo_tx_timeout = ravb_tx_timeout,
.ndo_eth_ioctl = phy_do_ioctl_running,
.ndo_change_mtu = ravb_change_mtu,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
.ndo_set_features = ravb_set_features,
.ndo_hwtstamp_get = ravb_hwtstamp_get,
.ndo_hwtstamp_set = ravb_hwtstamp_set,
};
/* MDIO bus init function */
static int ravb_mdio_init(struct ravb_private *priv)
{
struct platform_device *pdev = priv->pdev;
struct device *dev = &pdev->dev;
struct device_node *mdio_node;
struct phy_device *phydev;
struct device_node *pn;
int error;
/* Bitbang init */
priv->mdiobb.ops = &bb_ops;
/* MII controller setting */
priv->mii_bus = alloc_mdio_bitbang(&priv->mdiobb);
if (!priv->mii_bus)
return -ENOMEM;
/* Hook up MII support for ethtool */
priv->mii_bus->name = "ravb_mii";
priv->mii_bus->parent = dev;
snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
pdev->name, pdev->id);
/* Register MDIO bus */
mdio_node = of_get_child_by_name(dev->of_node, "mdio");
if (!mdio_node) {
/* backwards compatibility for DT lacking mdio subnode */
mdio_node = of_node_get(dev->of_node);
}
error = of_mdiobus_register(priv->mii_bus, mdio_node);
of_node_put(mdio_node);
if (error)
goto out_free_bus;
pn = of_parse_phandle(dev->of_node, "phy-handle", 0);
phydev = of_phy_find_device(pn);
if (phydev) {
phydev->mac_managed_pm = true;
put_device(&phydev->mdio.dev);
}
of_node_put(pn);
return 0;
out_free_bus:
free_mdio_bitbang(priv->mii_bus);
return error;
}
/* MDIO bus release function */
static int ravb_mdio_release(struct ravb_private *priv)
{
/* Unregister mdio bus */
mdiobus_unregister(priv->mii_bus);
/* Free bitbang info */
free_mdio_bitbang(priv->mii_bus);
return 0;
}
static const struct ravb_hw_info ravb_gen2_hw_info = {
.receive = ravb_rx_rcar,
.set_rate = ravb_set_rate_rcar,
.set_feature = ravb_set_features_rcar,
.dmac_init = ravb_dmac_init_rcar,
.emac_init = ravb_emac_init_rcar,
.gstrings_stats = ravb_gstrings_stats,
.gstrings_size = sizeof(ravb_gstrings_stats),
.net_hw_features = NETIF_F_RXCSUM,
.net_features = NETIF_F_RXCSUM,
.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
Annotation
- Immediate include surface: `linux/cache.h`, `linux/clk.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/err.h`, `linux/etherdevice.h`, `linux/ethtool.h`, `linux/if_vlan.h`.
- Detected declarations: `function Copyright`, `function ravb_wait`, `function ravb_set_opmode`, `function ravb_set_rate_gbeth`, `function ravb_set_rate_rcar`, `function ravb_read_mac_address`, `function ravb_mdio_ctrl`, `function ravb_set_mdc`, `function ravb_set_mdio_dir`, `function ravb_set_mdio_data`.
- 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.