2022-03-28 21:12:22

by Christophe Leroy

[permalink] [raw]
Subject: [PATCH net-next] sch_cake: Take into account guideline DEF/DGSIC/36 from French Administration

French Administration has written a guideline that defines additional
DSCP values for use in its networks.

Add new CAKE diffserv tables to take those new values into account
and add CONFIG_NET_SCH_CAKE_DGSIC to select those tables instead of
the default ones.

The document is available at
https://www.bo.sga.defense.gouv.fr/texte/signe/264219/N%C2%B0%2036/DEF/DGSIC.pdf
or https://www.bo.sga.defense.gouv.fr/texte/264219/N%C2%B0%2036/DEF/DGSIC.html

Signed-off-by: Christophe Leroy <[email protected]>
---
net/sched/Kconfig | 11 +++++++++++
net/sched/sch_cake.c | 42 +++++++++++++++++++++++++++++++++++++++---
2 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index 1e8ab4749c6c..b99f247404e0 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -331,6 +331,17 @@ config NET_SCH_CAKE

If unsure, say N.

+config NET_SCH_CAKE_DGSIC
+ bool "CAKE: Follow French Administration's guideline DEF/DGSIC/36"
+ depends on NET_SCH_CAKE
+ help
+ Say Y here if you want to use the Common Applications Kept Enhanced
+ (CAKE) queue management algorithm in an environment that requires to
+ take into account additional DSCP values defined by the French
+ Administration in the guideline document identified DEF/DGSIC/36,
+ available at
+ https://www.bo.sga.defense.gouv.fr/texte/signe/264219/N%C2%B0%2036/DEF/DGSIC.pdf
+
config NET_SCH_FQ
tristate "Fair Queue"
help
diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
index a43a58a73d09..3d9af3a68c05 100644
--- a/net/sched/sch_cake.c
+++ b/net/sched/sch_cake.c
@@ -322,6 +322,17 @@ static const u8 diffserv8[] = {
7, 2, 2, 2, 2, 2, 2, 2,
};

