Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-05 Thread Brenden Blanco
On Tue, Apr 05, 2016 at 05:15:20PM +0300, Or Gerlitz wrote: > On 4/4/2016 9:50 PM, Alexei Starovoitov wrote: > >On Mon, Apr 04, 2016 at 08:22:03AM -0700, Eric Dumazet wrote: > >>A single flow is able to use 40Gbit on those 40Gbit NIC, so there is not > >>a single 10GB trunk used for a given flow.

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-05 Thread Eran Ben Elisha
On Tue, Apr 5, 2016 at 5:20 AM, Brenden Blanco wrote: > On Sat, Apr 02, 2016 at 11:15:38PM -0700, Brenden Blanco wrote: >> On Fri, Apr 01, 2016 at 07:08:31PM -0700, Eric Dumazet wrote: > [...] >> > 2) priv->stats.rx_dropped is shared by all the RX queues -> false >> >

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-05 Thread Or Gerlitz
On 4/4/2016 9:50 PM, Alexei Starovoitov wrote: On Mon, Apr 04, 2016 at 08:22:03AM -0700, Eric Dumazet wrote: A single flow is able to use 40Gbit on those 40Gbit NIC, so there is not a single 10GB trunk used for a given flow. This 14Mpps thing seems to be a queue limitation on mlx4. yeah,

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-05 Thread Jesper Dangaard Brouer
On Mon, 4 Apr 2016 11:27:27 -0700 Alexei Starovoitov wrote: > On Sat, Apr 02, 2016 at 11:11:52PM -0700, Brenden Blanco wrote: > > On Sat, Apr 02, 2016 at 10:23:31AM +0200, Jesper Dangaard Brouer wrote: > > [...] > > > > > > I think you need to DMA sync RX-page

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-04 Thread Eric Dumazet
On Mon, 2016-04-04 at 19:20 -0700, Brenden Blanco wrote: > On Sat, Apr 02, 2016 at 11:15:38PM -0700, Brenden Blanco wrote: > > On Fri, Apr 01, 2016 at 07:08:31PM -0700, Eric Dumazet wrote: > [...] > > > 2) priv->stats.rx_dropped is shared by all the RX queues -> false > > > sharing. > > > > > >

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-04 Thread Brenden Blanco
On Sat, Apr 02, 2016 at 11:15:38PM -0700, Brenden Blanco wrote: > On Fri, Apr 01, 2016 at 07:08:31PM -0700, Eric Dumazet wrote: [...] > > 2) priv->stats.rx_dropped is shared by all the RX queues -> false > > sharing. > > > >This is probably the right time to add a rx_dropped field in struct >

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-04 Thread Alexei Starovoitov
On Mon, Apr 04, 2016 at 11:01:57PM +0200, Daniel Borkmann wrote: > On 04/04/2016 08:46 PM, Alexei Starovoitov wrote: > >On Mon, Apr 04, 2016 at 11:57:52AM +0200, Daniel Borkmann wrote: > >>On 04/04/2016 09:35 AM, Johannes Berg wrote: > >>>On Sat, 2016-04-02 at 23:38 -0700, Brenden Blanco wrote: >

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-04 Thread Daniel Borkmann
On 04/04/2016 08:46 PM, Alexei Starovoitov wrote: On Mon, Apr 04, 2016 at 11:57:52AM +0200, Daniel Borkmann wrote: On 04/04/2016 09:35 AM, Johannes Berg wrote: On Sat, 2016-04-02 at 23:38 -0700, Brenden Blanco wrote: Having a common check makes sense. The tricky thing is that the type can

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-04 Thread Alexei Starovoitov
On Mon, Apr 04, 2016 at 08:22:03AM -0700, Eric Dumazet wrote: > On Mon, 2016-04-04 at 16:57 +0200, Jesper Dangaard Brouer wrote: > > On Fri, 1 Apr 2016 19:47:12 -0700 Alexei Starovoitov > > wrote: > > > > > My guess we're hitting 14.5Mpps limit for empty bpf

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-04 Thread Alexei Starovoitov
On Mon, Apr 04, 2016 at 11:57:52AM +0200, Daniel Borkmann wrote: > On 04/04/2016 09:35 AM, Johannes Berg wrote: > >On Sat, 2016-04-02 at 23:38 -0700, Brenden Blanco wrote: > >> > >>Having a common check makes sense. The tricky thing is that the type can > >>only be checked after taking the

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-04 Thread Alexei Starovoitov
On Sat, Apr 02, 2016 at 11:11:52PM -0700, Brenden Blanco wrote: > On Sat, Apr 02, 2016 at 10:23:31AM +0200, Jesper Dangaard Brouer wrote: > [...] > > > > I think you need to DMA sync RX-page before you can safely access > > packet data in page (on all arch's). > > > Thanks, I will give that a

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-04 Thread Eric Dumazet
On Mon, 2016-04-04 at 16:57 +0200, Jesper Dangaard Brouer wrote: > On Fri, 1 Apr 2016 19:47:12 -0700 Alexei Starovoitov > wrote: > > > My guess we're hitting 14.5Mpps limit for empty bpf program > > and for program that actually looks into the packet because we're

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-04 Thread Jesper Dangaard Brouer
On Fri, 1 Apr 2016 19:47:12 -0700 Alexei Starovoitov wrote: > My guess we're hitting 14.5Mpps limit for empty bpf program > and for program that actually looks into the packet because we're > hitting 10G phy limit of 40G nic. Since physically 40G nic > consists of

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-04 Thread Daniel Borkmann
On 04/04/2016 09:35 AM, Johannes Berg wrote: On Sat, 2016-04-02 at 23:38 -0700, Brenden Blanco wrote: Having a common check makes sense. The tricky thing is that the type can only be checked after taking the reference, and I wanted to keep the scope of the prog brief in the case of errors. I

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-04 Thread Daniel Borkmann
On 04/02/2016 03:21 AM, Brenden Blanco wrote: Add support for the BPF_PROG_TYPE_PHYS_DEV hook in mlx4 driver. Since bpf programs require a skb context to navigate the packet, build a percpu fake skb with the minimal fields. This avoids the costly allocation for packets that end up being

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-04 Thread Jesper Dangaard Brouer
On Fri, 1 Apr 2016 18:21:57 -0700 Brenden Blanco wrote: > @@ -840,6 +843,21 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct > mlx4_en_cq *cq, int bud > l2_tunnel = (dev->hw_enc_features & NETIF_F_RXCSUM) && >

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-04 Thread Johannes Berg
On Sat, 2016-04-02 at 23:38 -0700, Brenden Blanco wrote: >  > Having a common check makes sense. The tricky thing is that the type can > only be checked after taking the reference, and I wanted to keep the > scope of the prog brief in the case of errors. I would have to move the > bpf_prog_get

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-03 Thread Brenden Blanco
On Sat, Apr 02, 2016 at 08:40:55PM +0200, Johannes Berg wrote: > On Fri, 2016-04-01 at 18:21 -0700, Brenden Blanco wrote: > > > +static int mlx4_bpf_set(struct net_device *dev, int fd) > > +{ > [...] > > + if (prog->type != BPF_PROG_TYPE_PHYS_DEV) { > > +

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-03 Thread Brenden Blanco
On Fri, Apr 01, 2016 at 07:08:31PM -0700, Eric Dumazet wrote: [...] > > > 1) mlx4 can use multiple fragments (priv->num_frags) to hold an Ethernet > frame. > > Still you pass a single fragment but total 'length' here : BPF program > can read past the end of this first fragment and panic the

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-03 Thread Brenden Blanco
On Sat, Apr 02, 2016 at 10:23:31AM +0200, Jesper Dangaard Brouer wrote: [...] > > I think you need to DMA sync RX-page before you can safely access > packet data in page (on all arch's). > Thanks, I will give that a try in the next spin. > > + ethh = (struct ethhdr

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-02 Thread Johannes Berg
On Fri, 2016-04-01 at 18:21 -0700, Brenden Blanco wrote: > +static int mlx4_bpf_set(struct net_device *dev, int fd) > +{ [...] > + if (prog->type != BPF_PROG_TYPE_PHYS_DEV) { > + bpf_prog_put(prog); > + return -EINVAL; > + } > +

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-02 Thread Jesper Dangaard Brouer
First of all, I'm very happy to see people start working on this! Thanks you Brenden! On Fri, 1 Apr 2016 18:21:57 -0700 Brenden Blanco wrote: > Add support for the BPF_PROG_TYPE_PHYS_DEV hook in mlx4 driver. Since > bpf programs require a skb context to navigate the

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-01 Thread Alexei Starovoitov
On Fri, Apr 01, 2016 at 07:08:31PM -0700, Eric Dumazet wrote: > On Fri, 2016-04-01 at 18:21 -0700, Brenden Blanco wrote: > > Add support for the BPF_PROG_TYPE_PHYS_DEV hook in mlx4 driver. Since > > bpf programs require a skb context to navigate the packet, build a > > percpu fake skb with the

Re: [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-01 Thread Eric Dumazet
On Fri, 2016-04-01 at 18:21 -0700, Brenden Blanco wrote: > Add support for the BPF_PROG_TYPE_PHYS_DEV hook in mlx4 driver. Since > bpf programs require a skb context to navigate the packet, build a > percpu fake skb with the minimal fields. This avoids the costly > allocation for packets that end

[RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program

2016-04-01 Thread Brenden Blanco
Add support for the BPF_PROG_TYPE_PHYS_DEV hook in mlx4 driver. Since bpf programs require a skb context to navigate the packet, build a percpu fake skb with the minimal fields. This avoids the costly allocation for packets that end up being dropped. Since mlx4 is so far the only user of this