Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp154577rdb; Sun, 28 Jan 2024 19:03:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IGu0EhAKPnbhhIh9ew3hupuaX9woZ64kkZjJqdtkGA12jVRxBykQkbUp+squLZ7XQMxekeI X-Received: by 2002:a05:6a00:3d4b:b0:6db:ce79:a2f with SMTP id lp11-20020a056a003d4b00b006dbce790a2fmr1619933pfb.1.1706497434695; Sun, 28 Jan 2024 19:03:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706497434; cv=pass; d=google.com; s=arc-20160816; b=MjVpe3AjIHaJzM2kN38zOpeBb6ylo7+aHmKTI9jYkVUEspXcNLwUCnycgkgm/YBS3M IXzTsX7EOFnJsB4aRR8/rx5A7mSXe+MzuyTd9wpN/4IHG8sAq9aMZZKG6baLVNCscQeq IHU+Qt6zWchA1k0rdB3eZk+cqghWwOwlheYo4XNWNRPDEgCrvAfE+8FVgXsO+3izWi8n dwhWN8vepXUOpzCogjaXa90FYp84gKhQ/adr8fXtQvkfMuYS3LczodMxW68kDtT88Nj6 99pcqXLgNJKzEg6dMIQdWfdygAbKNBvFdxsoHzxiPtq2yRJC3PHQVkNry/KxTlUIpcQs yrFA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=hUZuM/7erQxDJnYlhTtks20R14zFZ05CUreg11QXzOM=; fh=WnvvgcMYqSP7eOEy4HwgphlmhVHDUMgATATCTWD6hks=; b=LoWRkGcHQcE+a9R3spMYTYKz2Wgxsrw1rcpQYmfucRY7jGTkVlWC6H90JrTf1a8XkI FwMqQ8CRyBP7tkVuJJlM7vNmHOzPLw7hKZJQN+sU9xvneCEQXxh+r/UJiHQpap5g7d3p nTaERiGxgq6GOwPldduxG1UdSAldFhLB92iUPhMUGH0xBgvW3hrS5+DeORac6rVLNmbi fobvlBwUwKiXmRw49b4DnVde4siQfiSS8ToUNC1/s7/MErU/cl4bpp/eIMnTUodBpuOe t0Ygff7gt9p78YpT5CcajZiUR3fVtB6CCO6SehIKZ1JpXLlUMkXhzLj++Nac3lcP/OA+ QN7g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SKdahftW; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-42114-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42114-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id v15-20020aa7850f000000b006dd984fcea1si4974077pfn.337.2024.01.28.19.03.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 19:03:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42114-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SKdahftW; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-42114-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42114-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5B6DF28315A for ; Mon, 29 Jan 2024 03:03:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 18BFE101D5; Mon, 29 Jan 2024 03:03:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SKdahftW" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB857F9F7 for ; Mon, 29 Jan 2024 03:03:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706497421; cv=none; b=YKqPg18HOBZnfqVEsdYqdDinu4o+c/ke0PEq9MXKZ3f0l/hEpVgod5MkfZwUf6xbevUase/8m3IBEjiObP64AxTP+eR40wvVAOuwaBpzlnLOGtg3770xPK4tjjl2I24NSsjggE9/wTY9jgUzVfyIf/DgXnJRO3Gg8BK3knnztX4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706497421; c=relaxed/simple; bh=hUZuM/7erQxDJnYlhTtks20R14zFZ05CUreg11QXzOM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=oHOAKAtTMKQyNYe+WN/qg0Lp5IIsof8DvboWMKOR+Hu561ObO8e/g43TopJCnzBWU6vYDU0W2uJLoW2Y1nEc28hVwmPEdHU1Ubw9oVY7eIFI3n5ySu36UiqJNMSsQsqvZjYf/2haZWT548WL0EJg6xUJr1E2VPoG5S6HwGqiM8g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=SKdahftW; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706497418; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hUZuM/7erQxDJnYlhTtks20R14zFZ05CUreg11QXzOM=; b=SKdahftWMz6S8G2jjeC0hwuSIPDbHeRpvGvjPltdTHrxQnRfhZ/ZPVlc8B/IIrsUmoDaEV 1j+sqLDxn1XCObJB0hYkpfXEw78l0G+s4wxDOCQrTruH/PQYI4IO0A9P+IPzBPV0FWluPJ rx7cbJdQHbyBnIOI2KL9oNQkGyh10Rc= Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-416-BTpQCn5gNpuPNLcSC3661Q-1; Sun, 28 Jan 2024 22:03:37 -0500 X-MC-Unique: BTpQCn5gNpuPNLcSC3661Q-1 Received: by mail-oo1-f70.google.com with SMTP id 006d021491bc7-5997417c351so1869601eaf.2 for ; Sun, 28 Jan 2024 19:03:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706497416; x=1707102216; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hUZuM/7erQxDJnYlhTtks20R14zFZ05CUreg11QXzOM=; b=bykzoqDE/aPjFtZtrT1EhNNWJeaPjoc8YtFeQtz5+iYRCwrNkuaIXksbJLJyREnbGO eQRTPcaxNo6nzovWEgo7rjBErkrUfLHj+2Lr6XxenKfJht2ft6B0oYq6Db56UKvvPJ58 jnjefovDvafMWhnTbsezopcQ+w2vFTVcbAXtsnjdAcl30D0k9bdrN7PlkGyeYL5iEunY +K1lPXR2eSlvI7OrXdjuQKyfsBeOrHGAp1aQTKmQChw03IxgzTD/e3si2zvdcUMbA7Fz j1VcG0tzPIW5cvA1YA3H7K4po/pxA3+J6OwdstN/mrBOH+SYU1Ofd1+hU3Pvu27JKpie 4h8A== X-Gm-Message-State: AOJu0Yzk1kI2bXG6MrZH3G/HADadyYRbUluqCryDfV3qUBL9sfVdXiO2 KwGJcMy7B2vhoR9tUN+6MJvP9GdaZRV6a7vwGrjBRt0nKe+zu0r8Ib+j+BYTq1ZTH6+FOk9BFpJ kRtx5Dkl2sr30wgyqHsqmtYiJekvkqCumD5pE+MhUoRhn3vJAnUGBlniaeCVupSmXkc0r923c8i wtwq4szawVpZDYIWWwS3KKptOPoq7HqeZA9Ae3 X-Received: by 2002:a05:6359:459c:b0:176:5615:3ddd with SMTP id no28-20020a056359459c00b0017656153dddmr2935236rwb.2.1706497416340; Sun, 28 Jan 2024 19:03:36 -0800 (PST) X-Received: by 2002:a05:6359:459c:b0:176:5615:3ddd with SMTP id no28-20020a056359459c00b0017656153dddmr2935224rwb.2.1706497416041; Sun, 28 Jan 2024 19:03:36 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <1706089075-16084-1-git-send-email-wangyunjian@huawei.com> In-Reply-To: From: Jason Wang Date: Mon, 29 Jan 2024 11:03:24 +0800 Message-ID: Subject: Re: [PATCH net-next 2/2] tun: AF_XDP Rx zero-copy support To: wangyunjian Cc: "mst@redhat.com" , "willemdebruijn.kernel@gmail.com" , "kuba@kernel.org" , "davem@davemloft.net" , "magnus.karlsson@intel.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "virtualization@lists.linux.dev" , xudingke Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jan 25, 2024 at 8:54=E2=80=AFPM wangyunjian wrote: > > > > > -----Original Message----- > > From: Jason Wang [mailto:jasowang@redhat.com] > > Sent: Thursday, January 25, 2024 12:49 PM > > To: wangyunjian > > Cc: mst@redhat.com; willemdebruijn.kernel@gmail.com; kuba@kernel.org; > > davem@davemloft.net; magnus.karlsson@intel.com; netdev@vger.kernel.org; > > linux-kernel@vger.kernel.org; kvm@vger.kernel.org; > > virtualization@lists.linux.dev; xudingke > > Subject: Re: [PATCH net-next 2/2] tun: AF_XDP Rx zero-copy support > > > > On Wed, Jan 24, 2024 at 5:38=E2=80=AFPM Yunjian Wang > > wrote: > > > > > > Now the zero-copy feature of AF_XDP socket is supported by some > > > drivers, which can reduce CPU utilization on the xdp program. > > > This patch set allows tun to support AF_XDP Rx zero-copy feature. > > > > > > This patch tries to address this by: > > > - Use peek_len to consume a xsk->desc and get xsk->desc length. > > > - When the tun support AF_XDP Rx zero-copy, the vq's array maybe empt= y. > > > So add a check for empty vq's array in vhost_net_buf_produce(). > > > - add XDP_SETUP_XSK_POOL and ndo_xsk_wakeup callback support > > > - add tun_put_user_desc function to copy the Rx data to VM > > > > Code explains themselves, let's explain why you need to do this. > > > > 1) why you want to use peek_len > > 2) for "vq's array", what does it mean? > > 3) from the view of TUN/TAP tun_put_user_desc() is the TX path, so I gu= ess you > > meant TX zerocopy instead of RX (as I don't see codes for > > RX?) > > OK, I agree and use TX zerocopy instead of RX zerocopy. I meant RX zeroco= py > from the view of vhost-net. Ok. > > > > > A big question is how could you handle GSO packets from userspace/guest= s? > > Now by disabling VM's TSO and csum feature. Btw, how could you do that? Thanks