drivers/net/ethernet/ni/nixge.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/ni/nixge.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/ni/nixge.c- Extension
.c- Size
- 39654 bytes
- Lines
- 1429
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/etherdevice.hlinux/module.hlinux/netdevice.hlinux/of.hlinux/of_mdio.hlinux/of_net.hlinux/platform_device.hlinux/skbuff.hlinux/phy.hlinux/mii.hlinux/nvmem-consumer.hlinux/ethtool.hlinux/iopoll.h
Detected Declarations
struct nixge_hw_dma_bdstruct nixge_tx_skbstruct nixge_privenum nixge_versionfunction nixge_dma_write_regfunction nixge_dma_write_desc_regfunction nixge_dma_read_regfunction nixge_ctrl_write_regfunction nixge_ctrl_read_regfunction nixge_hw_dma_bd_releasefunction nixge_hw_dma_bd_initfunction __nixge_device_resetfunction nixge_device_resetfunction nixge_handle_link_changefunction nixge_tx_skb_unmapfunction nixge_start_xmit_donefunction nixge_check_tx_bd_spacefunction nixge_start_xmitfunction nixge_recvfunction nixge_pollfunction nixge_tx_irqfunction nixge_rx_irqfunction nixge_dma_err_handlerfunction nixge_openfunction nixge_stopfunction nixge_change_mtufunction __nixge_hw_set_mac_addressfunction nixge_net_set_mac_addressfunction nixge_ethtools_get_drvinfofunction nixge_ethtools_get_coalescefunction nixge_ethtools_set_coalescefunction nixge_ethtools_set_phys_idfunction nixge_mdio_read_c22function nixge_mdio_read_c45function nixge_mdio_write_c22function nixge_mdio_write_c45function nixge_mdio_setupfunction nixge_of_get_resourcesfunction nixge_probefunction nixge_remove
Annotated Snippet
static const struct net_device_ops nixge_netdev_ops = {
.ndo_open = nixge_open,
.ndo_stop = nixge_stop,
.ndo_start_xmit = nixge_start_xmit,
.ndo_change_mtu = nixge_change_mtu,
.ndo_set_mac_address = nixge_net_set_mac_address,
.ndo_validate_addr = eth_validate_addr,
};
static void nixge_ethtools_get_drvinfo(struct net_device *ndev,
struct ethtool_drvinfo *ed)
{
strscpy(ed->driver, "nixge", sizeof(ed->driver));
strscpy(ed->bus_info, "platform", sizeof(ed->bus_info));
}
static int
nixge_ethtools_get_coalesce(struct net_device *ndev,
struct ethtool_coalesce *ecoalesce,
struct kernel_ethtool_coalesce *kernel_coal,
struct netlink_ext_ack *extack)
{
struct nixge_priv *priv = netdev_priv(ndev);
u32 regval = 0;
regval = nixge_dma_read_reg(priv, XAXIDMA_RX_CR_OFFSET);
ecoalesce->rx_max_coalesced_frames = (regval & XAXIDMA_COALESCE_MASK)
>> XAXIDMA_COALESCE_SHIFT;
regval = nixge_dma_read_reg(priv, XAXIDMA_TX_CR_OFFSET);
ecoalesce->tx_max_coalesced_frames = (regval & XAXIDMA_COALESCE_MASK)
>> XAXIDMA_COALESCE_SHIFT;
return 0;
}
static int
nixge_ethtools_set_coalesce(struct net_device *ndev,
struct ethtool_coalesce *ecoalesce,
struct kernel_ethtool_coalesce *kernel_coal,
struct netlink_ext_ack *extack)
{
struct nixge_priv *priv = netdev_priv(ndev);
if (netif_running(ndev)) {
netdev_err(ndev,
"Please stop netif before applying configuration\n");
return -EBUSY;
}
if (ecoalesce->rx_max_coalesced_frames)
priv->coalesce_count_rx = ecoalesce->rx_max_coalesced_frames;
if (ecoalesce->tx_max_coalesced_frames)
priv->coalesce_count_tx = ecoalesce->tx_max_coalesced_frames;
return 0;
}
static int nixge_ethtools_set_phys_id(struct net_device *ndev,
enum ethtool_phys_id_state state)
{
struct nixge_priv *priv = netdev_priv(ndev);
u32 ctrl;
ctrl = nixge_ctrl_read_reg(priv, NIXGE_REG_LED_CTL);
switch (state) {
case ETHTOOL_ID_ACTIVE:
ctrl |= NIXGE_ID_LED_CTL_EN;
/* Enable identification LED override*/
nixge_ctrl_write_reg(priv, NIXGE_REG_LED_CTL, ctrl);
return 2;
case ETHTOOL_ID_ON:
ctrl |= NIXGE_ID_LED_CTL_VAL;
nixge_ctrl_write_reg(priv, NIXGE_REG_LED_CTL, ctrl);
break;
case ETHTOOL_ID_OFF:
ctrl &= ~NIXGE_ID_LED_CTL_VAL;
nixge_ctrl_write_reg(priv, NIXGE_REG_LED_CTL, ctrl);
break;
case ETHTOOL_ID_INACTIVE:
/* Restore LED settings */
ctrl &= ~NIXGE_ID_LED_CTL_EN;
nixge_ctrl_write_reg(priv, NIXGE_REG_LED_CTL, ctrl);
break;
}
return 0;
}
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/module.h`, `linux/netdevice.h`, `linux/of.h`, `linux/of_mdio.h`, `linux/of_net.h`, `linux/platform_device.h`, `linux/skbuff.h`.
- Detected declarations: `struct nixge_hw_dma_bd`, `struct nixge_tx_skb`, `struct nixge_priv`, `enum nixge_version`, `function nixge_dma_write_reg`, `function nixge_dma_write_desc_reg`, `function nixge_dma_read_reg`, `function nixge_ctrl_write_reg`, `function nixge_ctrl_read_reg`, `function nixge_hw_dma_bd_release`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- 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.