mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
netdevsim: Add max_vfs to bus_dev
Currently there is no limit to the number of VFs netdevsim can enable. In a real systems this value exist and used by the driver. Fore example, some features might need to consider this value when allocating memory. Expose max_vfs variable to debugfs as configurable resource. If are VFs configured (num_vfs != 0) then changing of max_vfs not allowed. Co-developed-by: Yuval Avnery <yuvalav@nvidia.com> Signed-off-by: Yuval Avnery <yuvalav@nvidia.com> Signed-off-by: Dmytro Linkin <dlinkin@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
53c7bb5530
commit
d395381909
@@ -192,6 +192,14 @@ static const struct file_operations nsim_dev_trap_fa_cookie_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static const struct file_operations nsim_dev_max_vfs_fops = {
|
||||
.open = simple_open,
|
||||
.read = nsim_bus_dev_max_vfs_read,
|
||||
.write = nsim_bus_dev_max_vfs_write,
|
||||
.llseek = generic_file_llseek,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int nsim_dev_debugfs_init(struct nsim_dev *nsim_dev)
|
||||
{
|
||||
char dev_ddir_name[sizeof(DRV_NAME) + 10];
|
||||
@@ -231,6 +239,11 @@ static int nsim_dev_debugfs_init(struct nsim_dev *nsim_dev)
|
||||
debugfs_create_bool("fail_trap_policer_counter_get", 0600,
|
||||
nsim_dev->ddir,
|
||||
&nsim_dev->fail_trap_policer_counter_get);
|
||||
nsim_dev->max_vfs = debugfs_create_file("max_vfs",
|
||||
0600,
|
||||
nsim_dev->ddir,
|
||||
nsim_dev->nsim_bus_dev,
|
||||
&nsim_dev_max_vfs_fops);
|
||||
nsim_udp_tunnels_debugfs_create(nsim_dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user