Commit Graph

10 Commits

Author SHA1 Message Date
Petr Oros 50682536c3 devlink: Fix length of eswitch inline-mode
JIRA: https://issues.redhat.com/browse/RHEL-30145

Upstream commit(s):
commit 8f4cd89bf10607de08231d6d91a73dd63336808e
Author: William Tu <witu@nvidia.com>
Date:   Sun Mar 10 18:45:47 2024 +0200

    devlink: Fix length of eswitch inline-mode

    Set eswitch inline-mode to be u8, not u16. Otherwise, errors below

    $ devlink dev eswitch set pci/0000:08:00.0 mode switchdev \
      inline-mode network
        Error: Attribute failed policy validation.
        kernel answers: Numerical result out of rang
        netlink: 'devlink': attribute type 26 has an invalid length.

    Fixes: f2f9dd164db0 ("netlink: specs: devlink: add the remaining command to generate complete split_ops")
    Signed-off-by: William Tu <witu@nvidia.com>
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://lore.kernel.org/r/20240310164547.35219-1-witu@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Petr Oros <poros@redhat.com>
2024-04-26 17:16:11 +02:00
Petr Oros 298f4a3ca9 devlink: extend multicast filtering by port index
JIRA: https://issues.redhat.com/browse/RHEL-30145

Upstream commit(s):
commit ded6f77c05b113001d449cf2cc810e090f20ec4a
Author: Jiri Pirko <jiri@nvidia.com>
Date:   Sat Dec 16 13:30:01 2023 +0100

    devlink: extend multicast filtering by port index

    Expose the previously introduced notification multicast messages
    filtering infrastructure and allow the user to select messages using
    port index.

    Signed-off-by: Jiri Pirko <jiri@nvidia.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Signed-off-by: Petr Oros <poros@redhat.com>
2024-04-26 17:16:10 +02:00
Petr Oros d32acff1d1 devlink: add a command to set notification filter and use it for multicasts
JIRA: https://issues.redhat.com/browse/RHEL-30145

Upstream commit(s):
commit 13b127d2578432e1e521310b69944c5a1b30679c
Author: Jiri Pirko <jiri@nvidia.com>
Date:   Sat Dec 16 13:30:00 2023 +0100

    devlink: add a command to set notification filter and use it for multicasts

    Currently the user listening on a socket for devlink notifications
    gets always all messages for all existing instances, even if he is
    interested only in one of those. That may cause unnecessary overhead
    on setups with thousands of instances present.

    User is currently able to narrow down the devlink objects replies
    to dump commands by specifying select attributes.

    Allow similar approach for notifications. Introduce a new devlink
    NOTIFY_FILTER_SET which the user passes the select attributes. Store
    these per-socket and use them for filtering messages
    during multicast send.

    Signed-off-by: Jiri Pirko <jiri@nvidia.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Signed-off-by: Petr Oros <poros@redhat.com>
2024-04-26 17:16:10 +02:00
Petr Oros 5a324ef43d devlink: Acquire device lock during reload command
JIRA: https://issues.redhat.com/browse/RHEL-30145

Upstream commit(s):
commit bf6b200bc80d18480f8d0fb61e185bb0587e633c
Author: Ido Schimmel <idosch@nvidia.com>
Date:   Wed Nov 15 13:17:14 2023 +0100

    devlink: Acquire device lock during reload command

    Device drivers register with devlink from their probe routines (under
    the device lock) by acquiring the devlink instance lock and calling
    devl_register().

    Drivers that support a devlink reload usually implement the
    reload_{down, up}() operations in a similar fashion to their remove and
    probe routines, respectively.

    However, while the remove and probe routines are invoked with the device
    lock held, the reload operations are only invoked with the devlink
    instance lock held. It is therefore impossible for drivers to acquire
    the device lock from their reload operations, as this would result in
    lock inversion.

    The motivating use case for invoking the reload operations with the
    device lock held is in mlxsw which needs to trigger a PCI reset as part
    of the reload. The driver cannot call pci_reset_function() as this
    function acquires the device lock. Instead, it needs to call
    __pci_reset_function_locked which expects the device lock to be held.

    To that end, adjust devlink to always acquire the device lock before the
    devlink instance lock when performing a reload.

    Do that when reload is explicitly triggered by user space by specifying
    the 'DEVLINK_NL_FLAG_NEED_DEV_LOCK' flag in the pre_doit and post_doit
    operations of the reload command.

    A previous patch already handled the case where reload is invoked as
    part of netns dismantle.

    Signed-off-by: Ido Schimmel <idosch@nvidia.com>
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Signed-off-by: Petr Machata <petrm@nvidia.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Petr Oros <poros@redhat.com>
2024-04-26 17:16:06 +02:00
Petr Oros 968587c19b netlink: specs: devlink: add forgotten port function caps enum values
JIRA: https://issues.redhat.com/browse/RHEL-30145

