mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-27 19:50:44 +01:00
fixup! WIP: support ethtool Forward Error Correction(fec)
Declare NMEthtoolFec in nm-base.h instead of exposing it in libnm setting. For Ethtool features we do not expose the enum values.
This commit is contained in:
parent
78cbe53889
commit
b0d5386de3
8 changed files with 16 additions and 51 deletions
|
|
@ -2451,20 +2451,12 @@ _ethtool_features_reset(NMDevice *self, NMPlatform *platform, EthtoolState *etht
|
|||
_LOGD(LOGD_DEVICE, "ethtool: offload features successfully reset");
|
||||
}
|
||||
|
||||
static inline _NMEthtoolFec
|
||||
_NM_ETHTOOL_FEC_CAST(NMEthtoolFec v)
|
||||
{
|
||||
return (_NMEthtoolFec) v;
|
||||
}
|
||||
|
||||
static void
|
||||
_ethtool_fec_reset(NMDevice *self, NMPlatform *platform, EthtoolState *ethtool_state)
|
||||
{
|
||||
gs_free NMEthtoolFeatureStates *features = NULL;
|
||||
|
||||
if (!nm_platform_ethtool_set_fec(platform,
|
||||
ethtool_state->ifindex,
|
||||
_NM_ETHTOOL_FEC_CAST(NM_ETHTOOL_FEC_AUTO)))
|
||||
if (!nm_platform_ethtool_set_fec(platform, ethtool_state->ifindex, NM_ETHTOOL_FEC_AUTO))
|
||||
_LOGW(LOGD_DEVICE, "ethtool: failure resetting FEC");
|
||||
else
|
||||
_LOGD(LOGD_DEVICE, "ethtool: FEC reset to auto");
|
||||
|
|
@ -2513,9 +2505,7 @@ _ethtool_fec_set(NMDevice *self,
|
|||
return;
|
||||
}
|
||||
|
||||
if (!nm_platform_ethtool_set_fec(platform,
|
||||
ethtool_state->ifindex,
|
||||
_NM_ETHTOOL_FEC_CAST(fec_mode)))
|
||||
if (!nm_platform_ethtool_set_fec(platform, ethtool_state->ifindex, fec_mode))
|
||||
_LOGW(LOGD_DEVICE, "ethtool: failure setting FEC %d", fec_mode);
|
||||
else
|
||||
_LOGD(LOGD_DEVICE, "ethtool: FEC %d successfully set", fec_mode);
|
||||
|
|
|
|||
|
|
@ -211,16 +211,6 @@ nm_ethtool_id_is_fec(NMEthtoolID id)
|
|||
return id == NM_ETHTOOL_ID_FEC;
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
// Mirrors libnm's NMEthtoolFec.
|
||||
_NM_ETHTOOL_FEC_NONE = ETHTOOL_FEC_NONE,
|
||||
_NM_ETHTOOL_FEC_AUTO = ETHTOOL_FEC_AUTO,
|
||||
_NM_ETHTOOL_FEC_OFF = ETHTOOL_FEC_OFF,
|
||||
_NM_ETHTOOL_FEC_RS = ETHTOOL_FEC_RS,
|
||||
_NM_ETHTOOL_FEC_BASER = ETHTOOL_FEC_BASER,
|
||||
_NM_ETHTOOL_FEC_LLRS = ETHTOOL_FEC_LLRS,
|
||||
} _NMEthtoolFec;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef enum {
|
||||
|
|
|
|||
|
|
@ -11,33 +11,9 @@
|
|||
#endif
|
||||
|
||||
#include "nm-setting.h"
|
||||
#include <linux/ethtool.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* NMEthtoolFec:
|
||||
* @NM_ETHTOOL_FEC_NONE: Internal use only
|
||||
* @NM_ETHTOOL_FEC_AUTO: Select default/best FEC mode automatically
|
||||
* @NM_ETHTOOL_FEC_OFF: No FEC Mode
|
||||
* @NM_ETHTOOL_FEC_RS: Reed-Solomon FEC Mode
|
||||
* @NM_ETHTOOL_FEC_BASER: Base-R/Reed-Solomon FEC Mode
|
||||
* @NM_ETHTOOL_FEC_LLRS: Low Latency Reed Solomon FEC Mode
|
||||
*
|
||||
* #NMEthtoolFec describe ethtool Forward Error Correction(FEC) encoding modes.
|
||||
* FQDN.
|
||||
*
|
||||
* Since: 1.48
|
||||
*/
|
||||
typedef enum /*< flags >*/ {
|
||||
NM_ETHTOOL_FEC_NONE = ETHTOOL_FEC_NONE,
|
||||
NM_ETHTOOL_FEC_AUTO = ETHTOOL_FEC_AUTO,
|
||||
NM_ETHTOOL_FEC_OFF = ETHTOOL_FEC_OFF,
|
||||
NM_ETHTOOL_FEC_RS = ETHTOOL_FEC_RS,
|
||||
NM_ETHTOOL_FEC_BASER = ETHTOOL_FEC_BASER,
|
||||
NM_ETHTOOL_FEC_LLRS = ETHTOOL_FEC_LLRS,
|
||||
} NMEthtoolFec;
|
||||
|
||||
NM_AVAILABLE_IN_1_20
|
||||
gboolean nm_ethtool_optname_is_feature(const char *optname);
|
||||
|
||||
|
|
|
|||
|
|
@ -1819,7 +1819,7 @@ nmp_utils_ethtool_set_wake_on_lan(int ifindex,
|
|||
}
|
||||
|
||||
gboolean
|
||||
nmp_utils_ethtool_set_fec(int ifindex, const _NMEthtoolFec fec)
|
||||
nmp_utils_ethtool_set_fec(int ifindex, const NMEthtoolFec fec)
|
||||
{
|
||||
struct ethtool_fecparam fec_param = {
|
||||
.cmd = ETHTOOL_SFECPARAM,
|
||||
|
|
@ -1828,7 +1828,7 @@ nmp_utils_ethtool_set_fec(int ifindex, const _NMEthtoolFec fec)
|
|||
|
||||
g_return_val_if_fail(ifindex > 0, FALSE);
|
||||
|
||||
if (fec == _NM_ETHTOOL_FEC_NONE)
|
||||
if (fec == NM_ETHTOOL_FEC_NONE)
|
||||
return TRUE;
|
||||
|
||||
nm_log_dbg(LOGD_PLATFORM, "ethtool[%d]: setting FEC options 0x%x", ifindex, fec);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ gboolean nmp_utils_ethtool_get_eee(int ifindex, NMEthtoolEEEState *eee);
|
|||
|
||||
gboolean nmp_utils_ethtool_set_eee(int ifindex, const NMEthtoolEEEState *eee);
|
||||
|
||||
gboolean nmp_utils_ethtool_set_fec(int ifindex, const _NMEthtoolFec fec);
|
||||
gboolean nmp_utils_ethtool_set_fec(int ifindex, const NMEthtoolFec fec);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -3570,7 +3570,7 @@ nm_platform_ethtool_set_features(
|
|||
}
|
||||
|
||||
gboolean
|
||||
nm_platform_ethtool_set_fec(NMPlatform *self, int ifindex, const _NMEthtoolFec fec)
|
||||
nm_platform_ethtool_set_fec(NMPlatform *self, int ifindex, const NMEthtoolFec fec)
|
||||
{
|
||||
_CHECK_SELF_NETNS(self, klass, netns, FALSE);
|
||||
|
||||
|
|
|
|||
|
|
@ -2615,7 +2615,7 @@ gboolean nm_platform_ethtool_set_channels(NMPlatform *self,
|
|||
int ifindex,
|
||||
const NMEthtoolChannelsState *channels);
|
||||
|
||||
gboolean nm_platform_ethtool_set_fec(NMPlatform *self, int ifindex, const _NMEthtoolFec fec);
|
||||
gboolean nm_platform_ethtool_set_fec(NMPlatform *self, int ifindex, const NMEthtoolFec fec);
|
||||
|
||||
gboolean
|
||||
nm_platform_ethtool_get_link_pause(NMPlatform *self, int ifindex, NMEthtoolPauseState *pause);
|
||||
|
|
|
|||
|
|
@ -124,6 +124,15 @@ typedef struct {
|
|||
bool enabled : 1;
|
||||
} NMEthtoolEEEState;
|
||||
|
||||
typedef enum {
|
||||
NM_ETHTOOL_FEC_NONE = ETHTOOL_FEC_NONE,
|
||||
NM_ETHTOOL_FEC_AUTO = ETHTOOL_FEC_AUTO,
|
||||
NM_ETHTOOL_FEC_OFF = ETHTOOL_FEC_OFF,
|
||||
NM_ETHTOOL_FEC_RS = ETHTOOL_FEC_RS,
|
||||
NM_ETHTOOL_FEC_BASER = ETHTOOL_FEC_BASER,
|
||||
NM_ETHTOOL_FEC_LLRS = ETHTOOL_FEC_LLRS,
|
||||
} NMEthtoolFec;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct _NMPNetns NMPNetns;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue