public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Yang Yingliang <yangyingliang@huawei•com>
To: Eric Dumazet <eric.dumazet@gmail•com>
Cc: <davem@davemloft•net>, <netdev@vger•kernel.org>,
	<stephen@networkplumber•org>
Subject: Re: [PATCH net-next 2/5] net_sched: add replace func in struct Qdisc_ops
Date: Fri, 7 Mar 2014 10:13:31 +0800	[thread overview]
Message-ID: <53192B4B.3020303@huawei.com> (raw)
In-Reply-To: <1394117746.27473.33.camel@edumazet-glaptop2.roam.corp.google.com>

On 2014/3/6 22:55, Eric Dumazet wrote:
> On Thu, 2014-03-06 at 21:08 +0800, Yang Yingliang wrote:
>> Add replace func, if NLM_F_REPLACE is set, use replace func.
>> Otherwise, use change func.
>>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei•com>
>> ---
>>  include/net/sch_generic.h |  1 +
>>  net/sched/sch_api.c       | 12 +++++++++---
>>  2 files changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
>> index d062f81c692f..ef8a41bcb9a7 100644
>> --- a/include/net/sch_generic.h
>> +++ b/include/net/sch_generic.h
>> @@ -170,6 +170,7 @@ struct Qdisc_ops {
>>  	void			(*reset)(struct Qdisc *);
>>  	void			(*destroy)(struct Qdisc *);
>>  	int			(*change)(struct Qdisc *, struct nlattr *arg);
>> +	int			(*replace)(struct Qdisc *, struct nlattr *arg);
>>  	void			(*attach)(struct Qdisc *);
>>  
>>  	int			(*dump)(struct Qdisc *, struct sk_buff *);
>> diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
>> index 961cb0f1bd0c..8f0f8e9d5475 100644
>> --- a/net/sched/sch_api.c
>> +++ b/net/sched/sch_api.c
>> @@ -999,9 +999,15 @@ static int qdisc_change(struct Qdisc *sch, struct nlattr **tca, u16 flags)
>>  	int err = 0;
>>  
>>  	if (tca[TCA_OPTIONS]) {
>> -		if (sch->ops->change == NULL)
>> -			return -EINVAL;
>> -		err = sch->ops->change(sch, tca[TCA_OPTIONS]);
>> +		if (flags & NLM_F_REPLACE) {
>> +			if (sch->ops->replace == NULL)
>> +				return -EINVAL;
>> +			err = sch->ops->replace(sch, tca[TCA_OPTIONS]);
>> +		} else {
>> +			if (sch->ops->change == NULL)
>> +				return -EINVAL;
>> +			err = sch->ops->change(sch, tca[TCA_OPTIONS]);
>> +		}
>>  		if (err)
>>  			return err;
>>  	}
> 
> NACK
> 
> This breaks existing userland scripts.

Yes, it is.

Maybe I need do some change for this code.

Thanks!

> 
> Have you tried :
> 
> tc qdisc replace dev eth0 root fq
> 

  reply	other threads:[~2014-03-07  2:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06 13:08 [PATCH net-next 0/5] net_sched: Adjust qdisc_change() for command "#tc qdisc change/replace ..." Yang Yingliang
2014-03-06 13:08 ` [PATCH net-next 1/5] net_sched: add flag parameter in qdisc_change Yang Yingliang
2014-03-06 13:08 ` [PATCH net-next 2/5] net_sched: add replace func in struct Qdisc_ops Yang Yingliang
2014-03-06 14:55   ` Eric Dumazet
2014-03-07  2:13     ` Yang Yingliang [this message]
2014-03-06 13:08 ` [PATCH net-next 3/5] sch_tbf: change name "tbf_change" to "tbf_replace" Yang Yingliang
2014-03-06 13:08 ` [PATCH net-next 4/5] sch_tbf: add tbf_change for #tc qdisc change Yang Yingliang
2014-03-06 13:08 ` [PATCH net-next 5/5] sch_netem: add netem_replace for #tc qdisc replace Yang Yingliang
2014-03-06 13:16 ` [PATCH net-next 0/5] net_sched: Adjust qdisc_change() for command "#tc qdisc change/replace ..." Hagen Paul Pfeifer
2014-03-07  2:16   ` Yang Yingliang
2014-03-06 21:08 ` Hiroaki SHIMODA
2014-03-07  2:29   ` Yang Yingliang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53192B4B.3020303@huawei.com \
    --to=yangyingliang@huawei$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=eric.dumazet@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=stephen@networkplumber$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox