From patchwork Fri Dec 17 19:35:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Damato X-Patchwork-Id: 1570300 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=fastly.com header.i=@fastly.com header.a=rsa-sha256 header.s=google header.b=TmvT+/sg; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JFzn869szz9sXM for ; Sat, 18 Dec 2021 06:38:52 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 72F3A41FEF; Fri, 17 Dec 2021 19:38:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org 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 HQHHVygdyhnx; Fri, 17 Dec 2021 19:38:49 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 7B62941FA4; Fri, 17 Dec 2021 19:38:49 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 6C83F1BF35E for ; Fri, 17 Dec 2021 19:37:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 5B8FD41F63 for ; Fri, 17 Dec 2021 19:37:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org 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 B_kdhWqqBAUN for ; Fri, 17 Dec 2021 19:37:41 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by smtp4.osuosl.org (Postfix) with ESMTPS id D60CD41F5D for ; Fri, 17 Dec 2021 19:37:41 +0000 (UTC) Received: by mail-pl1-x62c.google.com with SMTP id c6so2723592plg.3 for ; Fri, 17 Dec 2021 11:37:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8Ll/megliBvnHirIhlfhf9sv9I4xbL9uGA2hDg8OW1A=; b=TmvT+/sgG176ULevcaTCaQSKC/MIsri+Ce63wECSpDGjtrbIGrUKIGI93nNH1Q/eHL Vy8yRQKJCPlVboWCHKjzxEWhI+PQA2itzHJDHsirkZQdihcgJSq3me152OPVKqzjNa/E U+uNWJVeRz3sQ/+/9lhDd35/FptBhiYkWlGKE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8Ll/megliBvnHirIhlfhf9sv9I4xbL9uGA2hDg8OW1A=; b=Tk2hWQrP6iGl1nfC+ZW4eP+HnTEXMWLewnvrkRsvwSvLtfzvYvO3qP6ciDWQZ2o3Aw divEEQWFwJ9zio7j/MNgz1S9PVhGeB+1TBVB06SjSfeSdhO7r+55NUJ12LDMyOJLW6PA lHlGeuoEQ1pOKaFU0y98sZbB4Gm2MfFIDAsDFnvTsJXam0FJnv2Oh7Wh6grvE2lGiWw/ 8RuQ4BqPcU3+kLP9mi9rV+ztewtPP5WODiVxpCcQ95gc7mA7YGcx5ewInHhuQmhKAVaD iygpmHdjHKv1qdQ6iiuVDV8JktHrE8JccXoSJYZ69qfi/deSz7448kW1h3WFE2KX9t0P Yg1Q== X-Gm-Message-State: AOAM530t8z9tyLDAniokgyInfD8EZg41x+PLUaVz4X9fxzRhJnQoRkgp Er6+COaln4iO/rnOs1EXBRmeh2ym+jC+kyBx+RKB4s8gMHgCryTssoEtef95QoQzg5EFVUNMT3B FgwomhnnfbCHtNt6MYAnTzbzWSybnA2sEyOksMAwmvkH78/HPbD1skbPThyENx13As6DHGLzQtg wdtW2qqNOk X-Google-Smtp-Source: ABdhPJyNLB11PC9qokBMjL7Vnc9kxb8RmrsSSO81oUC2Jl5FNkjQa1Zj+tNLjbBJCm6SDn/3iABh9w== X-Received: by 2002:a17:90b:128b:: with SMTP id fw11mr1483215pjb.146.1639769860870; Fri, 17 Dec 2021 11:37:40 -0800 (PST) Received: from localhost.localdomain (c-73-223-190-181.hsd1.ca.comcast.net. [73.223.190.181]) by smtp.gmail.com with ESMTPSA id o17sm8783294pgb.42.2021.12.17.11.37.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Dec 2021 11:37:40 -0800 (PST) From: Joe Damato To: intel-wired-lan@lists.osuosl.org Date: Fri, 17 Dec 2021 11:35:15 -0800 Message-Id: <1639769719-81285-2-git-send-email-jdamato@fastly.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1639769719-81285-1-git-send-email-jdamato@fastly.com> References: <1639769719-81285-1-git-send-email-jdamato@fastly.com> X-Mailman-Approved-At: Fri, 17 Dec 2021 19:38:44 +0000 Subject: [Intel-wired-lan] [net-queue, v2, 1/5] i40e: Remove rx page reuse double count. X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kuba@kernel.org, Joe Damato MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Page reuse was being tracked from two locations: - i40e_reuse_rx_page (via 40e_clean_rx_irq), and - i40e_alloc_mapped_page Remove the double count and only count reuse from i40e_alloc_mapped_page when the page is about to be reused. Signed-off-by: Joe Damato Tested-By: Dave Switzer --- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 10a83e5..8b3ffb7 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -1382,8 +1382,6 @@ static void i40e_reuse_rx_page(struct i40e_ring *rx_ring, new_buff->page_offset = old_buff->page_offset; new_buff->pagecnt_bias = old_buff->pagecnt_bias; - rx_ring->rx_stats.page_reuse_count++; - /* clear contents of buffer_info */ old_buff->page = NULL; } From patchwork Fri Dec 17 19:35:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Damato X-Patchwork-Id: 1570301 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=fastly.com header.i=@fastly.com header.a=rsa-sha256 header.s=google header.b=V3xfBsqI; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JFznD64pLz9sXM for ; Sat, 18 Dec 2021 06:38:56 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 5B4E542031; Fri, 17 Dec 2021 19:38:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org 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 FREZGE50VuWi; Fri, 17 Dec 2021 19:38:53 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 437C942136; Fri, 17 Dec 2021 19:38:53 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 2A4F91BF35E for ; Fri, 17 Dec 2021 19:37:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 240BC40579 for ; Fri, 17 Dec 2021 19:37:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=fastly.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id two_tgG252PQ for ; Fri, 17 Dec 2021 19:37:43 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by smtp2.osuosl.org (Postfix) with ESMTPS id 4B3D7404A9 for ; Fri, 17 Dec 2021 19:37:43 +0000 (UTC) Received: by mail-pj1-x102b.google.com with SMTP id mj19so3154532pjb.3 for ; Fri, 17 Dec 2021 11:37:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZgtVJVvnbACKc4Enb0x5ug683st5CGBAW37lbrDODgg=; b=V3xfBsqI1or3ZNQF/VUEQptSRn7k2NGNuVYrkTJXWNsFnxIXyI+eTnfEY9oP8uRjtF ZlgXjV5Ss2yNAi9IaGEP6sxc52IbOshmR48uvYAzaYe8ArY4cN6EIn0HT/vvenBz4RyY ZSQSxKTDUrQPrOVzKSGQTezQCZDKQQ/qk2RxE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZgtVJVvnbACKc4Enb0x5ug683st5CGBAW37lbrDODgg=; b=l1Fwk3WGLvUQ4duFffafFwTzFnNwqG6HzkHQyWIfbq6YiyTN4RwV0meXSdiNDxxnxs VTK3Bcv/K54IZ5xnGtp4aa0i0IwNCyYi0r+4FE9jhzfLnFfHVK4/EhyCjVsZBz+Wopmm JGv27RbYMktkKWGCVMVh+ivUBl89u5IoiR0cw3q7WEapFE3FI5cg87KBTUth/WKe/1+T lNW2rihRSL5eNjNose/E5yqJdiPlzPcSDgq4m0Qb8G57wXYUkk+Q2Pum4cQFYipEJSav qgYLT9AcYOXzcwirT0C6t8okCrR6hrXbWtuOqJQ1mosZ58wnnVxKhhCniSKPIks/zyMg ftCg== X-Gm-Message-State: AOAM531q2tZGe6pIZjcyItllbO4q/pwwJs/sueJCEuuc+4uAthSv9Ko+ 1vLTVFAm2ykWLy+dY7L6G6djlrj8dcymHRtLs320KH95s7WOMVFybvRHg3HzLqfynqRo/CwyQxZ lUwZQ0ohFCRzQI4UaRs1AeHm1QFD1YQnIqCag6H1xW6Bc0amLEVZzTEYSVkkVQ4Pwp++jl3NeZs jRqzDhMi2i X-Google-Smtp-Source: ABdhPJxP9fkfy2DXNwlZ6Sbw9S1xEd6veGpbZbhPxIZn4qaSiaNiIojIQhNqozT7z0dgrw4Q56+WXA== X-Received: by 2002:a17:90a:fa88:: with SMTP id cu8mr3435776pjb.143.1639769862226; Fri, 17 Dec 2021 11:37:42 -0800 (PST) Received: from localhost.localdomain (c-73-223-190-181.hsd1.ca.comcast.net. [73.223.190.181]) by smtp.gmail.com with ESMTPSA id o17sm8783294pgb.42.2021.12.17.11.37.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Dec 2021 11:37:41 -0800 (PST) From: Joe Damato To: intel-wired-lan@lists.osuosl.org Date: Fri, 17 Dec 2021 11:35:16 -0800 Message-Id: <1639769719-81285-3-git-send-email-jdamato@fastly.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1639769719-81285-1-git-send-email-jdamato@fastly.com> References: <1639769719-81285-1-git-send-email-jdamato@fastly.com> X-Mailman-Approved-At: Fri, 17 Dec 2021 19:38:44 +0000 Subject: [Intel-wired-lan] [net-queue, v2, 2/5] i40e: Aggregate and export RX page reuse stat. X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kuba@kernel.org, Joe Damato MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" rx page reuse was already being tracked by the i40e driver per RX ring. Aggregate the counts and make them accessible via ethtool. Signed-off-by: Joe Damato Tested-By: Dave Switzer --- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 1 + drivers/net/ethernet/intel/i40e/i40e_main.c | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index 7f40f87..b61f17bf 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h @@ -853,6 +853,7 @@ struct i40e_vsi { u64 tx_force_wb; u64 rx_buf_failed; u64 rx_page_failed; + u64 rx_page_reuse; /* These are containers of ring pointers, allocated at run-time */ struct i40e_ring **rx_rings; diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index 513ba69..ceb0d5f 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c @@ -295,6 +295,7 @@ static const struct i40e_stats i40e_gstrings_misc_stats[] = { I40E_VSI_STAT("tx_busy", tx_busy), I40E_VSI_STAT("rx_alloc_fail", rx_buf_failed), I40E_VSI_STAT("rx_pg_alloc_fail", rx_page_failed), + I40E_VSI_STAT("rx_cache_reuse", rx_page_reuse), }; /* These PF_STATs might look like duplicates of some NETDEV_STATs, diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 4ff1c9b..6d3b0bc 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -812,7 +812,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) struct i40e_eth_stats *es; /* device's eth stats */ u64 tx_restart, tx_busy; struct i40e_ring *p; - u64 rx_page, rx_buf; + u64 rx_page, rx_buf, rx_reuse; u64 bytes, packets; unsigned int start; u64 tx_linearize; @@ -838,6 +838,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) tx_restart = tx_busy = tx_linearize = tx_force_wb = 0; rx_page = 0; rx_buf = 0; + rx_reuse = 0; rcu_read_lock(); for (q = 0; q < vsi->num_queue_pairs; q++) { /* locate Tx ring */ @@ -871,6 +872,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) rx_p += packets; rx_buf += p->rx_stats.alloc_buff_failed; rx_page += p->rx_stats.alloc_page_failed; + rx_reuse += p->rx_stats.page_reuse_count; if (i40e_enabled_xdp_vsi(vsi)) { /* locate XDP ring */ @@ -898,6 +900,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) vsi->tx_force_wb = tx_force_wb; vsi->rx_page_failed = rx_page; vsi->rx_buf_failed = rx_buf; + vsi->rx_page_reuse = rx_reuse; ns->rx_packets = rx_p; ns->rx_bytes = rx_b; From patchwork Fri Dec 17 19:35:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Damato X-Patchwork-Id: 1570302 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=fastly.com header.i=@fastly.com header.a=rsa-sha256 header.s=google header.b=ilmibtt+; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JFznJ3ZsPz9sXM for ; Sat, 18 Dec 2021 06:39:00 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 2CBAF41FEF; Fri, 17 Dec 2021 19:38:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org 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 WmuFvSqRroMv; Fri, 17 Dec 2021 19:38:57 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 159FB42143; Fri, 17 Dec 2021 19:38:57 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id D5C4E1BF35E for ; Fri, 17 Dec 2021 19:37:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id C2D8F40579 for ; Fri, 17 Dec 2021 19:37:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=fastly.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OIL8qrV9b4jH for ; Fri, 17 Dec 2021 19:37:44 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by smtp2.osuosl.org (Postfix) with ESMTPS id 8F829404A9 for ; Fri, 17 Dec 2021 19:37:44 +0000 (UTC) Received: by mail-pl1-x630.google.com with SMTP id y7so2760285plp.0 for ; Fri, 17 Dec 2021 11:37:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=70zoL/rw5reUH+wDepP5mNKGm1jSYyuL1cKzbKE0mRE=; b=ilmibtt+4pzAmZcM5Ofg2NpsHq1ebndpJg3FBSAjZPrM0NnQIGCfdW8hWezTYoa6Xc z5SDaaYtFUb7xHP6uUySmcyfU0jnca33WC1y/Zqb1+rMirQbIbeM5Alyx0ZNzC++2SwH 0Xa9us/hpT3gjNe/3G6jfeuezySTnPph0O5VM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=70zoL/rw5reUH+wDepP5mNKGm1jSYyuL1cKzbKE0mRE=; b=Eh9sjbyD/6k2+JFTH+DdngFtw/4a6wduE45Ruht0oavj/MB64TpAMACwp1hcjde3Av pYaNHtmI9w3zBOY6b5rkLld3luITUYq4JBDEZ7Rgwy+0NnSv4ougUAZx/5h3oGv1t1ap OB3LWosMaLbzcxFCS6lZs3IWf7Q6r8H0BPm5fhRVzedpf7s5j6cuBOzMrFpH8uDHLw/T UjxmM7zTZo+w+bLrEAQ058WOR+VUI6WxB2eoRz7RBtvP87UEnnD5cOf4U6BvMr/4MNag 3os6vaH/rMTBXV1OL34eAS8qaiiHwCJ88IicHfdD6H8FHh5FjWD/WJzX/zvVwFVSJHS3 ki4Q== X-Gm-Message-State: AOAM533h5X6ipm0J2rCm6qoLCkjNDl7Xbh8qzjbK2C3PW3Bf6uMpJv7u GMvhiI7hlaS0ljcF6Ehj80OrzZxaJ0BboZS+hNrYyzv6KikKevFIX8MTrj8ViBz36BnO8B7gpZQ pMP/TSRfgo2frm71x1Yi7K2kt41gWgngyGWDbIRsrp9W/soBFb1TUi9ZEy4DSCgRw5F1Z9ICDic oRs+uGYR5W X-Google-Smtp-Source: ABdhPJzAStTZa6VbWpB+diwfqBLkPIL0pWtxWGh18HCBGcrB+aW6I/Sh/9xBJ1414HwnVqSSNcR4qQ== X-Received: by 2002:a17:902:b718:b0:143:72b7:409e with SMTP id d24-20020a170902b71800b0014372b7409emr4673991pls.28.1639769863577; Fri, 17 Dec 2021 11:37:43 -0800 (PST) Received: from localhost.localdomain (c-73-223-190-181.hsd1.ca.comcast.net. [73.223.190.181]) by smtp.gmail.com with ESMTPSA id o17sm8783294pgb.42.2021.12.17.11.37.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Dec 2021 11:37:43 -0800 (PST) From: Joe Damato To: intel-wired-lan@lists.osuosl.org Date: Fri, 17 Dec 2021 11:35:17 -0800 Message-Id: <1639769719-81285-4-git-send-email-jdamato@fastly.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1639769719-81285-1-git-send-email-jdamato@fastly.com> References: <1639769719-81285-1-git-send-email-jdamato@fastly.com> X-Mailman-Approved-At: Fri, 17 Dec 2021 19:38:44 +0000 Subject: [Intel-wired-lan] [net-queue, v2, 3/5] i40e: Add a stat tracking new RX page allocations. X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kuba@kernel.org, Joe Damato MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Add a counter for new page allocations in the i40e RX path. This stat is accessible with ethtool. Signed-off-by: Joe Damato Tested-By: Dave Switzer --- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 1 + drivers/net/ethernet/intel/i40e/i40e_main.c | 5 ++++- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 ++ drivers/net/ethernet/intel/i40e/i40e_txrx.h | 1 + 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index b61f17bf..ab73de2 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h @@ -854,6 +854,7 @@ struct i40e_vsi { u64 rx_buf_failed; u64 rx_page_failed; u64 rx_page_reuse; + u64 rx_page_alloc; /* These are containers of ring pointers, allocated at run-time */ struct i40e_ring **rx_rings; diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index ceb0d5f..22f746b 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c @@ -296,6 +296,7 @@ static const struct i40e_stats i40e_gstrings_misc_stats[] = { I40E_VSI_STAT("rx_alloc_fail", rx_buf_failed), I40E_VSI_STAT("rx_pg_alloc_fail", rx_page_failed), I40E_VSI_STAT("rx_cache_reuse", rx_page_reuse), + I40E_VSI_STAT("rx_cache_alloc", rx_page_alloc), }; /* These PF_STATs might look like duplicates of some NETDEV_STATs, diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 6d3b0bc..6688598 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -812,7 +812,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) struct i40e_eth_stats *es; /* device's eth stats */ u64 tx_restart, tx_busy; struct i40e_ring *p; - u64 rx_page, rx_buf, rx_reuse; + u64 rx_page, rx_buf, rx_reuse, rx_alloc; u64 bytes, packets; unsigned int start; u64 tx_linearize; @@ -839,6 +839,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) rx_page = 0; rx_buf = 0; rx_reuse = 0; + rx_alloc = 0; rcu_read_lock(); for (q = 0; q < vsi->num_queue_pairs; q++) { /* locate Tx ring */ @@ -873,6 +874,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) rx_buf += p->rx_stats.alloc_buff_failed; rx_page += p->rx_stats.alloc_page_failed; rx_reuse += p->rx_stats.page_reuse_count; + rx_alloc += p->rx_stats.page_alloc_count; if (i40e_enabled_xdp_vsi(vsi)) { /* locate XDP ring */ @@ -901,6 +903,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) vsi->rx_page_failed = rx_page; vsi->rx_buf_failed = rx_buf; vsi->rx_page_reuse = rx_reuse; + vsi->rx_page_alloc = rx_alloc; ns->rx_packets = rx_p; ns->rx_bytes = rx_b; diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 8b3ffb7..322f85b 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -1673,6 +1673,8 @@ static bool i40e_alloc_mapped_page(struct i40e_ring *rx_ring, return false; } + rx_ring->rx_stats.page_alloc_count++; + /* map page for use */ dma = dma_map_page_attrs(rx_ring->dev, page, 0, i40e_rx_pg_size(rx_ring), diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h index bfc2845..7041e81 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h @@ -299,6 +299,7 @@ struct i40e_rx_queue_stats { u64 alloc_buff_failed; u64 page_reuse_count; u64 realloc_count; + u64 page_alloc_count; }; enum i40e_ring_state_t { From patchwork Fri Dec 17 19:35:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Damato X-Patchwork-Id: 1570303 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=fastly.com header.i=@fastly.com header.a=rsa-sha256 header.s=google header.b=O0fQ/e9r; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JFznM46yFz9sXM for ; Sat, 18 Dec 2021 06:39:03 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id D765384D46; Fri, 17 Dec 2021 19:39:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LQRgFbPNEwA8; Fri, 17 Dec 2021 19:39:01 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id D22F484D58; Fri, 17 Dec 2021 19:39:00 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id CF8C81BF35E for ; Fri, 17 Dec 2021 19:37:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id BEB3F84D30 for ; Fri, 17 Dec 2021 19:37:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8XvfeeqmW7-X for ; Fri, 17 Dec 2021 19:37:46 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by smtp1.osuosl.org (Postfix) with ESMTPS id 101B584D32 for ; Fri, 17 Dec 2021 19:37:45 +0000 (UTC) Received: by mail-pf1-x42b.google.com with SMTP id k64so3074989pfd.11 for ; Fri, 17 Dec 2021 11:37:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dPsS9WyOYebbPNlQIS4Y4eFXSN7Kabz8jwC+KvSYu+c=; b=O0fQ/e9riac+s27oLoUlu4Z7AD6HzT2Jqf77Vl6tpB6Q+EJKthNyXcJuTYIDZLVVYQ IA+WzIPb4ecBh5v/PAh/zFXuo83hg4FiQDmMDamnmj9tNW1ar2s0eoXAqXtaGLxkAMPE GTitjkLejb1ITyeiKP6wSB3BtJFPl5W1IGjeM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dPsS9WyOYebbPNlQIS4Y4eFXSN7Kabz8jwC+KvSYu+c=; b=iavhqJkUxPkdb8V6mMl6TqD5jc/aEuEj0ihW0tgZPSqdduAhCwr26D5Aw1I++AAuvA 5EQzb6MRfMYo7x7TCngs9iRHleobNlzSOiWtQIIt/dO69xicdNIDtyB3W8k0mKZAQXCM ouLrj4ZnIuw+W2c/Ci4xtV45Cd9H2Bop3NYUCz08q8EBVd1S7khvo1nc9eaHI0CAMuO+ RcsHwRVU6sS5ux4Rpon6ZumfN10Olv3e5+dbv0E1kChuMKvzSg3DU7Pqf7QzAGeYZ2sB gwUcKIbElSRWWZA0MHaed+mpc2micYMQN77q5d9A8qEuHmEAfBWoIW/GE4PXyLgmpVw5 C/vA== X-Gm-Message-State: AOAM532IqXyL+3vuNvgEfRnVbI8+Nys2AgReNSlkeot70UHYTGFUl5+W JC3h0LQyjMIWJD/cyJL4T8wmAiVmEsCd8nAbWsNdQpwlemGP5px0c09SAMrUz1V3hXyS5kC+423 3lNYmPN9DbJiayA62nW9Qn9NWw7dhHikunG/MaH2o4gx7hjlaKgMhCu8cBp3rI0Eenyu1tTrpnZ FIrbFgelfi X-Google-Smtp-Source: ABdhPJzFZSAdHtzcWszWyusbCXRI9L0TtrYGmSa6+pqPpbALyryvHmyPhX/WVG1mkoGwetiWFAOktg== X-Received: by 2002:a63:780e:: with SMTP id t14mr4173947pgc.605.1639769865014; Fri, 17 Dec 2021 11:37:45 -0800 (PST) Received: from localhost.localdomain (c-73-223-190-181.hsd1.ca.comcast.net. [73.223.190.181]) by smtp.gmail.com with ESMTPSA id o17sm8783294pgb.42.2021.12.17.11.37.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Dec 2021 11:37:44 -0800 (PST) From: Joe Damato To: intel-wired-lan@lists.osuosl.org Date: Fri, 17 Dec 2021 11:35:18 -0800 Message-Id: <1639769719-81285-5-git-send-email-jdamato@fastly.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1639769719-81285-1-git-send-email-jdamato@fastly.com> References: <1639769719-81285-1-git-send-email-jdamato@fastly.com> X-Mailman-Approved-At: Fri, 17 Dec 2021 19:38:44 +0000 Subject: [Intel-wired-lan] [net-queue, v2, 4/5] i40e: Add a stat for tracking pages waived. X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kuba@kernel.org, Joe Damato MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" In some cases, pages can not be reused because they are not associated with the correct NUMA zone. Knowing how often pages are waived helps users to understand the interaction between the driver's memory usage and their system. Pass rx_stats through to i40e_can_reuse_rx_page to allow tracking when pages are waived. The page waive count is accessible via ethtool. Signed-off-by: Joe Damato Tested-By: Dave Switzer --- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 1 + drivers/net/ethernet/intel/i40e/i40e_main.c | 5 ++++- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 13 ++++++++++--- drivers/net/ethernet/intel/i40e/i40e_txrx.h | 1 + 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index ab73de2..3774e7b 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h @@ -855,6 +855,7 @@ struct i40e_vsi { u64 rx_page_failed; u64 rx_page_reuse; u64 rx_page_alloc; + u64 rx_page_waive; /* These are containers of ring pointers, allocated at run-time */ struct i40e_ring **rx_rings; diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index 22f746b..224fe6d 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c @@ -297,6 +297,7 @@ static const struct i40e_stats i40e_gstrings_misc_stats[] = { I40E_VSI_STAT("rx_pg_alloc_fail", rx_page_failed), I40E_VSI_STAT("rx_cache_reuse", rx_page_reuse), I40E_VSI_STAT("rx_cache_alloc", rx_page_alloc), + I40E_VSI_STAT("rx_cache_waive", rx_page_waive), }; /* These PF_STATs might look like duplicates of some NETDEV_STATs, diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 6688598..7a25488 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -812,7 +812,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) struct i40e_eth_stats *es; /* device's eth stats */ u64 tx_restart, tx_busy; struct i40e_ring *p; - u64 rx_page, rx_buf, rx_reuse, rx_alloc; + u64 rx_page, rx_buf, rx_reuse, rx_alloc, rx_waive; u64 bytes, packets; unsigned int start; u64 tx_linearize; @@ -840,6 +840,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) rx_buf = 0; rx_reuse = 0; rx_alloc = 0; + rx_waive = 0; rcu_read_lock(); for (q = 0; q < vsi->num_queue_pairs; q++) { /* locate Tx ring */ @@ -875,6 +876,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) rx_page += p->rx_stats.alloc_page_failed; rx_reuse += p->rx_stats.page_reuse_count; rx_alloc += p->rx_stats.page_alloc_count; + rx_waive += p->rx_stats.page_waive_count; if (i40e_enabled_xdp_vsi(vsi)) { /* locate XDP ring */ @@ -904,6 +906,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) vsi->rx_buf_failed = rx_buf; vsi->rx_page_reuse = rx_reuse; vsi->rx_page_alloc = rx_alloc; + vsi->rx_page_waive = rx_waive; ns->rx_packets = rx_p; ns->rx_bytes = rx_b; diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 322f85b..1e2ad48 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -1982,22 +1982,29 @@ static bool i40e_cleanup_headers(struct i40e_ring *rx_ring, struct sk_buff *skb, /** * i40e_can_reuse_rx_page - Determine if page can be reused for another Rx * @rx_buffer: buffer containing the page + * @rx_stats: rx stats structure for the rx ring * @rx_buffer_pgcnt: buffer page refcount pre xdp_do_redirect() call * * If page is reusable, we have a green light for calling i40e_reuse_rx_page, * which will assign the current buffer to the buffer that next_to_alloc is * pointing to; otherwise, the DMA mapping needs to be destroyed and - * page freed + * page freed. + * + * rx_stats will be updated to indicate if the page was waived because it was + * not reusable. */ static bool i40e_can_reuse_rx_page(struct i40e_rx_buffer *rx_buffer, + struct i40e_rx_queue_stats *rx_stats, int rx_buffer_pgcnt) { unsigned int pagecnt_bias = rx_buffer->pagecnt_bias; struct page *page = rx_buffer->page; /* Is any reuse possible? */ - if (!dev_page_is_reusable(page)) + if (!dev_page_is_reusable(page)) { + rx_stats->page_waive_count++; return false; + } #if (PAGE_SIZE < 8192) /* if we are only owner of page we can reuse it */ @@ -2237,7 +2244,7 @@ static void i40e_put_rx_buffer(struct i40e_ring *rx_ring, struct i40e_rx_buffer *rx_buffer, int rx_buffer_pgcnt) { - if (i40e_can_reuse_rx_page(rx_buffer, rx_buffer_pgcnt)) { + if (i40e_can_reuse_rx_page(rx_buffer, &rx_ring->rx_stats, rx_buffer_pgcnt)) { /* hand second half of page back to the ring */ i40e_reuse_rx_page(rx_ring, rx_buffer); } else { diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h index 7041e81..e049cf48 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h @@ -300,6 +300,7 @@ struct i40e_rx_queue_stats { u64 page_reuse_count; u64 realloc_count; u64 page_alloc_count; + u64 page_waive_count; }; enum i40e_ring_state_t { From patchwork Fri Dec 17 19:35:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Damato X-Patchwork-Id: 1570304 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=fastly.com header.i=@fastly.com header.a=rsa-sha256 header.s=google header.b=IpKsjMEI; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JFznS1xbrz9sXM for ; Sat, 18 Dec 2021 06:39:07 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id DA17B84D6A; Fri, 17 Dec 2021 19:39:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9MRLxfb_PDbK; Fri, 17 Dec 2021 19:39:05 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id A4D5A84D46; Fri, 17 Dec 2021 19:39:04 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 23CFF1BF35E for ; Fri, 17 Dec 2021 19:37:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 1259C61158 for ; Fri, 17 Dec 2021 19:37:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=fastly.com 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 rWmZdSInhAlX for ; Fri, 17 Dec 2021 19:37:47 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by smtp3.osuosl.org (Postfix) with ESMTPS id 6963160ED2 for ; Fri, 17 Dec 2021 19:37:47 +0000 (UTC) Received: by mail-pf1-x430.google.com with SMTP id u14so718458pfg.2 for ; Fri, 17 Dec 2021 11:37:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MzdJr3mxq4/chwBeOQwBs4C8SvdL1I0L8qgy9q2/iRk=; b=IpKsjMEIsIeGhe7Fmzc0FNaWZo4wp8ixT09DVn0ddQrcM7M8mqc3/GKz9QpnR8nD8d TTV1RBlkux6t9KuzPry/2juLCES2XkNm91GCC4XsAYu/SvaasWb3BWjFvM4rIwNjD3uZ me8MQfQFX0Ict5fVBvhBlvaE6hkwrwlUmfVis= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MzdJr3mxq4/chwBeOQwBs4C8SvdL1I0L8qgy9q2/iRk=; b=s6/reH0Jt5sJ/XHSSFinpQLQ5/kL3OHAVYmMnDwm/AjzxW2484nJjcvS0oP1g5LTo+ YS41+/q56iY7XcWUqwBARKoQ8AoHIvcIQDZx4c1XA+Sy0VdH/FXBn66P99DK+zyF7+Hv /bJmyvCXzwLt6Yf7M8CEWY7O4lVFhpCfQXdaG93+H0IU6fyt5rFf03A3vBmbY6XjULuS ixFDTfHUy41tG85uUapdUslPfY1exVNJZeAmVkxCnmTKolZ+Zl17aQIV+G56rnXU7uh7 Rf6pYVYYiDH4pPUCIDzmhKQfprXUHea+KUDAuNo0gtbX/8QOfoK/5jKQLPbN0mwApVfN 6tQA== X-Gm-Message-State: AOAM533J5hJHZcF9bFrhX2Eg35DPtiHwQf6LF+06uf8/tWEh7mwHfcto pNHAL9Yl+Pqw6H1L3xHTW6/mSyPFHOQrzKjvO8LwLQLDLl8vAsWDpHDVEg7HW/XHK3cU/1DNAD7 9lY8hiy0EhKBI3k/Ua+TXsPXRVUs0WLFmj96CaH3/7jAlk255ryjEujoj+dcVToolmV+LRn68/o AJ3BJDS9b8 X-Google-Smtp-Source: ABdhPJz4kt2ks/6eb+SyF7HsYO7SsaBCB9Xbo9PHgHupJIs/j6whkQ+LUpbPKdOBabqF7AU+1anWeQ== X-Received: by 2002:a63:2307:: with SMTP id j7mr4272140pgj.48.1639769866400; Fri, 17 Dec 2021 11:37:46 -0800 (PST) Received: from localhost.localdomain (c-73-223-190-181.hsd1.ca.comcast.net. [73.223.190.181]) by smtp.gmail.com with ESMTPSA id o17sm8783294pgb.42.2021.12.17.11.37.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Dec 2021 11:37:45 -0800 (PST) From: Joe Damato To: intel-wired-lan@lists.osuosl.org Date: Fri, 17 Dec 2021 11:35:19 -0800 Message-Id: <1639769719-81285-6-git-send-email-jdamato@fastly.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1639769719-81285-1-git-send-email-jdamato@fastly.com> References: <1639769719-81285-1-git-send-email-jdamato@fastly.com> X-Mailman-Approved-At: Fri, 17 Dec 2021 19:38:44 +0000 Subject: [Intel-wired-lan] [net-queue, v2, 5/5] i40e: Add a stat for tracking busy rx pages. X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kuba@kernel.org, Joe Damato MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" In some cases, pages cannot be reused by i40e because the page is busy. Add a counter for this event. Busy page count is accessible via ethtool. Signed-off-by: Joe Damato Tested-by: Dave Switzer --- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 1 + drivers/net/ethernet/intel/i40e/i40e_main.c | 5 ++++- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 12 ++++++++---- drivers/net/ethernet/intel/i40e/i40e_txrx.h | 1 + 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index 3774e7b..b50530e 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h @@ -856,6 +856,7 @@ struct i40e_vsi { u64 rx_page_reuse; u64 rx_page_alloc; u64 rx_page_waive; + u64 rx_page_busy; /* These are containers of ring pointers, allocated at run-time */ struct i40e_ring **rx_rings; diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index 224fe6d..64fd869 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c @@ -298,6 +298,7 @@ static const struct i40e_stats i40e_gstrings_misc_stats[] = { I40E_VSI_STAT("rx_cache_reuse", rx_page_reuse), I40E_VSI_STAT("rx_cache_alloc", rx_page_alloc), I40E_VSI_STAT("rx_cache_waive", rx_page_waive), + I40E_VSI_STAT("rx_cache_busy", rx_page_busy), }; /* These PF_STATs might look like duplicates of some NETDEV_STATs, diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 7a25488..180650f 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -812,7 +812,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) struct i40e_eth_stats *es; /* device's eth stats */ u64 tx_restart, tx_busy; struct i40e_ring *p; - u64 rx_page, rx_buf, rx_reuse, rx_alloc, rx_waive; + u64 rx_page, rx_buf, rx_reuse, rx_alloc, rx_waive, rx_busy; u64 bytes, packets; unsigned int start; u64 tx_linearize; @@ -841,6 +841,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) rx_reuse = 0; rx_alloc = 0; rx_waive = 0; + rx_busy = 0; rcu_read_lock(); for (q = 0; q < vsi->num_queue_pairs; q++) { /* locate Tx ring */ @@ -877,6 +878,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) rx_reuse += p->rx_stats.page_reuse_count; rx_alloc += p->rx_stats.page_alloc_count; rx_waive += p->rx_stats.page_waive_count; + rx_busy += p->rx_stats.page_busy_count; if (i40e_enabled_xdp_vsi(vsi)) { /* locate XDP ring */ @@ -907,6 +909,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) vsi->rx_page_reuse = rx_reuse; vsi->rx_page_alloc = rx_alloc; vsi->rx_page_waive = rx_waive; + vsi->rx_page_busy = rx_busy; ns->rx_packets = rx_p; ns->rx_bytes = rx_b; diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 1e2ad48..692a727 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -1990,8 +1990,8 @@ static bool i40e_cleanup_headers(struct i40e_ring *rx_ring, struct sk_buff *skb, * pointing to; otherwise, the DMA mapping needs to be destroyed and * page freed. * - * rx_stats will be updated to indicate if the page was waived because it was - * not reusable. + * rx_stats will be updated to indicate whether the page was waived + * or busy if it could not be reused. */ static bool i40e_can_reuse_rx_page(struct i40e_rx_buffer *rx_buffer, struct i40e_rx_queue_stats *rx_stats, @@ -2008,13 +2008,17 @@ static bool i40e_can_reuse_rx_page(struct i40e_rx_buffer *rx_buffer, #if (PAGE_SIZE < 8192) /* if we are only owner of page we can reuse it */ - if (unlikely((rx_buffer_pgcnt - pagecnt_bias) > 1)) + if (unlikely((rx_buffer_pgcnt - pagecnt_bias) > 1)) { + rx_stats->page_busy_count++; return false; + } #else #define I40E_LAST_OFFSET \ (SKB_WITH_OVERHEAD(PAGE_SIZE) - I40E_RXBUFFER_2048) - if (rx_buffer->page_offset > I40E_LAST_OFFSET) + if (rx_buffer->page_offset > I40E_LAST_OFFSET) { + rx_stats->page_busy_count++; return false; + } #endif /* If we have drained the page fragment pool we need to update diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h index e049cf48..fd22e2f 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h @@ -301,6 +301,7 @@ struct i40e_rx_queue_stats { u64 realloc_count; u64 page_alloc_count; u64 page_waive_count; + u64 page_busy_count; }; enum i40e_ring_state_t {