From patchwork Tue Aug 1 01:15:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zulkifli, Muhammad Husaini" X-Patchwork-Id: 1815329 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=n554tnx0; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RFHT75YJxz1yfG for ; Tue, 1 Aug 2023 11:24:27 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 1D9F760592; Tue, 1 Aug 2023 01:24:26 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 1D9F760592 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1690853066; bh=YslFJ13rBheCzV7KvdqJLOBXFbxYriXafZdPXUr4fug=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=n554tnx0fFr3c/0NM2qWAieNJg3jNUv8DUNKfim12ml+7n26XKMbuixO2SXlXFRdE OFOVhIonznyrpJF8j6BFjm/vr8jL5SWojub5DoqZB4O6HxEy/dLGIWwfEqzXzCnxZh UOBo5Qf3cIk9nAr7PQrWfcorsj+47e/TdoshA+tBjg4gNiNFxxBRKIgr031jB2XegU VVqL0Y8qKJkFcVo0lcuZkUUERUm8BIuGK97GHhvKWdCXKyPqkkO6mx1mS4o31sp3QP KOMYhbtDxXPiwDkeu5DLzWPzV7cspw1+MlzMcF1qvsXuJ2hrkccGUDJvVmzPNTzOQa uHZ9VE1/hQatA== 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 GWiuLaf5RJon; Tue, 1 Aug 2023 01:24:23 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id A96F160F01; Tue, 1 Aug 2023 01:24:23 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org A96F160F01 X-Original-To: intel-wired-lan@osuosl.org Delivered-To: intel-wired-lan@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 390C31BF98D for ; Tue, 1 Aug 2023 01:24:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id B7E1F80C0C for ; Tue, 1 Aug 2023 01:23:57 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org B7E1F80C0C 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 arR8g7xjLfWj for ; Tue, 1 Aug 2023 01:23:56 +0000 (UTC) Received: from mgamail.intel.com (unknown [134.134.136.65]) by smtp1.osuosl.org (Postfix) with ESMTPS id 4FBA980BE0 for ; Tue, 1 Aug 2023 01:23:56 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 4FBA980BE0 X-IronPort-AV: E=McAfee;i="6600,9927,10788"; a="372792727" X-IronPort-AV: E=Sophos;i="6.01,246,1684825200"; d="scan'208";a="372792727" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jul 2023 18:16:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10788"; a="798458559" X-IronPort-AV: E=Sophos;i="6.01,246,1684825200"; d="scan'208";a="798458559" Received: from zulkifl3-ilbpg0.png.intel.com ([10.88.229.82]) by fmsmga004.fm.intel.com with ESMTP; 31 Jul 2023 18:16:42 -0700 From: Muhammad Husaini Zulkifli To: intel-wired-lan@osuosl.org Date: Tue, 1 Aug 2023 09:15:17 +0800 Message-Id: <20230801011518.25370-2-muhammad.husaini.zulkifli@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230801011518.25370-1-muhammad.husaini.zulkifli@intel.com> References: <20230801011518.25370-1-muhammad.husaini.zulkifli@intel.com> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690853036; x=1722389036; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=iNbzwRMjAEvSzQbxsOi+KU8F2Wyrzf5JNrk8JE3lgeI=; b=hKCF1v53FYsKO1uWPUflqC4FfzsbHgJDrZjvDLaJYWtUYmzcb2nm/yxU uOWm9QXYPNXFJ/h5NTnEGANWSze6FYlq/lOpD0E/bJg2Naufa672yqfLF 1jwPtE2ck+qUxT8tpiFdUf9cuXSuwewBAiwfklaEZWpPTGbWrzUp+ds8o Rrnd2rm3rcUWOTmQAYKT+icxEaY2wCpsR6SLEtTscADp3tuUdV6tTlK1O GVtDk4SyZaehvEwHau48cFCEitovcqSf6uFeXbYGCzs5v9y/J9wRcVPhu b01e0gSw9Awl4Botl6JOLuQL1hJ+q9JwDluzVtlKQjtnT9L198Y1eVQPH A==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=hKCF1v53 Subject: [Intel-wired-lan] [PATCH iwl-net v3 1/2] igc: Expose tx-usecs coalesce setting to user 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: netdev@vger.kernel.org, edumazet@google.com, anthony.l.nguyen@intel.com, horms@kernel.org, kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" When users attempt to obtain the coalesce setting using the ethtool command, current code always returns 0 for tx-usecs. This is because I225/6 always uses a queue pair setting, hence tx_coalesce_usecs does not return a value during the igc_ethtool_get_coalesce() callback process. The pair queue condition checking in igc_ethtool_get_coalesce() is removed by this patch so that the user gets information of the value of tx-usecs. Even if i225/6 is using queue pair setting, there is no harm in notifying the user of the tx-usecs. The implementation of the current code may have previously been a copy of the legacy code i210. How to test: User can get the coalesce value using ethtool command. Example command: Get: ethtool -c Previous output: rx-usecs: 3 rx-frames: n/a rx-usecs-irq: n/a rx-frames-irq: n/a tx-usecs: 0 tx-frames: n/a tx-usecs-irq: n/a tx-frames-irq: n/a New output: rx-usecs: 3 rx-frames: n/a rx-usecs-irq: n/a rx-frames-irq: n/a tx-usecs: 3 tx-frames: n/a tx-usecs-irq: n/a tx-frames-irq: n/a Fixes: 8c5ad0dae93c ("igc: Add ethtool support") Signed-off-by: Muhammad Husaini Zulkifli Tested-by: Naama Meir --- drivers/net/ethernet/intel/igc/igc_ethtool.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c index 93bce729be76..62d925b26f2c 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -880,12 +880,10 @@ static int igc_ethtool_get_coalesce(struct net_device *netdev, else ec->rx_coalesce_usecs = adapter->rx_itr_setting >> 2; - if (!(adapter->flags & IGC_FLAG_QUEUE_PAIRS)) { - if (adapter->tx_itr_setting <= 3) - ec->tx_coalesce_usecs = adapter->tx_itr_setting; - else - ec->tx_coalesce_usecs = adapter->tx_itr_setting >> 2; - } + if (adapter->tx_itr_setting <= 3) + ec->tx_coalesce_usecs = adapter->tx_itr_setting; + else + ec->tx_coalesce_usecs = adapter->tx_itr_setting >> 2; return 0; } @@ -910,9 +908,6 @@ static int igc_ethtool_set_coalesce(struct net_device *netdev, ec->tx_coalesce_usecs == 2) return -EINVAL; - if ((adapter->flags & IGC_FLAG_QUEUE_PAIRS) && ec->tx_coalesce_usecs) - return -EINVAL; - /* If ITR is disabled, disable DMAC */ if (ec->rx_coalesce_usecs == 0) { if (adapter->flags & IGC_FLAG_DMAC) From patchwork Tue Aug 1 01:15:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zulkifli, Muhammad Husaini" X-Patchwork-Id: 1815328 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=xHmdR8mK; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RFHT16nH5z1yfG for ; Tue, 1 Aug 2023 11:24:21 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 9328060C33; Tue, 1 Aug 2023 01:24:19 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 9328060C33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1690853059; bh=GPmdFYepmFo9Bs1ScI0MDqXTWslQ6CX5qPQkROPoG+g=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=xHmdR8mKkDY//E3hFe9eskgDdUPCk9tnU3CQuyEq+LoPbLO4Q3mkabLsHSfgW7fVY ZrDdmyV/puMQmFU2hc3gzOCuaF7DEgJp8fqPsqeN4NWZiSb4qOmUeEJhIBWrD7TWee 7Q1e0GRCH2Ki2/kCoKkInpnYxmy6jXpB7am9d8Y3A/JaMCiCCyrKtXvjFdZQAsJUky HjyuI0gOjJ18Pm7lg0GzpQ1gDW65CcJddBYkOHw16kqYr8pzKo0nOWwtup4z0wqK+I zOKlKorHGlAWAEIIn+c+vR/TKiAHLSAx1cJ1HCMDtGUOtXW6YAkefZg4FCCJlKMMpQ 7du0SgUEi2TlQ== 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 66bO1l9zlAf9; Tue, 1 Aug 2023 01:24:18 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 75FC260C13; Tue, 1 Aug 2023 01:24:18 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 75FC260C13 X-Original-To: intel-wired-lan@osuosl.org Delivered-To: intel-wired-lan@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 526471BF97F for ; Tue, 1 Aug 2023 01:24:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 84D3D8089C for ; Tue, 1 Aug 2023 01:23:57 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 84D3D8089C 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 a9cEExB_Q0hK for ; Tue, 1 Aug 2023 01:23:56 +0000 (UTC) Received: from mgamail.intel.com (unknown [134.134.136.65]) by smtp1.osuosl.org (Postfix) with ESMTPS id 9396480C0C for ; Tue, 1 Aug 2023 01:23:56 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 9396480C0C X-IronPort-AV: E=McAfee;i="6600,9927,10788"; a="372792742" X-IronPort-AV: E=Sophos;i="6.01,246,1684825200"; d="scan'208";a="372792742" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jul 2023 18:16:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10788"; a="798458572" X-IronPort-AV: E=Sophos;i="6.01,246,1684825200"; d="scan'208";a="798458572" Received: from zulkifl3-ilbpg0.png.intel.com ([10.88.229.82]) by fmsmga004.fm.intel.com with ESMTP; 31 Jul 2023 18:16:45 -0700 From: Muhammad Husaini Zulkifli To: intel-wired-lan@osuosl.org Date: Tue, 1 Aug 2023 09:15:18 +0800 Message-Id: <20230801011518.25370-3-muhammad.husaini.zulkifli@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230801011518.25370-1-muhammad.husaini.zulkifli@intel.com> References: <20230801011518.25370-1-muhammad.husaini.zulkifli@intel.com> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690853036; x=1722389036; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=b5WhSjde2r8XEbweVLXGUkprRp65g6AuGY6uG1nH19k=; b=a9/tBkbaQNi+Q2hCl6OVbE4ZnhjvVuhw+LBEqMJmKe4VcwqdHt5shPtI N1GE1qCRpj3QwYFvcM+ACI1IwCmvllgj2nYjhyCOdw/ruRkUYzd4toMNB 1tcduBGUmN7XW6vXiUvm+yT6nekr4LfxIz+fCDs/rR50syJMnVVVyn5yB ZySec/w7fmYFbK6o2luUQyQknUqDDRQFmhledj079voIKLvgW9/2u2GOW S5sPUhnLWArkdEQyyjhNUq4W8kMC69/KXHoJtuj0WRdVWVBjymgPYQmnv MZ1m2NXcgSr9s0E3T1GglHGm+mdQWaCavxJaJlon3onoPyPh7KXxgwwm7 w==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=a9/tBkba Subject: [Intel-wired-lan] [PATCH iwl-net v3 2/2] igc: Modify the tx-usecs coalesce setting 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: netdev@vger.kernel.org, edumazet@google.com, anthony.l.nguyen@intel.com, horms@kernel.org, kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" This patch enables users to modify the tx-usecs parameter. The rx-usecs value will adhere to the same value as tx-usecs if the queue pair setting is enabled. How to test: User can set the coalesce value using ethtool command. Example command: Set: ethtool -C Previous output: root@P12DYHUSAINI:~# ethtool -C enp170s0 tx-usecs 10 netlink error: Invalid argument New output: root@P12DYHUSAINI:~# ethtool -C enp170s0 tx-usecs 10 rx-usecs: 10 rx-frames: n/a rx-usecs-irq: n/a rx-frames-irq: n/a tx-usecs: 10 tx-frames: n/a tx-usecs-irq: n/a tx-frames-irq: n/a Fixes: 8c5ad0dae93c ("igc: Add ethtool support") Signed-off-by: Muhammad Husaini Zulkifli Tested-by: Naama Meir --- drivers/net/ethernet/intel/igc/igc_ethtool.c | 49 +++++++++++++++----- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c index 62d925b26f2c..ed67d9061452 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -914,19 +914,44 @@ static int igc_ethtool_set_coalesce(struct net_device *netdev, adapter->flags &= ~IGC_FLAG_DMAC; } - /* convert to rate of irq's per second */ - if (ec->rx_coalesce_usecs && ec->rx_coalesce_usecs <= 3) - adapter->rx_itr_setting = ec->rx_coalesce_usecs; - else - adapter->rx_itr_setting = ec->rx_coalesce_usecs << 2; + if (adapter->flags & IGC_FLAG_QUEUE_PAIRS) { + u32 old_tx_itr, old_rx_itr; + + /* This is to get back the original value before byte shifting */ + old_tx_itr = (adapter->tx_itr_setting <= 3) ? + adapter->tx_itr_setting : adapter->tx_itr_setting >> 2; + + old_rx_itr = (adapter->rx_itr_setting <= 3) ? + adapter->rx_itr_setting : adapter->rx_itr_setting >> 2; + + if (old_tx_itr != ec->tx_coalesce_usecs) { + if (ec->tx_coalesce_usecs && ec->tx_coalesce_usecs <= 3) + adapter->tx_itr_setting = ec->tx_coalesce_usecs; + else + adapter->tx_itr_setting = ec->tx_coalesce_usecs << 2; + + adapter->rx_itr_setting = adapter->tx_itr_setting; + } else if (old_rx_itr != ec->rx_coalesce_usecs) { + if (ec->rx_coalesce_usecs && ec->rx_coalesce_usecs <= 3) + adapter->rx_itr_setting = ec->rx_coalesce_usecs; + else + adapter->rx_itr_setting = ec->rx_coalesce_usecs << 2; + + adapter->tx_itr_setting = adapter->rx_itr_setting; + } + } else { + /* convert to rate of irq's per second */ + if (ec->rx_coalesce_usecs && ec->rx_coalesce_usecs <= 3) + adapter->rx_itr_setting = ec->rx_coalesce_usecs; + else + adapter->rx_itr_setting = ec->rx_coalesce_usecs << 2; - /* convert to rate of irq's per second */ - if (adapter->flags & IGC_FLAG_QUEUE_PAIRS) - adapter->tx_itr_setting = adapter->rx_itr_setting; - else if (ec->tx_coalesce_usecs && ec->tx_coalesce_usecs <= 3) - adapter->tx_itr_setting = ec->tx_coalesce_usecs; - else - adapter->tx_itr_setting = ec->tx_coalesce_usecs << 2; + /* convert to rate of irq's per second */ + if (ec->tx_coalesce_usecs && ec->tx_coalesce_usecs <= 3) + adapter->tx_itr_setting = ec->tx_coalesce_usecs; + else + adapter->tx_itr_setting = ec->tx_coalesce_usecs << 2; + } for (i = 0; i < adapter->num_q_vectors; i++) { struct igc_q_vector *q_vector = adapter->q_vector[i];