ixgbe tx hang with XDP_TX beyond queue limit

2017-06-09 Thread Brenden Blanco
Hi, I am doing some XDP testing on a dual socket, combined 40 core machine with ixgbe. I have found that with the default settings, depending on which core a packet is received on, the xdp tx queue will hang with: ixgbe :01:00.0 eno1: Detected Tx Unit Hang (XDP) Tx Queue

virtnet_xdp_set induces WARNING at drivers/pci/msi.c:1261 pci_irq_vector+0xd4/0xe0

2017-03-23 Thread Brenden Blanco
Hi netdev, I was using the new xdp support in virtio to test some idea that I have, and am seeing the WARN_ON_ONCE in the end of this email when I add the first xdp program. After this, the VM seems to operate just fine. I know that y'all were testing with a particular qemu command line, which I

Re: [PATCH net] rtnetlink: fix rtnl message size computation for XDP

2016-11-15 Thread Brenden Blanco
p prog") > Signed-off-by: Sabrina Dubroca <s...@queasysnail.net> Reviewed-by: Brenden Blanco <bbla...@plumgrid.com> > --- > net/core/rtnetlink.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c &

Re: [PATCH] net/mlx4_en: Fix bpf_prog_add ref_cnt in mlx4

2016-11-09 Thread Brenden Blanco
On Wed, Nov 09, 2016 at 10:57:32AM +0100, Daniel Borkmann wrote: > On 11/09/2016 10:45 AM, Zhiyi Sun wrote: > >On Wed, Nov 09, 2016 at 10:05:31AM +0100, Daniel Borkmann wrote: > >>On 11/09/2016 08:35 AM, Zhiyi Sun wrote: > >>>There are rx_ring_num queues. Each queue will load xdp prog. So >

Re: [PATCH net-next V2 3/3] net/mlx4_en: Add ethtool statistics for XDP cases

2016-11-01 Thread Brenden Blanco
On Tue, Nov 01, 2016 at 01:36:26PM +0200, Tariq Toukan wrote: > XDP statistics are reported in ethtool as follows: > - xdp_drop: the number of packets dropped by xdp. > - xdp_tx: the number of packets forwarded by xdp. > - xdp_tx_full: the number of times an xdp forward failed > due to a

Re: [PATCH net-next 2/2] net/mlx4_en: Refactor the XDP forwarding rings scheme

2016-10-29 Thread Brenden Blanco
On Thu, Oct 27, 2016 at 06:07:02PM -0700, Alexei Starovoitov wrote: > On Thu, Oct 27, 2016 at 05:52:04PM +0300, Tariq Toukan wrote: > > Separately manage the two types of TX rings: regular ones, and XDP. > > Upon an XDP set, do not borrow regular TX rings and convert them > > into XDP ones, but

[PATCH net] net/mlx4_en: fixup xdp tx irq to match rx

2016-10-13 Thread Brenden Blanco
). Resolve this discrepancy by shifting the irq for the xdp tx queues to start again from 0, modulo rx_ring_num. Fixes: 9ecc2d86171a ("net/mlx4_en: add xdp forwarding and data write support") Reported-by: Jesper Dangaard Brouer <bro...@redhat.com> Signed-off-by: Brenden Blanco <b

Re: XDP_TX bug report on mlx4

2016-10-13 Thread Brenden Blanco
On Sun, Sep 18, 2016 at 07:59:43PM -0400, Brenden Blanco wrote: > On Fri, Sep 16, 2016 at 09:24:43PM +0200, Jesper Dangaard Brouer wrote: > > On Fri, 16 Sep 2016 12:17:27 -0700 > > Brenden Blanco <bbla...@plumgrid.com> wrote: > > > > > On Fri, Sep 16, 2016

Re: XDP_TX bug report on mlx4

2016-09-18 Thread Brenden Blanco
On Fri, Sep 16, 2016 at 09:24:43PM +0200, Jesper Dangaard Brouer wrote: > On Fri, 16 Sep 2016 12:17:27 -0700 > Brenden Blanco <bbla...@plumgrid.com> wrote: > > > On Fri, Sep 16, 2016 at 09:03:40PM +0200, Jesper Dangaard Brouer wrote: > > > Hi Brenden, >

Re: [net PATCH] mlx4: fix XDP_TX is acting like XDP_PASS on TX ring full

2016-09-16 Thread Brenden Blanco
up, as you'll only save a handful of page_put's. The code to do so wouldn't have been pretty. Reviewed-by: Brenden Blanco <bbla...@plumgrid.com>

Re: XDP_TX bug report on mlx4

2016-09-16 Thread Brenden Blanco
On Fri, Sep 16, 2016 at 09:03:40PM +0200, Jesper Dangaard Brouer wrote: > Hi Brenden, > > I've discovered a bug with XDP_TX recycling of pages in the mlx4 driver. > > If I increase the number of RX and TX queues/channels via ethtool cmd: > ethtool -L mlx4p1 rx 10 tx 10 > > Then when running

