From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:58689 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727579AbfKVGJ2 (ORCPT ); Fri, 22 Nov 2019 01:09:28 -0500 Subject: Re: error loading xdp program on virtio nic References: <89f56317-5955-e692-fcf0-ee876aae068b@redhat.com> <3dc7b9d8-bcb2-1a90-630e-681cbf0f1ace@gmail.com> <18659bd0-432e-f317-fa8a-b5670a91c5b9@redhat.com> <20191121072625.3573368f@carbon> <4686849f-f3b8-dd1d-0fe4-3c176a37b67a@redhat.com> From: Jason Wang Message-ID: Date: Fri, 22 Nov 2019 14:09:10 +0800 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Sender: xdp-newbies-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable To: David Ahern , Jesper Dangaard Brouer Cc: "xdp-newbies@vger.kernel.org" On 2019/11/21 =E4=B8=8B=E5=8D=8811:49, David Ahern wrote: > On 11/21/19 12:02 AM, Jason Wang wrote: >> By specifying queues property like: >> >> >> >> =C2=A0 >> =C2=A0=C2=A0=C2=A0 >> =C2=A0=C2=A0=C2=A0 >> =C2=A0=C2=A0=C2=A0 >> =C2=A0=C2=A0=C2=A0 > event_idx=3D'off' queues=3D'5' rx_queue_size=3D'256' tx_queue_size=3D'25= 6'> > I can not check this because the 3.0 version of libvirt does not support > tx_queue_size. It is multiqueue (queues=3D5 in the example) setting that > needs to be set to 2*Nvcpus for XDP, correct? Yes. > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 > ufo=3D'off' mrg_rxbuf=3D'off'/> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 >> =C2=A0=C2=A0=C2=A0 >> =C2=A0=C2=A0=C2=A0 >> >> >> > The virtio_net driver suggests the queues are needed for XDP_TX: > > /* XDP requires extra queues for XDP_TX */ > if (curr_qp + xdp_qp > vi->max_queue_pairs) { > NL_SET_ERR_MSG_MOD(extack, "Too few free TX rings > available"); > netdev_warn(dev, "request %i queues but max is %i\n", > curr_qp + xdp_qp, vi->max_queue_pairs); > return -ENOMEM; > } > > Doubling the number of queues for each tap device adds overhead to the > hypervisor if you only want to allow XDP_DROP or XDP_DIRECT. Am I > understanding that correctly? Yes, but there's almost impossible to know whether or not XDP_TX will be=20 used by the program. If we don't use per CPU TX queue, it must be=20 serialized through locks, not sure it's worth try that (not by default,=20 of course). Thanks >