From patchwork Mon Sep 7 15:02:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= X-Patchwork-Id: 261413 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=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 84C57C433E2 for ; Mon, 7 Sep 2020 15:11:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4B4722176B for ; Mon, 7 Sep 2020 15:11:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Jtd/zKbs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730114AbgIGPLN (ORCPT ); Mon, 7 Sep 2020 11:11:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730069AbgIGPCn (ORCPT ); Mon, 7 Sep 2020 11:02:43 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2754C061574; Mon, 7 Sep 2020 08:02:39 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id m8so2859678pgi.3; Mon, 07 Sep 2020 08:02:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oCwcXoLsWMukL1+vXt1yI38gQtqXVGiihrBEQpJvTYo=; b=Jtd/zKbsueQrBTL7VJ5Slx40lKB2sw3dzum3wsYwe8BUGi4ZRFsOTM/4WGNeZEu5qE 0s2kLBj/P6fuhzmqQ928pebpR1fUVFTqSdf2Hr/IJIGqVee1MBu3tx1w+p5rtMlH0cD3 1OUJfHofzV9MBSWdR22VgdLFiQJk1YxoouJ2b9L1iunUB7TlTOYILIbfQ7+YRMuSYHn1 XZWJQ2Oi7mNgfElOyCXmDuXAw5ErNN3Yx2Z84eE8AUMWnD6XWENsQWHWC8Cn5kSATaSe G3zOkE/GjyNRSQH3Gcl0ie2Y54csLZwH9wBh/0uEWuo45b1te7MdjctT8Ih24p44/fdC 07Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oCwcXoLsWMukL1+vXt1yI38gQtqXVGiihrBEQpJvTYo=; b=pUWMwtwDpQ40THk/D5rnQGWu6H7NWr7BNV/tQXxV1L/zMMesVzmYDUmRHP84tV2pnk JDMTe74Fgq2+0EzscpsohsrjZZcjdHlgdZbYOEwFzzKp5IdD1goNEkKsoE3sYzYBmwBB AuYg0ezJNUajgUz30haVeFZvk6FVtBNONiLwLm5S0fty01b4A8LTPXkZtBtlAYmUV4vz uzLGaZJT7r1C/cuaozMjq6igaaGNNM3tQacqZnJFgpGraIcMa1/83AWif7CV67ayHIJP UDmqnfdD0C2/7Qsh7GxtUDoHkIqSpwf3ibaeGJBhn9Csy/WgmUNpFRz4GwKEdJj4BOeS +MAA== X-Gm-Message-State: AOAM5315l7joYlUcZO8H9VeoETbNLpNuvwivaxhtkuaAhgU0DoaEfV1R RwzE8DeSbG1hnKRLSqPP5eo= X-Google-Smtp-Source: ABdhPJzlb0YD6IjyVjw81EJMj1W/ABvKa4l/z7cI+rhquS1hPLeA60joniP+Kj27CgcmXo4K4UtJrQ== X-Received: by 2002:a62:648c:: with SMTP id y134mr21292351pfb.114.1599490959561; Mon, 07 Sep 2020 08:02:39 -0700 (PDT) Received: from btopel-mobl.ger.intel.com ([192.55.55.43]) by smtp.gmail.com with ESMTPSA id g129sm15436022pfb.33.2020.09.07.08.02.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2020 08:02:38 -0700 (PDT) From: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= To: ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org, bpf@vger.kernel.org Cc: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , magnus.karlsson@intel.com, kuba@kernel.org, intel-wired-lan@lists.osuosl.org Subject: [PATCH bpf-next 1/4] xsk: add XSK_NAPI_WEIGHT define Date: Mon, 7 Sep 2020 17:02:14 +0200 Message-Id: <20200907150217.30888-2-bjorn.topel@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200907150217.30888-1-bjorn.topel@gmail.com> References: <20200907150217.30888-1-bjorn.topel@gmail.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Björn Töpel The NAPI budget (NAPI_POLL_WEIGHT), meaning the number of received packets that are allowed to be processed for each NAPI invocation, takes into consideration that each received packet is aimed for the kernel networking stack. That is not the case for the AF_XDP receive path, where the cost of each packet is significantly less. Therefore, this commit adds a new NAPI budget, which is the NAPI_POLL_WEIGHT scaled by 4. Typically that would be 256 in most configuration. It is encouraged that AF_XDP zero-copy capable drivers use the XSK_NAPI_WEIGHT, when zero-copy is enabled. Processing 256 packets targeted for AF_XDP is still less work than 64 (NAPI_POLL_WEIGHT) packets going to the kernel networking stack. Signed-off-by: Björn Töpel --- include/net/xdp_sock_drv.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/net/xdp_sock_drv.h b/include/net/xdp_sock_drv.h index 5b1ee8a9976d..4fc8e931d56f 100644 --- a/include/net/xdp_sock_drv.h +++ b/include/net/xdp_sock_drv.h @@ -7,8 +7,11 @@ #define _LINUX_XDP_SOCK_DRV_H #include +#include #include +#define XSK_NAPI_WEIGHT (NAPI_POLL_WEIGHT << 2) + #ifdef CONFIG_XDP_SOCKETS void xsk_tx_completed(struct xsk_buff_pool *pool, u32 nb_entries); From patchwork Mon Sep 7 15:02:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= X-Patchwork-Id: 261414 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=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 009A7C433E2 for ; Mon, 7 Sep 2020 15:05:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B43EA21789 for ; Mon, 7 Sep 2020 15:05:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NcmCsZqy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730145AbgIGPFS (ORCPT ); Mon, 7 Sep 2020 11:05:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730084AbgIGPCt (ORCPT ); Mon, 7 Sep 2020 11:02:49 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B143C061755; Mon, 7 Sep 2020 08:02:48 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id v15so8150853pgh.6; Mon, 07 Sep 2020 08:02:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oi4BSZHdphLvMn4ImifMad+2Dzg1/daPi3Jxv2xnQrs=; b=NcmCsZqyCCq+KwtlcULSkCBfkjSDbIC6YHcT/uAIpORTGHCs3JrlZ0GL17TJSobwkq n4FhtNTGrv/AnGiFZoZkLj9JY1Y+4wY4lBiOWFx7+b8yYXemJKwnsfcFpgz11t27Ik4z gaitglCZf7n37ihZLFM2alBSrmcWjaSTu4O/pDozVCCeunH1UGTKCy/7ANBQ9oaaWaSy F/il0qCN65nxGXP/lWtzxcf+vKv25+T4QP4gZyuAaBis/1TPJByNvJ8TR08rLz2KVeu1 NYaXHvlqndCRvd8KcUGC9x//1Q24d1C9Dk4NQXDXG3SqKl9cC1ucsovrAJYgxwwKKCP3 X2+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oi4BSZHdphLvMn4ImifMad+2Dzg1/daPi3Jxv2xnQrs=; b=DPKTTTT2zjR5uAEQ42bV1naxCmsANbCwM4RdHv47lLjWNqm10KFgfleWiVFZ7yoeA1 GdBAWNSp4J3VhmHh4A4tgQ7QQHnlCaN/Bbx+YVwZw13ISIrpGo7MkBK8wXu+Jc1Qdju1 e10kLvtOncWUwMzEKgmG9zQOpeaq+Fju+oJGJ0yMMxJPCfZXLz4GxyOC2NleznUtYSwy U0/m3h3wiB2JmdgepbZDNz/Tl+rG/oCyc2zvpsR9Ge12vyesqs+eTvj2oO/XM3IGMcPJ X+0gKYjDe1zUzocMx5h9Hgb68NqDpEiJsLMl1rVGsIKdnzzLuUbhXz277Kw77VqLLw43 VqaQ== X-Gm-Message-State: AOAM530hB4d98yLsLvRajzOsvr0zsDu8a/u4bxmV8TOyGeU2p1AgJ2uw pkqNa/nsBBg60t0S95t4CBs= X-Google-Smtp-Source: ABdhPJyK0Eh/ki5AGgO8dibVUfobmkKI1lVGKcG2ekDu8CgUcH2I44/GYY3jjsR8QDXg9+H8arJEZw== X-Received: by 2002:a62:14d4:: with SMTP id 203mr1508796pfu.186.1599490967814; Mon, 07 Sep 2020 08:02:47 -0700 (PDT) Received: from btopel-mobl.ger.intel.com ([192.55.55.43]) by smtp.gmail.com with ESMTPSA id g129sm15436022pfb.33.2020.09.07.08.02.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2020 08:02:47 -0700 (PDT) From: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= To: ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org, bpf@vger.kernel.org Cc: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , magnus.karlsson@intel.com, kuba@kernel.org, intel-wired-lan@lists.osuosl.org Subject: [PATCH bpf-next 3/4] ice, xsk: use XSK_NAPI_WEIGHT as NAPI poll budget Date: Mon, 7 Sep 2020 17:02:16 +0200 Message-Id: <20200907150217.30888-4-bjorn.topel@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200907150217.30888-1-bjorn.topel@gmail.com> References: <20200907150217.30888-1-bjorn.topel@gmail.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Björn Töpel Start using XSK_NAPI_WEIGHT as NAPI poll budget for the AF_XDP Rx zero-copy path. Signed-off-by: Björn Töpel --- drivers/net/ethernet/intel/ice/ice_xsk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c index 797886524054..cb473ccdf613 100644 --- a/drivers/net/ethernet/intel/ice/ice_xsk.c +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c @@ -561,7 +561,7 @@ int ice_clean_rx_irq_zc(struct ice_ring *rx_ring, int budget) unsigned int xdp_xmit = 0; bool failure = false; - while (likely(total_rx_packets < (unsigned int)budget)) { + while (likely(total_rx_packets < XSK_NAPI_WEIGHT)) { union ice_32b_rx_flex_desc *rx_desc; unsigned int size, xdp_res = 0; struct ice_rx_buf *rx_buf;