Re: XDP user interface confusions

2016-09-15 Thread Brenden Blanco
On Thu, Sep 15, 2016 at 08:14:02PM +0200, Jesper Dangaard Brouer wrote: > Hi Brenden, > > I don't quite understand the semantics of the XDP userspace interface. > > We allow XDP programs to be (unconditionally) exchanged by another > program, this avoids taking the link down+up and avoids

[PATCH v2] net/mlx4_en: protect ring->xdp_prog with rcu_read_lock

2016-09-03 Thread Brenden Blanco
lock around rcu_assign instead of xchg loop. Fixes: d576acf0a22 ("net/mlx4_en: add page recycle to prepare rx ring for tx support") Acked-by: Daniel Borkmann <dan...@iogearbox.net> Acked-by: Alexei Starovoitov <alexei.starovoi...@gmail.com> Signed-off-by: Brenden Blanco

Re: [PATCH] net/mlx4_en: protect ring->xdp_prog with rcu_read_lock

2016-09-02 Thread Brenden Blanco
On Mon, Aug 29, 2016 at 10:46:38AM -0700, Tom Herbert wrote: [...] > Brenden, tracking down how the structure is freed needed a few steps, > please make sure the RCU requirements are well documented. Also, I'm Really? It's just bpf_prog_put->call_rcu(__bpf_prog_put_rcu). I suppose what's missing

Re: [PATCH] net/mlx4_en: protect ring->xdp_prog with rcu_read_lock

2016-09-02 Thread Brenden Blanco
On Fri, Sep 02, 2016 at 01:59:40AM +0300, Saeed Mahameed wrote: > On Wed, Aug 31, 2016 at 4:50 AM, Brenden Blanco <bbla...@plumgrid.com> wrote: > > On Tue, Aug 30, 2016 at 12:35:58PM +0300, Saeed Mahameed wrote: [...] > >> Sorry folks I am with Tariq on this, you

Re: [PATCH] net/mlx4_en: protect ring->xdp_prog with rcu_read_lock

2016-09-02 Thread Brenden Blanco
On Thu, Sep 01, 2016 at 04:30:28PM -0700, Tom Herbert wrote: [...] > > Yep, but this is an unlikely condition and the critical code here is > > much smaller and it is more clear that the rcu_read_lock here meant to > > protect the ring->xdp_prog under this small xdp critical section in > >

Re: [PATCH] net/mlx4_en: protect ring->xdp_prog with rcu_read_lock

2016-08-30 Thread Brenden Blanco
On Tue, Aug 30, 2016 at 12:35:58PM +0300, Saeed Mahameed wrote: > On Mon, Aug 29, 2016 at 8:46 PM, Tom Herbert <t...@herbertland.com> wrote: > > On Mon, Aug 29, 2016 at 8:55 AM, Brenden Blanco <bbla...@plumgrid.com> > > wrote: > >> On Mon, Aug 29, 2016 at

Re: [PATCH] net/mlx4_en: protect ring->xdp_prog with rcu_read_lock

2016-08-29 Thread Brenden Blanco
On Mon, Aug 29, 2016 at 05:59:26PM +0300, Tariq Toukan wrote: > Hi Brenden, > > The solution direction should be XDP specific that does not hurt the > regular flow. An rcu_read_lock is _already_ taken for _every_ packet. This is 1/64th of that. > > On 26/08/2016 11:38 PM, Br

Re: [PATCH] net/mlx4_en: protect ring->xdp_prog with rcu_read_lock

2016-08-26 Thread Brenden Blanco
On Fri, Aug 26, 2016 at 01:38:08PM -0700, Brenden Blanco wrote: > Depending on the preempt mode, the bpf_prog stored in xdp_prog may be > freed despite the use of call_rcu inside bpf_prog_put. The situation is > possible when running in PREEMPT_RCU=y mode, for instance, since the rcu &

[PATCH] net/mlx4_en: protect ring->xdp_prog with rcu_read_lock

2016-08-26 Thread Brenden Blanco
arovoi...@gmail.com> Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index 2040dad..efed546 10064

Re: [PATCH v10 12/12] bpf: add sample for xdp forwarding and rewrite

2016-08-03 Thread Brenden Blanco
On Wed, Aug 03, 2016 at 10:29:58AM -0700, Tom Herbert wrote: > On Wed, Aug 3, 2016 at 10:11 AM, Alexei Starovoitov > <alexei.starovoi...@gmail.com> wrote: > > On Wed, Aug 03, 2016 at 10:01:54AM -0700, Tom Herbert wrote: > >> On Tue, Jul 19, 2016 at 12:16 PM, Brenden B

[PATCH net-next 1/3] net/mlx4_en: use READ_ONCE when freeing xdp_prog

