mirror of
https://github.com/systemd/systemd.git
synced 2025-01-10 05:18:17 +03:00
link: Allow configuring RX mini and jumbo ring sizes, too
This now covers all ethtool_ringparam configurables (as of v5.6; https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/ethtool.h?h=v5.6#n488)
This commit is contained in:
parent
80af9bdabe
commit
e81f5fc4e8
@ -695,6 +695,20 @@
|
||||
When unset, the kernel's default will be used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>RxMiniBufferSize=</varname></term>
|
||||
<listitem>
|
||||
<para>Takes an integer. Specifies the maximum number of pending packets in the NIC mini receive buffer.
|
||||
When unset, the kernel's default will be used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>RxJumboBufferSize=</varname></term>
|
||||
<listitem>
|
||||
<para>Takes an integer. Specifies the maximum number of pending packets in the NIC jumbo receive buffer.
|
||||
When unset, the kernel's default will be used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>TxBufferSize=</varname></term>
|
||||
<listitem>
|
||||
|
@ -436,6 +436,16 @@ int ethtool_set_nic_buffer_size(int *ethtool_fd, const char *ifname, netdev_ring
|
||||
need_update = true;
|
||||
}
|
||||
|
||||
if (ring->rx_mini_pending_set && ecmd.rx_mini_pending != ring->rx_mini_pending) {
|
||||
ecmd.rx_mini_pending = ring->rx_mini_pending;
|
||||
need_update = true;
|
||||
}
|
||||
|
||||
if (ring->rx_jumbo_pending_set && ecmd.rx_jumbo_pending != ring->rx_jumbo_pending) {
|
||||
ecmd.rx_jumbo_pending = ring->rx_jumbo_pending;
|
||||
need_update = true;
|
||||
}
|
||||
|
||||
if (ring->tx_pending_set && ecmd.tx_pending != ring->tx_pending) {
|
||||
ecmd.tx_pending = ring->tx_pending;
|
||||
need_update = true;
|
||||
@ -1032,6 +1042,12 @@ int config_parse_nic_buffer_size(const char *unit,
|
||||
if (streq(lvalue, "RxBufferSize")) {
|
||||
ring->rx_pending = k;
|
||||
ring->rx_pending_set = true;
|
||||
} else if (streq(lvalue, "RxMiniBufferSize")) {
|
||||
ring->rx_mini_pending = k;
|
||||
ring->rx_mini_pending_set = true;
|
||||
} else if (streq(lvalue, "RxJumboBufferSize")) {
|
||||
ring->rx_jumbo_pending = k;
|
||||
ring->rx_jumbo_pending_set = true;
|
||||
} else if (streq(lvalue, "TxBufferSize")) {
|
||||
ring->tx_pending = k;
|
||||
ring->tx_pending_set = true;
|
||||
|
@ -84,9 +84,13 @@ typedef struct netdev_channels {
|
||||
|
||||
typedef struct netdev_ring_param {
|
||||
uint32_t rx_pending;
|
||||
uint32_t rx_mini_pending;
|
||||
uint32_t rx_jumbo_pending;
|
||||
uint32_t tx_pending;
|
||||
|
||||
bool rx_pending_set;
|
||||
bool rx_mini_pending_set;
|
||||
bool rx_jumbo_pending_set;
|
||||
bool tx_pending_set;
|
||||
} netdev_ring_param;
|
||||
|
||||
|
@ -59,6 +59,8 @@ Link.OtherChannels, config_parse_channel, 0,
|
||||
Link.CombinedChannels, config_parse_channel, 0, offsetof(link_config, channels)
|
||||
Link.Advertise, config_parse_advertise, 0, offsetof(link_config, advertise)
|
||||
Link.RxBufferSize, config_parse_nic_buffer_size, 0, offsetof(link_config, ring)
|
||||
Link.RxMiniBufferSize, config_parse_nic_buffer_size, 0, offsetof(link_config, ring)
|
||||
Link.RxJumboBufferSize, config_parse_nic_buffer_size, 0, offsetof(link_config, ring)
|
||||
Link.TxBufferSize, config_parse_nic_buffer_size, 0, offsetof(link_config, ring)
|
||||
Link.RxFlowControl, config_parse_tristate, 0, offsetof(link_config, rx_flow_control)
|
||||
Link.TxFlowControl, config_parse_tristate, 0, offsetof(link_config, tx_flow_control)
|
||||
|
@ -407,7 +407,7 @@ int link_config_apply(link_config_ctx *ctx, link_config *config,
|
||||
log_warning_errno(r, "Could not set channels of %s: %m", old_name);
|
||||
}
|
||||
|
||||
if (config->ring.rx_pending_set || config->ring.tx_pending_set) {
|
||||
if (config->ring.rx_pending_set || config->ring.rx_mini_pending_set || config->ring.rx_jumbo_pending_set || config->ring.tx_pending_set) {
|
||||
r = ethtool_set_nic_buffer_size(&ctx->ethtool_fd, old_name, &config->ring);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Could not set ring buffer of %s: %m", old_name);
|
||||
|
@ -40,6 +40,8 @@ OtherChannels=
|
||||
CombinedChannels=
|
||||
Advertise=
|
||||
RxBufferSize=
|
||||
RxMiniBufferSize=
|
||||
RxJumboBufferSize=
|
||||
TxBufferSize=
|
||||
RxFlowControl=
|
||||
TxFlowControl=
|
||||
|
Loading…
Reference in New Issue
Block a user