drivers/net/ethernet/mellanox/mlx5/core/lag/debugfs.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/lag/debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/lag/debugfs.c- Extension
.c- Size
- 4485 bytes
- Lines
- 184
- 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
lag.h
Detected Declarations
function type_showfunction port_sel_mode_showfunction state_showfunction flags_showfunction mapping_showfunction members_showfunction mlx5_ldev_add_debugfsfunction mlx5_ldev_remove_debugfs
Annotated Snippet
if (test_bit(MLX5_LAG_MODE_FLAG_HASH_BASED, &ldev->mode_flags)) {
mlx5_infer_tx_enabled(&ldev->tracker, ldev, ports,
&num_ports);
hash = true;
} else {
mlx5_ldev_for_each(i, 0, ldev)
ports[idx++] = ldev->v2p_map[i];
num_ports = ldev->ports;
}
}
mutex_unlock(&ldev->lock);
if (!lag_active)
return -EINVAL;
for (i = 0; i < num_ports; i++) {
if (hash)
seq_printf(file, "%d\n", ports[i] + 1);
else
seq_printf(file, "%d:%d\n", i + 1, ports[i]);
}
return 0;
}
static int members_show(struct seq_file *file, void *priv)
{
struct mlx5_core_dev *dev = file->private;
struct mlx5_lag *ldev;
int i;
ldev = mlx5_lag_dev(dev);
mutex_lock(&ldev->lock);
mlx5_ldev_for_each(i, 0, ldev)
seq_printf(file, "%s\n",
dev_name(mlx5_lag_pf(ldev, i)->dev->device));
mutex_unlock(&ldev->lock);
return 0;
}
DEFINE_SHOW_ATTRIBUTE(type);
DEFINE_SHOW_ATTRIBUTE(port_sel_mode);
DEFINE_SHOW_ATTRIBUTE(state);
DEFINE_SHOW_ATTRIBUTE(flags);
DEFINE_SHOW_ATTRIBUTE(mapping);
DEFINE_SHOW_ATTRIBUTE(members);
void mlx5_ldev_add_debugfs(struct mlx5_core_dev *dev)
{
struct mlx5_lag *ldev = mlx5_lag_dev(dev);
struct dentry *dbg;
if (!ldev)
return;
dbg = debugfs_create_dir("lag", mlx5_debugfs_get_dev_root(dev));
dev->priv.dbg.lag_debugfs = dbg;
debugfs_create_file("type", 0444, dbg, dev, &type_fops);
debugfs_create_file("port_sel_mode", 0444, dbg, dev, &port_sel_mode_fops);
debugfs_create_file("state", 0444, dbg, dev, &state_fops);
debugfs_create_file("flags", 0444, dbg, dev, &flags_fops);
debugfs_create_file("mapping", 0444, dbg, dev, &mapping_fops);
debugfs_create_file("members", 0444, dbg, dev, &members_fops);
}
void mlx5_ldev_remove_debugfs(struct dentry *dbg)
{
debugfs_remove_recursive(dbg);
}
Annotation
- Immediate include surface: `lag.h`.
- Detected declarations: `function type_show`, `function port_sel_mode_show`, `function state_show`, `function flags_show`, `function mapping_show`, `function members_show`, `function mlx5_ldev_add_debugfs`, `function mlx5_ldev_remove_debugfs`.
- 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.