drivers/net/ethernet/myricom/myri10ge/myri10ge.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/myricom/myri10ge/myri10ge.c- Extension
.c- Size
- 113515 bytes
- Lines
- 4072
- 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.
- 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/tcp.hlinux/netdevice.hlinux/skbuff.hlinux/string.hlinux/module.hlinux/pci.hlinux/dma-mapping.hlinux/etherdevice.hlinux/if_ether.hlinux/if_vlan.hlinux/dca.hlinux/ip.hlinux/inet.hlinux/in.hlinux/ethtool.hlinux/firmware.hlinux/delay.hlinux/timer.hlinux/vmalloc.hlinux/crc32.hlinux/moduleparam.hlinux/io.hlinux/log2.hlinux/slab.hlinux/prefetch.hnet/checksum.hnet/gso.hnet/ip.hnet/tcp.hasm/byteorder.hasm/processor.hmyri10ge_mcp.h
Detected Declarations
struct myri10ge_rx_buffer_statestruct myri10ge_tx_buffer_statestruct myri10ge_cmdstruct myri10ge_rx_bufstruct myri10ge_tx_bufstruct myri10ge_rx_donestruct myri10ge_slice_netstatsstruct myri10ge_slice_statestruct myri10ge_privfunction put_be32function set_fw_namefunction myri10ge_send_cmdfunction myri10ge_read_mac_addrfunction myri10ge_dummy_rdmafunction myri10ge_validate_firmwarefunction myri10ge_load_hotplug_firmwarefunction myri10ge_adopt_running_firmwarefunction myri10ge_get_firmware_capabilitiesfunction myri10ge_load_firmwarefunction myri10ge_update_mac_addressfunction myri10ge_change_pausefunction myri10ge_change_promiscfunction myri10ge_dma_testfunction myri10ge_resetfunction myri10ge_probe_slicesfunction myri10ge_toggle_relaxedfunction myri10ge_write_dcafunction myri10ge_update_dcafunction myri10ge_setup_dcafunction myri10ge_teardown_dcafunction myri10ge_notify_dca_devicefunction myri10ge_submit_8rxfunction myri10ge_alloc_rx_pagesfunction myri10ge_unmap_rx_pagefunction myri10ge_vlan_rxfunction myri10ge_rx_donefunction myri10ge_tx_donefunction myri10ge_clean_rx_donefunction myri10ge_check_statblockfunction myri10ge_pollfunction myri10ge_intrfunction myri10ge_get_link_ksettingsfunction myri10ge_get_drvinfofunction myri10ge_get_coalescefunction myri10ge_set_coalescefunction myri10ge_get_pauseparamfunction myri10ge_set_pauseparamfunction myri10ge_get_ringparam
Annotated Snippet
static const struct net_device_ops myri10ge_netdev_ops = {
.ndo_open = myri10ge_open,
.ndo_stop = myri10ge_close,
.ndo_start_xmit = myri10ge_xmit,
.ndo_get_stats64 = myri10ge_get_stats,
.ndo_validate_addr = eth_validate_addr,
.ndo_change_mtu = myri10ge_change_mtu,
.ndo_set_rx_mode = myri10ge_set_multicast_list,
.ndo_set_mac_address = myri10ge_set_mac_address,
};
static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
struct net_device *netdev;
struct myri10ge_priv *mgp;
struct device *dev = &pdev->dev;
int status = -ENXIO;
unsigned hdr_offset, ss_offset;
static int board_number;
netdev = alloc_etherdev_mq(sizeof(*mgp), MYRI10GE_MAX_SLICES);
if (netdev == NULL)
return -ENOMEM;
SET_NETDEV_DEV(netdev, &pdev->dev);
mgp = netdev_priv(netdev);
mgp->dev = netdev;
mgp->pdev = pdev;
mgp->pause = myri10ge_flow_control;
mgp->intr_coal_delay = myri10ge_intr_coal_delay;
mgp->msg_enable = netif_msg_init(myri10ge_debug, MYRI10GE_MSG_DEFAULT);
mgp->board_number = board_number;
init_waitqueue_head(&mgp->down_wq);
if (pci_enable_device(pdev)) {
dev_err(&pdev->dev, "pci_enable_device call failed\n");
status = -ENODEV;
goto abort_with_netdev;
}
/* Find the vendor-specific cap so we can check
* the reboot register later on */
mgp->vendor_specific_offset
= pci_find_capability(pdev, PCI_CAP_ID_VNDR);
/* Set our max read request to 4KB */
status = pcie_set_readrq(pdev, 4096);
if (status != 0) {
dev_err(&pdev->dev, "Error %d writing PCI_EXP_DEVCTL\n",
status);
goto abort_with_enabled;
}
myri10ge_mask_surprise_down(pdev);
pci_set_master(pdev);
status = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (status != 0) {
dev_err(&pdev->dev, "Error %d setting DMA mask\n", status);
goto abort_with_enabled;
}
mgp->cmd = dma_alloc_coherent(&pdev->dev, sizeof(*mgp->cmd),
&mgp->cmd_bus, GFP_KERNEL);
if (!mgp->cmd) {
status = -ENOMEM;
goto abort_with_enabled;
}
mgp->board_span = pci_resource_len(pdev, 0);
mgp->iomem_base = pci_resource_start(pdev, 0);
mgp->wc_cookie = arch_phys_wc_add(mgp->iomem_base, mgp->board_span);
mgp->sram = ioremap_wc(mgp->iomem_base, mgp->board_span);
if (mgp->sram == NULL) {
dev_err(&pdev->dev, "ioremap failed for %ld bytes at 0x%lx\n",
mgp->board_span, mgp->iomem_base);
status = -ENXIO;
goto abort_with_mtrr;
}
hdr_offset =
swab32(readl(mgp->sram + MCP_HEADER_PTR_OFFSET)) & 0xffffc;
ss_offset = hdr_offset + offsetof(struct mcp_gen_header, string_specs);
mgp->sram_size = swab32(readl(mgp->sram + ss_offset));
if (mgp->sram_size > mgp->board_span ||
mgp->sram_size <= MYRI10GE_FW_OFFSET) {
dev_err(&pdev->dev,
"invalid sram_size %dB or board span %ldB\n",
mgp->sram_size, mgp->board_span);
status = -EINVAL;
goto abort_with_ioremap;
}
Annotation
- Immediate include surface: `linux/tcp.h`, `linux/netdevice.h`, `linux/skbuff.h`, `linux/string.h`, `linux/module.h`, `linux/pci.h`, `linux/dma-mapping.h`, `linux/etherdevice.h`.
- Detected declarations: `struct myri10ge_rx_buffer_state`, `struct myri10ge_tx_buffer_state`, `struct myri10ge_cmd`, `struct myri10ge_rx_buf`, `struct myri10ge_tx_buf`, `struct myri10ge_rx_done`, `struct myri10ge_slice_netstats`, `struct myri10ge_slice_state`, `struct myri10ge_priv`, `function put_be32`.
- 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.