Re: [ovs-dev] [PATCHv9] netdev-afxdp: add new netdev type for AF_XDP.

2019-05-27 Thread William Tu
On Sun, May 26, 2019 at 10:35 PM Yanqin Wei (Arm Technology China)
 wrote:
>
> Hi William,
>
> I think the main objective of this patch is to introduce AF_XDP socket for 
> OVS userspace datapath. This is an alternative to DPDK  PMD library.  Is it 
> possible to continue using other DPDK libraries before XDP provides the 
> corresponding functionality?
>

Hi Yanqin,

Yes, I'm aware of the new AF_XDP feature in DPDK PMD.
With this patch, you can use both together, the AF_XDP this patch and
the DPDK PMD.
For example, you can configure OVS with (see afxdp.rst in this path)
./configure  --enable-afxdp --with-dpdk=

Regards,
William

> Best Regards,
> Wei Yanqin
>
> -Original Message-
> From: ovs-dev-boun...@openvswitch.org  On 
> Behalf Of William Tu
> Sent: Saturday, May 25, 2019 4:37 AM
> To: Ben Pfaff 
> Cc:  ; Ilya Maximets 
> 
> Subject: Re: [ovs-dev] [PATCHv9] netdev-afxdp: add new netdev type for AF_XDP.
>
> On Fri, May 24, 2019 at 11:32 AM Ben Pfaff  wrote:
> >
> > On Fri, May 24, 2019 at 11:03:33AM -0700, William Tu wrote:
> > > The patch introduces experimental AF_XDP support for OVS netdev.
> > > AF_XDP, the Address Family of the eXpress Data Path, is a new Linux
> > > socket type built upon the eBPF and XDP technology.  It is aims to
> > > have comparable performance to DPDK but cooperate better with
> > > existing kernel's networking stack.  An AF_XDP socket receives and
> > > sends packets from an eBPF/XDP program attached to the netdev,
> > > by-passing a couple of Linux kernel's subsystems As a result, AF_XDP
> > > socket shows much better performance than AF_PACKET For more details
> > > about AF_XDP, please see linux kernel's
> > > Documentation/networking/af_xdp.rst. Note that by default, this feature 
> > > is not compiled in.
> > >
> > > Signed-off-by: William Tu 
> >
> > How heavy is the x86(_64)-only dependency?  It seems undesirable. is
>
> Now in my patch, the cycles_counter_update has x86-specific instructions.
> Other part of the code has no x86-only dependency.
>
> The reason I made this x86-only is that AF_XDP is rarely tested on
> non-x86 system. So I'm not sure whether it works or not.
>
> Regards,
> William
> ___
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> IMPORTANT NOTICE: The contents of this email and any attachments are 
> confidential and may also be privileged. If you are not the intended 
> recipient, please notify the sender immediately and do not disclose the 
> contents to any other person, use it for any purpose, or store or copy the 
> information in any medium. Thank you.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCHv9] netdev-afxdp: add new netdev type for AF_XDP.

2019-05-26 Thread Yanqin Wei (Arm Technology China)
Hi William,

I think the main objective of this patch is to introduce AF_XDP socket for OVS 
userspace datapath. This is an alternative to DPDK  PMD library.  Is it 
possible to continue using other DPDK libraries before XDP provides the 
corresponding functionality?

Best Regards,
Wei Yanqin

-Original Message-
From: ovs-dev-boun...@openvswitch.org  On 
Behalf Of William Tu
Sent: Saturday, May 25, 2019 4:37 AM
To: Ben Pfaff 
Cc:  ; Ilya Maximets 

Subject: Re: [ovs-dev] [PATCHv9] netdev-afxdp: add new netdev type for AF_XDP.

On Fri, May 24, 2019 at 11:32 AM Ben Pfaff  wrote:
>
> On Fri, May 24, 2019 at 11:03:33AM -0700, William Tu wrote:
> > The patch introduces experimental AF_XDP support for OVS netdev.
> > AF_XDP, the Address Family of the eXpress Data Path, is a new Linux
> > socket type built upon the eBPF and XDP technology.  It is aims to
> > have comparable performance to DPDK but cooperate better with
> > existing kernel's networking stack.  An AF_XDP socket receives and
> > sends packets from an eBPF/XDP program attached to the netdev,
> > by-passing a couple of Linux kernel's subsystems As a result, AF_XDP
> > socket shows much better performance than AF_PACKET For more details
> > about AF_XDP, please see linux kernel's
> > Documentation/networking/af_xdp.rst. Note that by default, this feature is 
> > not compiled in.
> >
> > Signed-off-by: William Tu 
>
> How heavy is the x86(_64)-only dependency?  It seems undesirable. is

