drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c- Extension
.c- Size
- 62188 bytes
- Lines
- 2306
- 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.
- 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/firmware.hlinux/mdio.hcxgb4.ht4_regs.ht4fw_api.hcxgb4_cudbg.hcxgb4_filter.hcxgb4_tc_flower.h
Detected Declarations
struct queue_port_statsstruct adapter_statsenum cxgb4_ethtool_testsfunction Copyrightfunction set_msglevelfunction get_sset_countfunction get_regs_lenfunction get_eeprom_lenfunction get_drvinfofunction get_stringsfunction collect_sge_port_statsfunction collect_adapter_statsfunction get_statsfunction get_regsfunction restart_autonegfunction identify_portfunction from_fw_port_mod_typefunction speed_to_fw_capsfunction fw_caps_to_lmmfunction lmm_to_fw_capsfunction get_link_ksettingsfunction set_link_ksettingsfunction fwcap_to_eth_fecfunction cc_to_eth_fecfunction eth_to_cc_fecfunction get_fecparamfunction set_fecparamfunction get_pauseparamfunction set_pauseparamfunction get_sge_paramfunction set_sge_paramfunction set_rx_intr_paramsfunction set_adaptive_rx_settingfunction get_adaptive_rx_settingfunction get_dbqtimer_tickfunction get_dbqtimerfunction set_dbqtimer_tickfunction set_dbqtimerfunction set_dbqtimer_tickvalfunction set_coalescefunction get_coalescefunction eeprom_rd_physfunction eeprom_wr_physfunction get_eepromfunction set_eepromfunction cxgb4_ethtool_flash_bootcfgfunction cxgb4_ethtool_flash_bootfunction cxgb4_validate_phy_image
Annotated Snippet
struct queue_port_stats {
u64 tso;
u64 uso;
u64 tx_csum;
u64 rx_csum;
u64 vlan_ex;
u64 vlan_ins;
u64 gro_pkts;
u64 gro_merged;
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
u64 tx_tls_encrypted_packets;
u64 tx_tls_encrypted_bytes;
u64 tx_tls_ctx;
u64 tx_tls_ooo;
u64 tx_tls_skip_no_sync_data;
u64 tx_tls_drop_no_sync_data;
u64 tx_tls_drop_bypass_req;
#endif
};
struct adapter_stats {
u64 db_drop;
u64 db_full;
u64 db_empty;
u64 wc_success;
u64 wc_fail;
};
static void collect_sge_port_stats(const struct adapter *adap,
const struct port_info *p,
struct queue_port_stats *s)
{
const struct sge_eth_txq *tx = &adap->sge.ethtxq[p->first_qset];
const struct sge_eth_rxq *rx = &adap->sge.ethrxq[p->first_qset];
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
const struct ch_ktls_port_stats_debug *ktls_stats;
#endif
struct sge_eohw_txq *eohw_tx;
unsigned int i;
memset(s, 0, sizeof(*s));
for (i = 0; i < p->nqsets; i++, rx++, tx++) {
s->tso += tx->tso;
s->uso += tx->uso;
s->tx_csum += tx->tx_cso;
s->rx_csum += rx->stats.rx_cso;
s->vlan_ex += rx->stats.vlan_ex;
s->vlan_ins += tx->vlan_ins;
s->gro_pkts += rx->stats.lro_pkts;
s->gro_merged += rx->stats.lro_merged;
}
if (adap->sge.eohw_txq) {
eohw_tx = &adap->sge.eohw_txq[p->first_qset];
for (i = 0; i < p->nqsets; i++, eohw_tx++) {
s->tso += eohw_tx->tso;
s->uso += eohw_tx->uso;
s->tx_csum += eohw_tx->tx_cso;
s->vlan_ins += eohw_tx->vlan_ins;
}
}
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
ktls_stats = &adap->ch_ktls_stats.ktls_port[p->port_id];
s->tx_tls_encrypted_packets =
atomic64_read(&ktls_stats->ktls_tx_encrypted_packets);
s->tx_tls_encrypted_bytes =
atomic64_read(&ktls_stats->ktls_tx_encrypted_bytes);
s->tx_tls_ctx = atomic64_read(&ktls_stats->ktls_tx_ctx);
s->tx_tls_ooo = atomic64_read(&ktls_stats->ktls_tx_ooo);
s->tx_tls_skip_no_sync_data =
atomic64_read(&ktls_stats->ktls_tx_skip_no_sync_data);
s->tx_tls_drop_no_sync_data =
atomic64_read(&ktls_stats->ktls_tx_drop_no_sync_data);
s->tx_tls_drop_bypass_req =
atomic64_read(&ktls_stats->ktls_tx_drop_bypass_req);
#endif
}
static void collect_adapter_stats(struct adapter *adap, struct adapter_stats *s)
{
u64 val1, val2;
memset(s, 0, sizeof(*s));
s->db_drop = adap->db_stats.db_drop;
s->db_full = adap->db_stats.db_full;
s->db_empty = adap->db_stats.db_empty;
if (!is_t4(adap->params.chip)) {
int v;
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/mdio.h`, `cxgb4.h`, `t4_regs.h`, `t4fw_api.h`, `cxgb4_cudbg.h`, `cxgb4_filter.h`, `cxgb4_tc_flower.h`.
- Detected declarations: `struct queue_port_stats`, `struct adapter_stats`, `enum cxgb4_ethtool_tests`, `function Copyright`, `function set_msglevel`, `function get_sset_count`, `function get_regs_len`, `function get_eeprom_len`, `function get_drvinfo`, `function get_strings`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- 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.