2016-07-20 Thread Brenden Blanco
For consistency, and in order to hint at the synchronous nature of the xdp_prog field, use READ_ONCE in the destroy path of the ring. All occurrences should now use either READ_ONCE or xchg. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/net/ethernet/mellanox/mlx4/en_rx

[PATCH net-next 3/3] bpf: make xdp sample variable names more meaningful

2016-07-20 Thread Brenden Blanco
The naming choice of index is not terribly descriptive, and dropcnt is in fact incorrect for xdp2. Pick better names for these: ipproto and rxcnt. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- samples/bpf/xdp1_kern.c | 12 ++-- samples/bpf/xdp2_kern.c | 14 +++

[PATCH net-next 2/3] rtnl: protect do_setlink from IFLA_XDP_ATTACHED

2016-07-20 Thread Brenden Blanco
The IFLA_XDP_ATTACHED nested attribute is meant for read-only, and while do_setlink properly ignores it, it should be more paranoid and reject commands that try to set it. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- net/core/rtnetlink.c | 4 1 file changed, 4 inse

[PATCH net-next 0/3] misc cleanups for xdp

2016-07-20 Thread Brenden Blanco
This addresses several of the non-blocking comments left over from the xdp patch set. See individual patches for details. Brenden Blanco (3): net/mlx4_en: use READ_ONCE when freeing xdp_prog rtnl: protect do_setlink from IFLA_XDP_ATTACHED bpf: make xdp sample variable names more meaningful

Re: [PATCH v10 12/12] bpf: add sample for xdp forwarding and rewrite

2016-07-20 Thread Brenden Blanco
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. > >

Re: [PATCH v10 04/12] rtnl: add option for setting link xdp prog

2016-07-20 Thread Brenden Blanco
On Wed, Jul 20, 2016 at 10:38:49AM +0200, Daniel Borkmann wrote: > On 07/19/2016 09:16 PM, Brenden Blanco wrote: > >Sets the bpf program represented by fd as an early filter in the rx path > >of the netdev. The fd must have been created as BPF_PROG_TYPE_XDP. > >Providing a

Re: [PATCH v10 05/12] net/mlx4_en: add support for fast rx drop bpf program

2016-07-20 Thread Brenden Blanco
On Wed, Jul 20, 2016 at 11:07:57AM +0200, Daniel Borkmann wrote: > On 07/19/2016 09:16 PM, Brenden Blanco wrote: [...] > >+if (ring->xdp_prog) > >+bpf_prog_put(ring->xdp_prog); > > Would be good if you also make this a READ_ONCE() here. I believe th

[PATCH] bpf: fix implicit declaration of bpf_prog_add

2016-07-20 Thread Brenden Blanco
m") Reported-by: kbuild test robot <fengguang...@intel.com> Reported-by: Tariq Toukan <ttoukan.li...@gmail.com> Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/linux/bpf.h | 4 1 file changed, 4 insertions(+) diff --git a/include/linux/bpf.h

Re: [PATCH v10 00/12] Add driver bpf hook for early packet drop and forwarding

2016-07-20 Thread Brenden Blanco
On Wed, Jul 20, 2016 at 12:18:49PM +0300, Tariq Toukan wrote: > > On 20/07/2016 8:09 AM, David Miller wrote: > >From: Brenden Blanco <bbla...@plumgrid.com> > >Date: Tue, 19 Jul 2016 12:16:45 -0700 > > > >>This patch set introduces new infrastructure for

[PATCH v10 06/12] Add sample for adding simple drop program to link

2016-07-19 Thread Brenden Blanco
Add a sample program that only drops packets at the BPF_PROG_TYPE_XDP_RX hook of a link. With the drop-only program, observed single core rate is ~20Mpps. Other tests were run, for instance without the dropcnt increment or without reading from the packet header, the packet rate was mostly

[PATCH v10 05/12] net/mlx4_en: add support for fast rx drop bpf program

2016-07-19 Thread Brenden Blanco
at that granularity through any ndo. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 60 ++ drivers/net/ethernet/mellanox/mlx4/en_rx.c | 40 +++-- drivers/net/ethernet/mellanox/mlx4/mlx4_en.h

[PATCH v10 00/12] Add driver bpf hook for early packet drop and forwarding

2016-07-19 Thread Brenden Blanco
dma sync just before invoking prog Check for explicit bpf return code rather than nonzero Remove increment of rx_dropped 5/5: Use explicit bpf return code in example Update commit log with higher pps numbers Brenden Blanco (12): bpf: add bpf_prog_add api for bulk prog refcnt bpf:

[PATCH v10 01/12] bpf: add bpf_prog_add api for bulk prog refcnt

2016-07-19 Thread Brenden Blanco
A subsystem may need to store many copies of a bpf program, each deserving its own reference. Rather than requiring the caller to loop one by one (with possible mid-loop failure), add a bulk bpf_prog_add api. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/linux/bpf.h

[PATCH v10 08/12] bpf: add XDP_TX xdp_action for direct forwarding

