diff mbox

[iproute2] fq: don't allow set options to zero

Message ID 1399868319-2184-1-git-send-email-yangyingliang@huawei.com
State Superseded, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Yang Yingliang May 12, 2014, 4:18 a.m. UTC
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(-)

Comments

Eric Dumazet May 12, 2014, 5:58 a.m. UTC | #1
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.



--
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
Yang Yingliang May 12, 2014, 6:51 a.m. UTC | #2
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


--
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
Yang Yingliang May 12, 2014, 6:55 a.m. UTC | #3
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.

--
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
Yang Yingliang May 12, 2014, 6:59 a.m. UTC | #4
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


--
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
diff mbox

Patch

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;