Now in my patch, the cycles_counter_update has x86-specific instructions.
Other part of the code has no x86-only dependency.

The reason I made this x86-only is that AF_XDP is rarely tested on
non-x86 system. So I'm not sure whether it works or not.

Regards,
William
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCHv9] netdev-afxdp: add new netdev type for AF_XDP.

2019-05-24 Thread William Tu
On Fri, May 24, 2019 at 11:32 AM Ben Pfaff  wrote:
>
> On Fri, May 24, 2019 at 11:03:33AM -0700, William Tu wrote:
> > The patch introduces experimental AF_XDP support for OVS netdev.
> > AF_XDP, the Address Family of the eXpress Data Path, is a new Linux socket
> > type built upon the eBPF and XDP technology.  It is aims to have comparable
> > performance to DPDK but cooperate better with existing kernel's networking
> > stack.  An AF_XDP socket receives and sends packets from an eBPF/XDP program
> > attached to the netdev, by-passing a couple of Linux kernel's subsystems
> > As a result, AF_XDP socket shows much better performance than AF_PACKET
> > For more details about AF_XDP, please see linux kernel's
> > Documentation/networking/af_xdp.rst. Note that by default, this feature is
> > not compiled in.
> >
> > Signed-off-by: William Tu 
>
> How heavy is the x86(_64)-only dependency?  It seems undesirable. is

Now in my patch, the cycles_counter_update has x86-specific instructions.
Other part of the code has no x86-only dependency.

The reason I made this x86-only is that AF_XDP is rarely tested on
non-x86 system. So I'm not sure whether it works or not.

Regards,
William
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCHv9] netdev-afxdp: add new netdev type for AF_XDP.

2019-05-24 Thread Ben Pfaff
On Fri, May 24, 2019 at 11:03:33AM -0700, William Tu wrote:
> The patch introduces experimental AF_XDP support for OVS netdev.
> AF_XDP, the Address Family of the eXpress Data Path, is a new Linux socket
> type built upon the eBPF and XDP technology.  It is aims to have comparable
> performance to DPDK but cooperate better with existing kernel's networking
> stack.  An AF_XDP socket receives and sends packets from an eBPF/XDP program
> attached to the netdev, by-passing a couple of Linux kernel's subsystems
> As a result, AF_XDP socket shows much better performance than AF_PACKET
> For more details about AF_XDP, please see linux kernel's
> Documentation/networking/af_xdp.rst. Note that by default, this feature is
> not compiled in.
> 
> Signed-off-by: William Tu 

How heavy is the x86(_64)-only dependency?  It seems undesirable.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCHv9] netdev-afxdp: add new netdev type for AF_XDP.

2019-05-24 Thread William Tu
The patch introduces experimental AF_XDP support for OVS netdev.
AF_XDP, the Address Family of the eXpress Data Path, is a new Linux socket
type built upon the eBPF and XDP technology.  It is aims to have comparable
performance to DPDK but cooperate better with existing kernel's networking
stack.  An AF_XDP socket receives and sends packets from an eBPF/XDP program
attached to the netdev, by-passing a couple of Linux kernel's subsystems
As a result, AF_XDP socket shows much better performance than AF_PACKET
For more details about AF_XDP, please see linux kernel's
Documentation/networking/af_xdp.rst. Note that by default, this feature is
not compiled in.

Signed-off-by: William Tu 
---
v1->v2:
- add a list to maintain unused umem elements
- remove copy from rx umem to ovs internal buffer
- use hugetlb to reduce misses (not much difference)
- use pmd mode netdev in OVS (huge performance improve)
- remove malloc dp_packet, instead put dp_packet in umem