2016-07-19 Thread Brenden Blanco
XDP enabled drivers must transmit received packets back out on the same port they were received on when a program returns this action. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/uapi/linux/bpf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/b

[PATCH v10 07/12] net/mlx4_en: add page recycle to prepare rx ring for tx support

2016-07-19 Thread Brenden Blanco
] bpf_map_lookup_elem Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 38 +- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 70 +++--- drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 11 +++- 3

[PATCH v10 04/12] rtnl: add option for setting link xdp prog

2016-07-19 Thread Brenden Blanco
whether the program is valid on the link or not. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/uapi/linux/if_link.h | 12 + net/core/rtnetlink.c | 64 2 files changed, 76 insertions(+) diff --git a/include/uapi

[PATCH v10 02/12] bpf: add XDP prog type for early driver filter

2016-07-19 Thread Brenden Blanco
to XDP_ABORTED. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/linux/filter.h | 18 +++ include/uapi/linux/bpf.h | 20 kernel/bpf/verifier.c| 1 + net/core/filter.c| 79 4 files changed, 118 inse

[PATCH v10 10/12] net/mlx4_en: add xdp forwarding and data write support

2016-07-19 Thread Brenden Blanco
that is optionally updated whenever recycle_ring is activated. By default the original free function is always initialized. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 9 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 29 + d

[PATCH v10 11/12] bpf: enable direct packet data write for xdp progs

2016-07-19 Thread Brenden Blanco
For forwarding to be effective, XDP programs should be allowed to rewrite packet data. This requires that the drivers supporting XDP must all map the packet memory as TODEVICE or BIDIRECTIONAL before invoking the program. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- kern

[PATCH v10 03/12] net: add ndo to setup/query xdp prog in adapter rx

2016-07-19 Thread Brenden Blanco
Add one new netdev op for drivers implementing the BPF_PROG_TYPE_XDP filter. The single op is used for both setup/query of the xdp program, modelled after ndo_setup_tc. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/linux/netdevice.h | 34 +

[PATCH v10 09/12] net/mlx4_en: break out tx_desc write into separate function

2016-07-19 Thread Brenden Blanco
In preparation for writing the tx descriptor from multiple functions, create a helper for both normal and blueflame access. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/infiniband/hw/mlx4/qp.c| 11 +-- drivers/net/ethernet/mellanox/mlx4/en_tx.c

[PATCH v10 12/12] bpf: add sample for xdp forwarding and rewrite

2016-07-19 Thread Brenden Blanco
are likely occurring due to cache misses. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- samples/bpf/Makefile| 5 +++ samples/bpf/xdp2_kern.c | 114 2 files changed, 119 insertions(+) create mode 100644 samples/bpf/xdp2_kern.c

Re: [PATCH v8 06/11] net/mlx4_en: add page recycle to prepare rx ring for tx support

2016-07-19 Thread Brenden Blanco
On Tue, Jul 19, 2016 at 04:33:28PM +0300, Tariq Toukan wrote: [...] > >So, I took Dave's suggestion to heart, and spent the last 2 days seeing > >what was possible to implement with just xdp as the focus, rather than > >an overall cleanup which Tariq will be looking at. > > > >Unfortunately, this

Re: [PATCH v8 04/11] net/mlx4_en: add support for fast rx drop bpf program

2016-07-18 Thread Brenden Blanco
On Mon, Jul 18, 2016 at 01:39:02PM +0200, Tom Herbert wrote: > On Mon, Jul 18, 2016 at 11:10 AM, Thomas Graf wrote: > > On 07/15/16 at 10:49am, Tom Herbert wrote: [...] > >> To me, an XDP program is just another attribute of an RX queue, it's > >> really not special!. We already

Re: [PATCH v9 00/11] Add driver bpf hook for early packet drop and forwarding

2016-07-18 Thread Brenden Blanco
On Mon, Jul 18, 2016 at 09:38:28AM -0700, Brenden Blanco wrote: > On Mon, Jul 18, 2016 at 04:39:38PM +0300, Tariq Toukan wrote: > > After applying the patchset, I get no ping between two VLAN > > interfaces (w/o activating any BPF program). > > I'm debugging it, and will updat

Re: [PATCH v9 00/11] Add driver bpf hook for early packet drop and forwarding

2016-07-18 Thread Brenden Blanco
On Mon, Jul 18, 2016 at 04:39:38PM +0300, Tariq Toukan wrote: > After applying the patchset, I get no ping between two VLAN > interfaces (w/o activating any BPF program). > I'm debugging it, and will update once I find the bug. > > Brenden, please check if you can repro the issue. I was able to

[PATCH v9 06/11] net/mlx4_en: add page recycle to prepare rx ring for tx support

2016-07-15 Thread Brenden Blanco
] bpf_map_lookup_elem Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 35 +++-- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 70 +++--- drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 11 +++- 3 files c

[PATCH v9 03/11] rtnl: add option for setting link xdp prog

