From patchwork Sat Aug 19 13:50:50 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: 1823302 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; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=zVtl3exe; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RSgCs503lz1yfT for ; Sat, 19 Aug 2023 23:52:25 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 07FEE83BF2; Sat, 19 Aug 2023 13:52:21 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 07FEE83BF2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1692453141; 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=zVtl3exe97EO5ElN7OBNTpwmSGL8x8tQcB7HTy+G0nLOIdWL8w5JOhtzKDs9u/3VB wxTw05TRafRFDQtANp3tBJeu40CYtDfWr64PdMJpifxYt52XSY7Cwj08q/nXfbwZA6 chDR767SpkZoO3nSKhU5tRcETmigtj0lPARVTnvIxKK3TNXk7rynHU/5kZBBrfjVpU rgCQMnypqugeC9gyi5lE5nxfJsEKliuUgRCV4vUgckm8V/LMMxltOitQDKe8OvEVyt Fk3BZAaFa5Y/pURan4Y17HW237ZpNHYqU3c5IJhHDPq0Y+wL60eoztPZ3sdEVLNftn K8tRqmCHqmo/A== 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 Osr6Rpz_PneY; Sat, 19 Aug 2023 13:52:20 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id C93F783BF3; Sat, 19 Aug 2023 13:52:19 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org C93F783BF3 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 2B06A1BF476 for ; Sat, 19 Aug 2023 13:52:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 05E6D83BE4 for ; Sat, 19 Aug 2023 13:52:16 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 05E6D83BE4 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 1mKYBA68AIr8 for ; Sat, 19 Aug 2023 13:52:15 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by smtp1.osuosl.org (Postfix) with ESMTPS id 2694B83BA1 for ; Sat, 19 Aug 2023 13:52:15 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 2694B83BA1 X-IronPort-AV: E=McAfee;i="6600,9927,10807"; a="363463622" X-IronPort-AV: E=Sophos;i="6.01,186,1684825200"; d="scan'208";a="363463622" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Aug 2023 06:52:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10807"; a="805452177" X-IronPort-AV: E=Sophos;i="6.01,186,1684825200"; d="scan'208";a="805452177" Received: from zulkifl3-ilbpg0.png.intel.com ([10.88.229.82]) by fmsmga004.fm.intel.com with ESMTP; 19 Aug 2023 06:52:11 -0700 From: Muhammad Husaini Zulkifli To: intel-wired-lan@osuosl.org Date: Sat, 19 Aug 2023 21:50:50 +0800 Message-Id: <20230819135051.29390-2-muhammad.husaini.zulkifli@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230819135051.29390-1-muhammad.husaini.zulkifli@intel.com> References: <20230819135051.29390-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=1692453135; x=1723989135; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=iNbzwRMjAEvSzQbxsOi+KU8F2Wyrzf5JNrk8JE3lgeI=; b=NzQSo3pJ4AOR2OPU/TYQGmPFt4aLNvc9YJn/hQBC2ojlJUOJTg3iAP7b ZSATX25M3jQXcU3VhBj3RClTpkExlLPP0t4bBuUZ0nmqQJlLOmQG/usL0 dkOWJU5bpcVod1BUS5SyrIRB6PSxF9ZadCUaMHzvKAfkeM/o4liP0QA6V SrkI1PHKxr8jalyT6vF5ZL81CvNaF5t0kfl3rtZQeT+wyD4vxYsuO6Qg0 Nlq5MMHA4ziMRvJTn7lYyJiczB6PK2GG+CSqLHB3XAPYkYZHcyFNe/WDU ca6x5pFA3ifA754KiButWxl5PAYUGJrcTW+ohloSyb36ml1Wzi+6nbiKZ 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=NzQSo3pJ Subject: [Intel-wired-lan] [PATCH iwl-net v4 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: bcreeley@amd.com, netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, anthony.l.nguyen@intel.com, horms@kernel.org, kuba@kernel.org, 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 Sat Aug 19 13:50:51 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: 1823303 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; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=rKnsnCaT; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RSgCw5BJqz1yfT for ; Sat, 19 Aug 2023 23:52:28 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 3F93983BEE; Sat, 19 Aug 2023 13:52:25 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 3F93983BEE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1692453145; bh=mvdLl6SAdmvX7ggHWp5/SK033lu43P6uQlmhxVVpuZM=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=rKnsnCaThgBMQ4Zj0ZfKsMIzVZmSGhb/FxQgwdREXtEIzkpLl+DbWneGqLVHitlj2 pQPbL94J/dga47AQXDAs3yZaGDt3rJEbkUyRByvc0Qyk5FD6NJewzzDeHX3f5lfejr F5gguBlIqZfiLI6anygjAJHYR0+v7S4C5PpyE80yWcVNJmDKhUABCY51nyGEhC2Zhm VS2oqMg840re5bt7XDN0puU8OLFuxuAjKKMvXOSaloPQwF3xr0EBItWz0+NKDiChw9 V/abcraxHuoO9joxpOFARakJGcC9Wo+rYg8Ry++phb6WNulLI/pARI/bqeY9/xKSls yv9YhiIJJQthA== 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 mqhl4T209NwE; Sat, 19 Aug 2023 13:52:24 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id EAEEF83BE9; Sat, 19 Aug 2023 13:52:23 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org EAEEF83BE9 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 024AA1BF476 for ; Sat, 19 Aug 2023 13:52:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id CF93783BD7 for ; Sat, 19 Aug 2023 13:52:18 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org CF93783BD7 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 BM_hB5ZWGGeZ for ; Sat, 19 Aug 2023 13:52:18 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by smtp1.osuosl.org (Postfix) with ESMTPS id EF1A783BA1 for ; Sat, 19 Aug 2023 13:52:17 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org EF1A783BA1 X-IronPort-AV: E=McAfee;i="6600,9927,10807"; a="363463630" X-IronPort-AV: E=Sophos;i="6.01,186,1684825200"; d="scan'208";a="363463630" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Aug 2023 06:52:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10807"; a="805452183" X-IronPort-AV: E=Sophos;i="6.01,186,1684825200"; d="scan'208";a="805452183" Received: from zulkifl3-ilbpg0.png.intel.com ([10.88.229.82]) by fmsmga004.fm.intel.com with ESMTP; 19 Aug 2023 06:52:14 -0700 From: Muhammad Husaini Zulkifli To: intel-wired-lan@osuosl.org Date: Sat, 19 Aug 2023 21:50:51 +0800 Message-Id: <20230819135051.29390-3-muhammad.husaini.zulkifli@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230819135051.29390-1-muhammad.husaini.zulkifli@intel.com> References: <20230819135051.29390-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=1692453137; x=1723989137; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=yde9xJhaTEZD+38PelDCp44E5kb3nUKVR/tKJEve7W0=; b=REbgHN2imQoz3cIgPRsqxwl89OxqXDF35lHp3XjmxzaqbLvbMxhlQJcq HnYUhA1W2jrq0A90w5g4OMkfNO6678y1ERgkJJ2gre/oGxk71MwyM3vZE AGECRUqKujONV2QJqzTRe62DKITdLJTvISrQUnRVkDBZnLISXlvOtd8z1 0DpMZy+P4CEbdWJXWLwwgH+MUbioQsafWxES/9wBY80s+kPotTcoETzWC aXcCLH297EGZsOod6ITUjKmLfZCfabhVtwrl7+TSQ/QcbG1zl+mbwdU2V QfTwiFT2uR11iCa3pk5NY297EPqhS7LEhSOuzKC0pdlu7GacqM3W4F8is 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=REbgHN2i Subject: [Intel-wired-lan] [PATCH iwl-net v4 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: bcreeley@amd.com, netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, anthony.l.nguyen@intel.com, horms@kernel.org, kuba@kernel.org, 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 | 45 ++++++++++++++------ 1 file changed, 33 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..40ec6ebc0843 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -888,6 +888,11 @@ static int igc_ethtool_get_coalesce(struct net_device *netdev, return 0; } +static int igc_ethtool_coalesce_to_itr_setting(u32 coalesce_usecs) +{ + return coalesce_usecs <= 3 ? coalesce_usecs : coalesce_usecs << 2; +} + static int igc_ethtool_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec, struct kernel_ethtool_coalesce *kernel_coal, @@ -914,19 +919,35 @@ 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; + + /* convert to rate of irq's per second */ + if (old_tx_itr != ec->tx_coalesce_usecs) { + adapter->tx_itr_setting = + igc_ethtool_coalesce_to_itr_setting(ec->tx_coalesce_usecs); + adapter->rx_itr_setting = adapter->tx_itr_setting; + } else if (old_rx_itr != ec->rx_coalesce_usecs) { + adapter->rx_itr_setting = + igc_ethtool_coalesce_to_itr_setting(ec->rx_coalesce_usecs); + adapter->tx_itr_setting = adapter->rx_itr_setting; + } + } else { + /* convert to rate of irq's per second */ + adapter->rx_itr_setting = + igc_ethtool_coalesce_to_itr_setting(ec->rx_coalesce_usecs); - /* 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 */ + adapter->tx_itr_setting = + igc_ethtool_coalesce_to_itr_setting(ec->tx_coalesce_usecs); + } for (i = 0; i < adapter->num_q_vectors; i++) { struct igc_q_vector *q_vector = adapter->q_vector[i];