netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Harry Mason <harry.mason@smoothwall.net>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Jamal Hadi Salim <hadi@mojatatu.com>
Cc: linux-netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH v2] sch_htb: let skb->priority refer to non-leaf class
Date: Fri, 17 Jan 2014 16:53:33 +0400	[thread overview]
Message-ID: <52D927CD.4080403@cogentembedded.com> (raw)
In-Reply-To: <1389953999.4698.18.camel@azathoth.dev.smoothwall.net>

Hello.

On 17-01-2014 14:19, Harry Mason wrote:

> If the class in skb->priority is not a leaf, apply filters from the
> selected class, not the qdisc. This lets netfilter or user space
> partially classify the packet.

> Signed-off-by: Harry Mason <harry.mason@smoothwall.net>
> ---

> On Thu, 2014-01-16 at 08:25 -0800, Eric Dumazet wrote:
>> On Thu, 2014-01-16 at 14:45 +0000, Harry Mason wrote:

>>> + /* Start with inner filter chain if a non-leaf class is selected */
>>> + if (cl)
>>> +     tcf = cl->filter_list;
>>> + else
>>> +     tcf = q->filter_list;

>> Could this break some existing htb setups ?

> I think it is unlikely. Setting skb->priority to a non-leaf class would
> be equivalent to setting it to the base qdisc. In theory an application
> might rely on this if it expects the classes to be dynamic, but adding
> a filter could restore the old behaviour.

> To me this is intuitively how it should behave, and reproduces what would
> happen if a tc filter instead of netfilter had first assigned the
> non-leaf class.

>> Also we test cl being NULL at line 222, it would be nice to not
>> test it again...

> Updated below.

>   net/sched/sch_htb.c |   10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)

> diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
> index 717b210..8073d92 100644
> --- a/net/sched/sch_htb.c
> +++ b/net/sched/sch_htb.c
> @@ -219,11 +219,15 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,
>   	if (skb->priority == sch->handle)
>   		return HTB_DIRECT;	/* X:0 (direct flow) selected */
>   	cl = htb_find(skb->priority, sch);
> -	if (cl && cl->level == 0)
> -		return cl;
> +	if (cl) {
> +		if (cl->level == 0)
> +			return cl;
> +		/* Start with inner filter chain if a non-leaf class is selected */
> +		tcf = cl->filter_list;
> +	} else
> +		tcf = q->filter_list;

    There should be {} in the *else* arm, since it's in another arm of *if* 
already -- see Documentation/CodingStyle.

WBR, Sergei

  reply	other threads:[~2014-01-17 12:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-16 14:45 [PATCH] sch_htb: let skb->priority refer to non-leaf class Harry Mason
2014-01-16 16:25 ` Eric Dumazet
2014-01-17 10:19   ` [PATCH v2] " Harry Mason
2014-01-17 12:53     ` Sergei Shtylyov [this message]
2014-01-17 13:22       ` [PATCH v3] " Harry Mason
2014-01-21 22:36         ` David Miller
2014-01-22 12:41           ` Jamal Hadi Salim
2014-01-22 14:47         ` Eric Dumazet
2014-01-23  1:40         ` David Miller
2014-01-17 14:35     ` [PATCH v2] " Eric Dumazet

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=52D927CD.4080403@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=eric.dumazet@gmail.com \
    --cc=hadi@mojatatu.com \
    --cc=harry.mason@smoothwall.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).