drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c- Extension
.c- Size
- 12682 bytes
- Lines
- 465
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/unaligned.hlinux/ethtool.hlinux/netdevice.hlinux/platform_device.hbcmasp.hbcmasp_intf_defs.h
Detected Declarations
struct bcmasp_statsenum bcmasp_stat_typefunction bcmasp_get_sset_countfunction bcmasp_get_stringsfunction bcmasp_update_mib_countersfunction bcmasp_get_ethtool_statsfunction bcmasp_get_drvinfofunction bcmasp_get_msglevelfunction bcmasp_set_msglevelfunction bcmasp_get_wolfunction bcmasp_set_wolfunction bcmasp_flow_insertfunction bcmasp_flow_deletefunction bcmasp_flow_getfunction bcmasp_set_rxnfcfunction bcmasp_get_rxnfcfunction bcmasp_get_eeefunction bcmasp_set_eeefunction bcmasp_get_eth_mac_statsfunction bcmasp_get_rmon_statsfunction bcmasp_get_eth_ctrl_stats
Annotated Snippet
struct bcmasp_stats {
char stat_string[ETH_GSTRING_LEN];
enum bcmasp_stat_type type;
u32 reg_offset;
};
#define STAT_BCMASP_SOFT_MIB(str) { \
.stat_string = str, \
.type = BCMASP_STAT_SOFT, \
}
#define STAT_BCMASP_OFFSET(str, _type, offset) { \
.stat_string = str, \
.type = _type, \
.reg_offset = offset, \
}
#define STAT_BCMASP_RX_CTRL(str, offset) \
STAT_BCMASP_OFFSET(str, BCMASP_STAT_RX_CTRL, offset)
#define STAT_BCMASP_RX_CTRL_PER_INTF(str, offset) \
STAT_BCMASP_OFFSET(str, BCMASP_STAT_RX_CTRL_PER_INTF, offset)
/* Must match the order of struct bcmasp_mib_counters */
static const struct bcmasp_stats bcmasp_gstrings_stats[] = {
/* ASP RX control */
STAT_BCMASP_RX_CTRL_PER_INTF("Frames From Unimac",
ASP_RX_CTRL_UMAC_0_FRAME_COUNT),
STAT_BCMASP_RX_CTRL_PER_INTF("Frames From Port",
ASP_RX_CTRL_FB_0_FRAME_COUNT),
STAT_BCMASP_RX_CTRL_PER_INTF("RX Buffer FIFO Depth",
ASP_RX_CTRL_FB_RX_FIFO_DEPTH),
STAT_BCMASP_RX_CTRL("Frames Out(Buffer)",
ASP_RX_CTRL_FB_OUT_FRAME_COUNT),
STAT_BCMASP_RX_CTRL("Frames Out(Filters)",
ASP_RX_CTRL_FB_FILT_OUT_FRAME_COUNT),
/* Software maintained statistics */
STAT_BCMASP_SOFT_MIB("RX SKB Alloc Failed"),
STAT_BCMASP_SOFT_MIB("TX DMA Failed"),
STAT_BCMASP_SOFT_MIB("Multicast Filters Full"),
STAT_BCMASP_SOFT_MIB("Unicast Filters Full"),
STAT_BCMASP_SOFT_MIB("MDA Filters Combined"),
STAT_BCMASP_SOFT_MIB("Promisc Filter Set"),
STAT_BCMASP_SOFT_MIB("TX Realloc For Offload Failed"),
STAT_BCMASP_SOFT_MIB("Tx Timeout Count"),
};
#define BCMASP_STATS_LEN ARRAY_SIZE(bcmasp_gstrings_stats)
static int bcmasp_get_sset_count(struct net_device *dev, int string_set)
{
switch (string_set) {
case ETH_SS_STATS:
return BCMASP_STATS_LEN;
default:
return -EOPNOTSUPP;
}
}
static void bcmasp_get_strings(struct net_device *dev, u32 stringset,
u8 *data)
{
const char *str;
unsigned int i;
switch (stringset) {
case ETH_SS_STATS:
for (i = 0; i < BCMASP_STATS_LEN; i++) {
str = bcmasp_gstrings_stats[i].stat_string;
ethtool_puts(&data, str);
}
break;
default:
return;
}
}
static void bcmasp_update_mib_counters(struct bcmasp_intf *intf)
{
unsigned int i;
for (i = 0; i < BCMASP_STATS_LEN; i++) {
const struct bcmasp_stats *s;
u32 offset, val;
char *p;
s = &bcmasp_gstrings_stats[i];
offset = s->reg_offset;
switch (s->type) {
case BCMASP_STAT_SOFT:
continue;
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/ethtool.h`, `linux/netdevice.h`, `linux/platform_device.h`, `bcmasp.h`, `bcmasp_intf_defs.h`.
- Detected declarations: `struct bcmasp_stats`, `enum bcmasp_stat_type`, `function bcmasp_get_sset_count`, `function bcmasp_get_strings`, `function bcmasp_update_mib_counters`, `function bcmasp_get_ethtool_stats`, `function bcmasp_get_drvinfo`, `function bcmasp_get_msglevel`, `function bcmasp_set_msglevel`, `function bcmasp_get_wol`.
- 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.
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.