Skip to contentSkip to conversation

net: core: set qdisc pkt len before tc_classify

PATCH In review Florian Westphal 4 participants 4 messages May 13, 2015 – May 14, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 net: core: set qdisc pkt len before tc_classify

commit d2788d34885d4ce5ba ("net: sched: further simplify handle_ing") removed the call to qdisc_enqueue_root().

However, after this removal we no longer set qdisc pkt length. This breaks traffic policing on ingress.

This is the minimum fix: set qdisc pkt length before tc_classify.

Only setting the length does remove support for 'stab' on ingress, but as Alexei pointed out:
"Though it was allowed to add qdisc_size_table to ingress, it's useless.
Nothing takes advantage of recomputed qdisc_pkt_len".

Jamal suggested to use qdisc_pkt_len_init(), but as Eric mentioned that would result in qdisc_pkt_len_init to no longer get inlined due to the additional 2nd call site.

ingress policing is rare and GRO doesn't really work that well with police on ingress, as we see packets > mtu and drop skbs that -- without aggregation -- would still have fitted the policier budget. Thus to have reliable/smooth ingress policing GRO has to be turned off.

Cc Alexei Starovoitov <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jamal Hadi Salim <[email protected]>
Fixes d2788d34885d ("net: sched: further simplify handle_ing")

---
Changes since v2: identical to v1: just use skb->len
Changes since v1: use qdisc_pkt_len_init instead of simply using skb->len

net/core/dev.c +2 -1
index af54906..b3a92d6 100644
@@ -3646,8 +3646,9 @@ static inline struct sk_buff *handle_ing(struct sk_buff *skb,
 		*pt_prev = NULL;
 	}
 
-	qdisc_bstats_update_cpu(cl->q, skb);
+	qdisc_skb_cb(skb)->pkt_len = skb->len;
 	skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_INGRESS);
+	qdisc_bstats_update_cpu(cl->q, skb);
 
 	switch (tc_classify(skb, cl, &cl_res)) {
 	case TC_ACT_OK:
Signature · 1 line
2.0.5
Acked-by on v3 1/1
#1 lore raw
Quoted 7 lines · Florian Westphal

commit d2788d34885d4ce5ba ("net: sched: further simplify handle_ing") removed the call to qdisc_enqueue_root().

However, after this removal we no longer set qdisc pkt length. This breaks traffic policing on ingress.

This is the minimum fix: set qdisc pkt length before tc_classify.

Thanks

Acked-by on v3 1/1
#2 lore raw
In reply to Florian Westphal
Quoted 7 lines · Florian Westphal

commit d2788d34885d4ce5ba ("net: sched: further simplify handle_ing") removed the call to qdisc_enqueue_root().

However, after this removal we no longer set qdisc pkt length. This breaks traffic policing on ingress.

This is the minimum fix: set qdisc pkt length before tc_classify.

Thanks!

#3 lore raw
Quoted 4 lines · Alexei Starovoitov
Quoted 3 lines · Florian Westphal

commit d2788d34885d4ce5ba ("net: sched: further simplify handle_ing") removed the call to qdisc_enqueue_root().

Quoted 8 lines
Quoted 4 lines

However, after this removal we no longer set qdisc pkt length. This breaks traffic policing on ingress.

This is the minimum fix: set qdisc pkt length before tc_classify.

Thanks!

cheers,
jamal

PS:- dont agree with the statement that policer is rarely used on ingress.