drivers/net/ethernet/intel/idpf/idpf_ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/idpf/idpf_ethtool.c- Extension
.c- Size
- 53263 bytes
- Lines
- 1842
- 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
idpf.hidpf_ptp.hidpf_virtchnl.h
Detected Declarations
struct idpf_statsfunction idpf_get_rx_ring_countfunction idpf_get_rxnfcfunction list_for_each_entryfunction list_for_each_entryfunction idpf_fsteer_fill_ipv4function idpf_fsteer_fill_udpfunction idpf_fsteer_fill_tcpfunction idpf_add_flow_steerfunction idpf_del_flow_steerfunction idpf_set_rxnfcfunction idpf_get_rxfh_key_sizefunction idpf_get_rxfh_indir_sizefunction idpf_get_rxfhfunction idpf_set_rxfhfunction idpf_get_channelsfunction idpf_set_channelsfunction idpf_get_ringparamfunction idpf_set_ringparamfunction __idpf_add_qstat_stringsfunction idpf_add_stat_stringsfunction idpf_get_stat_stringsfunction idpf_get_stringsfunction idpf_get_sset_countfunction idpf_add_one_ethtool_statfunction rcu_read_lockfunction idpf_add_empty_queue_statsfunction idpf_add_port_statsfunction idpf_collect_queue_statsfunction idpf_get_ethtool_statsfunction __idpf_get_q_coalescefunction idpf_get_q_coalescefunction idpf_get_coalescefunction idpf_get_per_q_coalescefunction __idpf_set_q_coalescefunction idpf_set_q_coalescefunction idpf_set_coalescefunction idpf_set_per_q_coalescefunction idpf_get_msglevelfunction idpf_set_msglevelfunction idpf_get_link_ksettingsfunction idpf_get_timestamp_filtersfunction idpf_get_ts_infofunction idpf_get_ts_statsfunction idpf_set_ethtool_ops
Annotated Snippet
struct idpf_stats {
char stat_string[ETH_GSTRING_LEN];
int sizeof_stat;
int stat_offset;
};
/* Helper macro to define an idpf_stat structure with proper size and type.
* Use this when defining constant statistics arrays. Note that @_type expects
* only a type name and is used multiple times.
*/
#define IDPF_STAT(_type, _name, _stat) { \
.stat_string = _name, \
.sizeof_stat = sizeof_field(_type, _stat), \
.stat_offset = offsetof(_type, _stat) \
}
/* Helper macros for defining some statistics related to queues */
#define IDPF_RX_QUEUE_STAT(_name, _stat) \
IDPF_STAT(struct idpf_rx_queue, _name, _stat)
#define IDPF_TX_QUEUE_STAT(_name, _stat) \
IDPF_STAT(struct idpf_tx_queue, _name, _stat)
/* Stats associated with a Tx queue */
static const struct idpf_stats idpf_gstrings_tx_queue_stats[] = {
IDPF_TX_QUEUE_STAT("pkts", q_stats.packets),
IDPF_TX_QUEUE_STAT("bytes", q_stats.bytes),
IDPF_TX_QUEUE_STAT("lso_pkts", q_stats.lso_pkts),
};
/* Stats associated with an Rx queue */
static const struct idpf_stats idpf_gstrings_rx_queue_stats[] = {
IDPF_RX_QUEUE_STAT("pkts", q_stats.packets),
IDPF_RX_QUEUE_STAT("bytes", q_stats.bytes),
IDPF_RX_QUEUE_STAT("rx_gro_hw_pkts", q_stats.rsc_pkts),
};
#define IDPF_TX_QUEUE_STATS_LEN ARRAY_SIZE(idpf_gstrings_tx_queue_stats)
#define IDPF_RX_QUEUE_STATS_LEN ARRAY_SIZE(idpf_gstrings_rx_queue_stats)
#define IDPF_PORT_STAT(_name, _stat) \
IDPF_STAT(struct idpf_vport, _name, _stat)
static const struct idpf_stats idpf_gstrings_port_stats[] = {
IDPF_PORT_STAT("rx-csum_errors", port_stats.rx_hw_csum_err),
IDPF_PORT_STAT("rx-hsplit", port_stats.rx_hsplit),
IDPF_PORT_STAT("rx-hsplit_hbo", port_stats.rx_hsplit_hbo),
IDPF_PORT_STAT("rx-bad_descs", port_stats.rx_bad_descs),
IDPF_PORT_STAT("tx-skb_drops", port_stats.tx_drops),
IDPF_PORT_STAT("tx-dma_map_errs", port_stats.tx_dma_map_errs),
IDPF_PORT_STAT("tx-linearized_pkts", port_stats.tx_linearize),
IDPF_PORT_STAT("tx-busy_events", port_stats.tx_busy),
IDPF_PORT_STAT("rx-unicast_pkts", port_stats.vport_stats.rx_unicast),
IDPF_PORT_STAT("rx-multicast_pkts", port_stats.vport_stats.rx_multicast),
IDPF_PORT_STAT("rx-broadcast_pkts", port_stats.vport_stats.rx_broadcast),
IDPF_PORT_STAT("rx-unknown_protocol", port_stats.vport_stats.rx_unknown_protocol),
IDPF_PORT_STAT("tx-unicast_pkts", port_stats.vport_stats.tx_unicast),
IDPF_PORT_STAT("tx-multicast_pkts", port_stats.vport_stats.tx_multicast),
IDPF_PORT_STAT("tx-broadcast_pkts", port_stats.vport_stats.tx_broadcast),
};
#define IDPF_PORT_STATS_LEN ARRAY_SIZE(idpf_gstrings_port_stats)
/**
* __idpf_add_qstat_strings - copy stat strings into ethtool buffer
* @p: ethtool supplied buffer
* @stats: stat definitions array
* @size: size of the stats array
* @type: stat type
* @idx: stat index
*
* Format and copy the strings described by stats into the buffer pointed at
* by p.
*/
static void __idpf_add_qstat_strings(u8 **p, const struct idpf_stats *stats,
const unsigned int size, const char *type,
unsigned int idx)
{
unsigned int i;
for (i = 0; i < size; i++)
ethtool_sprintf(p, "%s_q-%u_%s",
type, idx, stats[i].stat_string);
}
/**
* idpf_add_qstat_strings - Copy queue stat strings into ethtool buffer
* @p: ethtool supplied buffer
* @stats: stat definitions array
* @type: stat type
* @idx: stat idx
Annotation
- Immediate include surface: `idpf.h`, `idpf_ptp.h`, `idpf_virtchnl.h`.
- Detected declarations: `struct idpf_stats`, `function idpf_get_rx_ring_count`, `function idpf_get_rxnfc`, `function list_for_each_entry`, `function list_for_each_entry`, `function idpf_fsteer_fill_ipv4`, `function idpf_fsteer_fill_udp`, `function idpf_fsteer_fill_tcp`, `function idpf_add_flow_steer`, `function idpf_del_flow_steer`.
- 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.