]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
devlink: Add new "max_mac_per_vf" generic device param
authorMohammad Heib <mheib@redhat.com>
Sat, 25 Oct 2025 13:08:58 +0000 (16:08 +0300)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 6 Nov 2025 20:57:31 +0000 (12:57 -0800)
Add a new device generic parameter to controls the maximum
number of MAC filters allowed per VF.

For example, to limit a VF to 3 MAC addresses:
 $ devlink dev param set pci/0000:3b:00.0 name max_mac_per_vf \
        value 3 \
        cmode runtime

Signed-off-by: Mohammad Heib <mheib@redhat.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Documentation/networking/devlink/devlink-params.rst
include/net/devlink.h
net/devlink/param.c

index 0a9c20d701225caf9a46fa9aa67edf011fc08f74..c0597d456641d742a7c5d050714bc85668900d8d 100644 (file)
@@ -151,3 +151,7 @@ own name.
    * - ``num_doorbells``
      - u32
      - Controls the number of doorbells used by the device.
+   * - ``max_mac_per_vf``
+     - u32
+     - Controls the maximum number of MAC address filters that can be assigned
+       to a Virtual Function (VF).
index 9e824f61e40f6717e92200f445bfe74674c6f52d..d01046ef0577c740b01167b5db19e3dc8381fe10 100644 (file)
@@ -532,6 +532,7 @@ enum devlink_param_generic_id {
        DEVLINK_PARAM_GENERIC_ID_CLOCK_ID,
        DEVLINK_PARAM_GENERIC_ID_TOTAL_VFS,
        DEVLINK_PARAM_GENERIC_ID_NUM_DOORBELLS,
+       DEVLINK_PARAM_GENERIC_ID_MAX_MAC_PER_VF,
 
        /* add new param generic ids above here*/
        __DEVLINK_PARAM_GENERIC_ID_MAX,
@@ -602,6 +603,9 @@ enum devlink_param_generic_id {
 #define DEVLINK_PARAM_GENERIC_NUM_DOORBELLS_NAME "num_doorbells"
 #define DEVLINK_PARAM_GENERIC_NUM_DOORBELLS_TYPE DEVLINK_PARAM_TYPE_U32
 
+#define DEVLINK_PARAM_GENERIC_MAX_MAC_PER_VF_NAME "max_mac_per_vf"
+#define DEVLINK_PARAM_GENERIC_MAX_MAC_PER_VF_TYPE DEVLINK_PARAM_TYPE_U32
+
 #define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate)     \
 {                                                                      \
        .id = DEVLINK_PARAM_GENERIC_ID_##_id,                           \
index 70e69523412cb632611c4d7313a0d2d3c90ac514..6b233b13b69ae3878906fa7ff562ce76609bc7e3 100644 (file)
@@ -112,6 +112,11 @@ static const struct devlink_param devlink_param_generic[] = {
                .name = DEVLINK_PARAM_GENERIC_NUM_DOORBELLS_NAME,
                .type = DEVLINK_PARAM_GENERIC_NUM_DOORBELLS_TYPE,
        },
+       {
+               .id = DEVLINK_PARAM_GENERIC_ID_MAX_MAC_PER_VF,
+               .name = DEVLINK_PARAM_GENERIC_MAX_MAC_PER_VF_NAME,
+               .type = DEVLINK_PARAM_GENERIC_MAX_MAC_PER_VF_TYPE,
+       },
 };
 
 static int devlink_param_generic_verify(const struct devlink_param *param)