mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 09:20:13 -04:00
net: microchip: vcap: use port number instead of netdev name for debugfs
sparx5_vcap_init() runs before sparx5_register_netdevs() in probe, and
its debugfs setup calls vcap_port_debugfs() for every port using
netdev_name(ndev) as the debugfs file name. At that point the netdevs
have only been allocated, not registered, so dev->name still holds the
"eth%d" template and netdev_name() returns "(unnamed net_device)".
Every port tries to create the same file under vcaps/, producing a
flood of warnings at boot:
debugfs: '(unnamed net_device)' already exists in 'vcaps'
debugfs: '(unnamed net_device)' already exists in 'vcaps'
...
Add vcap_port_debugfs_portno(), a variant of vcap_port_debugfs() that
takes the port's stable hardware port number and uses "p%u" as the
debugfs file name instead of netdev_name(ndev). This makes the file
name independent of registration order; the file still stores and
later dereferences the netdev itself, same as before. sparx5 already
reports the same "p%d" string via ndo_get_phys_port_name(), so the
debugfs name now matches that.
Only sparx5 (and lan969x, which shares this code) is switched to the
new function. lan966x keeps calling vcap_port_debugfs() unchanged, so
this fix does not rename any of its existing debugfs files.
Fixes: b8909aad5b ("net: sparx5: move netdev and notifier block registration to probe")
Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://patch.msgid.link/20260817-misc-fixes-sparx5-lan969x-v3-1-c7c7fef723a8@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
498386b6d4
commit
b7adcc56fd
@@ -2077,8 +2077,9 @@ int sparx5_vcap_init(struct sparx5 *sparx5)
|
||||
dir = vcap_debugfs(sparx5->dev, sparx5->debugfs_root, ctrl);
|
||||
for (idx = 0; idx < consts->n_ports; ++idx)
|
||||
if (sparx5->ports[idx])
|
||||
vcap_port_debugfs(sparx5->dev, dir, ctrl,
|
||||
sparx5->ports[idx]->ndev);
|
||||
vcap_port_debugfs_portno(sparx5->dev, dir, ctrl,
|
||||
sparx5->ports[idx]->ndev,
|
||||
sparx5->ports[idx]->portno);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -400,6 +400,27 @@ void vcap_port_debugfs(struct device *dev, struct dentry *parent,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(vcap_port_debugfs);
|
||||
|
||||
void vcap_port_debugfs_portno(struct device *dev,
|
||||
struct dentry *parent,
|
||||
struct vcap_control *vctrl,
|
||||
struct net_device *ndev,
|
||||
unsigned int portno)
|
||||
{
|
||||
struct vcap_port_debugfs_info *info;
|
||||
char name[16];
|
||||
|
||||
info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
info->vctrl = vctrl;
|
||||
info->ndev = ndev;
|
||||
|
||||
snprintf(name, sizeof(name), "p%u", portno);
|
||||
debugfs_create_file(name, 0444, parent, info, &vcap_port_debugfs_fops);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(vcap_port_debugfs_portno);
|
||||
|
||||
/* Show the full VCAP instance data (rules with all fields) */
|
||||
static int vcap_debugfs_show(struct seq_file *m, void *unused)
|
||||
{
|
||||
|
||||
@@ -18,6 +18,12 @@ void vcap_port_debugfs(struct device *dev, struct dentry *parent,
|
||||
struct vcap_control *vctrl,
|
||||
struct net_device *ndev);
|
||||
|
||||
void vcap_port_debugfs_portno(struct device *dev,
|
||||
struct dentry *parent,
|
||||
struct vcap_control *vctrl,
|
||||
struct net_device *ndev,
|
||||
unsigned int portno);
|
||||
|
||||
/* Create a debugFS entry for a vcap instance */
|
||||
struct dentry *vcap_debugfs(struct device *dev, struct dentry *parent,
|
||||
struct vcap_control *vctrl);
|
||||
@@ -30,6 +36,14 @@ static inline void vcap_port_debugfs(struct device *dev, struct dentry *parent,
|
||||
{
|
||||
}
|
||||
|
||||
static inline void vcap_port_debugfs_portno(struct device *dev,
|
||||
struct dentry *parent,
|
||||
struct vcap_control *vctrl,
|
||||
struct net_device *ndev,
|
||||
unsigned int portno)
|
||||
{
|
||||
}
|
||||
|
||||
static inline struct dentry *vcap_debugfs(struct device *dev,
|
||||
struct dentry *parent,
|
||||
struct vcap_control *vctrl)
|
||||
|
||||
Reference in New Issue
Block a user