* [PATCH v3 net-next] tc: remove unused redirect ttl
@ 2015-05-02 5:19 Alexei Starovoitov
2015-05-03 15:28 ` Jesper Dangaard Brouer
2015-05-04 4:20 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2015-05-02 5:19 UTC (permalink / raw)
To: David S. Miller
Cc: Jamal Hadi Salim, Daniel Borkmann, Florian Westphal, netdev
From: Jamal Hadi Salim <jhs@mojatatu.com>
improves ingress+u32 performance from 22.4 Mpps to 22.9 Mpps
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Florian Westphal <fw@strlen.de>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
---
V2->V3: added From:Jamal tag and Acks
V1->V2: missed removal of unused variable.
include/uapi/linux/pkt_cls.h | 2 ++
net/core/dev.c | 9 ---------
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index bf08e76bf505..f6344a522cd6 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -62,11 +62,13 @@ bits 9,10,11: redirect counter - redirect TTL. Loop avoidance
#define SET_TC_NCLS(v) ( TC_NCLS | (v & ~TC_NCLS))
#define CLR_TC_NCLS(v) ( v & ~TC_NCLS)
+#ifndef __KERNEL__
#define S_TC_RTTL _TC_MAKE32(9)
#define M_TC_RTTL _TC_MAKEMASK(3,S_TC_RTTL)
#define G_TC_RTTL(x) _TC_GETVALUE(x,S_TC_RTTL,M_TC_RTTL)
#define V_TC_RTTL(x) _TC_MAKEVALUE(x,S_TC_RTTL)
#define SET_TC_RTTL(v,n) ((V_TC_RTTL(n)) | (v & ~M_TC_RTTL))
+#endif
#define S_TC_AT _TC_MAKE32(12)
#define M_TC_AT _TC_MAKEMASK(2,S_TC_AT)
diff --git a/net/core/dev.c b/net/core/dev.c
index c7ba0388f1be..97a15ae8d07a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3531,18 +3531,9 @@ EXPORT_SYMBOL_GPL(br_fdb_test_addr_hook);
*/
static int ing_filter(struct sk_buff *skb, struct netdev_queue *rxq)
{
- struct net_device *dev = skb->dev;
- u32 ttl = G_TC_RTTL(skb->tc_verd);
int result = TC_ACT_OK;
struct Qdisc *q;
- if (unlikely(MAX_RED_LOOP < ttl++)) {
- net_warn_ratelimited("Redir loop detected Dropping packet (%d->%d)\n",
- skb->skb_iif, dev->ifindex);
- return TC_ACT_SHOT;
- }
-
- skb->tc_verd = SET_TC_RTTL(skb->tc_verd, ttl);
skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_INGRESS);
q = rcu_dereference(rxq->qdisc);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v3 net-next] tc: remove unused redirect ttl
2015-05-02 5:19 [PATCH v3 net-next] tc: remove unused redirect ttl Alexei Starovoitov
@ 2015-05-03 15:28 ` Jesper Dangaard Brouer
2015-05-04 4:20 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Jesper Dangaard Brouer @ 2015-05-03 15:28 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: brouer, David S. Miller, Jamal Hadi Salim, Daniel Borkmann,
Florian Westphal, netdev
On Fri, 1 May 2015 22:19:43 -0700
Alexei Starovoitov <ast@plumgrid.com> wrote:
> From: Jamal Hadi Salim <jhs@mojatatu.com>
>
> improves ingress+u32 performance from 22.4 Mpps to 22.9 Mpps
I like this change and I'm ACKing it.
But I would like to comment on these performance numbers. I assume this
is a single CPU test with your pktgen RX/STACK_INJECT mode that drops
the packet "early (in ip_rcv() I think).
It sound impressive to get +0.5 Mpps improvement from such a small
change, while in reality this is approx a 1ns improvement.
(1/(22.4*10^6)*10^9) = 44.64ns
(1/(22.9*10^6)*10^9) = 43.67ns
improvement diff = 0.97ns
I'm a fan of zooming in on parts of the stack, as it allow us to
performance optimize and measure parts of the stack that is normally
hard to measure. And your ingress use-case is valid. People should
just be aware, that we can easily "over-sell" when "zooming" in...
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
> Acked-by: Florian Westphal <fw@strlen.de>
> Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Sr. Network Kernel Developer at Red Hat
Author of http://www.iptv-analyzer.org
LinkedIn: http://www.linkedin.com/in/brouer
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3 net-next] tc: remove unused redirect ttl
2015-05-02 5:19 [PATCH v3 net-next] tc: remove unused redirect ttl Alexei Starovoitov
2015-05-03 15:28 ` Jesper Dangaard Brouer
@ 2015-05-04 4:20 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-05-04 4:20 UTC (permalink / raw)
To: ast; +Cc: jhs, daniel, fw, netdev
From: Alexei Starovoitov <ast@plumgrid.com>
Date: Fri, 1 May 2015 22:19:43 -0700
> From: Jamal Hadi Salim <jhs@mojatatu.com>
>
> improves ingress+u32 performance from 22.4 Mpps to 22.9 Mpps
>
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
> Acked-by: Florian Westphal <fw@strlen.de>
> Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-05-04 4:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-02 5:19 [PATCH v3 net-next] tc: remove unused redirect ttl Alexei Starovoitov
2015-05-03 15:28 ` Jesper Dangaard Brouer
2015-05-04 4:20 ` David Miller
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).