From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40880 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751726AbeB0C3K (ORCPT ); Mon, 26 Feb 2018 21:29:10 -0500 Subject: Re: [net PATCH 1/4] virtio_net: disable XDP_REDIRECT in receive_mergeable() case From: Jason Wang To: "Michael S. Tsirkin" , Jesper Dangaard Brouer Cc: netdev@vger.kernel.org, John Fastabend , Alexei Starovoitov , Saeed Mahameed , Daniel Borkmann , "David S. Miller" , Tariq Toukan References: <151913348634.28247.17519468037896960567.stgit@firesoul> <151913352486.28247.12339812865877070160.stgit@firesoul> <20180227023529-mutt-send-email-mst@kernel.org> <86ea9887-0ea2-1f58-7710-26d4d126a76d@redhat.com> Message-ID: <71fc11a2-ea95-766c-0d7a-2433abd9dcbc@redhat.com> Date: Tue, 27 Feb 2018 10:28:58 +0800 MIME-Version: 1.0 In-Reply-To: <86ea9887-0ea2-1f58-7710-26d4d126a76d@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 2018年02月27日 10:25, Jason Wang wrote: > > > On 2018年02月27日 08:40, Michael S. Tsirkin wrote: >>> IMHO we should consider NOT supporting XDP in receive_mergeable() at >>> all, because the principles behind XDP are to gain speed by (1) code >>> simplicity, (2) sacrificing memory and (3) where possible moving >>> runtime checks to setup time.  These principles are clearly being >>> violated in receive_mergeable(), that e.g. runtime track average >>> buffer size to save memory consumption. >>> >>> In the longer run, we should consider introducing a separate receive >>> function when attaching an XDP program, and also change the memory >>> model to be compatible with XDP when attaching an XDP prog. >> I agree with a separate function approach. >> >> So each buffer is tagged as xdp/non xdp, we check that >> and handle appropriately - where non xdp could be handled >> by the generic path. > > If we want to have separated function, should we do it for all XDP > capable drivers instead of virtio-net only? > > Thanks > What's more, since we don't stop device during XDP set. Even if a buffer is tagged as xdp/non xdp during refill, we still can't make sure whether or not XDP was used at receive function. So we can not handle them separately. Thanks