2016-07-15 Thread Brenden Blanco
whether the program is valid on the link or not. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/uapi/linux/if_link.h | 12 + net/core/rtnetlink.c | 64 2 files changed, 76 insertions(+) diff --git a/include/uapi

[PATCH v9 05/11] Add sample for adding simple drop program to link

2016-07-15 Thread Brenden Blanco
Add a sample program that only drops packets at the BPF_PROG_TYPE_XDP_RX hook of a link. With the drop-only program, observed single core rate is ~20Mpps. Other tests were run, for instance without the dropcnt increment or without reading from the packet header, the packet rate was mostly

[PATCH v9 11/11] bpf: add sample for xdp forwarding and rewrite

2016-07-15 Thread Brenden Blanco
are likely occurring due to cache misses. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- samples/bpf/Makefile| 5 +++ samples/bpf/xdp2_kern.c | 114 2 files changed, 119 insertions(+) create mode 100644 samples/bpf/xdp2_kern.c

[PATCH v9 10/11] bpf: enable direct packet data write for xdp progs

2016-07-15 Thread Brenden Blanco
For forwarding to be effective, XDP programs should be allowed to rewrite packet data. This requires that the drivers supporting XDP must all map the packet memory as TODEVICE or BIDIRECTIONAL before invoking the program. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- kern

[PATCH v9 09/11] net/mlx4_en: add xdp forwarding and data write support

2016-07-15 Thread Brenden Blanco
that is optionally updated whenever recycle_ring is activated. By default the original free function is always initialized. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 9 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c

[PATCH v9 07/11] bpf: add XDP_TX xdp_action for direct forwarding

2016-07-15 Thread Brenden Blanco
XDP enabled drivers must transmit received packets back out on the same port they were received on when a program returns this action. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/uapi/linux/bpf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/b

[PATCH v9 04/11] net/mlx4_en: add support for fast rx drop bpf program

2016-07-15 Thread Brenden Blanco
allocating an skb. Therefore, disallow MTU settings that would produce a multi-fragment packet that XDP programs would fail to access. Future enhancements could be done to increase the allowable MTU. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/net/ethernet/mellano

[PATCH v9 08/11] net/mlx4_en: break out tx_desc write into separate function

2016-07-15 Thread Brenden Blanco
In preparation for writing the tx descriptor from multiple functions, create a helper for both normal and blueflame access. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/infiniband/hw/mlx4/qp.c| 11 +-- drivers/net/ethernet/mellanox/mlx4/en_tx.c

[PATCH v9 02/11] net: add ndo to setup/query xdp prog in adapter rx

2016-07-15 Thread Brenden Blanco
Add one new netdev op for drivers implementing the BPF_PROG_TYPE_XDP filter. The single op is used for both setup/query of the xdp program, modelled after ndo_setup_tc. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/linux/netdevice.h | 34 +

[PATCH v9 00/11] Add driver bpf hook for early packet drop and forwarding

2016-07-15 Thread Brenden Blanco
t;num_frags > 1 Rename pseudo_skb to bpf_phys_dev_md Implement ndo_bpf_get Add dma sync just before invoking prog Check for explicit bpf return code rather than nonzero Remove increment of rx_dropped 5/5: Use explicit bpf return code in example Update commit log with highe

[PATCH v9 01/11] bpf: add XDP prog type for early driver filter

2016-07-15 Thread Brenden Blanco
to XDP_ABORTED. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/linux/filter.h | 18 +++ include/uapi/linux/bpf.h | 20 kernel/bpf/verifier.c| 1 + net/core/filter.c| 79 4 files changed, 118 inse

Re: [PATCH v8 06/11] net/mlx4_en: add page recycle to prepare rx ring for tx support

2016-07-15 Thread Brenden Blanco
On Wed, Jul 13, 2016 at 08:40:59AM -0700, Brenden Blanco wrote: > On Wed, Jul 13, 2016 at 10:17:26AM +0300, Tariq Toukan wrote: > > > > On 13/07/2016 3:54 AM, Brenden Blanco wrote: > > >On Tue, Jul 12, 2016 at 02:18:32PM -0700, David Miller wrote: > > >>From:

Re: [PATCH v7 09/11] net/mlx4_en: add xdp forwarding and data write support

2016-07-13 Thread Brenden Blanco
On Wed, Jul 13, 2016 at 06:25:28PM +0300, Saeed Mahameed wrote: > On Tue, Jul 12, 2016 at 12:29 AM, Brenden Blanco <bbla...@plumgrid.com> wrote: > > A user will now be able to loop packets back out of the same port using > > a bpf program attached to xdp hook. Updates to the

Re: [PATCH v8 06/11] net/mlx4_en: add page recycle to prepare rx ring for tx support

2016-07-13 Thread Brenden Blanco
On Wed, Jul 13, 2016 at 10:17:26AM +0300, Tariq Toukan wrote: > > On 13/07/2016 3:54 AM, Brenden Blanco wrote: > >On Tue, Jul 12, 2016 at 02:18:32PM -0700, David Miller wrote: > >>From: Brenden Blanco <bbla...@plumgrid.com> > >>D

