Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3371957pxm; Mon, 28 Feb 2022 18:50:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxMF8hHKr7b2+UWiucmejLWcn8ro6BpxFSicKLBmfZz8XZ5N1/r/uRTBXYYErW0FHwODfHM X-Received: by 2002:a17:903:1cc:b0:151:3e13:e2a1 with SMTP id e12-20020a17090301cc00b001513e13e2a1mr16955100plh.52.1646103004671; Mon, 28 Feb 2022 18:50:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646103004; cv=none; d=google.com; s=arc-20160816; b=RMDKwkNW0HrLDPQefAhxG5H8hT77UwjrGVnepIV8g2DeZvAsHpNXOTB3Lu7QhJSC5P L+LVzrdmQkD/qbr4ufy3hPOqSSoGMEB48kCe6/Pw0wKdbyJrO4/vvLz1/DUfUiilYQD/ zMqG2gJES0kNsqDGf9AMt505uWfzliOec7a78pSLnyu/EHa6YO5QPsvrCulLpv+QslpO zz9z+8IxR/xvRGmdHi+OSnHhtA436jlVqZc+yB6BvIhyQBW//hKXenSkF6x0XcO8KG4L H1V9wA8YwcP/NQPGJa0BCygrAKxzX0uJpY+NJYEOtUzBcZ2ndQvqewetabIX7ZLSd31Q TKQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=wQuhZUQchvRiqxYfZ/2ecxKW7Ujm6li2s4k5X8wdVJs=; b=IZZo0ARs897ejhZyF3JU8TNCklahtbVWpELIb9Yrenef3+JSB8Hj2bEmemNBw6yIZg yMbTl7x8mE8C9lzVKjr/LqfjJaBjcv6eBdptFwa5H7Kero3bpQBUk6/s7VQqbNc5CKq9 Px7hOjSl3GNtmJOBw9abTe5WAHWUCT3ugs0LwsTwhkUrTMhlqehWQZDhie55FaolQncg h9MM7O5+9TR14vVmFpBAJDkNYBQ2yBq9QX5HEbgT+f2DY+YzW+6x2gWtth8oJcoQnoys Jg00kchQnQ64Bl60X3K56Byk0b2YlbPtoa3XZn+v0fxG1+2zECMDBR5x3eN5AX7yxbjV 2LAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Aw8mcqgC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e16-20020a17090301d000b0014d682a1826si12380189plh.23.2022.02.28.18.49.47; Mon, 28 Feb 2022 18:50:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Aw8mcqgC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231922AbiCAB7d (ORCPT + 99 others); Mon, 28 Feb 2022 20:59:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231997AbiCAB7b (ORCPT ); Mon, 28 Feb 2022 20:59:31 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D2F6245AE; Mon, 28 Feb 2022 17:58:51 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id g21so6452488pfj.11; Mon, 28 Feb 2022 17:58:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wQuhZUQchvRiqxYfZ/2ecxKW7Ujm6li2s4k5X8wdVJs=; b=Aw8mcqgCxaTZhLI6sConqAzLqNdcyQ90JXNy9afK9cEixRTnqevGJOFRwkMD58lOZc kqpIquZtf1gf2BQmhSGa3V5WxNAW2B/O1fNa11vuZbZcrFH4fMQbjC719nIWMbCmANy1 Ml/BvzX13V9gH+2H/k3vs/KqaLJ5dPD/6X770yLypzdhDspj4Zw96YvJF4WWgNttOURn uHiY+5RffpXfRLzymJh9gx/waQD3KMx1Ymt04RXXEz0vSXlNqE+qK9mSX2fqcBWK8w47 Sr4Rojo9mVWucgBOAPrDo+m1NVnKVzCfFECYv1j6xhb1PW0JVhEjpdfT7WWM13II+Xrv FIxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wQuhZUQchvRiqxYfZ/2ecxKW7Ujm6li2s4k5X8wdVJs=; b=l0v/VDXmwEskroGMLD8HaOaty+FddccGIiYRPHnzlGspIDDCFFV7l1Rewpc5S8aha/ hx/xI834Z4xCpYPplEvsAcArnmoDbnw3JDoLhFriFYwyIawFegZobV2xXZ+XqZKisA9K /1jRZdYue38F2nqC5b+23Eb5yNEIEWVy1JYDIacXU7w69C947jTjz/RX+9UUZ5msED8B tmDIGZiJ8/Cb5B/umZvNvHAaJEYhFyD/knA+7KY54JU0hhlJq4OM51TJNvSi/a7WeOu6 Doqkrsr6wkCyHclJpP9dQ6mMdc2zid1cGq9MfIpTPqGxyIS11nUPO2HSXF+aF1YHQLqw KR1Q== X-Gm-Message-State: AOAM532atfS85tHkS0OrM/mcgd6F/R+7SE1XozN+H3LohCseLH6jpMNT JG2B2Ge7FnRh3+VhSOYGiszptpYcFxyz0q07Oys= X-Received: by 2002:a63:451d:0:b0:378:dead:f66b with SMTP id s29-20020a63451d000000b00378deadf66bmr1605809pga.150.1646099930872; Mon, 28 Feb 2022 17:58:50 -0800 (PST) MIME-Version: 1.0 References: <20220224103852.311369-1-baymaxhuang@gmail.com> <20220228033805.1579435-1-baymaxhuang@gmail.com> <20220228091539.057c80ef@hermes.local> In-Reply-To: <20220228091539.057c80ef@hermes.local> From: Harold Huang Date: Tue, 1 Mar 2022 09:58:39 +0800 Message-ID: Subject: Re: [PATCH net-next v3] tun: support NAPI for packets received from batched XDP buffs To: stephen@networkplumber.org Cc: Jason Wang , netdev , Paolo Abeni , "David S. Miller" , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , open list , "open list:XDP (eXpress Data Path)" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 1, 2022 at 1:15 AM Stephen Hemminger wrote: > > On Mon, 28 Feb 2022 15:46:56 +0800 > Jason Wang wrote: > > > On Mon, Feb 28, 2022 at 11:38 AM Harold Huang wrote: > > > > > > In tun, NAPI is supported and we can also use NAPI in the path of > > > batched XDP buffs to accelerate packet processing. What is more, after > > > we use NAPI, GRO is also supported. The iperf shows that the throughput of > > > single stream could be improved from 4.5Gbps to 9.2Gbps. Additionally, 9.2 > > > Gbps nearly reachs the line speed of the phy nic and there is still about > > > 15% idle cpu core remaining on the vhost thread. > > > > > > Test topology: > > > [iperf server]<--->tap<--->dpdk testpmd<--->phy nic<--->[iperf client] > > > > > > Iperf stream: > > > iperf3 -c 10.0.0.2 -i 1 -t 10 > > > > > > Before: > > > ... > > > [ 5] 5.00-6.00 sec 558 MBytes 4.68 Gbits/sec 0 1.50 MBytes > > > [ 5] 6.00-7.00 sec 556 MBytes 4.67 Gbits/sec 1 1.35 MBytes > > > [ 5] 7.00-8.00 sec 556 MBytes 4.67 Gbits/sec 2 1.18 MBytes > > > [ 5] 8.00-9.00 sec 559 MBytes 4.69 Gbits/sec 0 1.48 MBytes > > > [ 5] 9.00-10.00 sec 556 MBytes 4.67 Gbits/sec 1 1.33 MBytes > > > - - - - - - - - - - - - - - - - - - - - - - - - - > > > [ ID] Interval Transfer Bitrate Retr > > > [ 5] 0.00-10.00 sec 5.39 GBytes 4.63 Gbits/sec 72 sender > > > [ 5] 0.00-10.04 sec 5.39 GBytes 4.61 Gbits/sec receiver > > > > > > After: > > > ... > > > [ 5] 5.00-6.00 sec 1.07 GBytes 9.19 Gbits/sec 0 1.55 MBytes > > > [ 5] 6.00-7.00 sec 1.08 GBytes 9.30 Gbits/sec 0 1.63 MBytes > > > [ 5] 7.00-8.00 sec 1.08 GBytes 9.25 Gbits/sec 0 1.72 MBytes > > > [ 5] 8.00-9.00 sec 1.08 GBytes 9.25 Gbits/sec 77 1.31 MBytes > > > [ 5] 9.00-10.00 sec 1.08 GBytes 9.24 Gbits/sec 0 1.48 MBytes > > > - - - - - - - - - - - - - - - - - - - - - - - - - > > > [ ID] Interval Transfer Bitrate Retr > > > [ 5] 0.00-10.00 sec 10.8 GBytes 9.28 Gbits/sec 166 sender > > > [ 5] 0.00-10.04 sec 10.8 GBytes 9.24 Gbits/sec receiver > > > > > > Reported-at: https://lore.kernel.org/all/CACGkMEvTLG0Ayg+TtbN4q4pPW-ycgCCs3sC3-TF8cuRTf7Pp1A@mail.gmail.com > > > Signed-off-by: Harold Huang > > > > Acked-by: Jason Wang > > Would this help when using sendmmsg and recvmmsg on the TAP device? > Asking because interested in speeding up another use of TAP device, and wondering > if this would help. As Jason said, sendmmsg()/recvmsg() could not be used on tuntap. But I think another choice is to use writev/readv directly on the ttunap fd, which will call tun_get_user to send msg and NAPI has also been supported.