drivers/net/ethernet/google/gve/gve_ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/google/gve/gve_ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/google/gve/gve_ethtool.c- Extension
.c- Size
- 30294 bytes
- Lines
- 1016
- 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.
- 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
net/netdev_lock.hgve.hgve_adminq.hgve_dqo.hgve_utils.h
Detected Declarations
function Copyrightfunction gve_set_msglevelfunction gve_get_msglevelfunction gve_get_stringsfunction gve_get_sset_countfunction gve_get_ethtool_statsfunction gve_get_channelsfunction gve_set_channelsfunction gve_get_ringparamfunction gve_validate_req_ring_sizefunction gve_set_ring_sizes_configfunction gve_set_ringparamfunction gve_user_resetfunction gve_get_tunablefunction gve_set_tunablefunction gve_get_priv_flagsfunction gve_set_priv_flagsfunction gve_get_link_ksettingsfunction gve_get_coalescefunction gve_set_coalescefunction gve_set_rxnfcfunction gve_get_rx_ring_countfunction gve_get_rxnfcfunction gve_get_rxfh_key_sizefunction gve_get_rxfh_indir_sizefunction gve_get_rss_config_cachefunction gve_get_rxfhfunction gve_set_rss_config_cachefunction gve_set_rxfhfunction gve_get_ts_info
Annotated Snippet
if (priv->rx) {
do {
struct gve_rx_ring *rx = &priv->rx[ring];
start =
u64_stats_fetch_begin(&priv->rx[ring].statss);
tmp_rx_pkts = rx->rpackets;
tmp_rx_hsplit_pkt = rx->rx_hsplit_pkt;
tmp_rx_bytes = rx->rbytes;
tmp_rx_skb_alloc_fail = rx->rx_skb_alloc_fail;
tmp_rx_buf_alloc_fail = rx->rx_buf_alloc_fail;
tmp_rx_desc_err_dropped_pkt =
rx->rx_desc_err_dropped_pkt;
tmp_rx_hsplit_unsplit_pkt =
rx->rx_hsplit_unsplit_pkt;
tmp_xdp_tx_errors = rx->xdp_tx_errors;
tmp_xdp_redirect_errors =
rx->xdp_redirect_errors;
} while (u64_stats_fetch_retry(&priv->rx[ring].statss,
start));
rx_pkts += tmp_rx_pkts;
rx_hsplit_pkt += tmp_rx_hsplit_pkt;
rx_bytes += tmp_rx_bytes;
rx_skb_alloc_fail += tmp_rx_skb_alloc_fail;
rx_buf_alloc_fail += tmp_rx_buf_alloc_fail;
rx_desc_err_dropped_pkt += tmp_rx_desc_err_dropped_pkt;
rx_hsplit_unsplit_pkt += tmp_rx_hsplit_unsplit_pkt;
xdp_tx_errors += tmp_xdp_tx_errors;
xdp_redirect_errors += tmp_xdp_redirect_errors;
}
}
for (tx_pkts = 0, tx_bytes = 0, tx_dropped = 0, ring = 0;
ring < num_tx_queues; ring++) {
if (priv->tx) {
do {
start =
u64_stats_fetch_begin(&priv->tx[ring].statss);
tmp_tx_pkts = priv->tx[ring].pkt_done;
tmp_tx_bytes = priv->tx[ring].bytes_done;
} while (u64_stats_fetch_retry(&priv->tx[ring].statss,
start));
tx_pkts += tmp_tx_pkts;
tx_bytes += tmp_tx_bytes;
tx_dropped += priv->tx[ring].dropped_pkt;
}
}
i = 0;
data[i++] = rx_pkts;
data[i++] = rx_hsplit_pkt;
data[i++] = tx_pkts;
data[i++] = rx_bytes;
data[i++] = tx_bytes;
/* total rx dropped packets */
data[i++] = rx_skb_alloc_fail + rx_desc_err_dropped_pkt +
xdp_tx_errors + xdp_redirect_errors;
data[i++] = tx_dropped;
data[i++] = priv->tx_timeo_cnt;
data[i++] = rx_skb_alloc_fail;
data[i++] = rx_buf_alloc_fail;
data[i++] = rx_desc_err_dropped_pkt;
data[i++] = rx_hsplit_unsplit_pkt;
data[i++] = priv->interface_up_cnt;
data[i++] = priv->interface_down_cnt;
data[i++] = priv->reset_cnt;
data[i++] = priv->page_alloc_fail;
data[i++] = priv->dma_mapping_error;
data[i++] = priv->stats_report_trigger_cnt;
i = GVE_MAIN_STATS_LEN;
rx_base_stats_idx = 0;
max_rx_stats_idx = 0;
max_tx_stats_idx = 0;
stats_region_len = priv->stats_report_len -
sizeof(struct gve_stats_report);
nic_stats_len = (NIC_RX_STATS_REPORT_NUM * priv->rx_cfg.num_queues +
NIC_TX_STATS_REPORT_NUM * num_tx_queues) * sizeof(struct stats);
if (unlikely((stats_region_len -
nic_stats_len) % sizeof(struct stats))) {
net_err_ratelimited("Starting index of NIC stats should be multiple of stats size");
} else {
/* For rx cross-reporting stats,
* start from nic rx stats in report
*/
rx_base_stats_idx = (stats_region_len - nic_stats_len) /
sizeof(struct stats);
/* The boundary between driver stats and NIC stats
* shifts if there are stopped queues
*/
rx_base_stats_idx += NIC_RX_STATS_REPORT_NUM *
Annotation
- Immediate include surface: `net/netdev_lock.h`, `gve.h`, `gve_adminq.h`, `gve_dqo.h`, `gve_utils.h`.
- Detected declarations: `function Copyright`, `function gve_set_msglevel`, `function gve_get_msglevel`, `function gve_get_strings`, `function gve_get_sset_count`, `function gve_get_ethtool_stats`, `function gve_get_channels`, `function gve_set_channels`, `function gve_get_ringparam`, `function gve_validate_req_ring_size`.
- 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.