Re: [PATCH v8 04/11] net/mlx4_en: add support for fast rx drop bpf program

2016-07-13 Thread Brenden Blanco
On Wed, Jul 13, 2016 at 11:27:23AM +, David Laight wrote: > From: Brenden Blanco > > Sent: 12 July 2016 08:51 > > Add support for the BPF_PROG_TYPE_XDP hook in mlx4 driver. > > > > In tc/socket bpf programs, helpers linearize skb fragments as needed > > wh

Re: [PATCH v8 06/11] net/mlx4_en: add page recycle to prepare rx ring for tx support

2016-07-12 Thread Brenden Blanco
On Tue, Jul 12, 2016 at 02:18:32PM -0700, David Miller wrote: > From: Brenden Blanco <bbla...@plumgrid.com> > Date: Tue, 12 Jul 2016 00:51:29 -0700 > > > + mlx4_en_free_resources(priv); > > + > > old_prog = xchg(>prog, prog); > > if (old_p

Re: [PATCH v7 04/11] net/mlx4_en: add support for fast rx drop bpf program

2016-07-12 Thread Brenden Blanco
On Mon, Jul 11, 2016 at 11:17:00PM -0700, David Miller wrote: > From: Brenden Blanco <bbla...@plumgrid.com> > Date: Mon, 11 Jul 2016 14:29:51 -0700 > > > + if (priv->num_frags > 1) > > + return -EOPNOTSUPP; > > I hate to be the user who has to

[PATCH v8 03/11] rtnl: add option for setting link xdp prog

2016-07-12 Thread Brenden Blanco
whether the program is valid on the link or not. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/uapi/linux/if_link.h | 12 + net/core/rtnetlink.c | 64 2 files changed, 76 insertions(+) diff --git a/include/uapi

[PATCH v8 10/11] bpf: enable direct packet data write for xdp progs

2016-07-12 Thread Brenden Blanco
For forwarding to be effective, XDP programs should be allowed to rewrite packet data. This requires that the drivers supporting XDP must all map the packet memory as TODEVICE or BIDIRECTIONAL before invoking the program. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- kern

[PATCH v8 04/11] net/mlx4_en: add support for fast rx drop bpf program

2016-07-12 Thread Brenden Blanco
allocating an skb. Therefore, disallow MTU settings that would produce a multi-fragment packet that XDP programs would fail to access. Future enhancements could be done to increase the allowable MTU. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/net/ethernet/mellano

[PATCH v8 01/11] bpf: add XDP prog type for early driver filter

2016-07-12 Thread Brenden Blanco
to XDP_ABORTED. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/linux/filter.h | 18 +++ include/uapi/linux/bpf.h | 20 kernel/bpf/verifier.c| 1 + net/core/filter.c| 79 4 files changed, 118 inse

[PATCH v8 09/11] net/mlx4_en: add xdp forwarding and data write support

2016-07-12 Thread Brenden Blanco
tx completion, this dedicated tx ring recycles pages without unmapping directly back to the original rx ring. In steady state tx/drop workload, effectively 0 page allocs/frees will occur. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c

[PATCH v8 11/11] bpf: add sample for xdp forwarding and rewrite

2016-07-12 Thread Brenden Blanco
are likely occurring due to cache misses. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- samples/bpf/Makefile| 5 +++ samples/bpf/xdp2_kern.c | 114 2 files changed, 119 insertions(+) create mode 100644 samples/bpf/xdp2_kern.c

[PATCH v8 07/11] bpf: add XDP_TX xdp_action for direct forwarding

2016-07-12 Thread Brenden Blanco
XDP enabled drivers must transmit received packets back out on the same port they were received on when a program returns this action. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/uapi/linux/bpf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/b

[PATCH v8 08/11] net/mlx4_en: break out tx_desc write into separate function

2016-07-12 Thread Brenden Blanco
In preparation for writing the tx descriptor from multiple functions, create a helper for both normal and blueflame access. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/infiniband/hw/mlx4/qp.c| 11 +-- drivers/net/ethernet/mellanox/mlx4/en_tx.c

[PATCH v8 05/11] Add sample for adding simple drop program to link

2016-07-12 Thread Brenden Blanco
Add a sample program that only drops packets at the BPF_PROG_TYPE_XDP_RX hook of a link. With the drop-only program, observed single core rate is ~20Mpps. Other tests were run, for instance without the dropcnt increment or without reading from the packet header, the packet rate was mostly

[PATCH v8 06/11] net/mlx4_en: add page recycle to prepare rx ring for tx support

2016-07-12 Thread Brenden Blanco
] bpf_map_lookup_elem Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 46 +++-- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 69 ++--- drive

[PATCH v8 02/11] net: add ndo to setup/query xdp prog in adapter rx

