All of lore.kernel.org
 help / color / mirror / Atom feed
* Why do we prefer skb->priority to tc filters?
@ 2015-03-11 17:34 Cong Wang
  2015-03-11 18:08 ` Cong Wang
  0 siblings, 1 reply; 13+ messages in thread
From: Cong Wang @ 2015-03-11 17:34 UTC (permalink / raw)
  To: netdev; +Cc: Jamal Hadi Salim, David Miller

Hi,


Not sure about classful Qdisc's, for classless ones like fq_codel, we
also prefer skb->priority value over tc filters:

        if (TC_H_MAJ(skb->priority) == sch->handle &&
            TC_H_MIN(skb->priority) > 0 &&
            TC_H_MIN(skb->priority) <= q->flows_cnt)
                return TC_H_MIN(skb->priority);

        filter = rcu_dereference_bh(q->filter_list);
        if (!filter)
                return fq_codel_hash(q, skb) + 1;

        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
        result = tc_classify(skb, filter, &res);

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.

For discussion, I mean something like below makes more sense for me:

        struct tcf_result res;
        int result;

-       if (TC_H_MAJ(skb->priority) == sch->handle &&
-           TC_H_MIN(skb->priority) > 0 &&
-           TC_H_MIN(skb->priority) <= q->flows_cnt)
-               return TC_H_MIN(skb->priority);
-
        filter = rcu_dereference_bh(q->filter_list);
-       if (!filter)
+       if (!filter) {
+               if (TC_H_MAJ(skb->priority) == sch->handle &&
+                   TC_H_MIN(skb->priority) > 0 &&
+                   TC_H_MIN(skb->priority) <= q->flows_cnt)
+                       return TC_H_MIN(skb->priority);
+
                return fq_codel_hash(q, skb) + 1;
+       }

        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
        result = tc_classify(skb, filter, &res);

What do you think?

Thanks.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-03-12 17:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.