mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 23:30:28 +01:00
platform: call ethtool functions via platform
When adding namespace support later, we must call ethtool from the proper namespace, i.e. via a NMPlatform instance. Avoid calling ethtool directly.
This commit is contained in:
parent
98d14b0c15
commit
be4472bdcd
3 changed files with 24 additions and 2 deletions
|
|
@ -1187,7 +1187,7 @@ wake_on_lan_enable (NMDevice *device)
|
|||
}
|
||||
wol = NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE;
|
||||
found:
|
||||
return nmp_utils_ethtool_set_wake_on_lan (nm_device_get_iface (device), wol, password);
|
||||
return nm_platform_ethtool_set_wake_on_lan (NM_PLATFORM_GET, nm_device_get_iface (device), wol, password);
|
||||
}
|
||||
|
||||
/****************************************************************/
|
||||
|
|
@ -1533,7 +1533,7 @@ get_link_speed (NMDevice *device)
|
|||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
||||
guint32 speed;
|
||||
|
||||
if (!nmp_utils_ethtool_get_link_speed (nm_device_get_iface (device), &speed))
|
||||
if (!nm_platform_ethtool_get_link_speed (NM_PLATFORM_GET, nm_device_get_iface (device), &speed))
|
||||
return;
|
||||
if (priv->speed == speed)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -2370,6 +2370,24 @@ _to_string_dev (NMPlatform *self, int ifindex, char *buf, size_t size)
|
|||
|
||||
/******************************************************************/
|
||||
|
||||
gboolean
|
||||
nm_platform_ethtool_set_wake_on_lan (NMPlatform *self, const char *ifname, NMSettingWiredWakeOnLan wol, const char *wol_password)
|
||||
{
|
||||
_CHECK_SELF (self, klass, FALSE);
|
||||
|
||||
return nmp_utils_ethtool_set_wake_on_lan (ifname, wol, wol_password);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_platform_ethtool_get_link_speed (NMPlatform *self, const char *ifname, guint32 *out_speed)
|
||||
{
|
||||
_CHECK_SELF (self, klass, FALSE);
|
||||
|
||||
return nmp_utils_ethtool_get_link_speed (ifname, out_speed);
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
void
|
||||
nm_platform_ip4_address_set_addr (NMPlatformIP4Address *addr, in_addr_t address, int plen)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "nm-core-utils.h"
|
||||
#include "nm-setting-vlan.h"
|
||||
#include "nm-setting-wired.h"
|
||||
|
||||
#define NM_TYPE_PLATFORM (nm_platform_get_type ())
|
||||
#define NM_PLATFORM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_PLATFORM, NMPlatform))
|
||||
|
|
@ -925,4 +926,7 @@ const char *nm_platform_route_scope2str (int scope, char *buf, gsize len);
|
|||
|
||||
int nm_platform_ip_address_cmp_expiry (const NMPlatformIPAddress *a, const NMPlatformIPAddress *b);
|
||||
|
||||
gboolean nm_platform_ethtool_set_wake_on_lan (NMPlatform *self, const char *ifname, NMSettingWiredWakeOnLan wol, const char *wol_password);
|
||||
gboolean nm_platform_ethtool_get_link_speed (NMPlatform *self, const char *ifname, guint32 *out_speed);
|
||||
|
||||
#endif /* __NETWORKMANAGER_PLATFORM_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue