All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2-next] tc: Add support for ce_threshold_value/mask in fq_codel
@ 2021-11-23 20:13 Toke Høiland-Jørgensen
  2021-12-03 17:20 ` David Ahern
  0 siblings, 1 reply; 5+ messages in thread
From: Toke Høiland-Jørgensen @ 2021-11-23 20:13 UTC (permalink / raw)
  To: netdev; +Cc: Toke Høiland-Jørgensen

Commit dfcb63ce1de6 ("fq_codel: generalise ce_threshold marking for subset
of traffic") added support in fq_codel for setting a value and mask that
will be applied to the diffserv/ECN byte to turn on the ce_threshold
feature for a subset of traffic.

This adds support to tc for setting these values. The parameter is
called ce_threshold_selector and takes a value followed by a
slash-separated mask. Some examples:

 # apply ce_threshold to ECT(1) traffic
 tc qdisc replace dev eth0 root fq_codel ce_threshold 1ms ce_threshold_selector 0x1/0x3

 # apply ce_threshold to ECN-capable traffic marked as diffserv AF22
 tc qdisc replace dev eth0 root fq_codel ce_threshold 1ms ce_threshold_selector 0x50/0xfc

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
 tc/q_fq_codel.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/tc/q_fq_codel.c b/tc/q_fq_codel.c
index 300980652243..b7552e294fd0 100644
--- a/tc/q_fq_codel.c
+++ b/tc/q_fq_codel.c
@@ -55,6 +55,7 @@ static void explain(void)
 					"[ target TIME ] [ interval TIME ]\n"
 					"[ quantum BYTES ] [ [no]ecn ]\n"
 					"[ ce_threshold TIME ]\n"
+					"[ ce_threshold_selector VALUE/MASK ]\n"
 					"[ drop_batch SIZE ]\n");
 }
 
@@ -69,6 +70,8 @@ static int fq_codel_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 	unsigned int quantum = 0;
 	unsigned int ce_threshold = ~0U;
 	unsigned int memory = ~0U;
+	__u8 ce_threshold_mask = 0;
+	__u8 ce_threshold_selector = 0xFF;
 	int ecn = -1;
 	struct rtattr *tail;
 
@@ -109,6 +112,24 @@ static int fq_codel_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 				fprintf(stderr, "Illegal \"ce_threshold\"\n");
 				return -1;
 			}
+		} else if (strcmp(*argv, "ce_threshold_selector") == 0) {
+			char *sep;
+
+			NEXT_ARG();
+			sep = strchr(*argv, '/');
+			if (!sep) {
+				fprintf(stderr, "Missing mask for \"ce_threshold_selector\"\n");
+				return -1;
+			}
+			*sep++ = '\0';
+			if (get_u8(&ce_threshold_mask, sep, 0)) {
+				fprintf(stderr, "Illegal mask for \"ce_threshold_selector\"\n");
+				return -1;
+			}
+			if (get_u8(&ce_threshold_selector, *argv, 0)) {
+				fprintf(stderr, "Illegal \"ce_threshold_selector\"\n");
+				return -1;
+			}
 		} else if (strcmp(*argv, "memory_limit") == 0) {
 			NEXT_ARG();
 			if (get_size(&memory, *argv)) {
@@ -152,6 +173,10 @@ static int fq_codel_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 	if (ce_threshold != ~0U)
 		addattr_l(n, 1024, TCA_FQ_CODEL_CE_THRESHOLD,
 			  &ce_threshold, sizeof(ce_threshold));
+	if (ce_threshold_selector != 0xFF) {
+		addattr8(n, 1024, TCA_FQ_CODEL_CE_THRESHOLD_MASK, ce_threshold_mask);
+		addattr8(n, 1024, TCA_FQ_CODEL_CE_THRESHOLD_SELECTOR, ce_threshold_selector);
+	}
 	if (memory != ~0U)
 		addattr_l(n, 1024, TCA_FQ_CODEL_MEMORY_LIMIT,
 			  &memory, sizeof(memory));
@@ -172,6 +197,8 @@ static int fq_codel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt
 	unsigned int ecn;
 	unsigned int quantum;
 	unsigned int ce_threshold;
+	__u8 ce_threshold_selector = 0;
+	__u8 ce_threshold_mask = 0;
 	unsigned int memory_limit;
 	unsigned int drop_batch;
 
@@ -211,6 +238,19 @@ static int fq_codel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt
 		print_string(PRINT_FP, NULL, "ce_threshold %s ",
 			     sprint_time(ce_threshold, b1));
 	}
+	if (tb[TCA_FQ_CODEL_CE_THRESHOLD_SELECTOR] &&
+	    RTA_PAYLOAD(tb[TCA_FQ_CODEL_CE_THRESHOLD_SELECTOR]) >= sizeof(__u8))
+		ce_threshold_selector = rta_getattr_u8(tb[TCA_FQ_CODEL_CE_THRESHOLD_SELECTOR]);
+	if (tb[TCA_FQ_CODEL_CE_THRESHOLD_MASK] &&
+	    RTA_PAYLOAD(tb[TCA_FQ_CODEL_CE_THRESHOLD_MASK]) >= sizeof(__u8))
+		ce_threshold_mask = rta_getattr_u8(tb[TCA_FQ_CODEL_CE_THRESHOLD_MASK]);
+	if (ce_threshold_mask || ce_threshold_selector) {
+		print_hhu(PRINT_ANY, "ce_threshold_selector", "ce_threshold_selector %#x",
+			  ce_threshold_selector);
+		print_hhu(PRINT_ANY, "ce_threshold_mask", "/%#x ",
+			  ce_threshold_mask);
+	}
+
 	if (tb[TCA_FQ_CODEL_INTERVAL] &&
 	    RTA_PAYLOAD(tb[TCA_FQ_CODEL_INTERVAL]) >= sizeof(__u32)) {
 		interval = rta_getattr_u32(tb[TCA_FQ_CODEL_INTERVAL]);
-- 
2.34.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH iproute2-next] tc: Add support for ce_threshold_value/mask in fq_codel
  2021-11-23 20:13 [PATCH iproute2-next] tc: Add support for ce_threshold_value/mask in fq_codel Toke Høiland-Jørgensen
@ 2021-12-03 17:20 ` David Ahern
  2021-12-05 22:03   ` Toke Høiland-Jørgensen
  0 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2021-12-03 17:20 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen, netdev

On 11/23/21 1:13 PM, Toke Høiland-Jørgensen wrote:
> Commit dfcb63ce1de6 ("fq_codel: generalise ce_threshold marking for subset
> of traffic") added support in fq_codel for setting a value and mask that
> will be applied to the diffserv/ECN byte to turn on the ce_threshold
> feature for a subset of traffic.
> 
> This adds support to tc for setting these values. The parameter is
> called ce_threshold_selector and takes a value followed by a
> slash-separated mask. Some examples:
> 
>  # apply ce_threshold to ECT(1) traffic
>  tc qdisc replace dev eth0 root fq_codel ce_threshold 1ms ce_threshold_selector 0x1/0x3
> 
>  # apply ce_threshold to ECN-capable traffic marked as diffserv AF22
>  tc qdisc replace dev eth0 root fq_codel ce_threshold 1ms ce_threshold_selector 0x50/0xfc
> 
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
> ---
>  tc/q_fq_codel.c | 40 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)

please re-send with an update to

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH iproute2-next] tc: Add support for ce_threshold_value/mask in fq_codel
  2021-12-03 17:20 ` David Ahern
@ 2021-12-05 22:03   ` Toke Høiland-Jørgensen
  2021-12-07 16:14     ` David Ahern
  0 siblings, 1 reply; 5+ messages in thread
From: Toke Høiland-Jørgensen @ 2021-12-05 22:03 UTC (permalink / raw)
  To: David Ahern, netdev

David Ahern <dsahern@gmail.com> writes:

> On 11/23/21 1:13 PM, Toke Høiland-Jørgensen wrote:
>> Commit dfcb63ce1de6 ("fq_codel: generalise ce_threshold marking for subset
>> of traffic") added support in fq_codel for setting a value and mask that
>> will be applied to the diffserv/ECN byte to turn on the ce_threshold
>> feature for a subset of traffic.
>> 
>> This adds support to tc for setting these values. The parameter is
>> called ce_threshold_selector and takes a value followed by a
>> slash-separated mask. Some examples:
>> 
>>  # apply ce_threshold to ECT(1) traffic
>>  tc qdisc replace dev eth0 root fq_codel ce_threshold 1ms ce_threshold_selector 0x1/0x3
>> 
>>  # apply ce_threshold to ECN-capable traffic marked as diffserv AF22
>>  tc qdisc replace dev eth0 root fq_codel ce_threshold 1ms ce_threshold_selector 0x50/0xfc
>> 
>> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
>> ---
>>  tc/q_fq_codel.c | 40 ++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 40 insertions(+)
>
> please re-send with an update to

With an update to? :)

-Toke


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH iproute2-next] tc: Add support for ce_threshold_value/mask in fq_codel
  2021-12-05 22:03   ` Toke Høiland-Jørgensen
@ 2021-12-07 16:14     ` David Ahern
  2021-12-07 17:46       ` Toke Høiland-Jørgensen
  0 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2021-12-07 16:14 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen, netdev

[ vger seems to be having problems; just received this ]

On 12/5/21 3:03 PM, Toke Høiland-Jørgensen wrote:
> David Ahern <dsahern@gmail.com> writes:
> 
>> On 11/23/21 1:13 PM, Toke Høiland-Jørgensen wrote:
>>> Commit dfcb63ce1de6 ("fq_codel: generalise ce_threshold marking for subset
>>> of traffic") added support in fq_codel for setting a value and mask that
>>> will be applied to the diffserv/ECN byte to turn on the ce_threshold
>>> feature for a subset of traffic.
>>>
>>> This adds support to tc for setting these values. The parameter is
>>> called ce_threshold_selector and takes a value followed by a
>>> slash-separated mask. Some examples:
>>>
>>>  # apply ce_threshold to ECT(1) traffic
>>>  tc qdisc replace dev eth0 root fq_codel ce_threshold 1ms ce_threshold_selector 0x1/0x3
>>>
>>>  # apply ce_threshold to ECN-capable traffic marked as diffserv AF22
>>>  tc qdisc replace dev eth0 root fq_codel ce_threshold 1ms ce_threshold_selector 0x50/0xfc
>>>
>>> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
>>> ---
>>>  tc/q_fq_codel.c | 40 ++++++++++++++++++++++++++++++++++++++++
>>>  1 file changed, 40 insertions(+)
>>
>> please re-send with an update to
> 
> With an update to? :)
> 

... man page.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH iproute2-next] tc: Add support for ce_threshold_value/mask in fq_codel
  2021-12-07 16:14     ` David Ahern
@ 2021-12-07 17:46       ` Toke Høiland-Jørgensen
  0 siblings, 0 replies; 5+ messages in thread
From: Toke Høiland-Jørgensen @ 2021-12-07 17:46 UTC (permalink / raw)
  To: David Ahern, netdev

David Ahern <dsahern@gmail.com> writes:

> [ vger seems to be having problems; just received this ]
>
> On 12/5/21 3:03 PM, Toke Høiland-Jørgensen wrote:
>> David Ahern <dsahern@gmail.com> writes:
>> 
>>> On 11/23/21 1:13 PM, Toke Høiland-Jørgensen wrote:
>>>> Commit dfcb63ce1de6 ("fq_codel: generalise ce_threshold marking for subset
>>>> of traffic") added support in fq_codel for setting a value and mask that
>>>> will be applied to the diffserv/ECN byte to turn on the ce_threshold
>>>> feature for a subset of traffic.
>>>>
>>>> This adds support to tc for setting these values. The parameter is
>>>> called ce_threshold_selector and takes a value followed by a
>>>> slash-separated mask. Some examples:
>>>>
>>>>  # apply ce_threshold to ECT(1) traffic
>>>>  tc qdisc replace dev eth0 root fq_codel ce_threshold 1ms ce_threshold_selector 0x1/0x3
>>>>
>>>>  # apply ce_threshold to ECN-capable traffic marked as diffserv AF22
>>>>  tc qdisc replace dev eth0 root fq_codel ce_threshold 1ms ce_threshold_selector 0x50/0xfc
>>>>
>>>> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
>>>> ---
>>>>  tc/q_fq_codel.c | 40 ++++++++++++++++++++++++++++++++++++++++
>>>>  1 file changed, 40 insertions(+)
>>>
>>> please re-send with an update to
>> 
>> With an update to? :)
>> 
>
> ... man page.

Ah yes, of course; will do!

-Toke


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-07 17:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-23 20:13 [PATCH iproute2-next] tc: Add support for ce_threshold_value/mask in fq_codel Toke Høiland-Jørgensen
2021-12-03 17:20 ` David Ahern
2021-12-05 22:03   ` Toke Høiland-Jørgensen
2021-12-07 16:14     ` David Ahern
2021-12-07 17:46       ` Toke Høiland-Jørgensen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.