mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 07:18:03 +02:00
platform: support ethtool channels properties
Support setting the ethtool channels properties in platform via ETHTOOL_GCHANNELS and ETHTOOL_SCHANNELS ioctls.
This commit is contained in:
parent
80dd179ffd
commit
c3e538e1cd
5 changed files with 107 additions and 4 deletions
|
|
@ -1067,6 +1067,69 @@ nmp_utils_ethtool_set_ring(int ifindex, const NMEthtoolRingState *ring)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
nmp_utils_ethtool_get_channels(int ifindex, NMEthtoolChannelsState *channels)
|
||||||
|
{
|
||||||
|
struct ethtool_channels eth_data;
|
||||||
|
|
||||||
|
g_return_val_if_fail(ifindex > 0, FALSE);
|
||||||
|
g_return_val_if_fail(channels, FALSE);
|
||||||
|
|
||||||
|
eth_data.cmd = ETHTOOL_GCHANNELS;
|
||||||
|
|
||||||
|
if (_ethtool_call_once(ifindex, ð_data, sizeof(eth_data)) < 0) {
|
||||||
|
nm_log_trace(LOGD_PLATFORM,
|
||||||
|
"ethtool[%d]: %s: failure getting channels settings",
|
||||||
|
ifindex,
|
||||||
|
"get-channels");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*channels = (NMEthtoolChannelsState){
|
||||||
|
.rx = eth_data.rx_count,
|
||||||
|
.tx = eth_data.tx_count,
|
||||||
|
.other = eth_data.other_count,
|
||||||
|
.combined = eth_data.combined_count,
|
||||||
|
};
|
||||||
|
|
||||||
|
nm_log_trace(LOGD_PLATFORM,
|
||||||
|
"ethtool[%d]: %s: retrieved kernel channels settings",
|
||||||
|
ifindex,
|
||||||
|
"get-channels");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
nmp_utils_ethtool_set_channels(int ifindex, const NMEthtoolChannelsState *channels)
|
||||||
|
{
|
||||||
|
struct ethtool_channels eth_data;
|
||||||
|
|
||||||
|
g_return_val_if_fail(ifindex > 0, FALSE);
|
||||||
|
g_return_val_if_fail(channels, FALSE);
|
||||||
|
|
||||||
|
eth_data = (struct ethtool_channels){
|
||||||
|
.cmd = ETHTOOL_SCHANNELS,
|
||||||
|
.rx_count = channels->rx,
|
||||||
|
.tx_count = channels->tx,
|
||||||
|
.other_count = channels->other,
|
||||||
|
.combined_count = channels->combined,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_ethtool_call_once(ifindex, ð_data, sizeof(eth_data)) < 0) {
|
||||||
|
nm_log_trace(LOGD_PLATFORM,
|
||||||
|
"ethtool[%d]: %s: failure setting channels settings",
|
||||||
|
ifindex,
|
||||||
|
"set-channels");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
nm_log_trace(LOGD_PLATFORM,
|
||||||
|
"ethtool[%d]: %s: set kernel channels settings",
|
||||||
|
ifindex,
|
||||||
|
"set-channels");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
nmp_utils_ethtool_get_pause(int ifindex, NMEthtoolPauseState *pause)
|
nmp_utils_ethtool_get_pause(int ifindex, NMEthtoolPauseState *pause)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,10 @@ gboolean nmp_utils_ethtool_get_ring(int ifindex, NMEthtoolRingState *ring);
|
||||||
|
|
||||||
gboolean nmp_utils_ethtool_set_ring(int ifindex, const NMEthtoolRingState *ring);
|
gboolean nmp_utils_ethtool_set_ring(int ifindex, const NMEthtoolRingState *ring);
|
||||||
|
|
||||||
|
gboolean nmp_utils_ethtool_get_channels(int ifindex, NMEthtoolChannelsState *channels);
|
||||||
|
|
||||||
|
gboolean nmp_utils_ethtool_set_channels(int ifindex, const NMEthtoolChannelsState *channels);
|
||||||
|
|
||||||
gboolean nmp_utils_ethtool_get_pause(int ifindex, NMEthtoolPauseState *pause);
|
gboolean nmp_utils_ethtool_get_pause(int ifindex, NMEthtoolPauseState *pause);
|
||||||
|
|
||||||
gboolean nmp_utils_ethtool_set_pause(int ifindex, const NMEthtoolPauseState *pause);
|
gboolean nmp_utils_ethtool_set_pause(int ifindex, const NMEthtoolPauseState *pause);
|
||||||
|
|
|
||||||
|
|
@ -3580,6 +3580,31 @@ nm_platform_ethtool_set_ring(NMPlatform *self, int ifindex, const NMEthtoolRingS
|
||||||
return nmp_utils_ethtool_set_ring(ifindex, ring);
|
return nmp_utils_ethtool_set_ring(ifindex, ring);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
nm_platform_ethtool_get_link_channels(NMPlatform *self,
|
||||||
|
int ifindex,
|
||||||
|
NMEthtoolChannelsState *channels)
|
||||||
|
{
|
||||||
|
_CHECK_SELF_NETNS(self, klass, netns, FALSE);
|
||||||
|
|
||||||
|
g_return_val_if_fail(ifindex > 0, FALSE);
|
||||||
|
g_return_val_if_fail(channels, FALSE);
|
||||||
|
|
||||||
|
return nmp_utils_ethtool_get_channels(ifindex, channels);
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
nm_platform_ethtool_set_channels(NMPlatform *self,
|
||||||
|
int ifindex,
|
||||||
|
const NMEthtoolChannelsState *channels)
|
||||||
|
{
|
||||||
|
_CHECK_SELF_NETNS(self, klass, netns, FALSE);
|
||||||
|
|
||||||
|
g_return_val_if_fail(ifindex > 0, FALSE);
|
||||||
|
|
||||||
|
return nmp_utils_ethtool_set_channels(ifindex, channels);
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
nm_platform_ethtool_get_link_pause(NMPlatform *self, int ifindex, NMEthtoolPauseState *pause)
|
nm_platform_ethtool_get_link_pause(NMPlatform *self, int ifindex, NMEthtoolPauseState *pause)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2567,6 +2567,14 @@ gboolean nm_platform_ethtool_get_link_ring(NMPlatform *self, int ifindex, NMEtht
|
||||||
gboolean
|
gboolean
|
||||||
nm_platform_ethtool_set_ring(NMPlatform *self, int ifindex, const NMEthtoolRingState *ring);
|
nm_platform_ethtool_set_ring(NMPlatform *self, int ifindex, const NMEthtoolRingState *ring);
|
||||||
|
|
||||||
|
gboolean nm_platform_ethtool_get_link_channels(NMPlatform *self,
|
||||||
|
int ifindex,
|
||||||
|
NMEthtoolChannelsState *channels);
|
||||||
|
|
||||||
|
gboolean nm_platform_ethtool_set_channels(NMPlatform *self,
|
||||||
|
int ifindex,
|
||||||
|
const NMEthtoolChannelsState *channels);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
nm_platform_ethtool_get_link_pause(NMPlatform *self, int ifindex, NMEthtoolPauseState *pause);
|
nm_platform_ethtool_get_link_pause(NMPlatform *self, int ifindex, NMEthtoolPauseState *pause);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,16 +93,12 @@ typedef struct {
|
||||||
const NMEthtoolFeatureState states_list[];
|
const NMEthtoolFeatureState states_list[];
|
||||||
} NMEthtoolFeatureStates;
|
} NMEthtoolFeatureStates;
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint32
|
guint32
|
||||||
s[_NM_ETHTOOL_ID_COALESCE_NUM /* indexed by (NMEthtoolID - _NM_ETHTOOL_ID_COALESCE_FIRST) */
|
s[_NM_ETHTOOL_ID_COALESCE_NUM /* indexed by (NMEthtoolID - _NM_ETHTOOL_ID_COALESCE_FIRST) */
|
||||||
];
|
];
|
||||||
} NMEthtoolCoalesceState;
|
} NMEthtoolCoalesceState;
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint32 rx_pending;
|
guint32 rx_pending;
|
||||||
guint32 rx_mini_pending;
|
guint32 rx_mini_pending;
|
||||||
|
|
@ -116,6 +112,13 @@ typedef struct {
|
||||||
bool tx : 1;
|
bool tx : 1;
|
||||||
} NMEthtoolPauseState;
|
} NMEthtoolPauseState;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
guint32 rx;
|
||||||
|
guint32 tx;
|
||||||
|
guint32 other;
|
||||||
|
guint32 combined;
|
||||||
|
} NMEthtoolChannelsState;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
typedef struct _NMPNetns NMPNetns;
|
typedef struct _NMPNetns NMPNetns;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue