drivers/net/ethernet/broadcom/bnxt/bnxt.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/bnxt/bnxt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/bnxt/bnxt.c- Extension
.c- Size
- 470318 bytes
- Lines
- 17533
- 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/module.hlinux/stringify.hlinux/kernel.hlinux/timer.hlinux/errno.hlinux/ioport.hlinux/slab.hlinux/vmalloc.hlinux/interrupt.hlinux/pci.hlinux/netdevice.hlinux/etherdevice.hlinux/skbuff.hlinux/dma-mapping.hlinux/bitops.hlinux/io.hlinux/irq.hlinux/delay.hasm/byteorder.hasm/page.hlinux/time.hlinux/mii.hlinux/mdio.hlinux/if.hlinux/if_vlan.hlinux/if_bridge.hlinux/rtc.hlinux/bpf.hnet/gro.hnet/ip.hnet/tcp.hnet/udp.h
Detected Declarations
function bnxt_vf_pciidfunction DB_RING_IDXfunction bnxt_db_nq_armfunction bnxt_db_cqfunction bnxt_queue_fw_reset_workfunction __bnxt_queue_sp_workfunction bnxt_queue_sp_workfunction bnxt_sched_reset_rxrfunction bnxt_sched_reset_txrfunction bnxt_xmit_get_cfa_actionfunction bnxt_txr_db_kickfunction bnxt_start_xmitfunction __bnxt_tx_intfunction bnxt_tx_intfunction bnxt_for_each_napi_txfunction bnxt_separate_head_poolfunction __bnxt_alloc_rx_netmemfunction bnxt_alloc_rx_datafunction bnxt_reuse_rx_datafunction bnxt_find_next_agg_idxfunction bnxt_alloc_rx_netmemfunction bnxt_reuse_rx_agg_bufsfunction __bnxt_rx_agg_netmemsfunction bnxt_rx_agg_netmems_xdpfunction bnxt_agg_bufs_validfunction bnxt_discard_rxfunction bnxt_alloc_agg_idxfunction bnxt_free_agg_idxfunction bnxt_lookup_agg_idxfunction bnxt_tpa_metadatafunction bnxt_tpa_metadata_v2function bnxt_tpa_startfunction bnxt_abort_tpafunction bnxt_gro_tunnelfunction netdevfunction bnxt_tpa_aggfunction bnxt_deliver_skbfunction bnxt_rx_ts_validfunction bnxt_rx_pktfunction bnxt_force_rx_discardfunction bnxt_fw_health_readlfunction bnxt_agg_ring_id_to_grp_idxfunction bnxt_get_force_speedfunction bnxt_set_force_speedfunction bnxt_set_auto_speedfunction bnxt_force_speed_updatedfunction bnxt_auto_speed_updatedfunction bnxt_bs_trace_avail
Annotated Snippet
static const struct net_device_ops bnxt_netdev_ops = {
.ndo_open = bnxt_open,
.ndo_start_xmit = bnxt_start_xmit,
.ndo_stop = bnxt_close,
.ndo_get_stats64 = bnxt_get_stats64,
.ndo_set_rx_mode_async = bnxt_set_rx_mode,
.ndo_eth_ioctl = bnxt_ioctl,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = bnxt_change_mac_addr,
.ndo_change_mtu = bnxt_change_mtu,
.ndo_fix_features = bnxt_fix_features,
.ndo_set_features = bnxt_set_features,
.ndo_features_check = bnxt_features_check,
.ndo_tx_timeout = bnxt_tx_timeout,
#ifdef CONFIG_BNXT_SRIOV
.ndo_get_vf_config = bnxt_get_vf_config,
.ndo_set_vf_mac = bnxt_set_vf_mac,
.ndo_set_vf_vlan = bnxt_set_vf_vlan,
.ndo_set_vf_rate = bnxt_set_vf_bw,
.ndo_set_vf_link_state = bnxt_set_vf_link_state,
.ndo_set_vf_spoofchk = bnxt_set_vf_spoofchk,
.ndo_set_vf_trust = bnxt_set_vf_trust,
#endif
.ndo_setup_tc = bnxt_setup_tc,
#ifdef CONFIG_RFS_ACCEL
.ndo_rx_flow_steer = bnxt_rx_flow_steer,
#endif
.ndo_bpf = bnxt_xdp,
.ndo_xdp_xmit = bnxt_xdp_xmit,
.ndo_bridge_getlink = bnxt_bridge_getlink,
.ndo_bridge_setlink = bnxt_bridge_setlink,
.ndo_hwtstamp_get = bnxt_hwtstamp_get,
.ndo_hwtstamp_set = bnxt_hwtstamp_set,
};
static const struct xdp_metadata_ops bnxt_xdp_metadata_ops = {
.xmo_rx_hash = bnxt_xdp_rx_hash,
};
static void bnxt_get_queue_stats_rx(struct net_device *dev, int i,
struct netdev_queue_stats_rx *stats)
{
struct bnxt *bp = netdev_priv(dev);
struct bnxt_cp_ring_info *cpr;
u64 *sw;
if (!bp->bnapi)
return;
cpr = &bp->bnapi[i]->cp_ring;
sw = cpr->stats.sw_stats;
stats->packets = 0;
stats->packets += BNXT_GET_RING_STATS64(sw, rx_ucast_pkts);
stats->packets += BNXT_GET_RING_STATS64(sw, rx_mcast_pkts);
stats->packets += BNXT_GET_RING_STATS64(sw, rx_bcast_pkts);
stats->bytes = 0;
stats->bytes += BNXT_GET_RING_STATS64(sw, rx_ucast_bytes);
stats->bytes += BNXT_GET_RING_STATS64(sw, rx_mcast_bytes);
stats->bytes += BNXT_GET_RING_STATS64(sw, rx_bcast_bytes);
stats->alloc_fail = cpr->sw_stats->rx.rx_oom_discards;
stats->hw_gro_packets = cpr->sw_stats->rx.rx_hw_gro_packets;
stats->hw_gro_wire_packets = cpr->sw_stats->rx.rx_hw_gro_wire_packets;
}
static void bnxt_get_queue_stats_tx(struct net_device *dev, int i,
struct netdev_queue_stats_tx *stats)
{
struct bnxt *bp = netdev_priv(dev);
struct bnxt_napi *bnapi;
u64 *sw;
if (!bp->tx_ring)
return;
bnapi = bp->tx_ring[bp->tx_ring_map[i]].bnapi;
sw = bnapi->cp_ring.stats.sw_stats;
stats->packets = 0;
stats->packets += BNXT_GET_RING_STATS64(sw, tx_ucast_pkts);
stats->packets += BNXT_GET_RING_STATS64(sw, tx_mcast_pkts);
stats->packets += BNXT_GET_RING_STATS64(sw, tx_bcast_pkts);
stats->bytes = 0;
stats->bytes += BNXT_GET_RING_STATS64(sw, tx_ucast_bytes);
stats->bytes += BNXT_GET_RING_STATS64(sw, tx_mcast_bytes);
stats->bytes += BNXT_GET_RING_STATS64(sw, tx_bcast_bytes);
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/stringify.h`, `linux/kernel.h`, `linux/timer.h`, `linux/errno.h`, `linux/ioport.h`, `linux/slab.h`, `linux/vmalloc.h`.
- Detected declarations: `function bnxt_vf_pciid`, `function DB_RING_IDX`, `function bnxt_db_nq_arm`, `function bnxt_db_cq`, `function bnxt_queue_fw_reset_work`, `function __bnxt_queue_sp_work`, `function bnxt_queue_sp_work`, `function bnxt_sched_reset_rxr`, `function bnxt_sched_reset_txr`, `function bnxt_xmit_get_cfa_action`.
- 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.