]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
devlink: Support setting max_io_eqs
authorParav Pandit <parav@nvidia.com>
Wed, 10 Apr 2024 11:58:08 +0000 (14:58 +0300)
committerDavid Ahern <dsahern@kernel.org>
Sat, 13 Apr 2024 16:34:21 +0000 (16:34 +0000)
Devices send event notifications for the IO queues,
such as tx and rx queues, through event queues.

Enable a privileged owner, such as a hypervisor PF, to set the number
of IO event queues for the VF and SF during the provisioning stage.

example:
Get maximum IO event queues of the VF device::

  $ devlink port show pci/0000:06:00.0/2
  pci/0000:06:00.0/2: type eth netdev enp6s0pf0vf1 flavour pcivf pfnum 0 vfnum 1
      function:
          hw_addr 00:00:00:00:00:00 ipsec_packet disabled max_io_eqs 10

Set maximum IO event queues of the VF device::

  $ devlink port function set pci/0000:06:00.0/2 max_io_eqs 32

  $ devlink port show pci/0000:06:00.0/2
  pci/0000:06:00.0/2: type eth netdev enp6s0pf0vf1 flavour pcivf pfnum 0 vfnum 1
      function:
          hw_addr 00:00:00:00:00:00 ipsec_packet disabled max_io_eqs 32

Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
devlink/devlink.c
man/man8/devlink-port.8

index dbeb6e397e8e2c7ab45bf6014be076e975745d0a..03d2720225a2903c4cc319434640cd2c20b7faae 100644 (file)
@@ -309,6 +309,7 @@ static int ifname_map_update(struct ifname_map *ifname_map, const char *ifname)
 #define DL_OPT_PORT_FN_RATE_TX_PRIORITY        BIT(55)
 #define DL_OPT_PORT_FN_RATE_TX_WEIGHT  BIT(56)
 #define DL_OPT_PORT_FN_CAPS    BIT(57)
+#define DL_OPT_PORT_FN_MAX_IO_EQS      BIT(58)
 
 struct dl_opts {
        uint64_t present; /* flags of present items */
@@ -375,6 +376,7 @@ struct dl_opts {
        const char *linecard_type;
        bool selftests_opt[DEVLINK_ATTR_SELFTEST_ID_MAX + 1];
        struct nla_bitfield32 port_fn_caps;
+       uint32_t port_fn_max_io_eqs;
 };
 
 struct dl {
@@ -773,6 +775,7 @@ devlink_function_policy[DEVLINK_PORT_FUNCTION_ATTR_MAX + 1] = {
        [DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR ] = MNL_TYPE_BINARY,
        [DEVLINK_PORT_FN_ATTR_STATE] = MNL_TYPE_U8,
        [DEVLINK_PORT_FN_ATTR_DEVLINK] = MNL_TYPE_NESTED,
+       [DEVLINK_PORT_FN_ATTR_MAX_IO_EQS] = MNL_TYPE_U32,
 };
 
 static int function_attr_cb(const struct nlattr *attr, void *data)
@@ -2298,6 +2301,17 @@ static int dl_argv_parse(struct dl *dl, uint64_t o_required,
                        if (ipsec_packet)
                                opts->port_fn_caps.value |= DEVLINK_PORT_FN_CAP_IPSEC_PACKET;
                        o_found |= DL_OPT_PORT_FN_CAPS;
+               } else if (dl_argv_match(dl, "max_io_eqs") &&
+                          (o_all & DL_OPT_PORT_FN_MAX_IO_EQS)) {
+                       uint32_t max_io_eqs;
+
+                       dl_arg_inc(dl);
+                       err = dl_argv_uint32_t(dl, &max_io_eqs);
+                       if (err)
+                               return err;
+                       opts->port_fn_max_io_eqs = max_io_eqs;
+                       o_found |= DL_OPT_PORT_FN_MAX_IO_EQS;
+
                } else {
                        pr_err("Unknown option \"%s\"\n", dl_argv(dl));
                        return -EINVAL;
@@ -2428,6 +2442,9 @@ dl_function_attr_put(struct nlmsghdr *nlh, const struct dl_opts *opts)
        if (opts->present & DL_OPT_PORT_FN_CAPS)
                mnl_attr_put(nlh, DEVLINK_PORT_FN_ATTR_CAPS,
                             sizeof(opts->port_fn_caps), &opts->port_fn_caps);
+       if (opts->present & DL_OPT_PORT_FN_MAX_IO_EQS)
+               mnl_attr_put_u32(nlh, DEVLINK_PORT_FN_ATTR_MAX_IO_EQS,
+                               opts->port_fn_max_io_eqs);
 
        mnl_attr_nest_end(nlh, nest);
 }
@@ -4744,6 +4761,7 @@ static void cmd_port_help(void)
        pr_err("       devlink port function set DEV/PORT_INDEX [ hw_addr ADDR ] [ state { active | inactive } ]\n");
        pr_err("                      [ roce { enable | disable } ] [ migratable { enable | disable } ]\n");
        pr_err("                      [ ipsec_crypto { enable | disable } ] [ ipsec_packet { enable | disable } ]\n");
+       pr_err("                      [ max_io_eqs EQS\n");
        pr_err("       devlink port function rate { help | show | add | del | set }\n");
        pr_err("       devlink port param set DEV/PORT_INDEX name PARAMETER value VALUE cmode { permanent | driverinit | runtime }\n");
        pr_err("       devlink port param show [DEV/PORT_INDEX name PARAMETER]\n");
@@ -4878,6 +4896,15 @@ static void pr_out_port_function(struct dl *dl, struct nlattr **tb_port)
                                     port_fn_caps->value & DEVLINK_PORT_FN_CAP_IPSEC_PACKET ?
                                     "enable" : "disable");
        }
