diff --git a/man/systemd.network.xml b/man/systemd.network.xml
index 7baf1a9df0..422268b0f7 100644
--- a/man/systemd.network.xml
+++ b/man/systemd.network.xml
@@ -215,6 +215,20 @@
integer in the range 0—4294967294. Defaults to unset.
+
+ TransmitQueues=
+
+ Specifies the devices's number of transmit queues. An integer in the range 1...4096.
+ When unset, the kernel's default will be used.
+
+
+
+ ReceiveQueues=
+
+ Specifies the devices's number of receive queues. An integer in the range 1...4096.
+ When unset, the kernel's default will be used.
+
+
RequiredForOnline=
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 56ae6939a3..aa82576c17 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1487,6 +1487,61 @@ static int link_set_group(Link *link) {
return 0;
}
+static int link_tx_rx_queues_hadler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
+ int r;
+
+ assert(link);
+
+ if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
+ return 1;
+
+ r = sd_netlink_message_get_errno(m);
+ if (r < 0)
+ log_link_message_warning_errno(link, m, r, "Could not set transmit / receive queues for the interface");
+
+ return 1;
+}
+
+static int link_set_tx_rx_queues(Link *link) {
+ _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL;
+ int r;
+
+ assert(link);
+ assert(link->network);
+ assert(link->manager);
+ assert(link->manager->rtnl);
+
+ if (link->network->txqueues == 0 && link->network->rxqueues == 0)
+ return 0;
+
+ log_link_debug(link, "Setting transmit / receive queues");
+
+ r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINK, link->ifindex);
+ if (r < 0)
+ return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m");
+
+ if (link->network->txqueues > 0) {
+ r = sd_netlink_message_append_u32(req, IFLA_NUM_TX_QUEUES, link->network->txqueues);
+ if (r < 0)
+ return log_link_error_errno(link, r, "Could not set link transmit queues: %m");
+ }
+
+ if (link->network->rxqueues > 0) {
+ r = sd_netlink_message_append_u32(req, IFLA_NUM_RX_QUEUES, link->network->rxqueues);
+ if (r < 0)
+ return log_link_error_errno(link, r, "Could not set link receive queues: %m");
+ }
+
+ r = netlink_call_async(link->manager->rtnl, NULL, req, link_tx_rx_queues_hadler,
+ link_netlink_destroy_callback, link);
+ if (r < 0)
+ return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
+
+ link_ref(link);
+
+ return 0;
+}
+
static int link_handle_bound_to_list(Link *link) {
Link *l;
int r;
@@ -2062,6 +2117,10 @@ int link_configure(Link *link) {
if (r < 0)
return r;
+ r = link_set_tx_rx_queues(link);
+ if (r < 0)
+ return r;
+
r = ipv4ll_configure(link);
if (r < 0)
return r;
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index 2a6cb6deae..444c6c78bc 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -59,6 +59,8 @@ Match.Architecture, config_parse_net_condition,
Link.MACAddress, config_parse_hwaddr, 0, offsetof(Network, mac)
Link.MTUBytes, config_parse_mtu, AF_UNSPEC, offsetof(Network, mtu)
Link.Group, config_parse_uint32, 0, offsetof(Network, group)
+Link.TransmitQueues, config_parse_rx_tx_queues, 0, offsetof(Network, txqueues)
+Link.ReceiveQueues, config_parse_rx_tx_queues, 0, offsetof(Network, rxqueues)
Link.ARP, config_parse_tristate, 0, offsetof(Network, arp)
Link.Multicast, config_parse_tristate, 0, offsetof(Network, multicast)
Link.AllMulticast, config_parse_tristate, 0, offsetof(Network, allmulticast)
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index daece28dbb..6f1afed091 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -1196,6 +1196,40 @@ int config_parse_required_for_online(
return 0;
}
+int config_parse_rx_tx_queues(
+ const char *unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ uint32_t k, *v = data;
+ int r;
+
+ if (isempty(rvalue)) {
+ *v = 0;
+ return 0;
+ }
+
+ r = safe_atou32(rvalue, &k);
+ if (r < 0) {
+ log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s=, ignoring assignment: %s.", lvalue, rvalue);
+ return 0;
+ }
+ if (k > 4096) {
+ log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid %s=, ignoring assignment: %s.", lvalue, rvalue);
+ return 0;
+ }
+
+ *v = k;
+ return 0;
+}
+
DEFINE_CONFIG_PARSE_ENUM(config_parse_keep_configuration, keep_configuration, KeepConfiguration,
"Failed to parse KeepConfiguration= setting");
diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h
index 32f5ae8d72..762dc971db 100644
--- a/src/network/networkd-network.h
+++ b/src/network/networkd-network.h
@@ -84,6 +84,8 @@ struct Network {
struct ether_addr *mac;
uint32_t mtu;
uint32_t group;
+ uint32_t txqueues;
+ uint32_t rxqueues;
int arp;
int multicast;
int allmulticast;
@@ -328,6 +330,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_ntp);
CONFIG_PARSER_PROTOTYPE(config_parse_required_for_online);
CONFIG_PARSER_PROTOTYPE(config_parse_keep_configuration);
CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_link_local_address_gen_mode);
+CONFIG_PARSER_PROTOTYPE(config_parse_rx_tx_queues);
const struct ConfigPerfItem* network_network_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
diff --git a/test/fuzz/fuzz-network-parser/directives.network b/test/fuzz/fuzz-network-parser/directives.network
index f57f0cd561..e7860702c6 100644
--- a/test/fuzz/fuzz-network-parser/directives.network
+++ b/test/fuzz/fuzz-network-parser/directives.network
@@ -39,6 +39,8 @@ Multicast=
MACAddress=
Group=
Promiscuous=
+TransmitQueues=
+ReceiveQueues=
[SR-IOV]
VirtualFunction=
MACSpoofCheck=