2016-07-12 Thread Brenden Blanco
Add one new netdev op for drivers implementing the BPF_PROG_TYPE_XDP filter. The single op is used for both setup/query of the xdp program, modelled after ndo_setup_tc. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/linux/netdevice.h | 34 +

[PATCH v8 00/11] Add driver bpf hook for early packet drop and forwarding

2016-07-12 Thread Brenden Blanco
example Update commit log with higher pps numbers Brenden Blanco (11): bpf: add XDP prog type for early driver filter net: add ndo to setup/query xdp prog in adapter rx rtnl: add option for setting link xdp prog net/mlx4_en: add support for fast rx drop bpf program Add sample for adding simp

Re: [PATCH v7 02/11] net: add ndo to setup/query xdp prog in adapter rx

2016-07-12 Thread Brenden Blanco
On Mon, Jul 11, 2016 at 11:12:24PM -0700, David Miller wrote: > From: Brenden Blanco <bbla...@plumgrid.com> > Date: Mon, 11 Jul 2016 14:29:49 -0700 > > > + if (fd >= 0) { > > + prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_XDP); &

Re: [PATCH v7 01/11] bpf: add XDP prog type for early driver filter

2016-07-12 Thread Brenden Blanco
On Mon, Jul 11, 2016 at 11:02:54PM -0700, David Miller wrote: > From: Brenden Blanco <bbla...@plumgrid.com> > Date: Mon, 11 Jul 2016 14:29:48 -0700 > > > + WARN_ONCE(1, "\n" > > +"*\n

Re: [PATCH v7 00/11] Add driver bpf hook for early packet drop and forwarding

2016-07-11 Thread Brenden Blanco
On Tue, Jul 12, 2016 at 12:53:34AM +0300, Or Gerlitz wrote: > On Tue, Jul 12, 2016 at 12:29 AM, Brenden Blanco <bbla...@plumgrid.com> wrote: > > > v7: > [...] > > TODOs: > > Add ethtool per-ring stats for aborted, default cases, maybe even drop > > and

Re: [PATCH v6 04/12] net/mlx4_en: add support for fast rx drop bpf program

2016-07-11 Thread Brenden Blanco
On Mon, Jul 11, 2016 at 02:48:17PM +0300, Saeed Mahameed wrote: [...] > > yes, we need something like: > > +static inline void > +mlx4_en_sync_dma(struct mlx4_en_priv *priv, > +struct mlx4_en_rx_desc *rx_desc, > +int length) > +{ > + dma_addr_t dma; > + > +

[PATCH v7 04/11] net/mlx4_en: add support for fast rx drop bpf program

2016-07-11 Thread Brenden Blanco
allocating an skb. Therefore, disallow MTU settings that would produce a multi-fragment packet that XDP programs would fail to access. Future enhancements could be done to increase the allowable MTU. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/net/ethernet/mellano

[PATCH v7 02/11] net: add ndo to setup/query xdp prog in adapter rx

2016-07-11 Thread Brenden Blanco
Add one new netdev op for drivers implementing the BPF_PROG_TYPE_XDP filter. The single op is used for both setup/query of the xdp program, modelled after ndo_setup_tc. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/linux/netdevice.h | 32 +++

[PATCH v7 03/11] rtnl: add option for setting link xdp prog

2016-07-11 Thread Brenden Blanco
whether the program is valid on the link or not. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/uapi/linux/if_link.h | 12 + net/core/rtnetlink.c | 64 2 files changed, 76 insertions(+) diff --git a/include/uapi

[PATCH v7 06/11] net/mlx4_en: add page recycle to prepare rx ring for tx support

2016-07-11 Thread Brenden Blanco
] bpf_map_lookup_elem Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 46 +++-- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 69 ++--- drive

[PATCH v7 10/11] bpf: enable direct packet data write for xdp progs

2016-07-11 Thread Brenden Blanco
For forwarding to be effective, XDP programs should be allowed to rewrite packet data. This requires that the drivers supporting XDP must all map the packet memory as TODEVICE or BIDIRECTIONAL before invoking the program. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- kern

[PATCH v7 07/11] bpf: add XDP_TX xdp_action for direct forwarding

2016-07-11 Thread Brenden Blanco
XDP enabled drivers must transmit received packets back out on the same port they were received on when a program returns this action. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/uapi/linux/bpf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/b

[PATCH v7 11/11] bpf: add sample for xdp forwarding and rewrite

2016-07-11 Thread Brenden Blanco
are likely occurring due to cache misses. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- samples/bpf/Makefile| 5 +++ samples/bpf/xdp2_kern.c | 114 2 files changed, 119 insertions(+) create mode 100644 samples/bpf/xdp2_kern.c

[PATCH v7 08/11] net/mlx4_en: break out tx_desc write into separate function

2016-07-11 Thread Brenden Blanco
In preparation for writing the tx descriptor from multiple functions, create a helper for both normal and blueflame access. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/infiniband/hw/mlx4/qp.c| 11 +-- drivers/net/ethernet/mellanox/mlx4/en_tx.c

[PATCH v7 00/11] Add driver bpf hook for early packet drop and forwarding

2016-07-11 Thread Brenden Blanco
5/5: Use explicit bpf return code in example Update commit log with higher pps numbers Brenden Blanco (11): bpf: add XDP prog type for early driver filter net: add ndo to setup/query xdp prog in adapter rx rtnl: add option for setting link xdp prog net/mlx4_en: add support for fast rx

[PATCH v7 05/11] Add sample for adding simple drop program to link

2016-07-11 Thread Brenden Blanco
Add a sample program that only drops packets at the BPF_PROG_TYPE_XDP_RX hook of a link. With the drop-only program, observed single core rate is ~20Mpps. Other tests were run, for instance without the dropcnt increment or without reading from the packet header, the packet rate was mostly

[PATCH v7 09/11] net/mlx4_en: add xdp forwarding and data write support

2016-07-11 Thread Brenden Blanco
tx completion, this dedicated tx ring recycles pages without unmapping directly back to the original rx ring. In steady state tx/drop workload, effectively 0 page allocs/frees will occur. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c

[PATCH v7 01/11] bpf: add XDP prog type for early driver filter

2016-07-11 Thread Brenden Blanco
to XDP_ABORTED. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- include/linux/filter.h | 18 ++ include/uapi/linux/bpf.h | 20 +++ kernel/bpf/verifier.c| 1 + net/core/filter.c| 91 4 files changed, 130 insertions(+)

Re: [PATCH v6 01/12] bpf: add XDP prog type for early driver filter

2016-07-11 Thread Brenden Blanco
On Sun, Jul 10, 2016 at 03:56:02PM -0500, Tom Herbert wrote: > On Thu, Jul 7, 2016 at 9:15 PM, Brenden Blanco <bbla...@plumgrid.com> wrote: > > Add a new bpf prog type that is intended to run in early stages of the > > packet rx path. Only minimal packet metadata will be avail

Re: [net-next PATCH RFC] mlx4: RX prefetch loop

2016-07-11 Thread Brenden Blanco
On Mon, Jul 11, 2016 at 01:09:22PM +0200, Jesper Dangaard Brouer wrote: [...] > This patch is based on top of Brenden's patch 11/12, and is mean to > replace patch 12/12. > > Prefetching is very important for XDP, especially when using a CPU > without DDIO (here i7-4790K CPU @ 4.00GHz). > >

Re: [PATCH v6 01/12] bpf: add XDP prog type for early driver filter

2016-07-10 Thread Brenden Blanco
t; > On Thu, 7 Jul 2016 19:15:13 -0700 > > > Brenden Blanco <bbla...@plumgrid.com> wrote: > > > > > >> Add a new bpf prog type that is intended to run in early stages of the > > >> packet rx path. Only minimal packet metadata will be available, hence a

Re: [PATCH v6 04/12] net/mlx4_en: add support for fast rx drop bpf program

2016-07-10 Thread Brenden Blanco
On Sun, Jul 10, 2016 at 06:25:40PM +0300, Tariq Toukan wrote: > > On 09/07/2016 10:58 PM, Saeed Mahameed wrote: > >On Fri, Jul 8, 2016 at 5:15 AM, Brenden Blanco <bbla...@plumgrid.com> wrote: > >>+ /* A bpf program gets first chance to d

Re: [PATCH v6 04/12] net/mlx4_en: add support for fast rx drop bpf program

2016-07-10 Thread Brenden Blanco
On Sat, Jul 09, 2016 at 05:07:36PM +0300, Or Gerlitz wrote: > On Fri, Jul 8, 2016 at 5:15 AM, Brenden Blanco <bbla...@plumgrid.com> wrote: > > Add support for the BPF_PROG_TYPE_XDP hook in mlx4 driver. > > > > In tc/socket bpf programs, helpers linearize skb f

Re: [PATCH v6 12/12] net/mlx4_en: add prefetch in xdp rx path

2016-07-08 Thread Brenden Blanco
On Fri, Jul 08, 2016 at 08:56:45AM +0200, Eric Dumazet wrote: > On Thu, 2016-07-07 at 21:16 -0700, Alexei Starovoitov wrote: > > > I've tried this style of prefetching in the past for normal stack > > and it didn't help at all. > > This is very nice, but my experience showed opposite numbers. >

[PATCH v6 08/12] net/mlx4_en: break out tx_desc write into separate function

2016-07-07 Thread Brenden Blanco
In preparation for writing the tx descriptor from multiple functions, create a helper for both normal and blueflame access. Signed-off-by: Brenden Blanco <bbla...@plumgrid.com> --- drivers/infiniband/hw/mlx4/qp.c| 11 +-- drivers/net/ethernet/mellanox/mlx4/en_tx.c

  1   2   >