Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

devlink: Add new "enable_vnet" generic device param

Add new device generic parameter to enable/disable creation of
VDPA net auxiliary device and associated device functionality
in the devlink instance.

User who prefers to disable such functionality can disable it using below
example.

$ devlink dev param set pci/0000:06:00.0 \
name enable_vnet value false cmode driverinit
$ devlink dev reload pci/0000:06:00.0

At this point devlink instance do not create auxiliary device for the
VDPA net functionality.

Signed-off-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Parav Pandit and committed by
David S. Miller
076b2a9d 8ddaabee

+13
+4
include/net/devlink.h
··· 521 521 DEVLINK_PARAM_GENERIC_ID_ENABLE_REMOTE_DEV_RESET, 522 522 DEVLINK_PARAM_GENERIC_ID_ENABLE_ETH, 523 523 DEVLINK_PARAM_GENERIC_ID_ENABLE_RDMA, 524 + DEVLINK_PARAM_GENERIC_ID_ENABLE_VNET, 524 525 525 526 /* add new param generic ids above here*/ 526 527 __DEVLINK_PARAM_GENERIC_ID_MAX, ··· 567 566 568 567 #define DEVLINK_PARAM_GENERIC_ENABLE_RDMA_NAME "enable_rdma" 569 568 #define DEVLINK_PARAM_GENERIC_ENABLE_RDMA_TYPE DEVLINK_PARAM_TYPE_BOOL 569 + 570 + #define DEVLINK_PARAM_GENERIC_ENABLE_VNET_NAME "enable_vnet" 571 + #define DEVLINK_PARAM_GENERIC_ENABLE_VNET_TYPE DEVLINK_PARAM_TYPE_BOOL 570 572 571 573 #define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate) \ 572 574 { \
+5
net/core/devlink.c
··· 4287 4287 .name = DEVLINK_PARAM_GENERIC_ENABLE_RDMA_NAME, 4288 4288 .type = DEVLINK_PARAM_GENERIC_ENABLE_RDMA_TYPE, 4289 4289 }, 4290 + { 4291 + .id = DEVLINK_PARAM_GENERIC_ID_ENABLE_VNET, 4292 + .name = DEVLINK_PARAM_GENERIC_ENABLE_VNET_NAME, 4293 + .type = DEVLINK_PARAM_GENERIC_ENABLE_VNET_TYPE, 4294 + }, 4290 4295 }; 4291 4296 4292 4297 static int devlink_param_generic_verify(const struct devlink_param *param)