diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-09-04 13:32:32 +0200 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-09-04 14:56:40 +0200 |
commit | 2b9ced9072a280a2cb0c2c7783a288788a3a6771 (patch) | |
tree | 93da3524ca0064c5ce35ba957c4b3e3c02595bf8 | |
parent | network: Add support for multiq qdisc (diff) | |
download | systemd-2b9ced9072a280a2cb0c2c7783a288788a3a6771.tar.xz systemd-2b9ced9072a280a2cb0c2c7783a288788a3a6771.zip |
network: Add support for mq qdisc
-rw-r--r-- | man/systemd.network.xml | 10 | ||||
-rw-r--r-- | src/network/meson.build | 1 | ||||
-rw-r--r-- | src/network/networkd-network-gperf.gperf | 2 | ||||
-rw-r--r-- | src/network/networkd-network.c | 1 | ||||
-rw-r--r-- | src/network/tc/mq.c | 8 | ||||
-rw-r--r-- | src/network/tc/mq.h | 11 | ||||
-rw-r--r-- | src/network/tc/qdisc.c | 1 | ||||
-rw-r--r-- | src/network/tc/qdisc.h | 2 | ||||
-rw-r--r-- | test/test-network/conf/25-qdisc-mq.network | 12 | ||||
-rwxr-xr-x | test/test-network/systemd-networkd-tests.py | 9 |
10 files changed, 57 insertions, 0 deletions
diff --git a/man/systemd.network.xml b/man/systemd.network.xml index cc6a31484f..89484c449f 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -6065,6 +6065,16 @@ ServerAddress=192.168.0.1/24</programlisting> </refsect1> <refsect1> + <title>[ClassfulMultiQueueing] Section Options</title> + <para>The [ClassfulMultiQueueing] section manages the queueing discipline (qdisc) of Classful Multi Queueing (mq).</para> + + <variablelist class='network-directives'> + <xi:include href="tc.xml" xpointer="qdisc-parent" /> + <xi:include href="tc.xml" xpointer="qdisc-handle" /> + </variablelist> + </refsect1> + + <refsect1> <title>[BandMultiQueueing] Section Options</title> <para>The [BandMultiQueueing] section manages the queueing discipline (qdisc) of Band Multi Queueing (multiq).</para> diff --git a/src/network/meson.build b/src/network/meson.build index 3edcd48c83..54cf694aeb 100644 --- a/src/network/meson.build +++ b/src/network/meson.build @@ -93,6 +93,7 @@ sources = files( 'tc/gred.c', 'tc/hhf.c', 'tc/htb.c', + 'tc/mq.c', 'tc/multiq.c', 'tc/netem.c', 'tc/pie.c', diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 95fe0275a9..a84de4ca7f 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -552,6 +552,8 @@ HierarchyTokenBucketClass.Rate, config_parse_hierarchy_token_bucket HierarchyTokenBucketClass.CeilRate, config_parse_hierarchy_token_bucket_class_rate, TCLASS_KIND_HTB, 0 HierarchyTokenBucketClass.BufferBytes, config_parse_hierarchy_token_bucket_class_size, TCLASS_KIND_HTB, 0 HierarchyTokenBucketClass.CeilBufferBytes, config_parse_hierarchy_token_bucket_class_size, TCLASS_KIND_HTB, 0 +ClassfulMultiQueueing.Parent, config_parse_qdisc_parent, QDISC_KIND_MQ, 0 +ClassfulMultiQueueing.Handle, config_parse_qdisc_handle, QDISC_KIND_MQ, 0 BandMultiQueueing.Parent, config_parse_qdisc_parent, QDISC_KIND_MULTIQ, 0 BandMultiQueueing.Handle, config_parse_qdisc_handle, QDISC_KIND_MULTIQ, 0 NetworkEmulator.Parent, config_parse_qdisc_parent, QDISC_KIND_NETEM, 0 diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 2c2f8ad939..8ccf215a71 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -551,6 +551,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi "HeavyHitterFilter\0" "HierarchyTokenBucket\0" "HierarchyTokenBucketClass\0" + "ClassfulMultiQueueing\0" "BandMultiQueueing\0" "NetworkEmulator\0" "PFIFO\0" diff --git a/src/network/tc/mq.c b/src/network/tc/mq.c new file mode 100644 index 0000000000..1435ed1fda --- /dev/null +++ b/src/network/tc/mq.c @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ + +#include "mq.h" + +const QDiscVTable mq_vtable = { + .object_size = sizeof(ClassfulMultiQueueing), + .tca_kind = "mq", +}; diff --git a/src/network/tc/mq.h b/src/network/tc/mq.h new file mode 100644 index 0000000000..88f0049670 --- /dev/null +++ b/src/network/tc/mq.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +#pragma once + +#include "qdisc.h" + +typedef struct ClassfulMultiQueueing { + QDisc meta; +} ClassfulMultiQueueing; + +DEFINE_QDISC_CAST(MQ, ClassfulMultiQueueing); +extern const QDiscVTable mq_vtable; diff --git a/src/network/tc/qdisc.c b/src/network/tc/qdisc.c index 5e8f97a785..3bcc393066 100644 --- a/src/network/tc/qdisc.c +++ b/src/network/tc/qdisc.c @@ -30,6 +30,7 @@ const QDiscVTable * const qdisc_vtable[_QDISC_KIND_MAX] = { [QDISC_KIND_GRED] = &gred_vtable, [QDISC_KIND_HHF] = &hhf_vtable, [QDISC_KIND_HTB] = &htb_vtable, + [QDISC_KIND_MQ] = &mq_vtable, [QDISC_KIND_MULTIQ] = &multiq_vtable, [QDISC_KIND_NETEM] = &netem_vtable, [QDISC_KIND_PIE] = &pie_vtable, diff --git a/src/network/tc/qdisc.h b/src/network/tc/qdisc.h index 83853dcaa7..80b95c2aab 100644 --- a/src/network/tc/qdisc.h +++ b/src/network/tc/qdisc.h @@ -21,6 +21,7 @@ typedef enum QDiscKind { QDISC_KIND_GRED, QDISC_KIND_HHF, QDISC_KIND_HTB, + QDISC_KIND_MQ, QDISC_KIND_MULTIQ, QDISC_KIND_NETEM, QDISC_KIND_PFIFO, @@ -107,6 +108,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_qdisc_handle); #include "gred.h" #include "hhf.h" #include "htb.h" +#include "mq.h" #include "multiq.h" #include "pie.h" #include "qfq.h" diff --git a/test/test-network/conf/25-qdisc-mq.network b/test/test-network/conf/25-qdisc-mq.network new file mode 100644 index 0000000000..32366d05da --- /dev/null +++ b/test/test-network/conf/25-qdisc-mq.network @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Match] +Name=testtun99 +Name=testtap99 + +[Network] +LinkLocalAddressing=yes +IPv6AcceptRA=no + +[ClassfulMultiQueueing] +Parent=root +Handle=0002 diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index a2b4eb40b2..3989fc0401 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -4648,6 +4648,15 @@ class NetworkdTCTests(unittest.TestCase, Utilities): print(output) self.assertRegex(output, 'qdisc ingress') + def test_qdisc_mq(self): + copy_network_unit('25-tun.netdev', '25-tap.netdev', '25-qdisc-mq.network') + start_networkd() + self.wait_online('testtun99:degraded', 'testtap99:degraded') + + output = check_output('tc qdisc show dev testtun99') + print(output) + self.assertIn('qdisc mq 2: root', output) + @expectedFailureIfModuleIsNotAvailable('sch_multiq') def test_qdisc_multiq(self): copy_network_unit('25-tun.netdev', '25-tap.netdev', '25-qdisc-multiq.network') |