drivers/net/ethernet/alibaba/eea/eea_ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/alibaba/eea/eea_ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/alibaba/eea/eea_ethtool.c- Extension
.c- Size
- 7118 bytes
- Lines
- 274
- 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/ethtool.hlinux/ethtool_netlink.hlinux/rtnetlink.heea_adminq.heea_net.heea_pci.h
Detected Declarations
struct eea_stat_descfunction eea_get_drvinfofunction eea_get_ringparamfunction eea_set_ringparamfunction eea_set_channelsfunction eea_get_channelsfunction eea_get_stringsfunction eea_get_sset_countfunction eea_stats_fill_for_qfunction eea_get_ethtool_statsfunction eea_update_rx_statsfunction eea_get_link_ksettings
Annotated Snippet
struct eea_stat_desc {
char desc[ETH_GSTRING_LEN];
size_t offset;
};
#define EEA_TX_STAT(m) {#m, offsetof(struct eea_tx_stats, m)}
#define EEA_RX_STAT(m) {#m, offsetof(struct eea_rx_stats, m)}
static const struct eea_stat_desc eea_rx_stats_desc[] = {
EEA_RX_STAT(descs),
EEA_RX_STAT(kicks),
};
static const struct eea_stat_desc eea_tx_stats_desc[] = {
EEA_TX_STAT(descs),
EEA_TX_STAT(kicks),
};
#define EEA_TX_STATS_LEN ARRAY_SIZE(eea_tx_stats_desc)
#define EEA_RX_STATS_LEN ARRAY_SIZE(eea_rx_stats_desc)
static void eea_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *info)
{
struct eea_net *enet = netdev_priv(netdev);
struct eea_device *edev = enet->edev;
strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
strscpy(info->bus_info, eea_pci_name(edev), sizeof(info->bus_info));
}
static void eea_get_ringparam(struct net_device *netdev,
struct ethtool_ringparam *ring,
struct kernel_ethtool_ringparam *kernel_ring,
struct netlink_ext_ack *extack)
{
struct eea_net *enet = netdev_priv(netdev);
ring->rx_max_pending = enet->cfg_hw.rx_ring_depth;
ring->tx_max_pending = enet->cfg_hw.tx_ring_depth;
ring->rx_pending = enet->cfg.rx_ring_depth;
ring->tx_pending = enet->cfg.tx_ring_depth;
kernel_ring->tcp_data_split = enet->cfg.split_hdr ?
ETHTOOL_TCP_DATA_SPLIT_ENABLED :
ETHTOOL_TCP_DATA_SPLIT_DISABLED;
}
static int eea_set_ringparam(struct net_device *netdev,
struct ethtool_ringparam *ring,
struct kernel_ethtool_ringparam *kernel_ring,
struct netlink_ext_ack *extack)
{
struct eea_net *enet = netdev_priv(netdev);
struct eea_net_init_ctx ctx;
bool need_update = false;
struct eea_net_cfg *cfg;
bool sh;
if (ring->rx_pending < EEA_NET_IO_RING_DEPTH_MIN ||
ring->tx_pending < EEA_NET_IO_RING_DEPTH_MIN)
return -EINVAL;
if (!is_power_of_2(ring->rx_pending) ||
!is_power_of_2(ring->tx_pending))
return -EINVAL;
eea_init_ctx(enet, &ctx);
cfg = &ctx.cfg;
if (ring->rx_pending != cfg->rx_ring_depth)
need_update = true;
if (ring->tx_pending != cfg->tx_ring_depth)
need_update = true;
sh = false;
switch (kernel_ring->tcp_data_split) {
case ETHTOOL_TCP_DATA_SPLIT_ENABLED:
sh = true;
break;
case ETHTOOL_TCP_DATA_SPLIT_DISABLED:
sh = false;
break;
case ETHTOOL_TCP_DATA_SPLIT_UNKNOWN:
sh = !!cfg->split_hdr;
Annotation
- Immediate include surface: `linux/ethtool.h`, `linux/ethtool_netlink.h`, `linux/rtnetlink.h`, `eea_adminq.h`, `eea_net.h`, `eea_pci.h`.
- Detected declarations: `struct eea_stat_desc`, `function eea_get_drvinfo`, `function eea_get_ringparam`, `function eea_set_ringparam`, `function eea_set_channels`, `function eea_get_channels`, `function eea_get_strings`, `function eea_get_sset_count`, `function eea_stats_fill_for_q`, `function eea_get_ethtool_stats`.
- 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.