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
@@ -212,6 +212,7 @@ struct nsim_dev {
|
||||
struct dentry *ddir;
|
||||
struct dentry *ports_ddir;
|
||||
struct dentry *take_snapshot;
|
||||
struct dentry *max_vfs;
|
||||
struct bpf_offload_dev *bpf_dev;
|
||||
bool bpf_bind_accept;
|
||||
bool bpf_bind_verifier_accept;
|
||||
@@ -269,6 +270,13 @@ void nsim_fib_destroy(struct devlink *devlink, struct nsim_fib_data *fib_data);
|
||||
u64 nsim_fib_get_val(struct nsim_fib_data *fib_data,
|
||||
enum nsim_resource_id res_id, bool max);
|
||||
|
||||
ssize_t nsim_bus_dev_max_vfs_read(struct file *file,
|
||||
char __user *data,
|
||||
size_t count, loff_t *ppos);
|
||||
ssize_t nsim_bus_dev_max_vfs_write(struct file *file,
|
||||
const char __user *data,
|
||||
size_t count, loff_t *ppos);
|
||||
|
||||
#if IS_ENABLED(CONFIG_XFRM_OFFLOAD)
|
||||
void nsim_ipsec_init(struct netdevsim *ns);
|
||||
void nsim_ipsec_teardown(struct netdevsim *ns);
|
||||
@@ -308,7 +316,9 @@ struct nsim_bus_dev {
|
||||
struct net *initial_net; /* Purpose of this is to carry net pointer
|
||||
* during the probe time only.
|
||||
*/
|
||||
unsigned int max_vfs;
|
||||
unsigned int num_vfs;
|
||||
struct mutex vfs_lock; /* Protects vfconfigs */
|
||||
struct nsim_vf_config *vfconfigs;
|
||||
/* Lock for devlink->reload_enabled in netdevsim module */
|
||||
struct mutex nsim_bus_reload_lock;
|
||||
|
||||
Reference in New Issue
Block a user