+       if (tb[DEVLINK_PORT_FN_ATTR_MAX_IO_EQS]) {
+               uint32_t max_io_eqs;
+
+               max_io_eqs = mnl_attr_get_u32(tb[DEVLINK_PORT_FN_ATTR_MAX_IO_EQS]);
+
+               print_uint(PRINT_ANY, "max_io_eqs", " max_io_eqs %u",
+                          max_io_eqs);
+       }
+
        if (tb[DEVLINK_PORT_FN_ATTR_DEVLINK])
                pr_out_nested_handle_obj(dl, tb[DEVLINK_PORT_FN_ATTR_DEVLINK],
                                         true, true);
@@ -5086,7 +5113,7 @@ static int cmd_port_function_set(struct dl *dl)
        }
        err = dl_argv_parse(dl, DL_OPT_HANDLEP,
                            DL_OPT_PORT_FUNCTION_HW_ADDR | DL_OPT_PORT_FUNCTION_STATE |
-                           DL_OPT_PORT_FN_CAPS);
+                           DL_OPT_PORT_FN_CAPS | DL_OPT_PORT_FN_MAX_IO_EQS);
        if (err)
                return err;
 
index 70d8837eabc0a200b9811d86f5c409a9488c168e..6f5822601aebb1d96bca2cb84a19e7d9160be1bb 100644 (file)
@@ -83,6 +83,9 @@ devlink-port \- devlink port configuration
 .RI "[ "
 .BR ipsec_packet " { " enable " | " disable " }"
 .RI "]"
+.RI "[ "
+.BR max_io_eqs " EQS"
+.RI "]"
 
 .ti -8
 .BR "devlink port function rate "
@@ -238,6 +241,10 @@ crypto operation (Encrypt/Decrypt) offload.
 Set the IPsec packet offload capability of the function. Controls XFRM state
 and policy offload (Encrypt/Decrypt operation and IPsec encapsulation).
 
+.TP
+.BR max_io_eqs " EQS"
+Set the maximum number of IO event queues of the function.
+
 .ti -8
 .SS devlink port del - delete a devlink port
 .PP
@@ -377,6 +384,11 @@ devlink port function set pci/0000:01:00.0/1 ipsec_packet enable
 This will enable the IPsec packet offload functionality of the function.
 .RE
 .PP
+devlink port function set pci/0000:01:00.0/1 max_io_eqs 4
+.RS 4
+This will set the maximum number of IO event queues of the function to 4.
+.RE
+.PP
 devlink port function set pci/0000:01:00.0/1 hw_addr 00:00:00:11:22:33 state active
 .RS 4
 Configure hardware address and also active the function. When a function is