Upstream commit(s):
commit 05f0431bb90f2ee3657e7fc2678f11a1f9b778b7
Author: Jiri Pirko <jiri@nvidia.com>
Date:   Mon Oct 30 17:17:50 2023 +0100

    netlink: specs: devlink: add forgotten port function caps enum values

    Add two enum values that the blamed commit omitted.

    Fixes: f2f9dd164db0 ("netlink: specs: devlink: add the remaining command to generate complete split_ops")
    Signed-off-by: Jiri Pirko <jiri@nvidia.com>
    Link: https://lore.kernel.org/r/20231030161750.110420-1-jiri@resnulli.us
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Petr Oros <poros@redhat.com>
2024-04-26 17:16:05 +02:00
Petr Oros d1e25cb9f7 netlink: specs: devlink: add the remaining command to generate complete split_ops
JIRA: https://issues.redhat.com/browse/RHEL-30145

Upstream commit(s):
commit f2f9dd164db079161a834c8698c68a94a50b4168
Author: Jiri Pirko <jiri@nvidia.com>
Date:   Sat Oct 21 13:27:09 2023 +0200

    netlink: specs: devlink: add the remaining command to generate complete split_ops

    Currently, some of the commands are not described in devlink yaml file
    and are manually filled in net/devlink/netlink.c in small_ops. To make
    all part of split_ops, add definitions of the rest of the commands
    alongside with needed attributes and enums.

    Note that this focuses on the kernel side. The requests are fully
    described in order to generate split_op alongside with policies.
    Follow-up will describe the replies in order to make the userspace
    helpers complete.

    Signed-off-by: Jiri Pirko <jiri@nvidia.com>
    Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
    Link: https://lore.kernel.org/r/20231021112711.660606-9-jiri@resnulli.us
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Petr Oros <poros@redhat.com>
2024-04-26 17:16:04 +02:00
Ivan Vecera 7707f155e9 netlink: specs: devlink: extend health reporter dump attributes by port index
JIRA: https://issues.redhat.com/browse/RHEL-30656

commit 0149bca172622d802c0caff8cf0928fb0ded767b
Author: Jiri Pirko <jiri@nvidia.com>
Date:   Fri Aug 11 17:57:14 2023 +0200

    netlink: specs: devlink: extend health reporter dump attributes by port index

    Allow user to pass port index for health reporter dump request.

    Re-generate the related code.

    Signed-off-by: Jiri Pirko <jiri@nvidia.com>
    Acked-by: Jakub Kicinski <kuba@kernel.org>
    Link: https://lore.kernel.org/r/20230811155714.1736405-14-jiri@resnulli.us
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
2024-04-10 09:19:30 +02:00
Ivan Vecera a20e9fef96 netlink: specs: devlink: extend per-instance dump commands to accept instance attributes
JIRA: https://issues.redhat.com/browse/RHEL-30656

commit 34493336e7d3d38a8ec6472243baa6660214d990
Author: Jiri Pirko <jiri@nvidia.com>
Date:   Fri Aug 11 17:57:12 2023 +0200

    netlink: specs: devlink: extend per-instance dump commands to accept instance attributes

    Extend per-instance dump command definitions to accept instance
    attributes. Allow parsing of devlink handle attributes so they could
    be used for instance selection.

    Re-generate the related code.

    Signed-off-by: Jiri Pirko <jiri@nvidia.com>
    Acked-by: Jakub Kicinski <kuba@kernel.org>
    Link: https://lore.kernel.org/r/20230811155714.1736405-12-jiri@resnulli.us
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
2024-04-10 09:19:30 +02:00
Ivan Vecera f0a98c7942 netlink: specs: devlink: add commands that do per-instance dump
JIRA: https://issues.redhat.com/browse/RHEL-30656

commit 7199c86247e9618981a2916900d3fcb83e5df157
Author: Jiri Pirko <jiri@nvidia.com>
Date:   Fri Aug 11 17:57:08 2023 +0200

    netlink: specs: devlink: add commands that do per-instance dump

    Add the definitions for the commands that do per-instance dump
    and re-generate the related code.

    Signed-off-by: Jiri Pirko <jiri@nvidia.com>
    Acked-by: Jakub Kicinski <kuba@kernel.org>
    Link: https://lore.kernel.org/r/20230811155714.1736405-8-jiri@resnulli.us
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
2024-04-10 09:19:30 +02:00
Ivan Vecera 9916dd5e3a devlink: add split ops generated according to spec
JIRA: https://issues.redhat.com/browse/RHEL-30656

commit 6b7c486cae8136050df8fca2fbebedb685c49b2d
Author: Jiri Pirko <jiri@nvidia.com>
Date:   Thu Aug 3 13:13:38 2023 +0200

    devlink: add split ops generated according to spec

    Improve the existing devlink spec in order to serve as a source for
    generation of valid devlink split ops for the existing commands.
    Add the generated sources.

    Node that the policies are narrowed down only to the attributes that
    are actually parsed. The dont-validate-strict parsing policy makes sure
    that other possibly passed garbage attributes from userspace are
    ignored during validation.

    Signed-off-by: Jiri Pirko <jiri@nvidia.com>
    Reviewed-by: Jakub Kicinski <kuba@kernel.org>
    Link: https://lore.kernel.org/r/20230803111340.1074067-11-jiri@resnulli.us
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
2024-04-10 09:19:28 +02:00