NetworkManager/src/libnm-platform/devlink/nm-devlink.h
Íñigo Huguet f31d29bbb7 platform: netlink: add devlink support
Add support for Devlink, which is just another family of Generic Netlink
like nl80211. Implement get_eswitch_mode and set_eswitch_mode to allow
changing between legacy SRIOV and switchdev modes.

Devlink's purpose is to allow querying and configuring stuff related to
a piece of hardware but not to any of the usual Linux device classes.

For example, nowadays the Smart NICs normally allow to change the
eswitch mode per PF, because their hardware implements one eswitch per
PF, but future models might have a single eswitch for all the physical
and virtual ports of the NIC allowing more advanced bridge offloads.

Regarding the above example, for the moment we only support PCI network
devices with the "one eswitch per PF" model. The reason is that currently
NM only knows about netdevs so dealing with "devlink devices" that
doesn't map 1-1 with a netdev would require new mechanisms to understand
what they are and their relation with the netdevs that NM manage. We
will deal with that use cases when they arise and we have more
information about the right way to support them.
2024-02-20 16:01:25 +01:00

22 lines
No EOL
675 B
C

/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2024 Red Hat, Inc.
*/
#ifndef __NMP_DEVLINK_H__
#define __NMP_DEVLINK_H__
#include <linux/devlink.h>
struct nl_sock;
typedef struct _NMPlatform NMPlatform;
typedef struct _NMDevlink NMDevlink;
NMDevlink *nm_devlink_new(NMPlatform *platform, struct nl_sock *genl_sock_sync, int ifindex);
gboolean
nm_devlink_get_dev_identifier(NMDevlink *self, char **out_bus, char **out_addr, GError **error);
int nm_devlink_get_eswitch_mode(NMDevlink *self, GError **error);
gboolean
nm_devlink_set_eswitch_mode(NMDevlink *self, enum devlink_eswitch_mode mode, GError **error);
#endif /* __NMP_DEVLINK_H__ */