mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 13:38:43 +02:00
platform: simplify NMEthtoolCoalesceState to only track one state
Only in one moment we need the old and requested settings together: during _ethtool_coalesce_set(). But for that we shouldn't track both states in "NMEthtoolCoalesceState". Simplify "NMEthtoolCoalesceState" to only contain one set of options. By tracking less state, the code becomes simpler, because you don't need to wonder where the old and requested state is used.
This commit is contained in:
parent
d71f920f2e
commit
12063d6cb6
5 changed files with 81 additions and 95 deletions
|
|
@ -32,6 +32,7 @@
|
||||||
#include "NetworkManagerUtils.h"
|
#include "NetworkManagerUtils.h"
|
||||||
#include "nm-manager.h"
|
#include "nm-manager.h"
|
||||||
#include "platform/nm-platform.h"
|
#include "platform/nm-platform.h"
|
||||||
|
#include "platform/nm-platform-utils.h"
|
||||||
#include "platform/nmp-object.h"
|
#include "platform/nmp-object.h"
|
||||||
#include "platform/nmp-rules-manager.h"
|
#include "platform/nmp-rules-manager.h"
|
||||||
#include "ndisc/nm-ndisc.h"
|
#include "ndisc/nm-ndisc.h"
|
||||||
|
|
@ -185,7 +186,7 @@ typedef struct {
|
||||||
int ifindex;
|
int ifindex;
|
||||||
NMEthtoolFeatureStates *features;
|
NMEthtoolFeatureStates *features;
|
||||||
NMTernary requested[_NM_ETHTOOL_ID_FEATURE_NUM];
|
NMTernary requested[_NM_ETHTOOL_ID_FEATURE_NUM];
|
||||||
NMEthtoolCoalesceStates *coalesce;
|
NMEthtoolCoalesceState *coalesce;
|
||||||
} EthtoolState;
|
} EthtoolState;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
@ -868,7 +869,7 @@ static gboolean
|
||||||
_ethtool_init_coalesce (NMDevice *self,
|
_ethtool_init_coalesce (NMDevice *self,
|
||||||
NMPlatform *platform,
|
NMPlatform *platform,
|
||||||
NMSettingEthtool *s_ethtool,
|
NMSettingEthtool *s_ethtool,
|
||||||
NMEthtoolCoalesceStates *coalesce)
|
NMEthtoolCoalesceState *coalesce)
|
||||||
{
|
{
|
||||||
GHashTable *hash;
|
GHashTable *hash;
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
|
|
@ -904,14 +905,12 @@ _ethtool_init_coalesce (NMDevice *self,
|
||||||
return (!!n_coalesce_set);
|
return (!!n_coalesce_set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ethtool_coalesce_reset (NMDevice *self,
|
_ethtool_coalesce_reset (NMDevice *self,
|
||||||
NMPlatform *platform,
|
NMPlatform *platform,
|
||||||
EthtoolState *ethtool_state)
|
EthtoolState *ethtool_state)
|
||||||
{
|
{
|
||||||
gs_free NMEthtoolCoalesceStates *coalesce = NULL;
|
gs_free NMEthtoolCoalesceState *coalesce = NULL;
|
||||||
|
|
||||||
nm_assert (NM_IS_DEVICE (self));
|
nm_assert (NM_IS_DEVICE (self));
|
||||||
nm_assert (NM_IS_PLATFORM (platform));
|
nm_assert (NM_IS_PLATFORM (platform));
|
||||||
|
|
@ -919,13 +918,17 @@ _ethtool_coalesce_reset (NMDevice *self,
|
||||||
|
|
||||||
coalesce = g_steal_pointer (ðtool_state->coalesce);
|
coalesce = g_steal_pointer (ðtool_state->coalesce);
|
||||||
|
|
||||||
|
if (!coalesce)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!nm_platform_ethtool_set_coalesce (platform,
|
if (!nm_platform_ethtool_set_coalesce (platform,
|
||||||
ethtool_state->ifindex,
|
ethtool_state->ifindex,
|
||||||
coalesce,
|
coalesce)) {
|
||||||
FALSE))
|
|
||||||
_LOGW (LOGD_DEVICE, "ethtool: failure resetting one or more coalesce settings");
|
_LOGW (LOGD_DEVICE, "ethtool: failure resetting one or more coalesce settings");
|
||||||
else
|
return;
|
||||||
_LOGD (LOGD_DEVICE, "ethtool: coalesce settings successfully reset");
|
}
|
||||||
|
|
||||||
|
_LOGD (LOGD_DEVICE, "ethtool: coalesce settings successfully reset");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -934,37 +937,39 @@ _ethtool_coalesce_set (NMDevice *self,
|
||||||
EthtoolState *ethtool_state,
|
EthtoolState *ethtool_state,
|
||||||
NMSettingEthtool *s_ethtool)
|
NMSettingEthtool *s_ethtool)
|
||||||
{
|
{
|
||||||
gs_free NMEthtoolCoalesceStates *coalesce = NULL;
|
NMEthtoolCoalesceState coalesce_old;
|
||||||
|
NMEthtoolCoalesceState coalesce_new;
|
||||||
|
|
||||||
nm_assert (ethtool_state);
|
nm_assert (ethtool_state);
|
||||||
nm_assert (NM_IS_DEVICE (self));
|
nm_assert (NM_IS_DEVICE (self));
|
||||||
nm_assert (NM_IS_PLATFORM (platform));
|
nm_assert (NM_IS_PLATFORM (platform));
|
||||||
nm_assert (NM_IS_SETTING_ETHTOOL (s_ethtool));
|
nm_assert (NM_IS_SETTING_ETHTOOL (s_ethtool));
|
||||||
|
|
||||||
coalesce = nm_platform_ethtool_get_link_coalesce (platform,
|
if (!nm_platform_ethtool_get_link_coalesce (platform,
|
||||||
ethtool_state->ifindex);
|
ethtool_state->ifindex,
|
||||||
|
&coalesce_old)) {
|
||||||
if (!coalesce) {
|
|
||||||
_LOGW (LOGD_DEVICE, "ethtool: failure getting coalesce settings (cannot read)");
|
_LOGW (LOGD_DEVICE, "ethtool: failure getting coalesce settings (cannot read)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
coalesce_new = coalesce_old;
|
||||||
|
|
||||||
if (!_ethtool_init_coalesce (self,
|
if (!_ethtool_init_coalesce (self,
|
||||||
platform,
|
platform,
|
||||||
s_ethtool,
|
s_ethtool,
|
||||||
coalesce))
|
&coalesce_new))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
ethtool_state->coalesce = nm_memdup (&coalesce_old, sizeof (coalesce_old));
|
||||||
|
|
||||||
if (!nm_platform_ethtool_set_coalesce (platform,
|
if (!nm_platform_ethtool_set_coalesce (platform,
|
||||||
ethtool_state->ifindex,
|
ethtool_state->ifindex,
|
||||||
coalesce,
|
&coalesce_new)) {
|
||||||
TRUE)) {
|
|
||||||
_LOGW (LOGD_DEVICE, "ethtool: failure setting coalesce settings");
|
_LOGW (LOGD_DEVICE, "ethtool: failure setting coalesce settings");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_LOGD (LOGD_DEVICE, "ethtool: coalesce settings successfully set");
|
|
||||||
|
|
||||||
ethtool_state->coalesce = g_steal_pointer (&coalesce);
|
_LOGD (LOGD_DEVICE, "ethtool: coalesce settings successfully set");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -845,31 +845,26 @@ ethtool_get_coalesce (SocketHandle *shandle,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
NMEthtoolCoalesceStates *
|
nmp_utils_ethtool_get_coalesce (int ifindex,
|
||||||
nmp_utils_ethtool_get_coalesce (int ifindex)
|
NMEthtoolCoalesceState *coalesce)
|
||||||
{
|
{
|
||||||
gs_free NMEthtoolCoalesceStates *coalesce = NULL;
|
|
||||||
nm_auto_socket_handle SocketHandle shandle = SOCKET_HANDLE_INIT (ifindex);
|
nm_auto_socket_handle SocketHandle shandle = SOCKET_HANDLE_INIT (ifindex);
|
||||||
|
|
||||||
g_return_val_if_fail (ifindex > 0, NULL);
|
g_return_val_if_fail (ifindex > 0, FALSE);
|
||||||
|
g_return_val_if_fail (coalesce, FALSE);
|
||||||
|
|
||||||
coalesce = g_new0 (NMEthtoolCoalesceStates, 1);
|
if (!ethtool_get_coalesce (&shandle, coalesce)) {
|
||||||
|
|
||||||
if (!ethtool_get_coalesce (&shandle, &coalesce->old_state)) {
|
|
||||||
nm_log_trace (LOGD_PLATFORM, "ethtool[%d]: %s: failure getting coalesce settings",
|
nm_log_trace (LOGD_PLATFORM, "ethtool[%d]: %s: failure getting coalesce settings",
|
||||||
ifindex,
|
ifindex,
|
||||||
"get-coalesce");
|
"get-coalesce");
|
||||||
return NULL;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy into requested as well, so that they're merged when applying */
|
|
||||||
coalesce->requested_state = coalesce->old_state;
|
|
||||||
|
|
||||||
nm_log_trace (LOGD_PLATFORM, "ethtool[%d]: %s: retrieved kernel coalesce settings",
|
nm_log_trace (LOGD_PLATFORM, "ethtool[%d]: %s: retrieved kernel coalesce settings",
|
||||||
ifindex,
|
ifindex,
|
||||||
"get-coalesce");
|
"get-coalesce");
|
||||||
return g_steal_pointer (&coalesce);
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
@ -916,32 +911,23 @@ ethtool_set_coalesce (SocketHandle *shandle,
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
nmp_utils_ethtool_set_coalesce (int ifindex,
|
nmp_utils_ethtool_set_coalesce (int ifindex,
|
||||||
const NMEthtoolCoalesceStates *coalesce,
|
const NMEthtoolCoalesceState *coalesce)
|
||||||
gboolean do_set)
|
|
||||||
{
|
{
|
||||||
gboolean success;
|
|
||||||
nm_auto_socket_handle SocketHandle shandle = SOCKET_HANDLE_INIT (ifindex);
|
nm_auto_socket_handle SocketHandle shandle = SOCKET_HANDLE_INIT (ifindex);
|
||||||
|
|
||||||
g_return_val_if_fail (ifindex > 0, FALSE);
|
g_return_val_if_fail (ifindex > 0, FALSE);
|
||||||
g_return_val_if_fail (coalesce, FALSE);
|
g_return_val_if_fail (coalesce, FALSE);
|
||||||
|
|
||||||
if (do_set)
|
if (!ethtool_set_coalesce (&shandle, coalesce)) {
|
||||||
success = ethtool_set_coalesce (&shandle, &coalesce->requested_state);
|
nm_log_trace (LOGD_PLATFORM, "ethtool[%d]: %s: failure setting coalesce settings",
|
||||||
else
|
|
||||||
success = ethtool_set_coalesce (&shandle, &coalesce->old_state);
|
|
||||||
|
|
||||||
if (!success) {
|
|
||||||
nm_log_trace (LOGD_PLATFORM, "ethtool[%d]: %s: failure %s coalesce settings",
|
|
||||||
ifindex,
|
ifindex,
|
||||||
"set-coalesce",
|
"set-coalesce");
|
||||||
do_set ? "setting" : "resetting");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nm_log_trace (LOGD_PLATFORM, "ethtool[%d]: %s: %s kernel coalesce settings",
|
nm_log_trace (LOGD_PLATFORM, "ethtool[%d]: %s: set kernel coalesce settings",
|
||||||
ifindex,
|
ifindex,
|
||||||
"set-coalesce",
|
"set-coalesce");
|
||||||
do_set ? "set" : "reset");
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ gboolean nmp_utils_ethtool_set_features (int ifindex,
|
||||||
const NMTernary *requested /* indexed by NMEthtoolID - _NM_ETHTOOL_ID_FEATURE_FIRST */,
|
const NMTernary *requested /* indexed by NMEthtoolID - _NM_ETHTOOL_ID_FEATURE_FIRST */,
|
||||||
gboolean do_set /* or reset */);
|
gboolean do_set /* or reset */);
|
||||||
|
|
||||||
typedef struct {
|
struct _NMEthtoolCoalesceState {
|
||||||
guint32 rx_coalesce_usecs;
|
guint32 rx_coalesce_usecs;
|
||||||
guint32 rx_max_coalesced_frames;
|
guint32 rx_max_coalesced_frames;
|
||||||
guint32 rx_coalesce_usecs_irq;
|
guint32 rx_coalesce_usecs_irq;
|
||||||
|
|
@ -115,18 +115,13 @@ typedef struct {
|
||||||
guint32 tx_coalesce_usecs_high;
|
guint32 tx_coalesce_usecs_high;
|
||||||
guint32 tx_max_coalesced_frames_high;
|
guint32 tx_max_coalesced_frames_high;
|
||||||
guint32 rate_sample_interval;
|
guint32 rate_sample_interval;
|
||||||
} NMEthtoolCoalesceState;
|
|
||||||
|
|
||||||
struct _NMEthtoolCoalesceStates {
|
|
||||||
NMEthtoolCoalesceState old_state;
|
|
||||||
NMEthtoolCoalesceState requested_state;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NMEthtoolCoalesceStates * nmp_utils_ethtool_get_coalesce (int ifindex);
|
gboolean nmp_utils_ethtool_get_coalesce (int ifindex,
|
||||||
|
NMEthtoolCoalesceState *coalesce);
|
||||||
|
|
||||||
gboolean nmp_utils_ethtool_set_coalesce (int ifindex,
|
gboolean nmp_utils_ethtool_set_coalesce (int ifindex,
|
||||||
const NMEthtoolCoalesceStates *coalesce,
|
const NMEthtoolCoalesceState *coalesce);
|
||||||
gboolean do_set);
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3214,29 +3214,30 @@ nm_platform_ethtool_set_features (NMPlatform *self,
|
||||||
return nmp_utils_ethtool_set_features (ifindex, features, requested, do_set);
|
return nmp_utils_ethtool_set_features (ifindex, features, requested, do_set);
|
||||||
}
|
}
|
||||||
|
|
||||||
NMEthtoolCoalesceStates *
|
gboolean
|
||||||
nm_platform_ethtool_get_link_coalesce (NMPlatform *self, int ifindex)
|
nm_platform_ethtool_get_link_coalesce (NMPlatform *self,
|
||||||
|
int ifindex,
|
||||||
|
NMEthtoolCoalesceState *coalesce)
|
||||||
{
|
{
|
||||||
_CHECK_SELF_NETNS (self, klass, netns, NULL);
|
_CHECK_SELF_NETNS (self, klass, netns, FALSE);
|
||||||
|
|
||||||
g_return_val_if_fail (ifindex > 0, NULL);
|
g_return_val_if_fail (ifindex > 0, FALSE);
|
||||||
|
g_return_val_if_fail (coalesce, FALSE);
|
||||||
|
|
||||||
return nmp_utils_ethtool_get_coalesce (ifindex);
|
return nmp_utils_ethtool_get_coalesce (ifindex, coalesce);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
nm_platform_ethtool_init_coalesce (NMPlatform *self,
|
nm_platform_ethtool_init_coalesce (NMPlatform *self,
|
||||||
NMEthtoolCoalesceStates *coalesce,
|
NMEthtoolCoalesceState *coalesce,
|
||||||
const char *option_name,
|
const char *option_name,
|
||||||
guint32 value)
|
guint32 value)
|
||||||
{
|
{
|
||||||
NMEthtoolID ethtool_id;
|
NMEthtoolID ethtool_id;
|
||||||
NMEthtoolCoalesceState *state;
|
|
||||||
|
|
||||||
g_return_val_if_fail (coalesce, FALSE);
|
g_return_val_if_fail (coalesce, FALSE);
|
||||||
g_return_val_if_fail (option_name, FALSE);
|
g_return_val_if_fail (option_name, FALSE);
|
||||||
|
|
||||||
state = &coalesce->requested_state;
|
|
||||||
ethtool_id = nm_ethtool_id_get_by_name (option_name);
|
ethtool_id = nm_ethtool_id_get_by_name (option_name);
|
||||||
|
|
||||||
if (!nm_ethtool_id_is_coalesce (ethtool_id))
|
if (!nm_ethtool_id_is_coalesce (ethtool_id))
|
||||||
|
|
@ -3244,70 +3245,70 @@ nm_platform_ethtool_init_coalesce (NMPlatform *self,
|
||||||
|
|
||||||
switch (ethtool_id) {
|
switch (ethtool_id) {
|
||||||
case NM_ETHTOOL_ID_COALESCE_ADAPTIVE_RX:
|
case NM_ETHTOOL_ID_COALESCE_ADAPTIVE_RX:
|
||||||
state->use_adaptive_rx_coalesce = value;
|
coalesce->use_adaptive_rx_coalesce = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_ADAPTIVE_TX:
|
case NM_ETHTOOL_ID_COALESCE_ADAPTIVE_TX:
|
||||||
state->use_adaptive_tx_coalesce = value;
|
coalesce->use_adaptive_tx_coalesce = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_PKT_RATE_HIGH:
|
case NM_ETHTOOL_ID_COALESCE_PKT_RATE_HIGH:
|
||||||
state->pkt_rate_high = value;
|
coalesce->pkt_rate_high = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_PKT_RATE_LOW:
|
case NM_ETHTOOL_ID_COALESCE_PKT_RATE_LOW:
|
||||||
state->pkt_rate_low = value;
|
coalesce->pkt_rate_low = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_RX_FRAMES:
|
case NM_ETHTOOL_ID_COALESCE_RX_FRAMES:
|
||||||
state->rx_max_coalesced_frames = value;
|
coalesce->rx_max_coalesced_frames = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_RX_FRAMES_HIGH:
|
case NM_ETHTOOL_ID_COALESCE_RX_FRAMES_HIGH:
|
||||||
state->rx_max_coalesced_frames_high = value;
|
coalesce->rx_max_coalesced_frames_high = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_RX_FRAMES_IRQ:
|
case NM_ETHTOOL_ID_COALESCE_RX_FRAMES_IRQ:
|
||||||
state->rx_max_coalesced_frames_irq = value;
|
coalesce->rx_max_coalesced_frames_irq = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_RX_FRAMES_LOW:
|
case NM_ETHTOOL_ID_COALESCE_RX_FRAMES_LOW:
|
||||||
state->rx_max_coalesced_frames_low = value;
|
coalesce->rx_max_coalesced_frames_low = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_RX_USECS:
|
case NM_ETHTOOL_ID_COALESCE_RX_USECS:
|
||||||
state->rx_coalesce_usecs = value;
|
coalesce->rx_coalesce_usecs = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_RX_USECS_HIGH:
|
case NM_ETHTOOL_ID_COALESCE_RX_USECS_HIGH:
|
||||||
state->rx_coalesce_usecs_high = value;
|
coalesce->rx_coalesce_usecs_high = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_RX_USECS_IRQ:
|
case NM_ETHTOOL_ID_COALESCE_RX_USECS_IRQ:
|
||||||
state->rx_coalesce_usecs_irq = value;
|
coalesce->rx_coalesce_usecs_irq = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_RX_USECS_LOW:
|
case NM_ETHTOOL_ID_COALESCE_RX_USECS_LOW:
|
||||||
state->rx_coalesce_usecs_low = value;
|
coalesce->rx_coalesce_usecs_low = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_SAMPLE_INTERVAL:
|
case NM_ETHTOOL_ID_COALESCE_SAMPLE_INTERVAL:
|
||||||
state->rate_sample_interval = value;
|
coalesce->rate_sample_interval = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_STATS_BLOCK_USECS:
|
case NM_ETHTOOL_ID_COALESCE_STATS_BLOCK_USECS:
|
||||||
state->stats_block_coalesce_usecs = value;
|
coalesce->stats_block_coalesce_usecs = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_TX_FRAMES:
|
case NM_ETHTOOL_ID_COALESCE_TX_FRAMES:
|
||||||
state->tx_max_coalesced_frames = value;
|
coalesce->tx_max_coalesced_frames = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_TX_FRAMES_HIGH:
|
case NM_ETHTOOL_ID_COALESCE_TX_FRAMES_HIGH:
|
||||||
state->tx_max_coalesced_frames_high = value;
|
coalesce->tx_max_coalesced_frames_high = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_TX_FRAMES_IRQ:
|
case NM_ETHTOOL_ID_COALESCE_TX_FRAMES_IRQ:
|
||||||
state->tx_max_coalesced_frames_irq = value;
|
coalesce->tx_max_coalesced_frames_irq = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_TX_FRAMES_LOW:
|
case NM_ETHTOOL_ID_COALESCE_TX_FRAMES_LOW:
|
||||||
state->tx_max_coalesced_frames_low = value;
|
coalesce->tx_max_coalesced_frames_low = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_TX_USECS:
|
case NM_ETHTOOL_ID_COALESCE_TX_USECS:
|
||||||
state->tx_coalesce_usecs = value;
|
coalesce->tx_coalesce_usecs = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_TX_USECS_HIGH:
|
case NM_ETHTOOL_ID_COALESCE_TX_USECS_HIGH:
|
||||||
state->tx_coalesce_usecs_high = value;
|
coalesce->tx_coalesce_usecs_high = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_TX_USECS_IRQ:
|
case NM_ETHTOOL_ID_COALESCE_TX_USECS_IRQ:
|
||||||
state->tx_coalesce_usecs_irq = value;
|
coalesce->tx_coalesce_usecs_irq = value;
|
||||||
break;
|
break;
|
||||||
case NM_ETHTOOL_ID_COALESCE_TX_USECS_LOW:
|
case NM_ETHTOOL_ID_COALESCE_TX_USECS_LOW:
|
||||||
state->tx_coalesce_usecs_low = value;
|
coalesce->tx_coalesce_usecs_low = value;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_return_val_if_reached (FALSE);
|
g_return_val_if_reached (FALSE);
|
||||||
|
|
@ -3319,14 +3320,13 @@ nm_platform_ethtool_init_coalesce (NMPlatform *self,
|
||||||
gboolean
|
gboolean
|
||||||
nm_platform_ethtool_set_coalesce (NMPlatform *self,
|
nm_platform_ethtool_set_coalesce (NMPlatform *self,
|
||||||
int ifindex,
|
int ifindex,
|
||||||
const NMEthtoolCoalesceStates *coalesce,
|
const NMEthtoolCoalesceState *coalesce)
|
||||||
gboolean do_set)
|
|
||||||
{
|
{
|
||||||
_CHECK_SELF_NETNS (self, klass, netns, FALSE);
|
_CHECK_SELF_NETNS (self, klass, netns, FALSE);
|
||||||
|
|
||||||
g_return_val_if_fail (ifindex > 0, FALSE);
|
g_return_val_if_fail (ifindex > 0, FALSE);
|
||||||
|
|
||||||
return nmp_utils_ethtool_set_coalesce (ifindex, coalesce, do_set);
|
return nmp_utils_ethtool_set_coalesce (ifindex, coalesce);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -1954,20 +1954,20 @@ gboolean nm_platform_ethtool_set_features (NMPlatform *self,
|
||||||
const NMTernary *requested /* indexed by NMEthtoolID - _NM_ETHTOOL_ID_FEATURE_FIRST */,
|
const NMTernary *requested /* indexed by NMEthtoolID - _NM_ETHTOOL_ID_FEATURE_FIRST */,
|
||||||
gboolean do_set /* or reset */);
|
gboolean do_set /* or reset */);
|
||||||
|
|
||||||
typedef struct _NMEthtoolCoalesceStates NMEthtoolCoalesceStates;
|
typedef struct _NMEthtoolCoalesceState NMEthtoolCoalesceState;
|
||||||
|
|
||||||
NMEthtoolCoalesceStates *nm_platform_ethtool_get_link_coalesce (NMPlatform *self,
|
gboolean nm_platform_ethtool_get_link_coalesce (NMPlatform *self,
|
||||||
int ifindex);
|
int ifindex,
|
||||||
|
NMEthtoolCoalesceState *coalesce);
|
||||||
|
|
||||||
gboolean nm_platform_ethtool_init_coalesce (NMPlatform *self,
|
gboolean nm_platform_ethtool_init_coalesce (NMPlatform *self,
|
||||||
NMEthtoolCoalesceStates *coalesce,
|
NMEthtoolCoalesceState *coalesce,
|
||||||
const char *option_name,
|
const char *option_name,
|
||||||
guint32 value);
|
guint32 value);
|
||||||
|
|
||||||
gboolean nm_platform_ethtool_set_coalesce (NMPlatform *self,
|
gboolean nm_platform_ethtool_set_coalesce (NMPlatform *self,
|
||||||
int ifindex,
|
int ifindex,
|
||||||
const NMEthtoolCoalesceStates *coalesce,
|
const NMEthtoolCoalesceState *coalesce);
|
||||||
gboolean do_set);
|
|
||||||
|
|
||||||
const char * nm_platform_link_duplex_type_to_string (NMPlatformLinkDuplexType duplex);
|
const char * nm_platform_link_duplex_type_to_string (NMPlatformLinkDuplexType duplex);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue