Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4518963ooa; Tue, 14 Aug 2018 07:05:02 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwv/WV2d4RUZOn1b8uey2ENUJbylhQYWIwer1iAC3WlCdPQCvswElQ4oNwTfoj1lKoaSfEN X-Received: by 2002:a17:902:ac96:: with SMTP id h22-v6mr20667641plr.17.1534255502116; Tue, 14 Aug 2018 07:05:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534255502; cv=none; d=google.com; s=arc-20160816; b=FNJ+Fo2BRGSAPpLLqp3yEa+fp0ElQNer4sXExxO1H+D09YZD3OXc/mj7TXSrchSJ3Y pvy4Ir4QKR0ViODlr3sG8S8pO8kb5T5S2bPYjueB3PRavaYMRml6y8Ic0zGFOMpfNqw7 47NCa8NqKSXhDIOWpK4hzq/4tLV8MArDDIMxWKPqmsnWtbG0olQjF4CjsZlcaNCpaHth Z/1bgTfnxpeK/kkwNVPZVQrEc54qb2NgLn0CDzu41WeE9Bol5MUDqRALwDf9/vVjVNXh V7A03T3X3YU2k17jOwdld4sP2pYBoc0myLsWOv690ErunMcvWMsPIFVUEL9aZdbfwJVk TAmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=P6rpk0HA4b8AjI6HBZ6tFxmj/RPHBJFN2ReN88/d4L0=; b=NKaPcNjlucsPKCNw9rhbz3vta6kZ86Rdr00DoUDuU6u1ZI63ONuj+Zpy/sp2+qO5Sr P57iBmYTirUCcwHSh1w+SocY6TirwcD2DjZor8Lcdy/AG0pGSado9FoZzqYIaeB770b1 P6mNY93GX8PtJ1EgnwpyPBWZjZcKL/BozIvUWBTRJA+dfqg+mD8iD4IVeATsfbhFAcGX bhcpR6b5ekH2isj4rvn/3A4Ur+y7HSw7BuppsdB/9Z5ySZi2Jxj8KGlML6dd5wI3/0K5 JWp+tNkQ/PTngG47H/ZuxunUvXK8ASUwi1QjAkyXgfItELisbWW7I1EtGvcKctt9cTAi 9WzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i3-v6si16545770pld.454.2018.08.14.07.04.32; Tue, 14 Aug 2018 07:05:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732581AbeHNPsX (ORCPT + 99 others); Tue, 14 Aug 2018 11:48:23 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60226 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729472AbeHNPsX (ORCPT ); Tue, 14 Aug 2018 11:48:23 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 76EE5402315B; Tue, 14 Aug 2018 13:01:17 +0000 (UTC) Received: from [10.72.12.152] (ovpn-12-152.pek2.redhat.com [10.72.12.152]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D9B642156712; Tue, 14 Aug 2018 13:01:14 +0000 (UTC) Subject: Re: [RFC PATCH net-next V2 6/6] virtio-net: support XDP rx handler To: Jesper Dangaard Brouer Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, mst@redhat.com References: <1534130250-5302-1-git-send-email-jasowang@redhat.com> <1534130250-5302-7-git-send-email-jasowang@redhat.com> <20180814112222.42177a24@redhat.com> From: Jason Wang Message-ID: Date: Tue, 14 Aug 2018 21:01:10 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180814112222.42177a24@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 14 Aug 2018 13:01:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 14 Aug 2018 13:01:17 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jasowang@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018年08月14日 17:22, Jesper Dangaard Brouer wrote: > On Mon, 13 Aug 2018 11:17:30 +0800 > Jason Wang wrote: > >> This patch tries to add the support of XDP rx handler to >> virtio-net. This is straight-forward, just call xdp_do_pass() and >> behave depends on its return value. >> >> Test was done by using XDP_DROP (xdp1) for macvlan on top of >> virtio-net. PPS of SKB mode was ~1.2Mpps while PPS of native XDP mode >> was ~2.2Mpps. About 83% improvement was measured. > I'm not convinced... > > Why are you not using XDP_REDIRECT, which is already implemented in > receive_mergeable (which you modify below). > > The macvlan driver just need to implement ndo_xdp_xmit(), and then you > can redirect (with XDP prog from physical driver into the guest). It > should be much faster... > > Macvlan is different from macvtap. For host RX, macvtap deliver the packet to a pointer ring which could be accessed through a socket but macvlan deliver the packet to the normal networking stack. As an example of XDP rx handler, this series just try to make native XDP works for macvlan, macvtap path will still go for skb (but it's not hard to add it on top). Consider the case of fast forwarding between host and guest. For TAP, XDP_REDIRECT works perfectly since from the host point of view, host RX is guest TX and host guest RX is host TX. But for macvtap which is based on macvlan, transmitting packet to macvtap/macvlan means transmitting packets to under layer device which is either a physical NIC or another macvlan device. That's why we can't use XDP_REDIRECT with ndo_xdp_xmit(). Thanks