From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4636BC48BE8 for ; Thu, 17 Jun 2021 03:24:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2002B613E4 for ; Thu, 17 Jun 2021 03:24:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229502AbhFQD0O (ORCPT ); Wed, 16 Jun 2021 23:26:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52036 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229709AbhFQD0O (ORCPT ); Wed, 16 Jun 2021 23:26:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623900246; 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=P2YA3pPwX5KufYHZusNwV1Ms/tC5NgvQ2lY4eCYE9qw=; b=DSCD6Depk82GdWEIyvmUobkMAaJaDhM7Qd/F7TAe4KoN2RHY9nEcIsiLY2kKOVDfMQ9l89 qDr64J2Vd7TuKOE9n8aJt7zZ2UnKIBqSF+Pxyb6q2KRQbgE7b/qnqM62wt9dOQtzzQ3EXV JGHm5NSnK+dwMSRhaKdK1Yes+KFtPzo= Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-581-QitVxbTuPVu9yGmfXdP56g-1; Wed, 16 Jun 2021 23:24:05 -0400 X-MC-Unique: QitVxbTuPVu9yGmfXdP56g-1 Received: by mail-pl1-f200.google.com with SMTP id bh7-20020a170902a987b029011744126551so1150368plb.3 for ; Wed, 16 Jun 2021 20:24:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=P2YA3pPwX5KufYHZusNwV1Ms/tC5NgvQ2lY4eCYE9qw=; b=XN0Vs2dYL/YQHCP6EWm2BA+qqB1gpwh+XwInKa4Z7y8B5a7U2E8w1McAuyTQ+aD8Kz hx/BQln9JkhuUnZg0yQ0bX4P8sTFJw+lYXZpBhToacsQlE38ByvL54mzJzjY6AP6rb+I qos6pfWBUTAxkJiltZDWFGJuwjmrTHsgqzzN0SSUXeAsUdItfcN+uRjYg/GvbDDiuLTo xNa89zdVBmI/NP6aMn3LF+VFOrM6KMQkjtkcH3N6rIQyY88tGYPhzK0wh+DlfLX4xPXj rLR+j0opnF6rEy3daOmK9r6G+Dh/t3SZJPaWI6fs8N0GPB6HlGZY/cc3K4+KrA70wxXo up3A== X-Gm-Message-State: AOAM532WUkMrQKrc2m+Sp4x08Xw4mOi31xk/r4Cj76VRDQfaF8/p/6zT rPiTUFSXGJqJTHgFJ4NqDJ9SqzHLmZrv4Vn0OPDKJf7/2SHtn3Sr1JSv6x5Fbag1L/XgCtqh6FZ W6PHkUX7/40vS X-Received: by 2002:a62:800d:0:b029:2f0:fe27:2935 with SMTP id j13-20020a62800d0000b02902f0fe272935mr3108396pfd.15.1623900244007; Wed, 16 Jun 2021 20:24:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLsgZLhkeGRgsw9sNEy2BSQC7XLsAdd6KI8S9BIqhLUelD+ESONzXLb6Bkzo6ZqDFo4Y+zFQ== X-Received: by 2002:a62:800d:0:b029:2f0:fe27:2935 with SMTP id j13-20020a62800d0000b02902f0fe272935mr3108370pfd.15.1623900243689; Wed, 16 Jun 2021 20:24:03 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id y20sm3880550pfb.207.2021.06.16.20.23.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Jun 2021 20:24:03 -0700 (PDT) Subject: Re: [PATCH net-next v5 13/15] virtio-net: support AF_XDP zc rx To: Xuan Zhuo , netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , "Michael S. Tsirkin" , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Jonathan Lemon , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , virtualization@lists.linux-foundation.org, bpf@vger.kernel.org, "dust . li" References: <20210610082209.91487-1-xuanzhuo@linux.alibaba.com> <20210610082209.91487-14-xuanzhuo@linux.alibaba.com> From: Jason Wang Message-ID: Date: Thu, 17 Jun 2021 11:23:52 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210610082209.91487-14-xuanzhuo@linux.alibaba.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org ÔÚ 2021/6/10 ÏÂÎç4:22, Xuan Zhuo дµÀ: > Compared to the case of xsk tx, the case of xsk zc rx is more > complicated. > > When we process the buf received by vq, we may encounter ordinary > buffers, or xsk buffers. What makes the situation more complicated is > that in the case of mergeable, when num_buffer > 1, we may still > encounter the case where xsk buffer is mixed with ordinary buffer. > > Another thing that makes the situation more complicated is that when we > get an xsk buffer from vq, the xsk bound to this xsk buffer may have > been unbound. > > Signed-off-by: Xuan Zhuo This is somehow similar to the case of tx where we don't have per vq reset. [...] > > - if (vi->mergeable_rx_bufs) > + if (is_xsk_ctx(ctx)) > + skb = receive_xsk(dev, vi, rq, buf, len, xdp_xmit, stats); > + else if (vi->mergeable_rx_bufs) > skb = receive_mergeable(dev, vi, rq, buf, ctx, len, xdp_xmit, > stats); > else if (vi->big_packets) > @@ -1175,6 +1296,14 @@ static bool try_fill_recv(struct virtnet_info *vi, struct receive_queue *rq, > int err; > bool oom; > > + /* Because virtio-net does not yet support flow direct, Note that this is not the case any more. RSS has been supported by virtio spec and qemu/vhost/tap now. We just need some work on the virtio-net driver part (e.g the ethool interface). Thanks From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_RED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B876C49361 for ; Thu, 17 Jun 2021 03:24:14 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F0FC5613EA for ; Thu, 17 Jun 2021 03:24:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0FC5613EA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=virtualization-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id B7CE960B5B; Thu, 17 Jun 2021 03:24:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hti6CvVOXS1p; Thu, 17 Jun 2021 03:24:13 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 6D19760B52; Thu, 17 Jun 2021 03:24:12 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2D2BBC000D; Thu, 17 Jun 2021 03:24:12 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id D420CC000B for ; Thu, 17 Jun 2021 03:24:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id C1E5641480 for ; Thu, 17 Jun 2021 03:24:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1kI8-GNOjm0A for ; Thu, 17 Jun 2021 03:24:09 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 621CA4059F for ; Thu, 17 Jun 2021 03:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623900248; 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=P2YA3pPwX5KufYHZusNwV1Ms/tC5NgvQ2lY4eCYE9qw=; b=QSqNCHuEAtA3FhSjsUuZj94XJnk4KnbwRAPGKQ84qqNZoMwrn1TdOmaEdxTzKsnECcwXnT 0xC2vipfpwaLKmcFNpJXTgpsvQZhHqbqBVidEgRxFJaG07iaKx7M8yCWEfZe40AyqYEZ/p VysM077xLk+2o2xODLN7m28bRZUz568= Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-296-p1-mwnDJO6qPnRh0lZko2A-1; Wed, 16 Jun 2021 23:24:05 -0400 X-MC-Unique: p1-mwnDJO6qPnRh0lZko2A-1 Received: by mail-pf1-f197.google.com with SMTP id r15-20020a62e40f0000b02902ec871096d3so2887024pfh.12 for ; Wed, 16 Jun 2021 20:24:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=P2YA3pPwX5KufYHZusNwV1Ms/tC5NgvQ2lY4eCYE9qw=; b=srwJ4moezeoA50rbrvO0viRG4IK9O0q2+aHj8A9WUuP3Xt412zZ7azo7wbY2F1ilMb QpPpNHgo9ju3WIA9/xTndqNDQsF/onhBQKutYFXddyYTrobOvSEXp8SWj3HMfJSYCAZA J5Ck4WiPdjyhVow7KzRBnhU9HMhlMGoflKpr0vwkIrTowxYh3h2vwojMy2OPYfZMXl1B r+jN81dCHEm8qCmr1HAc8v449IqFLs801DisUvxIsAM0fz+bVsSBwLYZ0AcxRYnsyAhm etK4GwGtea/LcH8yxve1OWtWeUYlicGqnYkJi4wQCBaQ9Bu6/0kSKN47Zr/rba+gLK8a /pLQ== X-Gm-Message-State: AOAM531Vex/tRABxk3/WbiSjXelTjQCyxlNfYP6smxwqJZXmiKGzfjHA v27FyXW3qp5wDK9YE/ZigwKdRg/QmzHiqUWTZaKGmfNn5K0cUqymlbjnFkaYXXfAdAeEXiGN6wF Om6gGtUzGhnI3VW3Hn2En+pLIKo2HWYJvbIgNBZhKuQ== X-Received: by 2002:a62:800d:0:b029:2f0:fe27:2935 with SMTP id j13-20020a62800d0000b02902f0fe272935mr3108407pfd.15.1623900244010; Wed, 16 Jun 2021 20:24:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLsgZLhkeGRgsw9sNEy2BSQC7XLsAdd6KI8S9BIqhLUelD+ESONzXLb6Bkzo6ZqDFo4Y+zFQ== X-Received: by 2002:a62:800d:0:b029:2f0:fe27:2935 with SMTP id j13-20020a62800d0000b02902f0fe272935mr3108370pfd.15.1623900243689; Wed, 16 Jun 2021 20:24:03 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id y20sm3880550pfb.207.2021.06.16.20.23.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Jun 2021 20:24:03 -0700 (PDT) Subject: Re: [PATCH net-next v5 13/15] virtio-net: support AF_XDP zc rx To: Xuan Zhuo , netdev@vger.kernel.org References: <20210610082209.91487-1-xuanzhuo@linux.alibaba.com> <20210610082209.91487-14-xuanzhuo@linux.alibaba.com> From: Jason Wang Message-ID: Date: Thu, 17 Jun 2021 11:23:52 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210610082209.91487-14-xuanzhuo@linux.alibaba.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jasowang@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Cc: Song Liu , Martin KaFai Lau , Jesper Dangaard Brouer , Daniel Borkmann , "Michael S. Tsirkin" , Yonghong Song , John Fastabend , Alexei Starovoitov , Andrii Nakryiko , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , "dust . li" , Jonathan Lemon , KP Singh , Jakub Kicinski , bpf@vger.kernel.org, virtualization@lists.linux-foundation.org, "David S. Miller" , Magnus Karlsson X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: base64 Content-Type: text/plain; charset="gbk"; Format="flowed" Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" CtTaIDIwMjEvNi8xMCDPws7nNDoyMiwgWHVhbiBaaHVvINC0tcA6Cj4gQ29tcGFyZWQgdG8gdGhl IGNhc2Ugb2YgeHNrIHR4LCB0aGUgY2FzZSBvZiB4c2sgemMgcnggaXMgbW9yZQo+IGNvbXBsaWNh dGVkLgo+Cj4gV2hlbiB3ZSBwcm9jZXNzIHRoZSBidWYgcmVjZWl2ZWQgYnkgdnEsIHdlIG1heSBl bmNvdW50ZXIgb3JkaW5hcnkKPiBidWZmZXJzLCBvciB4c2sgYnVmZmVycy4gV2hhdCBtYWtlcyB0 aGUgc2l0dWF0aW9uIG1vcmUgY29tcGxpY2F0ZWQgaXMKPiB0aGF0IGluIHRoZSBjYXNlIG9mIG1l cmdlYWJsZSwgd2hlbiBudW1fYnVmZmVyID4gMSwgd2UgbWF5IHN0aWxsCj4gZW5jb3VudGVyIHRo ZSBjYXNlIHdoZXJlIHhzayBidWZmZXIgaXMgbWl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