All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Cong Wang <cwang@twopensource.com>
Cc: netdev <netdev@vger.kernel.org>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	David Miller <davem@davemloft.net>
Subject: Re: Why do we prefer skb->priority to tc filters?
Date: Wed, 11 Mar 2015 11:25:40 -0700	[thread overview]
Message-ID: <1426098340.11398.59.camel@edumazet-glaptop2.roam.corp.google.com> (raw)
In-Reply-To: <CAHA+R7Os6=uxTAYr=0ZrCKZpySNJ4QoT=mJa5daGJ_0zgD1Y7w@mail.gmail.com>

On Wed, 2015-03-11 at 11:08 -0700, Cong Wang wrote:
> On Wed, Mar 11, 2015 at 10:34 AM, Cong Wang <cwang@twopensource.com> wrote:
> >
> > Given that skb->priority can be specified in user-space, doesn't this
> > mean some application can always override our rules specified by tc
> > filters? I think we should always respect tc filters over any
> > application setting.
> >
> 
> Hmm, on the other hand, skb->priority can be changed in cgroup
> too, in this case the current behavior seems correct. :-/ Interesting.

Note that even HTB has the following code :

static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,
                                      int *qerr)
{
        struct htb_sched *q = qdisc_priv(sch);
        struct htb_class *cl;
        struct tcf_result res;
        struct tcf_proto *tcf;
        int result;

        /* allow to select class by setting skb->priority to valid classid;
         * note that nfmark can be used too by attaching filter fw with no
         * rules in it
         */
        if (skb->priority == sch->handle)
                return HTB_DIRECT;      /* X:0 (direct flow) selected */
        cl = htb_find(skb->priority, sch);
        if (cl) {
                if (cl->level == 0)
                        return cl;
                /* Start with inner filter chain if a non-leaf class is selected */
                tcf = rcu_dereference_bh(cl->filter_list);
        } else {
                tcf = rcu_dereference_bh(q->filter_list);
        }


So if skb->priority happens to match sch->handle or any class handle,
we queue packet into a queue, without calling tc_classify()

  reply	other threads:[~2015-03-11 18:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-11 17:34 Why do we prefer skb->priority to tc filters? Cong Wang
2015-03-11 18:08 ` Cong Wang
2015-03-11 18:25   ` Eric Dumazet [this message]
2015-03-11 19:18     ` Cong Wang
2015-03-11 20:09       ` Eric Dumazet
2015-03-11 20:46         ` Cong Wang
2015-03-11 21:47           ` Eric Dumazet
2015-03-11 22:12             ` Cong Wang
2015-03-12  0:00               ` Eric Dumazet
2015-03-12 16:59                 ` Cong Wang
2015-03-12 17:25                   ` Cong Wang
2015-03-12  7:53             ` Dmitry Sytchev
2015-03-12 17:08               ` Cong Wang

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=1426098340.11398.59.camel@edumazet-glaptop2.roam.corp.google.com \
    --to=eric.dumazet@gmail.com \
    --cc=cwang@twopensource.com \
    --cc=davem@davemloft.net \
    --cc=jhs@mojatatu.com \
    --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 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.