* [PATCH iproute2] fq: don't allow set options to zero
@ 2014-05-12 4:18 Yang Yingliang
2014-05-12 5:58 ` Eric Dumazet
0 siblings, 1 reply; 14+ messages in thread
From: Yang Yingliang @ 2014-05-12 4:18 UTC (permalink / raw)
To: stephen; +Cc: netdev, eric.dumazet
Now options of fair queue can be zero but cannot be (~0U).
Zero is useless, so don't allow set the options to zero.
Also, maxrate cannot be reset to unlimited because it
cannot be (~0U).
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
tc/q_fq.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/tc/q_fq.c b/tc/q_fq.c
index c1f658e..c529842 100644
--- a/tc/q_fq.c
+++ b/tc/q_fq.c
@@ -71,13 +71,13 @@ static unsigned int ilog2(unsigned int val)
static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
struct nlmsghdr *n)
{
- unsigned int plimit = ~0U;
- unsigned int flow_plimit = ~0U;
- unsigned int quantum = ~0U;
- unsigned int initial_quantum = ~0U;
+ unsigned int plimit = 0;
+ unsigned int flow_plimit = 0;
+ unsigned int quantum = 0;
+ unsigned int initial_quantum = 0;
unsigned int buckets = 0;
- unsigned int maxrate = ~0U;
- unsigned int defrate = ~0U;
+ unsigned int maxrate = 0;
+ unsigned int defrate = 0;
int pacing = -1;
struct rtattr *tail;
@@ -147,24 +147,24 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
addattr_l(n, 1024, TCA_FQ_BUCKETS_LOG,
&log, sizeof(log));
}
- if (plimit != ~0U)
+ if (plimit)
addattr_l(n, 1024, TCA_FQ_PLIMIT,
&plimit, sizeof(plimit));
- if (flow_plimit != ~0U)
+ if (flow_plimit)
addattr_l(n, 1024, TCA_FQ_FLOW_PLIMIT,
&flow_plimit, sizeof(flow_plimit));
- if (quantum != ~0U)
+ if (quantum)
addattr_l(n, 1024, TCA_FQ_QUANTUM, &quantum, sizeof(quantum));
- if (initial_quantum != ~0U)
+ if (initial_quantum)
addattr_l(n, 1024, TCA_FQ_INITIAL_QUANTUM,
&initial_quantum, sizeof(initial_quantum));
if (pacing != -1)
addattr_l(n, 1024, TCA_FQ_RATE_ENABLE,
&pacing, sizeof(pacing));
- if (maxrate != ~0U)
+ if (maxrate)
addattr_l(n, 1024, TCA_FQ_FLOW_MAX_RATE,
&maxrate, sizeof(maxrate));
- if (defrate != ~0U)
+ if (defrate)
addattr_l(n, 1024, TCA_FQ_FLOW_DEFAULT_RATE,
&defrate, sizeof(defrate));
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
--
1.8.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH iproute2] fq: don't allow set options to zero
2014-05-12 4:18 [PATCH iproute2] fq: don't allow set options to zero Yang Yingliang
@ 2014-05-12 5:58 ` Eric Dumazet
2014-05-12 6:51 ` Yang Yingliang
2014-05-12 6:59 ` Yang Yingliang
0 siblings, 2 replies; 14+ messages in thread
From: Eric Dumazet @ 2014-05-12 5:58 UTC (permalink / raw)
To: Yang Yingliang; +Cc: stephen, netdev
On Mon, 2014-05-12 at 12:18 +0800, Yang Yingliang wrote:
> Now options of fair queue can be zero but cannot be (~0U).
> Zero is useless, so don't allow set the options to zero.
> Also, maxrate cannot be reset to unlimited because it
> cannot be (~0U).
>
> Cc: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> tc/q_fq.c | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
No, you are changing behavior for existing scripts.
If you really want to fix these cases, you need to do it properly.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH iproute2] fq: don't allow set options to zero
2014-05-12 5:58 ` Eric Dumazet
@ 2014-05-12 6:51 ` Yang Yingliang
2014-05-12 6:55 ` Yang Yingliang
2014-05-12 6:59 ` Yang Yingliang
1 sibling, 1 reply; 14+ messages in thread
From: Yang Yingliang @ 2014-05-12 6:51 UTC (permalink / raw)
To: Eric Dumazet; +Cc: stephen, netdev
On 2014/5/12 13:58, Eric Dumazet wrote:
> On Mon, 2014-05-12 at 12:18 +0800, Yang Yingliang wrote:
>> Now options of fair queue can be zero but cannot be (~0U).
>> Zero is useless, so don't allow set the options to zero.
>> Also, maxrate cannot be reset to unlimited because it
>> cannot be (~0U).
>>
>> Cc: Eric Dumazet <edumazet@google.com>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
>> tc/q_fq.c | 24 ++++++++++++------------
>> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> No, you are changing behavior for existing scripts.
>
> If you really want to fix these cases, you need to do it properly.
>
Do you mean allow options set to zero changing the behavior ?
Regards,
Yang
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH iproute2] fq: don't allow set options to zero
2014-05-12 6:51 ` Yang Yingliang
@ 2014-05-12 6:55 ` Yang Yingliang
0 siblings, 0 replies; 14+ messages in thread
From: Yang Yingliang @ 2014-05-12 6:55 UTC (permalink / raw)
To: Eric Dumazet; +Cc: stephen, netdev
On 2014/5/12 14:51, Yang Yingliang wrote:
> On 2014/5/12 13:58, Eric Dumazet wrote:
>> On Mon, 2014-05-12 at 12:18 +0800, Yang Yingliang wrote:
>>> Now options of fair queue can be zero but cannot be (~0U).
>>> Zero is useless, so don't allow set the options to zero.
>>> Also, maxrate cannot be reset to unlimited because it
>>> cannot be (~0U).
>>>
>>> Cc: Eric Dumazet <edumazet@google.com>
>>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>>> ---
>>> tc/q_fq.c | 24 ++++++++++++------------
>>> 1 file changed, 12 insertions(+), 12 deletions(-)
>>
>> No, you are changing behavior for existing scripts.
>>
>> If you really want to fix these cases, you need to do it properly.
>>
>
> Do you mean allow options set to zero changing the behavior ?
>
> Regards,
> Yang
>
My bad, please ignore this mail.
Sorry for the noisy.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH iproute2] fq: don't allow set options to zero
2014-05-12 5:58 ` Eric Dumazet
2014-05-12 6:51 ` Yang Yingliang
@ 2014-05-12 6:59 ` Yang Yingliang
2014-05-12 15:23 ` Eric Dumazet
1 sibling, 1 reply; 14+ messages in thread
From: Yang Yingliang @ 2014-05-12 6:59 UTC (permalink / raw)
To: Eric Dumazet; +Cc: stephen, netdev
On 2014/5/12 13:58, Eric Dumazet wrote:
> On Mon, 2014-05-12 at 12:18 +0800, Yang Yingliang wrote:
>> Now options of fair queue can be zero but cannot be (~0U).
>> Zero is useless, so don't allow set the options to zero.
>> Also, maxrate cannot be reset to unlimited because it
>> cannot be (~0U).
>>
>> Cc: Eric Dumazet <edumazet@google.com>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
>> tc/q_fq.c | 24 ++++++++++++------------
>> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> No, you are changing behavior for existing scripts.
>
> If you really want to fix these cases, you need to do it properly.
>
Do you mean options cannot be zero changing the behavior ?
Regards,
Yang
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH iproute2] fq: don't allow set options to zero
2014-05-12 6:59 ` Yang Yingliang
@ 2014-05-12 15:23 ` Eric Dumazet
2014-05-13 2:23 ` [PATCH iproute2 v2] fq: allow options of fair queue set to ~0U Yang Yingliang
0 siblings, 1 reply; 14+ messages in thread
From: Eric Dumazet @ 2014-05-12 15:23 UTC (permalink / raw)
To: Yang Yingliang; +Cc: stephen, netdev
On Mon, 2014-05-12 at 14:59 +0800, Yang Yingliang wrote:
> On 2014/5/12 13:58, Eric Dumazet wrote:
> > On Mon, 2014-05-12 at 12:18 +0800, Yang Yingliang wrote:
> >> Now options of fair queue can be zero but cannot be (~0U).
> >> Zero is useless, so don't allow set the options to zero.
> >> Also, maxrate cannot be reset to unlimited because it
> >> cannot be (~0U).
> >>
> >> Cc: Eric Dumazet <edumazet@google.com>
> >> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> >> ---
> >> tc/q_fq.c | 24 ++++++++++++------------
> >> 1 file changed, 12 insertions(+), 12 deletions(-)
> >
> > No, you are changing behavior for existing scripts.
> >
> > If you really want to fix these cases, you need to do it properly.
> >
> Do you mean options cannot be zero changing the behavior ?
I mean that you need to do something like the following.
diff --git a/tc/q_fq.c b/tc/q_fq.c
index c1f658e..26ecac3 100644
--- a/tc/q_fq.c
+++ b/tc/q_fq.c
@@ -76,7 +76,8 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
unsigned int quantum = ~0U;
unsigned int initial_quantum = ~0U;
unsigned int buckets = 0;
- unsigned int maxrate = ~0U;
+ unsigned int maxrate;
+ int set_maxrate = 0;
unsigned int defrate = ~0U;
int pacing = -1;
struct rtattr *tail;
@@ -106,6 +107,7 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
fprintf(stderr, "Illegal \"maxrate\"\n");
return -1;
}
+ set_maxrate = 1;
} else if (strcmp(*argv, "defrate") == 0) {
NEXT_ARG();
if (get_rate(&defrate, *argv)) {
@@ -161,7 +163,7 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
if (pacing != -1)
addattr_l(n, 1024, TCA_FQ_RATE_ENABLE,
&pacing, sizeof(pacing));
- if (maxrate != ~0U)
+ if (set_maxrate)
addattr_l(n, 1024, TCA_FQ_FLOW_MAX_RATE,
&maxrate, sizeof(maxrate));
if (defrate != ~0U)
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH iproute2 v2] fq: allow options of fair queue set to ~0U
2014-05-12 15:23 ` Eric Dumazet
@ 2014-05-13 2:23 ` Yang Yingliang
2014-05-13 3:03 ` Eric Dumazet
2014-05-13 4:20 ` [PATCH iproute2 v3] " Yang Yingliang
0 siblings, 2 replies; 14+ messages in thread
From: Yang Yingliang @ 2014-05-13 2:23 UTC (permalink / raw)
To: Eric Dumazet, stephen; +Cc: netdev
From: Yang Yingliang <yangyingliang@huawei.com>
Some options of fair queue cannot be (~0U). It leads to maxrate
cannot be reset to unlimited because it cannot be (~0U).
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
tc/q_fq.c | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/tc/q_fq.c b/tc/q_fq.c
index c1f658e..6a493a5 100644
--- a/tc/q_fq.c
+++ b/tc/q_fq.c
@@ -71,13 +71,19 @@ static unsigned int ilog2(unsigned int val)
static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
struct nlmsghdr *n)
{
- unsigned int plimit = ~0U;
- unsigned int flow_plimit = ~0U;
- unsigned int quantum = ~0U;
- unsigned int initial_quantum = ~0U;
+ unsigned int plimit;
+ unsigned int flow_plimit;
+ unsigned int quantum;
+ unsigned int initial_quantum;
unsigned int buckets = 0;
- unsigned int maxrate = ~0U;
- unsigned int defrate = ~0U;
+ unsigned int maxrate;
+ unsigned int defrate;
+ int set_plimit = 0;
+ int set_flow_plimit = 0;
+ int set_quantum = 0;
+ int set_initial_quantum = 0;
+ int set_maxrate = 0;
+ int set_defrate = 0;
int pacing = -1;
struct rtattr *tail;
@@ -88,12 +94,14 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
fprintf(stderr, "Illegal \"limit\"\n");
return -1;
}
+ set_plimit = 1;
} else if (strcmp(*argv, "flow_limit") == 0) {
NEXT_ARG();
if (get_unsigned(&flow_plimit, *argv, 0)) {
fprintf(stderr, "Illegal \"flow_limit\"\n");
return -1;
}
+ set_flow_plimit = 0;
} else if (strcmp(*argv, "buckets") == 0) {
NEXT_ARG();
if (get_unsigned(&buckets, *argv, 0)) {
@@ -106,24 +114,28 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
fprintf(stderr, "Illegal \"maxrate\"\n");
return -1;
}
+ set_maxrate = 1;
} else if (strcmp(*argv, "defrate") == 0) {
NEXT_ARG();
if (get_rate(&defrate, *argv)) {
fprintf(stderr, "Illegal \"defrate\"\n");
return -1;
}
+ set_defrate = 1;
} else if (strcmp(*argv, "quantum") == 0) {
NEXT_ARG();
if (get_unsigned(&quantum, *argv, 0)) {
fprintf(stderr, "Illegal \"quantum\"\n");
return -1;
}
+ set_quantum = 1;
} else if (strcmp(*argv, "initial_quantum") == 0) {
NEXT_ARG();
if (get_unsigned(&initial_quantum, *argv, 0)) {
fprintf(stderr, "Illegal \"initial_quantum\"\n");
return -1;
}
+ set_initial_quantum = 1;
} else if (strcmp(*argv, "pacing") == 0) {
pacing = 1;
} else if (strcmp(*argv, "nopacing") == 0) {
@@ -147,24 +159,24 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
addattr_l(n, 1024, TCA_FQ_BUCKETS_LOG,
&log, sizeof(log));
}
- if (plimit != ~0U)
+ if (set_plimit)
addattr_l(n, 1024, TCA_FQ_PLIMIT,
&plimit, sizeof(plimit));
- if (flow_plimit != ~0U)
+ if (set_flow_plimit)
addattr_l(n, 1024, TCA_FQ_FLOW_PLIMIT,
&flow_plimit, sizeof(flow_plimit));
- if (quantum != ~0U)
+ if (set_quantum)
addattr_l(n, 1024, TCA_FQ_QUANTUM, &quantum, sizeof(quantum));
- if (initial_quantum != ~0U)
+ if (set_initial_quantum)
addattr_l(n, 1024, TCA_FQ_INITIAL_QUANTUM,
&initial_quantum, sizeof(initial_quantum));
if (pacing != -1)
addattr_l(n, 1024, TCA_FQ_RATE_ENABLE,
&pacing, sizeof(pacing));
- if (maxrate != ~0U)
+ if (set_maxrate)
addattr_l(n, 1024, TCA_FQ_FLOW_MAX_RATE,
&maxrate, sizeof(maxrate));
- if (defrate != ~0U)
+ if (set_defrate)
addattr_l(n, 1024, TCA_FQ_FLOW_DEFAULT_RATE,
&defrate, sizeof(defrate));
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH iproute2 v2] fq: allow options of fair queue set to ~0U
2014-05-13 2:23 ` [PATCH iproute2 v2] fq: allow options of fair queue set to ~0U Yang Yingliang
@ 2014-05-13 3:03 ` Eric Dumazet
2014-05-13 4:10 ` Yang Yingliang
2014-05-13 4:20 ` [PATCH iproute2 v3] " Yang Yingliang
1 sibling, 1 reply; 14+ messages in thread
From: Eric Dumazet @ 2014-05-13 3:03 UTC (permalink / raw)
To: Yang Yingliang; +Cc: stephen, netdev
On Tue, 2014-05-13 at 10:23 +0800, Yang Yingliang wrote:
> From: Yang Yingliang <yangyingliang@huawei.com>
>
> Some options of fair queue cannot be (~0U). It leads to maxrate
> cannot be reset to unlimited because it cannot be (~0U).
>
> Suggested-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> tc/q_fq.c | 36 ++++++++++++++++++++++++------------
> 1 file changed, 24 insertions(+), 12 deletions(-)
>
> diff --git a/tc/q_fq.c b/tc/q_fq.c
> index c1f658e..6a493a5 100644
> --- a/tc/q_fq.c
> +++ b/tc/q_fq.c
> @@ -71,13 +71,19 @@ static unsigned int ilog2(unsigned int val)
> static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
> struct nlmsghdr *n)
> {
> - unsigned int plimit = ~0U;
> - unsigned int flow_plimit = ~0U;
> - unsigned int quantum = ~0U;
> - unsigned int initial_quantum = ~0U;
> + unsigned int plimit;
> + unsigned int flow_plimit;
> + unsigned int quantum;
> + unsigned int initial_quantum;
> unsigned int buckets = 0;
> - unsigned int maxrate = ~0U;
> - unsigned int defrate = ~0U;
> + unsigned int maxrate;
> + unsigned int defrate;
> + int set_plimit = 0;
> + int set_flow_plimit = 0;
> + int set_quantum = 0;
> + int set_initial_quantum = 0;
> + int set_maxrate = 0;
> + int set_defrate = 0;
> int pacing = -1;
> struct rtattr *tail;
>
> @@ -88,12 +94,14 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
> fprintf(stderr, "Illegal \"limit\"\n");
> return -1;
> }
> + set_plimit = 1;
> } else if (strcmp(*argv, "flow_limit") == 0) {
> NEXT_ARG();
> if (get_unsigned(&flow_plimit, *argv, 0)) {
> fprintf(stderr, "Illegal \"flow_limit\"\n");
> return -1;
> }
> + set_flow_plimit = 0;
= 1; ?
> } else if (strcmp(*argv, "buckets") == 0) {
> NEXT_ARG();
> if (get_unsigned(&buckets, *argv, 0)) {
> @@ -106,24 +114,28 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
> fprintf(stderr, "Illegal \"maxrate\"\n");
> return -1;
> }
> + set_maxrate = 1;
> } else if (strcmp(*argv, "defrate") == 0) {
> NEXT_ARG();
> if (get_rate(&defrate, *argv)) {
> fprintf(stderr, "Illegal \"defrate\"\n");
> return -1;
> }
> + set_defrate = 1;
> } else if (strcmp(*argv, "quantum") == 0) {
> NEXT_ARG();
> if (get_unsigned(&quantum, *argv, 0)) {
> fprintf(stderr, "Illegal \"quantum\"\n");
> return -1;
> }
> + set_quantum = 1;
> } else if (strcmp(*argv, "initial_quantum") == 0) {
> NEXT_ARG();
> if (get_unsigned(&initial_quantum, *argv, 0)) {
> fprintf(stderr, "Illegal \"initial_quantum\"\n");
> return -1;
> }
> + set_initial_quantum = 1;
> } else if (strcmp(*argv, "pacing") == 0) {
> pacing = 1;
> } else if (strcmp(*argv, "nopacing") == 0) {
> @@ -147,24 +159,24 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
> addattr_l(n, 1024, TCA_FQ_BUCKETS_LOG,
> &log, sizeof(log));
> }
> - if (plimit != ~0U)
> + if (set_plimit)
> addattr_l(n, 1024, TCA_FQ_PLIMIT,
> &plimit, sizeof(plimit));
> - if (flow_plimit != ~0U)
> + if (set_flow_plimit)
> addattr_l(n, 1024, TCA_FQ_FLOW_PLIMIT,
> &flow_plimit, sizeof(flow_plimit));
> - if (quantum != ~0U)
> + if (set_quantum)
> addattr_l(n, 1024, TCA_FQ_QUANTUM, &quantum, sizeof(quantum));
> - if (initial_quantum != ~0U)
> + if (set_initial_quantum)
> addattr_l(n, 1024, TCA_FQ_INITIAL_QUANTUM,
> &initial_quantum, sizeof(initial_quantum));
> if (pacing != -1)
> addattr_l(n, 1024, TCA_FQ_RATE_ENABLE,
> &pacing, sizeof(pacing));
> - if (maxrate != ~0U)
> + if (set_maxrate)
> addattr_l(n, 1024, TCA_FQ_FLOW_MAX_RATE,
> &maxrate, sizeof(maxrate));
> - if (defrate != ~0U)
> + if (set_defrate)
> addattr_l(n, 1024, TCA_FQ_FLOW_DEFAULT_RATE,
> &defrate, sizeof(defrate));
> tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH iproute2 v2] fq: allow options of fair queue set to ~0U
2014-05-13 3:03 ` Eric Dumazet
@ 2014-05-13 4:10 ` Yang Yingliang
0 siblings, 0 replies; 14+ messages in thread
From: Yang Yingliang @ 2014-05-13 4:10 UTC (permalink / raw)
To: Eric Dumazet; +Cc: stephen, netdev
On 2014/5/13 11:03, Eric Dumazet wrote:
> On Tue, 2014-05-13 at 10:23 +0800, Yang Yingliang wrote:
>> From: Yang Yingliang <yangyingliang@huawei.com>
>>
>> Some options of fair queue cannot be (~0U). It leads to maxrate
>> cannot be reset to unlimited because it cannot be (~0U).
>>
>> Suggested-by: Eric Dumazet <edumazet@google.com>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
>> tc/q_fq.c | 36 ++++++++++++++++++++++++------------
>> 1 file changed, 24 insertions(+), 12 deletions(-)
>>
>> diff --git a/tc/q_fq.c b/tc/q_fq.c
>> index c1f658e..6a493a5 100644
>> --- a/tc/q_fq.c
>> +++ b/tc/q_fq.c
>> @@ -71,13 +71,19 @@ static unsigned int ilog2(unsigned int val)
>> static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
>> struct nlmsghdr *n)
>> {
>> - unsigned int plimit = ~0U;
>> - unsigned int flow_plimit = ~0U;
>> - unsigned int quantum = ~0U;
>> - unsigned int initial_quantum = ~0U;
>> + unsigned int plimit;
>> + unsigned int flow_plimit;
>> + unsigned int quantum;
>> + unsigned int initial_quantum;
>> unsigned int buckets = 0;
>> - unsigned int maxrate = ~0U;
>> - unsigned int defrate = ~0U;
>> + unsigned int maxrate;
>> + unsigned int defrate;
>> + int set_plimit = 0;
>> + int set_flow_plimit = 0;
>> + int set_quantum = 0;
>> + int set_initial_quantum = 0;
>> + int set_maxrate = 0;
>> + int set_defrate = 0;
>> int pacing = -1;
>> struct rtattr *tail;
>>
>> @@ -88,12 +94,14 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
>> fprintf(stderr, "Illegal \"limit\"\n");
>> return -1;
>> }
>> + set_plimit = 1;
>> } else if (strcmp(*argv, "flow_limit") == 0) {
>> NEXT_ARG();
>> if (get_unsigned(&flow_plimit, *argv, 0)) {
>> fprintf(stderr, "Illegal \"flow_limit\"\n");
>> return -1;
>> }
>> + set_flow_plimit = 0;
>
>
> = 1; ?
>
Yes, thanks!
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH iproute2 v3] fq: allow options of fair queue set to ~0U
2014-05-13 2:23 ` [PATCH iproute2 v2] fq: allow options of fair queue set to ~0U Yang Yingliang
2014-05-13 3:03 ` Eric Dumazet
@ 2014-05-13 4:20 ` Yang Yingliang
2014-05-29 0:09 ` Stephen Hemminger
1 sibling, 1 reply; 14+ messages in thread
From: Yang Yingliang @ 2014-05-13 4:20 UTC (permalink / raw)
To: Eric Dumazet, stephen; +Cc: netdev
From: Yang Yingliang <yangyingliang@huawei.com>
Some options of fair queue cannot be (~0U). It leads to maxrate
cannot be reset to unlimited because it cannot be (~0U).
Tested by the following command:
# tc qdisc replace dev eth4 root handle 1: fq limit 2000 maxrate 100mbit quantum 2000 initial_quantum 1600
# tc -s -d qdisc show
qdisc fq 1: dev eth4 root refcnt 2 limit 100p flow_limit 2000p buckets 1024 quantum 2000 initial_quantum 1600 maxrate 100Mbit
Sent 12596 bytes 82 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
2 flows (1 inactive, 0 throttled)
0 gc, 0 highprio, 0 throttled
# tc qdisc replace dev eth4 root handle 1: fq limit 100 maxrate 34359738360 quantum 2000 initial_quantum 1600
# tc -s -d qdisc show
qdisc fq 1: dev eth4 root refcnt 2 limit 100p flow_limit 100p buckets 1024 quantum 2000 initial_quantum 1600
Sent 15758 bytes 99 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
2 flows (1 inactive, 0 throttled)
0 gc, 0 highprio, 0 throttled
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
tc/q_fq.c | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/tc/q_fq.c b/tc/q_fq.c
index c1f658e..6a493a5 100644
--- a/tc/q_fq.c
+++ b/tc/q_fq.c
@@ -71,13 +71,19 @@ static unsigned int ilog2(unsigned int val)
static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
struct nlmsghdr *n)
{
- unsigned int plimit = ~0U;
- unsigned int flow_plimit = ~0U;
- unsigned int quantum = ~0U;
- unsigned int initial_quantum = ~0U;
+ unsigned int plimit;
+ unsigned int flow_plimit;
+ unsigned int quantum;
+ unsigned int initial_quantum;
unsigned int buckets = 0;
- unsigned int maxrate = ~0U;
- unsigned int defrate = ~0U;
+ unsigned int maxrate;
+ unsigned int defrate;
+ int set_plimit = 0;
+ int set_flow_plimit = 0;
+ int set_quantum = 0;
+ int set_initial_quantum = 0;
+ int set_maxrate = 0;
+ int set_defrate = 0;
int pacing = -1;
struct rtattr *tail;
@@ -88,12 +94,14 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
fprintf(stderr, "Illegal \"limit\"\n");
return -1;
}
+ set_plimit = 1;
} else if (strcmp(*argv, "flow_limit") == 0) {
NEXT_ARG();
if (get_unsigned(&flow_plimit, *argv, 0)) {
fprintf(stderr, "Illegal \"flow_limit\"\n");
return -1;
}
+ set_flow_plimit = 1;
} else if (strcmp(*argv, "buckets") == 0) {
NEXT_ARG();
if (get_unsigned(&buckets, *argv, 0)) {
@@ -106,24 +114,28 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
fprintf(stderr, "Illegal \"maxrate\"\n");
return -1;
}
+ set_maxrate = 1;
} else if (strcmp(*argv, "defrate") == 0) {
NEXT_ARG();
if (get_rate(&defrate, *argv)) {
fprintf(stderr, "Illegal \"defrate\"\n");
return -1;
}
+ set_defrate = 1;
} else if (strcmp(*argv, "quantum") == 0) {
NEXT_ARG();
if (get_unsigned(&quantum, *argv, 0)) {
fprintf(stderr, "Illegal \"quantum\"\n");
return -1;
}
+ set_quantum = 1;
} else if (strcmp(*argv, "initial_quantum") == 0) {
NEXT_ARG();
if (get_unsigned(&initial_quantum, *argv, 0)) {
fprintf(stderr, "Illegal \"initial_quantum\"\n");
return -1;
}
+ set_initial_quantum = 1;
} else if (strcmp(*argv, "pacing") == 0) {
pacing = 1;
} else if (strcmp(*argv, "nopacing") == 0) {
@@ -147,24 +159,24 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
addattr_l(n, 1024, TCA_FQ_BUCKETS_LOG,
&log, sizeof(log));
}
- if (plimit != ~0U)
+ if (set_plimit)
addattr_l(n, 1024, TCA_FQ_PLIMIT,
&plimit, sizeof(plimit));
- if (flow_plimit != ~0U)
+ if (set_flow_plimit)
addattr_l(n, 1024, TCA_FQ_FLOW_PLIMIT,
&flow_plimit, sizeof(flow_plimit));
- if (quantum != ~0U)
+ if (set_quantum)
addattr_l(n, 1024, TCA_FQ_QUANTUM, &quantum, sizeof(quantum));
- if (initial_quantum != ~0U)
+ if (set_initial_quantum)
addattr_l(n, 1024, TCA_FQ_INITIAL_QUANTUM,
&initial_quantum, sizeof(initial_quantum));
if (pacing != -1)
addattr_l(n, 1024, TCA_FQ_RATE_ENABLE,
&pacing, sizeof(pacing));
- if (maxrate != ~0U)
+ if (set_maxrate)
addattr_l(n, 1024, TCA_FQ_FLOW_MAX_RATE,
&maxrate, sizeof(maxrate));
- if (defrate != ~0U)
+ if (set_defrate)
addattr_l(n, 1024, TCA_FQ_FLOW_DEFAULT_RATE,
&defrate, sizeof(defrate));
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH iproute2 v3] fq: allow options of fair queue set to ~0U
2014-05-13 4:20 ` [PATCH iproute2 v3] " Yang Yingliang
@ 2014-05-29 0:09 ` Stephen Hemminger
2014-05-29 2:43 ` Yang Yingliang
2014-05-29 4:04 ` [PATCH iproute2 v4] " Yang Yingliang
0 siblings, 2 replies; 14+ messages in thread
From: Stephen Hemminger @ 2014-05-29 0:09 UTC (permalink / raw)
To: Yang Yingliang; +Cc: Eric Dumazet, netdev
On Tue, 13 May 2014 12:20:52 +0800
Yang Yingliang <yangyingliang@huawei.com> wrote:
> + int set_plimit = 0;
> + int set_flow_plimit = 0;
> + int set_quantum = 0;
> + int set_initial_quantum = 0;
> + int set_maxrate = 0;
> + int set_defrate = 0;
Please use bool for these since they are boolean flags.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH iproute2 v3] fq: allow options of fair queue set to ~0U
2014-05-29 0:09 ` Stephen Hemminger
@ 2014-05-29 2:43 ` Yang Yingliang
2014-05-29 4:04 ` [PATCH iproute2 v4] " Yang Yingliang
1 sibling, 0 replies; 14+ messages in thread
From: Yang Yingliang @ 2014-05-29 2:43 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Eric Dumazet, netdev
On 2014/5/29 8:09, Stephen Hemminger wrote:
> On Tue, 13 May 2014 12:20:52 +0800
> Yang Yingliang <yangyingliang@huawei.com> wrote:
>
>> + int set_plimit = 0;
>> + int set_flow_plimit = 0;
>> + int set_quantum = 0;
>> + int set_initial_quantum = 0;
>> + int set_maxrate = 0;
>> + int set_defrate = 0;
>
> Please use bool for these since they are boolean flags.
>
>
OK, I'll send a v3 later.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH iproute2 v4] fq: allow options of fair queue set to ~0U
2014-05-29 0:09 ` Stephen Hemminger
2014-05-29 2:43 ` Yang Yingliang
@ 2014-05-29 4:04 ` Yang Yingliang
2014-06-09 19:43 ` Stephen Hemminger
1 sibling, 1 reply; 14+ messages in thread
From: Yang Yingliang @ 2014-05-29 4:04 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Eric Dumazet, netdev
From: Yang Yingliang <yangyingliang@huawei.com>
Some options of fair queue cannot be (~0U). It leads to maxrate
cannot be reset to unlimited because it cannot be (~0U). Allow
the options being ~0U.
Tested by the following command:
# tc qdisc add dev eth4 root handle 1: fq limit 2000 flow_limit 200 maxrate 100mbit quantum 2000 initial_quantum 1600
# tc -s -d qdisc show
qdisc fq 1: dev eth4 root refcnt 2 limit 2000p flow_limit 200p buckets 1024 quantum 2000 initial_quantum 1600 maxrate 100Mbit
Sent 1492 bytes 10 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
1 flows (0 inactive, 0 throttled)
0 gc, 0 highprio, 0 throttled
# tc qdisc change dev eth4 root handle 1: fq limit 4294967295 flow_limit 4294967295 maxrate 34359738360 quantum 4294967295 initial_quantum 4294967295
# tc -s -d qdisc show
qdisc fq 1: dev eth4 root refcnt 2 limit 4294967295p flow_limit 4294967295p buckets 1024 quantum 4294967295 initial_quantum 4294967295
Sent 38372 bytes 216 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
2 flows (1 inactive, 0 throttled)
0 gc, 2 highprio, 7 throttled
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
Change note:
v3 -> v4: Change boolean flags from 'int' to 'bool'.
---
tc/q_fq.c | 37 +++++++++++++++++++++++++------------
1 file changed, 25 insertions(+), 12 deletions(-)
diff --git a/tc/q_fq.c b/tc/q_fq.c
index c1f658e..e7288c2 100644
--- a/tc/q_fq.c
+++ b/tc/q_fq.c
@@ -44,6 +44,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
+#include <stdbool.h>
#include "utils.h"
#include "tc_util.h"
@@ -71,13 +72,19 @@ static unsigned int ilog2(unsigned int val)
static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
struct nlmsghdr *n)
{
- unsigned int plimit = ~0U;
- unsigned int flow_plimit = ~0U;
- unsigned int quantum = ~0U;
- unsigned int initial_quantum = ~0U;
+ unsigned int plimit;
+ unsigned int flow_plimit;
+ unsigned int quantum;
+ unsigned int initial_quantum;
unsigned int buckets = 0;
- unsigned int maxrate = ~0U;
- unsigned int defrate = ~0U;
+ unsigned int maxrate;
+ unsigned int defrate;
+ bool set_plimit = false;
+ bool set_flow_plimit = false;
+ bool set_quantum = false;
+ bool set_initial_quantum = false;
+ bool set_maxrate = false;
+ bool set_defrate = false;
int pacing = -1;
struct rtattr *tail;
@@ -88,12 +95,14 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
fprintf(stderr, "Illegal \"limit\"\n");
return -1;
}
+ set_plimit = true;
} else if (strcmp(*argv, "flow_limit") == 0) {
NEXT_ARG();
if (get_unsigned(&flow_plimit, *argv, 0)) {
fprintf(stderr, "Illegal \"flow_limit\"\n");
return -1;
}
+ set_flow_plimit = true;
} else if (strcmp(*argv, "buckets") == 0) {
NEXT_ARG();
if (get_unsigned(&buckets, *argv, 0)) {
@@ -106,24 +115,28 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
fprintf(stderr, "Illegal \"maxrate\"\n");
return -1;
}
+ set_maxrate = true;
} else if (strcmp(*argv, "defrate") == 0) {
NEXT_ARG();
if (get_rate(&defrate, *argv)) {
fprintf(stderr, "Illegal \"defrate\"\n");
return -1;
}
+ set_defrate = true;
} else if (strcmp(*argv, "quantum") == 0) {
NEXT_ARG();
if (get_unsigned(&quantum, *argv, 0)) {
fprintf(stderr, "Illegal \"quantum\"\n");
return -1;
}
+ set_quantum = true;
} else if (strcmp(*argv, "initial_quantum") == 0) {
NEXT_ARG();
if (get_unsigned(&initial_quantum, *argv, 0)) {
fprintf(stderr, "Illegal \"initial_quantum\"\n");
return -1;
}
+ set_initial_quantum = true;
} else if (strcmp(*argv, "pacing") == 0) {
pacing = 1;
} else if (strcmp(*argv, "nopacing") == 0) {
@@ -147,24 +160,24 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
addattr_l(n, 1024, TCA_FQ_BUCKETS_LOG,
&log, sizeof(log));
}
- if (plimit != ~0U)
+ if (set_plimit)
addattr_l(n, 1024, TCA_FQ_PLIMIT,
&plimit, sizeof(plimit));
- if (flow_plimit != ~0U)
+ if (set_flow_plimit)
addattr_l(n, 1024, TCA_FQ_FLOW_PLIMIT,
&flow_plimit, sizeof(flow_plimit));
- if (quantum != ~0U)
+ if (set_quantum)
addattr_l(n, 1024, TCA_FQ_QUANTUM, &quantum, sizeof(quantum));
- if (initial_quantum != ~0U)
+ if (set_initial_quantum)
addattr_l(n, 1024, TCA_FQ_INITIAL_QUANTUM,
&initial_quantum, sizeof(initial_quantum));
if (pacing != -1)
addattr_l(n, 1024, TCA_FQ_RATE_ENABLE,
&pacing, sizeof(pacing));
- if (maxrate != ~0U)
+ if (set_maxrate)
addattr_l(n, 1024, TCA_FQ_FLOW_MAX_RATE,
&maxrate, sizeof(maxrate));
- if (defrate != ~0U)
+ if (set_defrate)
addattr_l(n, 1024, TCA_FQ_FLOW_DEFAULT_RATE,
&defrate, sizeof(defrate));
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH iproute2 v4] fq: allow options of fair queue set to ~0U
2014-05-29 4:04 ` [PATCH iproute2 v4] " Yang Yingliang
@ 2014-06-09 19:43 ` Stephen Hemminger
0 siblings, 0 replies; 14+ messages in thread
From: Stephen Hemminger @ 2014-06-09 19:43 UTC (permalink / raw)
To: Yang Yingliang; +Cc: Eric Dumazet, netdev
On Thu, 29 May 2014 12:04:34 +0800
Yang Yingliang <yangyingliang@huawei.com> wrote:
> From: Yang Yingliang <yangyingliang@huawei.com>
>
> Some options of fair queue cannot be (~0U). It leads to maxrate
> cannot be reset to unlimited because it cannot be (~0U). Allow
> the options being ~0U.
>
> Tested by the following command:
> # tc qdisc add dev eth4 root handle 1: fq limit 2000 flow_limit 200 maxrate 100mbit quantum 2000 initial_quantum 1600
> # tc -s -d qdisc show
> qdisc fq 1: dev eth4 root refcnt 2 limit 2000p flow_limit 200p buckets 1024 quantum 2000 initial_quantum 1600 maxrate 100Mbit
> Sent 1492 bytes 10 pkt (dropped 0, overlimits 0 requeues 0)
> backlog 0b 0p requeues 0
> 1 flows (0 inactive, 0 throttled)
> 0 gc, 0 highprio, 0 throttled
>
> # tc qdisc change dev eth4 root handle 1: fq limit 4294967295 flow_limit 4294967295 maxrate 34359738360 quantum 4294967295 initial_quantum 4294967295
> # tc -s -d qdisc show
> qdisc fq 1: dev eth4 root refcnt 2 limit 4294967295p flow_limit 4294967295p buckets 1024 quantum 4294967295 initial_quantum 4294967295
> Sent 38372 bytes 216 pkt (dropped 0, overlimits 0 requeues 0)
> backlog 0b 0p requeues 0
> 2 flows (1 inactive, 0 throttled)
> 0 gc, 2 highprio, 7 throttled
>
> Suggested-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>
Applied
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2014-06-09 19:47 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-12 4:18 [PATCH iproute2] fq: don't allow set options to zero Yang Yingliang
2014-05-12 5:58 ` Eric Dumazet
2014-05-12 6:51 ` Yang Yingliang
2014-05-12 6:55 ` Yang Yingliang
2014-05-12 6:59 ` Yang Yingliang
2014-05-12 15:23 ` Eric Dumazet
2014-05-13 2:23 ` [PATCH iproute2 v2] fq: allow options of fair queue set to ~0U Yang Yingliang
2014-05-13 3:03 ` Eric Dumazet
2014-05-13 4:10 ` Yang Yingliang
2014-05-13 4:20 ` [PATCH iproute2 v3] " Yang Yingliang
2014-05-29 0:09 ` Stephen Hemminger
2014-05-29 2:43 ` Yang Yingliang
2014-05-29 4:04 ` [PATCH iproute2 v4] " Yang Yingliang
2014-06-09 19:43 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).