network: TC - introduce pfifo_head_drop

This adds the required changes to gain access to
the head drop classfull queuing discipline named
pfifo_head_drop.
This commit is contained in:
Susant Sahani 2020-03-10 13:19:56 +01:00 committed by Yu Watanabe
parent 7b1a31a3d0
commit 053a2ddbb2
8 changed files with 59 additions and 3 deletions

View File

@ -2664,6 +2664,33 @@
</variablelist>
</refsect1>
<refsect1>
<title>[PFIFOHeadDrop] Section Options</title>
<para>The <literal>[PFIFOHeadDrop]</literal> section manages the queueing discipline (qdisc) of
Packet First In First Out Head Drop (pfifo_head_drop).</para>
<variablelist class='network-directives'>
<varlistentry>
<term><varname>Parent=</varname></term>
<listitem>
<para>As in <literal>[PFIFO]</literal> section.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>Handle=</varname></term>
<listitem>
<para>As in <literal>[PFIFO]</literal> section..</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>PacketLimit=</varname></term>
<listitem>
<para>As in <literal>[PFIFO]</literal> section.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>[CAKE] Section Options</title>
<para>The <literal>[CAKE]</literal> section manages the queueing discipline (qdisc) of

View File

@ -280,6 +280,9 @@ DeficitRoundRobinSchedulerClass.Quantum, config_parse_drr_size,
PFIFO.Parent, config_parse_qdisc_parent, QDISC_KIND_PFIFO, 0
PFIFO.Handle, config_parse_qdisc_handle, QDISC_KIND_PFIFO, 0
PFIFO.PacketLimit, config_parse_pfifo_size, QDISC_KIND_PFIFO, 0
PFIFOHeadDrop.Parent, config_parse_qdisc_parent, QDISC_KIND_PFIFO_HEAD_DROP, 0
PFIFOHeadDrop.Handle, config_parse_qdisc_handle, QDISC_KIND_PFIFO_HEAD_DROP, 0
PFIFOHeadDrop.PacketLimit, config_parse_pfifo_size, QDISC_KIND_PFIFO_HEAD_DROP, 0
FairQueueing.Parent, config_parse_qdisc_parent, QDISC_KIND_FQ, 0
FairQueueing.Handle, config_parse_qdisc_handle, QDISC_KIND_FQ, 0
FairQueueing.PacketLimit, config_parse_fair_queueing_u32, QDISC_KIND_FQ, 0

View File

@ -492,6 +492,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
"DeficitRoundRobinScheduler\0"
"DeficitRoundRobinSchedulerClass\0"
"PFIFO\0"
"PFIFOHeadDrop\0"
"FairQueueing\0"
"FairQueueingControlledDelay\0"
"GenericRandomEarlyDetection\0"

View File

@ -26,6 +26,9 @@ static int fifo_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req)
case QDISC_KIND_BFIFO:
fifo = BFIFO(qdisc);
break;
case QDISC_KIND_PFIFO_HEAD_DROP:
fifo = PFIFO_HEAD_DROP(qdisc);
break;
default:
assert_not_reached("Invalid QDisc kind.");
}
@ -61,14 +64,23 @@ int config_parse_pfifo_size(
assert(rvalue);
assert(data);
r = qdisc_new_static(QDISC_KIND_PFIFO, network, filename, section_line, &qdisc);
r = qdisc_new_static(ltype, network, filename, section_line, &qdisc);
if (r == -ENOMEM)
return log_oom();
if (r < 0)
return log_syntax(unit, LOG_ERR, filename, line, r,
"More than one kind of queueing discipline, ignoring assignment: %m");
switch(qdisc->kind) {
case QDISC_KIND_PFIFO:
fifo = PFIFO(qdisc);
break;
case QDISC_KIND_PFIFO_HEAD_DROP:
fifo = PFIFO_HEAD_DROP(qdisc);
break;
default:
assert_not_reached("Invalid QDisc kind.");
}
if (isempty(rvalue)) {
fifo->limit = 0;
@ -147,7 +159,6 @@ int config_parse_bfifo_size(
return 0;
}
const QDiscVTable pfifo_vtable = {
.object_size = sizeof(FirstInFirstOut),
.tca_kind = "pfifo",
@ -159,3 +170,9 @@ const QDiscVTable bfifo_vtable = {
.tca_kind = "bfifo",
.fill_message = fifo_fill_message,
};
const QDiscVTable pfifo_head_drop_vtable = {
.object_size = sizeof(FirstInFirstOut),
.tca_kind = "pfifo_head_drop",
.fill_message = fifo_fill_message,
};

View File

@ -13,9 +13,11 @@ typedef struct FirstInFirstOut {
DEFINE_QDISC_CAST(PFIFO, FirstInFirstOut);
DEFINE_QDISC_CAST(BFIFO, FirstInFirstOut);
DEFINE_QDISC_CAST(PFIFO_HEAD_DROP, FirstInFirstOut);
extern const QDiscVTable pfifo_vtable;
extern const QDiscVTable bfifo_vtable;
extern const QDiscVTable pfifo_head_drop_vtable;
CONFIG_PARSER_PROTOTYPE(config_parse_pfifo_size);
CONFIG_PARSER_PROTOTYPE(config_parse_bfifo_size);

View File

@ -27,6 +27,7 @@ const QDiscVTable * const qdisc_vtable[_QDISC_KIND_MAX] = {
[QDISC_KIND_NETEM] = &netem_vtable,
[QDISC_KIND_PIE] = &pie_vtable,
[QDISC_KIND_PFIFO] = &pfifo_vtable,
[QDISC_KIND_PFIFO_HEAD_DROP] = &pfifo_head_drop_vtable,
[QDISC_KIND_SFB] = &sfb_vtable,
[QDISC_KIND_SFQ] = &sfq_vtable,
[QDISC_KIND_TBF] = &tbf_vtable,

View File

@ -19,6 +19,7 @@ typedef enum QDiscKind {
QDISC_KIND_HTB,
QDISC_KIND_NETEM,
QDISC_KIND_PFIFO,
QDISC_KIND_PFIFO_HEAD_DROP,
QDISC_KIND_PIE,
QDISC_KIND_SFB,
QDISC_KIND_SFQ,

View File

@ -364,6 +364,10 @@ LimitSize=
Parent=
Handle=
PacketLimit=
[PFIFOHeadDrop]
Parent=
Handle=
PacketLimit=
[GenericRandomEarlyDetection]
Parent=
Handle=