[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160720173827.GC16467@gmail.com>
Date: Wed, 20 Jul 2016 10:38:28 -0700
From: Brenden Blanco <bblanco@...mgrid.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org,
Jamal Hadi Salim <jhs@...atatu.com>,
Saeed Mahameed <saeedm@....mellanox.co.il>,
Martin KaFai Lau <kafai@...com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Ari Saha <as754m@....com>, Or Gerlitz <gerlitz.or@...il.com>,
john.fastabend@...il.com, hannes@...essinduktion.org,
Thomas Graf <tgraf@...g.ch>, Tom Herbert <tom@...bertland.com>,
Daniel Borkmann <daniel@...earbox.net>,
Tariq Toukan <ttoukan.linux@...il.com>
Subject: Re: [PATCH v10 12/12] bpf: add sample for xdp forwarding and rewrite
On Tue, Jul 19, 2016 at 03:05:37PM -0700, Alexei Starovoitov wrote:
> On Tue, Jul 19, 2016 at 12:16:57PM -0700, Brenden Blanco wrote:
> > Add a sample that rewrites and forwards packets out on the same
> > interface. Observed single core forwarding performance of ~10Mpps.
> >
> > Since the mlx4 driver under test recycles every single packet page, the
> > perf output shows almost exclusively just the ring management and bpf
> > program work. Slowdowns are likely occurring due to cache misses.
>
> long term we need to resurrect your prefetch patch. sux to leave
> so much performance on the table.
I know :( Let's keep working at it, in a way that's good for both
xdp/non-xdp.
>
> > +static int parse_ipv4(void *data, u64 nh_off, void *data_end)
> > +{
> > + struct iphdr *iph = data + nh_off;
> > +
> > + if (iph + 1 > data_end)
> > + return 0;
> > + return iph->protocol;
> > +}
> > +
> > +static int parse_ipv6(void *data, u64 nh_off, void *data_end)
> > +{
> > + struct ipv6hdr *ip6h = data + nh_off;
> > +
> > + if (ip6h + 1 > data_end)
> > + return 0;
> > + return ip6h->nexthdr;
> > +}
> ...
> > + if (h_proto == htons(ETH_P_IP))
> > + index = parse_ipv4(data, nh_off, data_end);
> > + else if (h_proto == htons(ETH_P_IPV6))
> > + index = parse_ipv6(data, nh_off, data_end);
> > + else
> > + index = 0;
> > +
> > + value = bpf_map_lookup_elem(&dropcnt, &index);
> > + if (value)
> > + *value += 1;
> > +
> > + if (index == 17) {
>
> not an obvious xdp example. if you'd have to respin for other
> reasons please consider 'proto' name and IPPROTO_UDP here.
Will collect this into a followup.
>
> Acked-by: Alexei Starovoitov <ast@...nel.org>
>
Powered by blists - more mailing lists