+static const u8 diffserv8_dgsic[] = {
+ 2, 0, 1, 2, 4, 2, 2, 2,
+ 1, 1, 1, 2, 1, 1, 1, 2,
+ 5, 4, 4, 2, 4, 4, 4, 2,
+ 3, 3, 3, 2, 3, 3, 3, 2,
+ 6, 3, 3, 2, 3, 3, 3, 2,
+ 6, 6, 6, 2, 6, 6, 6, 2,
+ 7, 2, 2, 2, 2, 2, 2, 2,
+ 7, 2, 2, 2, 2, 2, 2, 2,
+};
+
static const u8 diffserv4[] = {
0, 1, 0, 0, 2, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0,
@@ -333,6 +344,17 @@ static const u8 diffserv4[] = {
3, 0, 0, 0, 0, 0, 0, 0,
};

+static const u8 diffserv4_dgsic[] = {
+ 0, 1, 0, 0, 2, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0,
+ 2, 2, 2, 0, 2, 2, 2, 0,
+ 2, 2, 2, 0, 2, 2, 2, 0,
+ 3, 2, 2, 0, 2, 2, 2, 0,
+ 3, 3, 3, 0, 3, 3, 3, 0,
+ 3, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0, 0, 0,
+};
+
static const u8 diffserv3[] = {
0, 1, 0, 0, 2, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0,
@@ -344,6 +366,17 @@ static const u8 diffserv3[] = {
2, 0, 0, 0, 0, 0, 0, 0,
};

+static const u8 diffserv3_dgsic[] = {
+ 0, 1, 0, 0, 2, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 2, 2, 0, 2, 2, 2, 0,
+ 2, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0, 0, 0,
+};
+
static const u8 besteffort[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2409,7 +2442,8 @@ static int cake_config_diffserv8(struct Qdisc *sch)
q->tin_cnt = 8;

/* codepoint to class mapping */
- q->tin_index = diffserv8;
+ q->tin_index = IS_ENABLED(CONFIG_NET_SCH_CAKE_DGSIC) ? diffserv8_dgsic :
+ diffserv8;
q->tin_order = normal_order;

/* class characteristics */
@@ -2452,7 +2486,8 @@ static int cake_config_diffserv4(struct Qdisc *sch)
q->tin_cnt = 4;

/* codepoint to class mapping */
- q->tin_index = diffserv4;
+ q->tin_index = IS_ENABLED(CONFIG_NET_SCH_CAKE_DGSIC) ? diffserv4_dgsic :
+ diffserv4;
q->tin_order = bulk_order;

/* class characteristics */
@@ -2489,7 +2524,8 @@ static int cake_config_diffserv3(struct Qdisc *sch)
q->tin_cnt = 3;

/* codepoint to class mapping */
- q->tin_index = diffserv3;
+ q->tin_index = IS_ENABLED(CONFIG_NET_SCH_CAKE_DGSIC) ? diffserv3_dgsic :
+ diffserv3;
q->tin_order = bulk_order;

/* class characteristics */
--
2.35.1


2022-03-28 21:38:10

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH net-next] sch_cake: Take into account guideline DEF/DGSIC/36 from French Administration



Le 28/03/2022 à 17:43, Toke Høiland-Jørgensen a écrit :
> Christophe Leroy <[email protected]> writes:
>
>> French Administration has written a guideline that defines additional
>> DSCP values for use in its networks.
>
> Huh, that's interesting!
>
>> Add new CAKE diffserv tables to take those new values into account
>> and add CONFIG_NET_SCH_CAKE_DGSIC to select those tables instead of
>> the default ones.
>
> ...however I don't think we should be including something this
> special-purpose into the qdisc kernel code, and certainly we shouldn't
> have a config option that changes the meaning of the existing diffserv
> keywords!

By the way it doesn't really change meaning. Just enhances it indeed.
Because they are not changing the meaning of existing DSCP codes, just
adding new ones.

>
> Rather, this is something that is best specified from userspace; and in
> fact Cake already has no less than two different ways to do this: the
> 'fwmark' option, and setting the skb->priority field. Have you tried
> using those?

No I have not. In fact I'm just discovering the subject after some
people told me "we are contractually required to apply this guideline,
please make sure Linux kernel supports it".

I'll give 'fwmark' and/or skb->priority a try. Is there any
Documentation on that somewhere ?

Thanks
Christophe

2022-03-28 22:07:28

by Toke Høiland-Jørgensen

[permalink] [raw]
Subject: Re: [PATCH net-next] sch_cake: Take into account guideline DEF/DGSIC/36 from French Administration

Christophe Leroy <[email protected]> writes:

> French Administration has written a guideline that defines additional
> DSCP values for use in its networks.

Huh, that's interesting!

> Add new CAKE diffserv tables to take those new values into account
> and add CONFIG_NET_SCH_CAKE_DGSIC to select those tables instead of
> the default ones.

...however I don't think we should be including something this
special-purpose into the qdisc kernel code, and certainly we shouldn't
have a config option that changes the meaning of the existing diffserv
keywords!

Rather, this is something that is best specified from userspace; and in
fact Cake already has no less than two different ways to do this: the
'fwmark' option, and setting the skb->priority field. Have you tried
using those?

-Toke

2022-03-28 23:02:04

by Toke Høiland-Jørgensen

[permalink] [raw]
Subject: Re: [PATCH net-next] sch_cake: Take into account guideline DEF/DGSIC/36 from French Administration

Christophe Leroy <[email protected]> writes:

> Le 28/03/2022 à 17:43, Toke Høiland-Jørgensen a écrit :
>> Christophe Leroy <[email protected]> writes:
>>
>>> French Administration has written a guideline that defines additional
>>> DSCP values for use in its networks.
>>
>> Huh, that's interesting!
>>
>>> Add new CAKE diffserv tables to take those new values into account
>>> and add CONFIG_NET_SCH_CAKE_DGSIC to select those tables instead of
>>> the default ones.
>>
>> ...however I don't think we should be including something this
>> special-purpose into the qdisc kernel code, and certainly we shouldn't
>> have a config option that changes the meaning of the existing diffserv
>> keywords!
>
> By the way it doesn't really change meaning. Just enhances it indeed.
> Because they are not changing the meaning of existing DSCP codes, just
> adding new ones.

Ah, OK, but then it's even easier, you can just add rules for the new
values using the userspace options and let cake select the rest using
the existing code.

>> Rather, this is something that is best specified from userspace; and in
>> fact Cake already has no less than two different ways to do this: the
>> 'fwmark' option, and setting the skb->priority field. Have you tried
>> using those?
>
> No I have not. In fact I'm just discovering the subject after some
> people told me "we are contractually required to apply this guideline,
> please make sure Linux kernel supports it".
>
> I'll give 'fwmark' and/or skb->priority a try. Is there any
> Documentation on that somewhere ?

Both are documented in the tc-cake man page.

-Toke