drivers/net/ethernet/broadcom/bnge/bnge_ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/bnge/bnge_ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/bnge/bnge_ethtool.c- Extension
.c- Size
- 22375 bytes
- Lines
- 766
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/unaligned.hlinux/pci.hlinux/types.hnet/devlink.hlinux/ethtool.hlinux/etherdevice.hlinux/ethtool_netlink.hbnge.hbnge_ethtool.hbnge_hwrm_lib.h
Detected Declarations
function bnge_nway_resetfunction bnge_get_num_tpa_ring_statsfunction ARRAY_SIZEfunction bnge_get_num_statsfunction bnge_get_drvinfofunction bnge_get_sset_countfunction is_rx_ringfunction is_tx_ringfunction bnge_get_ethtool_statsfunction bnge_get_stringsfunction bnge_get_eth_phy_statsfunction bnge_get_eth_mac_statsfunction bnge_get_eth_ctrl_statsfunction bnge_get_pause_statsfunction bnge_get_rmon_statsfunction bnge_get_pauseparamfunction bnge_set_pauseparamfunction bnge_set_ethtool_ops
Annotated Snippet
if (is_rx_ring(bd, i)) {
buf[j++] = BNGE_GET_RING_STATS64(sw_stats, rx_ucast_pkts);
buf[j++] = BNGE_GET_RING_STATS64(sw_stats, rx_mcast_pkts);
buf[j++] = BNGE_GET_RING_STATS64(sw_stats, rx_bcast_pkts);
buf[j++] = BNGE_GET_RING_STATS64(sw_stats, rx_ucast_bytes);
buf[j++] = BNGE_GET_RING_STATS64(sw_stats, rx_mcast_bytes);
buf[j++] = BNGE_GET_RING_STATS64(sw_stats, rx_bcast_bytes);
}
if (is_tx_ring(bd, i)) {
buf[j++] = BNGE_GET_RING_STATS64(sw_stats, tx_ucast_pkts);
buf[j++] = BNGE_GET_RING_STATS64(sw_stats, tx_mcast_pkts);
buf[j++] = BNGE_GET_RING_STATS64(sw_stats, tx_bcast_pkts);
buf[j++] = BNGE_GET_RING_STATS64(sw_stats, tx_ucast_bytes);
buf[j++] = BNGE_GET_RING_STATS64(sw_stats, tx_mcast_bytes);
buf[j++] = BNGE_GET_RING_STATS64(sw_stats, tx_bcast_bytes);
}
if (!tpa_stats || !is_rx_ring(bd, i))
continue;
k = BNGE_NUM_RX_RING_STATS + BNGE_NUM_TX_RING_STATS;
for (; k < BNGE_NUM_RX_RING_STATS + BNGE_NUM_TX_RING_STATS +
tpa_stats; j++, k++)
buf[j] = sw_stats[k];
}
skip_ring_stats:
if (bn->flags & BNGE_FLAG_PORT_STATS) {
u64 *port_stats = bn->port_stats.sw_stats;
for (i = 0; i < BNGE_NUM_PORT_STATS; i++, j++)
buf[j] = *(port_stats + bnge_port_stats_arr[i].offset);
}
if (bn->flags & BNGE_FLAG_PORT_STATS_EXT) {
u64 *rx_port_stats_ext = bn->rx_port_stats_ext.sw_stats;
u64 *tx_port_stats_ext = bn->tx_port_stats_ext.sw_stats;
u32 len;
len = min_t(u32, bn->fw_rx_stats_ext_size,
ARRAY_SIZE(bnge_port_stats_ext_arr));
for (i = 0; i < len; i++, j++) {
buf[j] = *(rx_port_stats_ext +
bnge_port_stats_ext_arr[i].offset);
}
len = min_t(u32, bn->fw_tx_stats_ext_size,
ARRAY_SIZE(bnge_tx_port_stats_ext_arr));
for (i = 0; i < len; i++, j++) {
buf[j] = *(tx_port_stats_ext +
bnge_tx_port_stats_ext_arr[i].offset);
}
if (bn->pri2cos_valid) {
for (i = 0; i < 8; i++, j++) {
long n = bnge_rx_bytes_pri_arr[i].base_off +
bn->pri2cos_idx[i];
buf[j] = *(rx_port_stats_ext + n);
}
for (i = 0; i < 8; i++, j++) {
long n = bnge_rx_pkts_pri_arr[i].base_off +
bn->pri2cos_idx[i];
buf[j] = *(rx_port_stats_ext + n);
}
for (i = 0; i < 8; i++, j++) {
long n = bnge_tx_bytes_pri_arr[i].base_off +
bn->pri2cos_idx[i];
buf[j] = *(tx_port_stats_ext + n);
}
for (i = 0; i < 8; i++, j++) {
long n = bnge_tx_pkts_pri_arr[i].base_off +
bn->pri2cos_idx[i];
buf[j] = *(tx_port_stats_ext + n);
}
}
}
}
static void bnge_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
{
struct bnge_net *bn = netdev_priv(dev);
struct bnge_dev *bd = bn->bd;
u32 i, j, num_str;
const char *str;
switch (stringset) {
case ETH_SS_STATS:
for (i = 0; i < bd->nq_nr_rings; i++) {
if (is_rx_ring(bd, i))
for (j = 0; j < NUM_RING_Q_HW_STATS; j++) {
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/pci.h`, `linux/types.h`, `net/devlink.h`, `linux/ethtool.h`, `linux/etherdevice.h`, `linux/ethtool_netlink.h`, `bnge.h`.
- Detected declarations: `function bnge_nway_reset`, `function bnge_get_num_tpa_ring_stats`, `function ARRAY_SIZE`, `function bnge_get_num_stats`, `function bnge_get_drvinfo`, `function bnge_get_sset_count`, `function is_rx_ring`, `function is_tx_ring`, `function bnge_get_ethtool_stats`, `function bnge_get_strings`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
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.