v2->v3:
- rebase on the OVS master, 7ab4b0653784
  ("configure: Check for more specific function to pull in pthread library.")
- remove the dependency on libbpf and dpif-bpf.
  instead, use the built-in XDP_ATTACH feature.
- data structure optimizations for better performance, see[1]
- more test cases support
v3: https://mail.openvswitch.org/pipermail/ovs-dev/2018-November/354179.html

v3->v4:
- Use AF_XDP API provided by libbpf
- Remove the dependency on XDP_ATTACH kernel patch set
- Add documentation, bpf.rst

v4->v5:
- rebase to master
- remove rfc, squash all into a single patch
- add --enable-afxdp, so by default, AF_XDP is not compiled
- add options: xdpmode=drv,skb
- add multiple queue and multiple PMD support, with options: n_rxq
- improve documentation, rename bpf.rst to af_xdp.rst

v5->v6
- rebase to master, commit 0cdd5b13de91b98
- address errors from sparse and clang
- pass travis-ci test
- address feedback from Ben
- fix issues reported by 0-day robot
- improved documentation

v6-v7
- rebase to master, commit abf11558c1515bf3b1
- address feedbacks from Ilya, Ben, and Eelco, see:
  https://www.mail-archive.com/ovs-dev@openvswitch.org/msg32357.html
- add XDP mode change, implement get/set_config, reconfigure
- Fix reconfiguration/crash issue caused by libbpf, see patch:
  [PATCH bpf 0/2] libbpf: fixes for AF_XDP teardown
- perf optimization for batching umem_push/pop
- perf optimization for batching kick_tx
- test build with dpdk
- fix/refactor atomic operation
- make AF_XDP x86 specific, otherwise fail at build time
- lots of code refactoring
- add PVP setup in documentation

v7-v8:
- Address feedback from Ilya at:
  https://patchwork.ozlabs.org/patch/1095019/
- add netdev-linux-private.h
- fix afxdp reconfigure issue
- sort include headers
- remove unnecessary OVS_UNUSED
- coding style fixes
- error case handling and memory leak

v8-v9:
- rebase to master 180bbbed3a3867d52
- Address review feedback from Ben, Ilya and Eelco, at:
  https://patchwork.ozlabs.org/patch/1097740/
- == From Ilya ==
- Optimize the reconfiguration logic
- Implement .rxq_recv and .send for afxdp
- Remove system-afxdp-traffic.at, reuse existing code
- Use Ilya's rdtsc code
- remove --disable-system
- == From Eelco ==
- Fix bug when remove br0, util(revalidator49)|EMER|lib/poll-loop.c:111:
  assertion !fd != !wevent failed
- Fix bug and use default value from libbpf, ex: XSK_RING_PROD__DEFAULT...
- Clear xdp program when receive signal, ctrl+c
- Add options to vswitch.xml, set xdpmode default to skb-mode
- No support for ARM and PPC, now x86_64 only
- remove redundant header includes and function/macro definitions
- remove some ifdef HAVE_AF_XDP
- == From others/both about afxdp rx and tx ==
- Several umem push/pop error handling improvement/fixes
- add lock to address concurrent_txq case
- improve error handling
- add stats
- Things that are not done yet
- MTU limitation
- n_txq_desc/n_rxq_desc option.
---
 Documentation/automake.mk |   1 +
 Documentation/index.rst   |   1 +
 Documentation/intro/install/afxdp.rst | 433 +
 Documentation/intro/install/index.rst |   1 +
 acinclude.m4  |  35 ++
 configure.ac  |   1 +
 lib/automake.mk   |  14 +
 lib/dp-packet.c   |  28 ++
 lib/dp-packet.h   |  18 +-
 lib/dpif-netdev-perf.h|   6 +
 lib/netdev-afxdp.c| 858 ++
 lib/netdev-afxdp.h|  77 +++
 lib/netdev-linux-private.h| 139 ++
 lib/netdev-linux.c| 121 ++---
 lib/netdev-provider.h |   3 +
 lib/netdev.c  |  11 +
 lib/spinlock.h|  70 +++
 lib/xdpsock.c | 183 
 lib/xdpsock.h | 101 
 tests/automake.mk |  16 +
 tests/system-afxdp-macros.at  |  20 +