drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c- Extension
.c- Size
- 63850 bytes
- Lines
- 2316
- 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/clk.hlinux/crc32.hlinux/dma-mapping.hlinux/etherdevice.hlinux/ethtool.hlinux/if.hlinux/if_ether.hlinux/if_vlan.hlinux/init.hlinux/interrupt.hlinux/ip.hlinux/kernel.hlinux/mii.hlinux/module.hlinux/net_tstamp.hlinux/netdevice.hlinux/phy.hlinux/platform_device.hlinux/prefetch.hlinux/skbuff.hlinux/slab.hlinux/tcp.hlinux/sxgbe_platform.hsxgbe_common.hsxgbe_desc.hsxgbe_dma.hsxgbe_mtl.hsxgbe_reg.h
Detected Declarations
function sxgbe_verify_argsfunction sxgbe_enable_eee_modefunction sxgbe_disable_eee_modefunction sxgbe_eee_ctrl_timerfunction EEEfunction sxgbe_eee_adjustfunction sxgbe_clk_csr_setfunction sxgbe_tx_availfunction sxgbe_adjust_linkfunction sxgbe_init_phyfunction sxgbe_clear_descriptorsfunction sxgbe_init_rx_buffersfunction sxgbe_free_rx_buffersfunction init_tx_ringfunction free_rx_ringfunction init_rx_ringfunction free_tx_ringfunction init_dma_desc_ringsfunction tx_free_ring_skbufsfunction dma_free_tx_skbufsfunction SXGBE_FOR_EACH_QUEUEfunction free_dma_desc_resourcesfunction txring_mem_allocfunction SXGBE_FOR_EACH_QUEUEfunction rxring_mem_allocfunction SXGBE_FOR_EACH_QUEUEfunction sxgbe_mtl_operation_modefunction sxgbe_tx_queue_cleanfunction sxgbe_tx_availfunction sxgbe_tx_all_cleanfunction SXGBE_FOR_EACH_QUEUEfunction sxgbe_restart_tx_queuefunction sxgbe_reset_all_tx_queuesfunction sxgbe_get_hw_featuresfunction sxgbe_check_ether_addrfunction sxgbe_init_dma_enginefunction sxgbe_init_mtl_enginefunction SXGBE_FOR_EACH_QUEUEfunction sxgbe_disable_mtl_enginefunction sxgbe_tx_timerfunction sxgbe_tx_init_coalescefunction SXGBE_FOR_EACH_QUEUEfunction sxgbe_tx_del_timerfunction SXGBE_FOR_EACH_QUEUEfunction appropriatefunction sxgbe_releasefunction sxgbe_tso_preparefunction sxgbe_xmit
Annotated Snippet
static const struct net_device_ops sxgbe_netdev_ops = {
.ndo_open = sxgbe_open,
.ndo_start_xmit = sxgbe_xmit,
.ndo_stop = sxgbe_release,
.ndo_get_stats64 = sxgbe_get_stats64,
.ndo_change_mtu = sxgbe_change_mtu,
.ndo_set_features = sxgbe_set_features,
.ndo_set_rx_mode = sxgbe_set_rx_mode,
.ndo_tx_timeout = sxgbe_tx_timeout,
.ndo_eth_ioctl = sxgbe_ioctl,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = sxgbe_poll_controller,
#endif
.ndo_set_mac_address = eth_mac_addr,
};
/* Get the hardware ops */
static void sxgbe_get_ops(struct sxgbe_ops * const ops_ptr)
{
ops_ptr->mac = sxgbe_get_core_ops();
ops_ptr->desc = sxgbe_get_desc_ops();
ops_ptr->dma = sxgbe_get_dma_ops();
ops_ptr->mtl = sxgbe_get_mtl_ops();
/* set the MDIO communication Address/Data regisers */
ops_ptr->mii.addr = SXGBE_MDIO_SCMD_ADD_REG;
ops_ptr->mii.data = SXGBE_MDIO_SCMD_DATA_REG;
/* Assigning the default link settings
* no SXGBE defined default values to be set in registers,
* so assigning as 0 for port and duplex
*/
ops_ptr->link.port = 0;
ops_ptr->link.duplex = 0;
ops_ptr->link.speed = SXGBE_SPEED_10G;
}
/**
* sxgbe_hw_init - Init the GMAC device
* @priv: driver private structure
* Description: this function checks the HW capability
* (if supported) and sets the driver's features.
*/
static int sxgbe_hw_init(struct sxgbe_priv_data * const priv)
{
u32 ctrl_ids;
priv->hw = kmalloc_obj(*priv->hw);
if(!priv->hw)
return -ENOMEM;
/* get the hardware ops */
sxgbe_get_ops(priv->hw);
/* get the controller id */
ctrl_ids = priv->hw->mac->get_controller_version(priv->ioaddr);
priv->hw->ctrl_uid = (ctrl_ids & 0x00ff0000) >> 16;
priv->hw->ctrl_id = (ctrl_ids & 0x000000ff);
pr_info("user ID: 0x%x, Controller ID: 0x%x\n",
priv->hw->ctrl_uid, priv->hw->ctrl_id);
/* get the H/W features */
if (!sxgbe_get_hw_features(priv))
pr_info("Hardware features not found\n");
if (priv->hw_cap.tx_csum_offload)
pr_info("TX Checksum offload supported\n");
if (priv->hw_cap.rx_csum_offload)
pr_info("RX Checksum offload supported\n");
return 0;
}
static int sxgbe_sw_reset(void __iomem *addr)
{
int retry_count = 10;
writel(SXGBE_DMA_SOFT_RESET, addr + SXGBE_DMA_MODE_REG);
while (retry_count--) {
if (!(readl(addr + SXGBE_DMA_MODE_REG) &
SXGBE_DMA_SOFT_RESET))
break;
mdelay(10);
}
if (retry_count < 0)
return -EBUSY;
return 0;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/crc32.h`, `linux/dma-mapping.h`, `linux/etherdevice.h`, `linux/ethtool.h`, `linux/if.h`, `linux/if_ether.h`, `linux/if_vlan.h`.
- Detected declarations: `function sxgbe_verify_args`, `function sxgbe_enable_eee_mode`, `function sxgbe_disable_eee_mode`, `function sxgbe_eee_ctrl_timer`, `function EEE`, `function sxgbe_eee_adjust`, `function sxgbe_clk_csr_set`, `function sxgbe_tx_avail`, `function sxgbe_adjust_link`, `function sxgbe_init_phy`.
- 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.