drivers/net/ethernet/hisilicon/hibmcge/hbg_debugfs.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/hisilicon/hibmcge/hbg_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/hisilicon/hibmcge/hbg_debugfs.c- Extension
.c- Size
- 4794 bytes
- Lines
- 169
- 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/debugfs.hlinux/device.hlinux/etherdevice.hlinux/seq_file.hlinux/string_choices.hhbg_common.hhbg_debugfs.hhbg_hw.hhbg_irq.hhbg_txrx.h
Detected Declarations
struct hbg_dbg_infofunction hbg_dbg_ringfunction hbg_dbg_tx_ringfunction hbg_dbg_rx_ringfunction hbg_dbg_irq_infofunction hbg_dbg_mac_tablefunction hbg_dbg_nic_statefunction hbg_debugfs_uninitfunction hbg_debugfs_initfunction hbg_debugfs_registerfunction hbg_debugfs_unregister
Annotated Snippet
struct hbg_dbg_info {
const char *name;
int (*read)(struct seq_file *seq, void *data);
};
#define state_str_true_false(p, s) str_true_false(test_bit(s, &(p)->state))
static void hbg_dbg_ring(struct hbg_priv *priv, struct hbg_ring *ring,
struct seq_file *s)
{
u32 irq_mask = ring->dir == HBG_DIR_TX ? HBG_INT_MSK_TX_B :
HBG_INT_MSK_RX_B;
seq_printf(s, "ring used num: %u\n",
hbg_get_queue_used_num(ring));
seq_printf(s, "ring max num: %u\n", ring->len);
seq_printf(s, "ring head: %u, tail: %u\n", ring->head, ring->tail);
seq_printf(s, "fifo used num: %u\n",
hbg_hw_get_fifo_used_num(priv, ring->dir));
seq_printf(s, "fifo max num: %u\n",
hbg_get_spec_fifo_max_num(priv, ring->dir));
seq_printf(s, "irq enabled: %s\n",
str_true_false(hbg_hw_irq_is_enabled(priv, irq_mask)));
}
static int hbg_dbg_tx_ring(struct seq_file *s, void *unused)
{
struct net_device *netdev = dev_get_drvdata(s->private);
struct hbg_priv *priv = netdev_priv(netdev);
hbg_dbg_ring(priv, &priv->tx_ring, s);
return 0;
}
static int hbg_dbg_rx_ring(struct seq_file *s, void *unused)
{
struct net_device *netdev = dev_get_drvdata(s->private);
struct hbg_priv *priv = netdev_priv(netdev);
hbg_dbg_ring(priv, &priv->rx_ring, s);
return 0;
}
static int hbg_dbg_irq_info(struct seq_file *s, void *unused)
{
struct net_device *netdev = dev_get_drvdata(s->private);
struct hbg_priv *priv = netdev_priv(netdev);
const struct hbg_irq_info *info;
u32 i;
for (i = 0; i < priv->vectors.info_array_len; i++) {
info = &priv->vectors.info_array[i];
seq_printf(s,
"%-20s: enabled: %-5s, reset: %-5s, logged: %-5s, count: %llu\n",
info->name,
str_true_false(hbg_hw_irq_is_enabled(priv,
info->mask)),
str_true_false(info->need_reset),
str_true_false(info->need_print),
priv->vectors.stats_array[i]);
}
return 0;
}
static int hbg_dbg_mac_table(struct seq_file *s, void *unused)
{
struct net_device *netdev = dev_get_drvdata(s->private);
struct hbg_priv *priv = netdev_priv(netdev);
struct hbg_mac_filter *filter;
u32 i;
filter = &priv->filter;
seq_printf(s, "mac addr max count: %u\n", filter->table_max_len);
seq_printf(s, "filter enabled: %s\n", str_true_false(filter->enabled));
for (i = 0; i < filter->table_max_len; i++) {
if (is_zero_ether_addr(filter->mac_table[i].addr))
continue;
seq_printf(s, "[%u] %pM\n", i, filter->mac_table[i].addr);
}
return 0;
}
static const char * const reset_type_str[] = {"None", "FLR", "Function"};
static int hbg_dbg_nic_state(struct seq_file *s, void *unused)
{
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/device.h`, `linux/etherdevice.h`, `linux/seq_file.h`, `linux/string_choices.h`, `hbg_common.h`, `hbg_debugfs.h`, `hbg_hw.h`.
- Detected declarations: `struct hbg_dbg_info`, `function hbg_dbg_ring`, `function hbg_dbg_tx_ring`, `function hbg_dbg_rx_ring`, `function hbg_dbg_irq_info`, `function hbg_dbg_mac_table`, `function hbg_dbg_nic_state`, `function hbg_debugfs_uninit`, `function hbg_debugfs_init`, `function hbg_debugfs_register`.
- 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.