drivers/net/ethernet/brocade/bna/bnad.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/brocade/bna/bnad.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/brocade/bna/bnad.c- Extension
.c- Size
- 94081 bytes
- Lines
- 3850
- 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/bitops.hlinux/netdevice.hlinux/skbuff.hlinux/etherdevice.hlinux/in.hlinux/ethtool.hlinux/if_vlan.hlinux/if_ether.hlinux/ip.hlinux/prefetch.hlinux/module.hnet/gro.hbnad.hbna.hcna.h
Detected Declarations
function bnad_cq_cleanupfunction bnad_tx_buff_unmapfunction bnad_txq_cleanupfunction bnad_txcmpl_processfunction bnad_tx_completefunction bnad_msix_txfunction bnad_rxq_alloc_uninitfunction bnad_rxq_alloc_initfunction bnad_rxq_cleanup_pagefunction bnad_rxq_cleanup_skbfunction bnad_rxq_cleanupfunction bnad_rxq_refill_pagefunction bnad_rxq_refill_skbfunction bnad_rxq_postfunction bnad_cq_drop_packetfunction bnad_cq_setup_skb_fragsfunction bnad_cq_setup_skbfunction bnad_cq_processfunction bnad_netif_rx_schedule_pollfunction bnad_msix_rxfunction bnad_msix_mbox_handlerfunction bnad_isrfunction bnad_enable_mbox_irqfunction bnad_disable_mbox_irqfunction bnad_set_netdev_perm_addrfunction bnad_cb_mbox_intr_enablefunction bnad_cb_mbox_intr_disablefunction bnad_cb_ioceth_readyfunction bnad_cb_ioceth_failedfunction bnad_cb_ioceth_disabledfunction bnad_cb_enet_disabledfunction bnad_cb_ethport_link_statusfunction bnad_cb_tx_disabledfunction bnad_cb_tcb_setupfunction bnad_cb_tcb_destroyfunction bnad_cb_ccb_setupfunction bnad_cb_ccb_destroyfunction bnad_cb_tx_stallfunction bnad_cb_tx_resumefunction bnad_tx_cleanupfunction bnad_cb_tx_cleanupfunction bnad_cb_rx_stallfunction bnad_rx_cleanupfunction bnad_cb_rx_cleanupfunction bnad_cb_rx_postfunction bnad_cb_rx_disabledfunction bnad_cb_rx_mcast_addfunction bnad_cb_stats_get
Annotated Snippet
static const struct net_device_ops bnad_netdev_ops = {
.ndo_open = bnad_open,
.ndo_stop = bnad_stop,
.ndo_start_xmit = bnad_start_xmit,
.ndo_get_stats64 = bnad_get_stats64,
.ndo_set_rx_mode = bnad_set_rx_mode,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = bnad_set_mac_address,
.ndo_change_mtu = bnad_change_mtu,
.ndo_vlan_rx_add_vid = bnad_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = bnad_vlan_rx_kill_vid,
.ndo_set_features = bnad_set_features,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = bnad_netpoll
#endif
};
static void
bnad_netdev_init(struct bnad *bnad)
{
struct net_device *netdev = bnad->netdev;
netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX;
netdev->vlan_features = NETIF_F_SG | NETIF_F_HIGHDMA |
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_TSO | NETIF_F_TSO6;
netdev->features |= netdev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HIGHDMA;
netdev->mem_start = bnad->mmio_start;
netdev->mem_end = bnad->mmio_start + bnad->mmio_len - 1;
/* MTU range: 46 - 9000 */
netdev->min_mtu = ETH_ZLEN - ETH_HLEN;
netdev->max_mtu = BNAD_JUMBO_MTU;
netdev->netdev_ops = &bnad_netdev_ops;
bnad_set_ethtool_ops(netdev);
}
/*
* 1. Initialize the bnad structure
* 2. Setup netdev pointer in pci_dev
* 3. Initialize no. of TxQ & CQs & MSIX vectors
* 4. Initialize work queue.
*/
static int
bnad_init(struct bnad *bnad,
struct pci_dev *pdev, struct net_device *netdev)
{
unsigned long flags;
SET_NETDEV_DEV(netdev, &pdev->dev);
pci_set_drvdata(pdev, netdev);
bnad->netdev = netdev;
bnad->pcidev = pdev;
bnad->mmio_start = pci_resource_start(pdev, 0);
bnad->mmio_len = pci_resource_len(pdev, 0);
bnad->bar0 = ioremap(bnad->mmio_start, bnad->mmio_len);
if (!bnad->bar0) {
dev_err(&pdev->dev, "ioremap for bar0 failed\n");
return -ENOMEM;
}
dev_info(&pdev->dev, "bar0 mapped to %p, len %llu\n", bnad->bar0,
(unsigned long long) bnad->mmio_len);
spin_lock_irqsave(&bnad->bna_lock, flags);
if (!bnad_msix_disable)
bnad->cfg_flags = BNAD_CF_MSIX;
bnad->cfg_flags |= BNAD_CF_DIM_ENABLED;
bnad_q_num_init(bnad);
spin_unlock_irqrestore(&bnad->bna_lock, flags);
bnad->msix_num = (bnad->num_tx * bnad->num_txq_per_tx) +
(bnad->num_rx * bnad->num_rxp_per_rx) +
BNAD_MAILBOX_MSIX_VECTORS;
bnad->txq_depth = BNAD_TXQ_DEPTH;
bnad->rxq_depth = BNAD_RXQ_DEPTH;
bnad->tx_coalescing_timeo = BFI_TX_COALESCING_TIMEO;
bnad->rx_coalescing_timeo = BFI_RX_COALESCING_TIMEO;
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/netdevice.h`, `linux/skbuff.h`, `linux/etherdevice.h`, `linux/in.h`, `linux/ethtool.h`, `linux/if_vlan.h`, `linux/if_ether.h`.
- Detected declarations: `function bnad_cq_cleanup`, `function bnad_tx_buff_unmap`, `function bnad_txq_cleanup`, `function bnad_txcmpl_process`, `function bnad_tx_complete`, `function bnad_msix_tx`, `function bnad_rxq_alloc_uninit`, `function bnad_rxq_alloc_init`, `function bnad_rxq_cleanup_page`, `function bnad_rxq_cleanup_skb`.
- 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.