drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c- Extension
.c- Size
- 165744 bytes
- Lines
- 5810
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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/ctype.hlinux/stringify.hlinux/ethtool.hlinux/ethtool_netlink.hlinux/linkmode.hlinux/interrupt.hlinux/pci.hlinux/etherdevice.hlinux/crc32.hlinux/firmware.hlinux/utsname.hlinux/time.hlinux/ptp_clock_kernel.hlinux/net_tstamp.hlinux/timecounter.hnet/netdev_queues.hnet/netlink.hlinux/bnxt/hsi.hlinux/bnxt/ulp.hbnxt.hbnxt_hwrm.hbnxt_xdp.hbnxt_ptp.hbnxt_ethtool.hbnxt_gso.hbnxt_nvm_defs.hbnxt_fw_hdr.hbnxt_coredump.h
Detected Declarations
enum bnxt_media_typeenum bnxt_link_speed_indicesfunction bnxt_get_msglevelfunction bnxt_set_msglevelfunction bnxt_get_coalescefunction bnxt_set_coalescefunction ARRAY_SIZEfunction bnxt_get_num_ring_statsfunction bnxt_get_num_statsfunction bnxt_get_sset_countfunction is_rx_ringfunction is_tx_ringfunction bnxt_get_ethtool_statsfunction bnxt_get_stringsfunction bnxt_get_ringparamfunction bnxt_set_ringparamfunction bnxt_get_channelsfunction bnxt_set_channelsfunction bnxt_get_nr_rss_ctxsfunction bnxt_get_all_fltr_ids_rcufunction hlist_for_each_entry_rcufunction hlist_for_each_entry_rcufunction bnxt_grxclsrlallfunction bnxt_grxclsrulefunction bnxt_alloc_vnic_rss_tablefunction bnxt_add_l2_cls_rulefunction bnxt_verify_ntuple_ip4_flowfunction bnxt_verify_ntuple_ip6_flowfunction bnxt_add_ntuple_cls_rulefunction bnxt_srxclsrlinsfunction bnxt_srxclsrldelfunction get_ethtool_ipv4_rssfunction get_ethtool_ipv6_rssfunction bnxt_get_rxfh_fieldsfunction bnxt_set_rxfh_fieldsfunction bnxt_get_rx_ring_countfunction bnxt_get_rxnfcfunction bnxt_set_rxnfcfunction bnxt_get_rxfh_indir_sizefunction bnxt_get_rxfh_key_sizefunction bnxt_get_rxfhfunction bnxt_modify_rssfunction bnxt_rxfh_context_checkfunction bnxt_create_rxfh_contextfunction bnxt_modify_rxfh_contextfunction bnxt_remove_rxfh_contextfunction bnxt_set_rxfhfunction bnxt_get_drvinfo
Annotated Snippet
if (bp->flags & BNXT_FLAG_DIM) {
bp->flags &= ~(BNXT_FLAG_DIM);
goto reset_coalesce;
}
}
if ((kernel_coal->use_cqe_mode_rx || kernel_coal->use_cqe_mode_tx) &&
!(bp->coal_cap.cmpl_params &
RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_TIMER_RESET))
return -EOPNOTSUPP;
hw_coal = &bp->rx_coal;
mult = hw_coal->bufs_per_record;
hw_coal->coal_ticks = coal->rx_coalesce_usecs;
hw_coal->coal_bufs = coal->rx_max_coalesced_frames * mult;
hw_coal->coal_ticks_irq = coal->rx_coalesce_usecs_irq;
hw_coal->coal_bufs_irq = coal->rx_max_coalesced_frames_irq * mult;
hw_coal->flags &=
~RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_FLAGS_TIMER_RESET;
if (kernel_coal->use_cqe_mode_rx)
hw_coal->flags |=
RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_FLAGS_TIMER_RESET;
hw_coal = &bp->tx_coal;
mult = hw_coal->bufs_per_record;
hw_coal->coal_ticks = coal->tx_coalesce_usecs;
hw_coal->coal_bufs = coal->tx_max_coalesced_frames * mult;
hw_coal->coal_ticks_irq = coal->tx_coalesce_usecs_irq;
hw_coal->coal_bufs_irq = coal->tx_max_coalesced_frames_irq * mult;
hw_coal->flags &=
~RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_FLAGS_TIMER_RESET;
if (kernel_coal->use_cqe_mode_tx)
hw_coal->flags |=
RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_FLAGS_TIMER_RESET;
if (bp->stats_coal_ticks != coal->stats_block_coalesce_usecs) {
u32 stats_ticks = coal->stats_block_coalesce_usecs;
/* Allow 0, which means disable. */
if (stats_ticks)
stats_ticks = clamp_t(u32, stats_ticks,
BNXT_MIN_STATS_COAL_TICKS,
BNXT_MAX_STATS_COAL_TICKS);
stats_ticks = rounddown(stats_ticks, BNXT_MIN_STATS_COAL_TICKS);
bp->stats_coal_ticks = stats_ticks;
if (bp->stats_coal_ticks)
bp->current_interval =
bp->stats_coal_ticks * HZ / 1000000;
else
bp->current_interval = BNXT_TIMER_INTERVAL;
update_stats = true;
}
reset_coalesce:
if (test_bit(BNXT_STATE_OPEN, &bp->state)) {
if (update_stats) {
bnxt_close_nic(bp, true, false);
rc = bnxt_open_nic(bp, true, false);
} else {
rc = bnxt_hwrm_set_coal(bp);
}
}
return rc;
}
static const char * const bnxt_ring_rx_stats_str[] = {
"rx_ucast_packets",
"rx_mcast_packets",
"rx_bcast_packets",
"rx_discards",
"rx_errors",
"rx_ucast_bytes",
"rx_mcast_bytes",
"rx_bcast_bytes",
};
static const char * const bnxt_ring_tx_stats_str[] = {
"tx_ucast_packets",
"tx_mcast_packets",
"tx_bcast_packets",
"tx_errors",
"tx_discards",
"tx_ucast_bytes",
"tx_mcast_bytes",
"tx_bcast_bytes",
};
static const char * const bnxt_ring_tpa_stats_str[] = {
"tpa_packets",
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/ctype.h`, `linux/stringify.h`, `linux/ethtool.h`, `linux/ethtool_netlink.h`, `linux/linkmode.h`, `linux/interrupt.h`, `linux/pci.h`.
- Detected declarations: `enum bnxt_media_type`, `enum bnxt_link_speed_indices`, `function bnxt_get_msglevel`, `function bnxt_set_msglevel`, `function bnxt_get_coalesce`, `function bnxt_set_coalesce`, `function ARRAY_SIZE`, `function bnxt_get_num_ring_stats`, `function bnxt_get_num_stats`, `function bnxt_get_sset_count`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.