On Wed, 27 May 2020 17:04:50 +0200 Toke Høiland-Jørgensen <toke@xxxxxxxxxx> wrote: > Hangbin Liu <liuhangbin@xxxxxxxxx> writes: > > > On Wed, May 27, 2020 at 12:21:54PM +0200, Toke Høiland-Jørgensen wrote: > >> > The example in patch 2 is functional, but not a lot of effort > >> > has been made on performance optimisation. I did a simple test(pkt size 64) > >> > with pktgen. Here is the test result with BPF_MAP_TYPE_DEVMAP_HASH > >> > arrays: > >> > > >> > bpf_redirect_map() with 1 ingress, 1 egress: > >> > generic path: ~1600k pps > >> > native path: ~980k pps > >> > > >> > bpf_redirect_map_multi() with 1 ingress, 3 egress: > >> > generic path: ~600k pps > >> > native path: ~480k pps > >> > > >> > bpf_redirect_map_multi() with 1 ingress, 9 egress: > >> > generic path: ~125k pps > >> > native path: ~100k pps > >> > > >> > The bpf_redirect_map_multi() is slower than bpf_redirect_map() as we loop > >> > the arrays and do clone skb/xdpf. The native path is slower than generic > >> > path as we send skbs by pktgen. So the result looks reasonable. > >> > >> How are you running these tests? Still on virtual devices? We really > > > > I run it with the test topology in patch 2/2. The test is run on physical > > machines, but I use veth interface. Do you mean use a physical NIC driver > > for testing? > > Yes, sorry, when I said 'physical machine' I should have also 'physical > NIC'. We really need to know how the performance of this is on the XDP > fast path, i.e., when there are no skbs involved at all. > > > BTW, when using pktgen, I got an panic because the skb don't have enough > > header room. The code path looks like > > > > do_xdp_generic() > > - netif_receive_generic_xdp() > > - skb_headroom(skb) < XDP_PACKET_HEADROOM > > - pskb_expand_head() > > - BUG_ON(skb_shared(skb)) > > > > So I added a draft patch for pktgen, not sure if it has any influence. > > Hmm, as Jesper said pktgen was really not intended to be used this way, > so I guess that's why. I guess I'll let him comment on whether he thinks > it's worth fixing; or you could send this as a proper patch and see if > anyone complains about it ;) Don't use pktgen in this way with veth. If anything pktgen should detect that you use pktgen in virtual interfaces and reject/disallow that you do this. Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer