drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c- Extension
.c- Size
- 27170 bytes
- Lines
- 1025
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/net_tstamp.hlinux/nospec.hdpni.hdpaa2-eth.h
Detected Declarations
function dpaa2_eth_get_drvinfofunction dpaa2_eth_nway_resetfunction dpaa2_eth_get_link_ksettingsfunction dpaa2_eth_set_link_ksettingsfunction dpaa2_eth_get_pauseparamfunction dpaa2_eth_set_pauseparamfunction dpaa2_eth_get_stringsfunction dpaa2_eth_get_sset_countfunction dpaa2_eth_get_ethtool_statsfunction dpaa2_eth_prep_eth_rulefunction dpaa2_eth_prep_uip_rulefunction dpaa2_eth_prep_l4_rulefunction dpaa2_eth_prep_ext_rulefunction dpaa2_eth_prep_mac_ext_rulefunction dpaa2_eth_prep_cls_rulefunction dpaa2_eth_do_cls_rulefunction dpaa2_eth_num_cls_rulesfunction dpaa2_eth_update_cls_rulefunction dpaa2_eth_get_rx_ring_countfunction dpaa2_eth_get_rxnfcfunction dpaa2_eth_set_rxnfcfunction dpaa2_eth_get_rxfh_fieldsfunction dpaa2_eth_set_rxfh_fieldsfunction dpaa2_eth_get_ts_infofunction dpaa2_eth_get_tunablefunction dpaa2_eth_set_tunablefunction dpaa2_eth_get_coalescefunction dpaa2_eth_set_coalescefunction dpaa2_eth_get_channelsfunction dpaa2_eth_get_rmon_statsfunction dpaa2_eth_get_pause_statsfunction dpaa2_eth_get_ctrl_statsfunction dpaa2_eth_get_eth_mac_statsexport dpaa2_phc_index
Annotated Snippet
if (err) {
netdev_warn(net_dev, "FQ query error %d", err);
return;
}
if (priv->fq[j].type == DPAA2_TX_CONF_FQ) {
fcnt_tx_total += fcnt;
bcnt_tx_total += bcnt;
} else {
fcnt_rx_total += fcnt;
bcnt_rx_total += bcnt;
}
}
*(data + i++) = fcnt_rx_total;
*(data + i++) = bcnt_rx_total;
*(data + i++) = fcnt_tx_total;
*(data + i++) = bcnt_tx_total;
for (j = 0; j < priv->num_bps; j++) {
err = dpaa2_io_query_bp_count(NULL, priv->bp[j]->bpid, &buf_cnt);
if (err) {
netdev_warn(net_dev, "Buffer count query error %d\n", err);
return;
}
buf_cnt_total += buf_cnt;
}
*(data + i++) = buf_cnt_total;
mutex_lock(&priv->mac_lock);
if (dpaa2_eth_has_mac(priv))
dpaa2_mac_get_ethtool_stats(priv->mac, data + i);
mutex_unlock(&priv->mac_lock);
}
static int dpaa2_eth_prep_eth_rule(struct ethhdr *eth_value, struct ethhdr *eth_mask,
void *key, void *mask, u64 *fields)
{
int off;
if (eth_mask->h_proto) {
off = dpaa2_eth_cls_fld_off(NET_PROT_ETH, NH_FLD_ETH_TYPE);
*(__be16 *)(key + off) = eth_value->h_proto;
*(__be16 *)(mask + off) = eth_mask->h_proto;
*fields |= DPAA2_ETH_DIST_ETHTYPE;
}
if (!is_zero_ether_addr(eth_mask->h_source)) {
off = dpaa2_eth_cls_fld_off(NET_PROT_ETH, NH_FLD_ETH_SA);
ether_addr_copy(key + off, eth_value->h_source);
ether_addr_copy(mask + off, eth_mask->h_source);
*fields |= DPAA2_ETH_DIST_ETHSRC;
}
if (!is_zero_ether_addr(eth_mask->h_dest)) {
off = dpaa2_eth_cls_fld_off(NET_PROT_ETH, NH_FLD_ETH_DA);
ether_addr_copy(key + off, eth_value->h_dest);
ether_addr_copy(mask + off, eth_mask->h_dest);
*fields |= DPAA2_ETH_DIST_ETHDST;
}
return 0;
}
static int dpaa2_eth_prep_uip_rule(struct ethtool_usrip4_spec *uip_value,
struct ethtool_usrip4_spec *uip_mask,
void *key, void *mask, u64 *fields)
{
int off;
u32 tmp_value, tmp_mask;
if (uip_mask->tos || uip_mask->ip_ver)
return -EOPNOTSUPP;
if (uip_mask->ip4src) {
off = dpaa2_eth_cls_fld_off(NET_PROT_IP, NH_FLD_IP_SRC);
*(__be32 *)(key + off) = uip_value->ip4src;
*(__be32 *)(mask + off) = uip_mask->ip4src;
*fields |= DPAA2_ETH_DIST_IPSRC;
}
if (uip_mask->ip4dst) {
off = dpaa2_eth_cls_fld_off(NET_PROT_IP, NH_FLD_IP_DST);
*(__be32 *)(key + off) = uip_value->ip4dst;
*(__be32 *)(mask + off) = uip_mask->ip4dst;
*fields |= DPAA2_ETH_DIST_IPDST;
}
Annotation
- Immediate include surface: `linux/net_tstamp.h`, `linux/nospec.h`, `dpni.h`, `dpaa2-eth.h`.
- Detected declarations: `function dpaa2_eth_get_drvinfo`, `function dpaa2_eth_nway_reset`, `function dpaa2_eth_get_link_ksettings`, `function dpaa2_eth_set_link_ksettings`, `function dpaa2_eth_get_pauseparam`, `function dpaa2_eth_set_pauseparam`, `function dpaa2_eth_get_strings`, `function dpaa2_eth_get_sset_count`, `function dpaa2_eth_get_ethtool_stats`, `function dpaa2_eth_prep_eth_rule`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.