From patchwork Tue Jun 4 22:13:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Brandeburg X-Patchwork-Id: 13685906 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91C5414D28E; Tue, 4 Jun 2024 22:13:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717539220; cv=none; b=hy9X/E0PneOCCfSgKYMP+CG10TjZUZssDQJ6DFdGfO2qO9ybN80vJJrS67f2yUybeZ5LM04fBVz3ldoCvd7ZcDzakSKmzgt9tF5ddYdFb8Fu2UeqJTxl9ZLlPkXMlXjWmtlgl8ogyGDV18WHrAucCEBgBruQXJedyOyU8Vcj0cM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717539220; c=relaxed/simple; bh=NH0e1gv30FCCZJHwSEekSafzctrL119woZPwilJfxY8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QuDvhxR5FxhFVjuTltA4yCiGxXWAJ+773tcvo2R0y1B5ETmzp0RRHcTGoE3hzSROHECOfO1hVIjgohw0yeE1bN4Mw/meIPUH16XuHlruZ0oAsROEhipQCv5hQ3kIy85rKOAQ1m8JPRV8UgiY18Wflc/JriexAq3RfS6mYYpo2/Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=VpUusI+/; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VpUusI+/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717539219; x=1749075219; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NH0e1gv30FCCZJHwSEekSafzctrL119woZPwilJfxY8=; b=VpUusI+/q3k1DAP3CM0NkGebER50PkejQflocEuhLrp17O0Bz81i05TI uWqUzztQQl928C6LYbe2yHZ+L4nW5mDJPCgxellsEfnhFhcK/+LEIoFFa w4KAsAeLGkxNarxdOUjMBVEd1ZJe6gW0pnnjXtXZTsc3soIRhG7TGOieE nxq1dfMC0cfVomULntrxTkIPk5byweRTkFsnHm3eqDjAq1GNomnhnBAXc S04hvqUw6H771aT/gWpXBNqL7l72yBn40mt4sP8yBZ65FbL4AUmj9JDZM DeS0CKa2vJOO6VMnapB2KXcYRzLKJrSLfpOXcSvQFJuXj+J6Bh0W9F3QV Q==; X-CSE-ConnectionGUID: dBAJcf5kRoS7geVz6KRmRQ== X-CSE-MsgGUID: +7y6u/KyQbGpOsfmA10TSQ== X-IronPort-AV: E=McAfee;i="6600,9927,11093"; a="36635254" X-IronPort-AV: E=Sophos;i="6.08,214,1712646000"; d="scan'208";a="36635254" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2024 15:13:33 -0700 X-CSE-ConnectionGUID: kKp/BzTuQsaTHfbLTqH4WA== X-CSE-MsgGUID: WiCz+YyNQ2++ZuhmAYwhZw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,214,1712646000"; d="scan'208";a="37503235" Received: from jbrandeb-spr1.jf.intel.com ([10.166.28.233]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2024 15:13:32 -0700 From: Jesse Brandeburg To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org Cc: Jesse Brandeburg , corbet@lwn.net, linux-doc@vger.kernel.org, Rahul Rameshbabu , Jacob Keller Subject: [PATCH iwl-next v1 1/5] net: docs: add missing features that can have stats Date: Tue, 4 Jun 2024 15:13:21 -0700 Message-ID: <20240604221327.299184-2-jesse.brandeburg@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240604221327.299184-1-jesse.brandeburg@intel.com> References: <20240604221327.299184-1-jesse.brandeburg@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org While trying to figure out ethtool -I | --include-statistics, I noticed some docs got missed when implementing commit 0e9c127729be ("ethtool: add interface to read Tx hardware timestamping statistics"). Fix up the docs to match the kernel code, and while there, sort them in alphabetical order. Cc: Rahul Rameshbabu Reviewed-by: Jacob Keller Signed-off-by: Jesse Brandeburg Reviewed-by: Rahul Rameshbabu --- I didn't add a Fixes: tag because this is not an urgent kind of fix that should require backports. --- Documentation/networking/statistics.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/networking/statistics.rst b/Documentation/networking/statistics.rst index 75e017dfa825..22503a90e369 100644 --- a/Documentation/networking/statistics.rst +++ b/Documentation/networking/statistics.rst @@ -184,9 +184,11 @@ Protocol-related statistics can be requested in get commands by setting the `ETHTOOL_FLAG_STATS` flag in `ETHTOOL_A_HEADER_FLAGS`. Currently statistics are supported in the following commands: - - `ETHTOOL_MSG_PAUSE_GET` - `ETHTOOL_MSG_FEC_GET` + - 'ETHTOOL_MSG_LINKSTATE_GET' - `ETHTOOL_MSG_MM_GET` + - `ETHTOOL_MSG_PAUSE_GET` + - 'ETHTOOL_MSG_TSINFO_GET' debugfs ------- From patchwork Tue Jun 4 22:13:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Brandeburg X-Patchwork-Id: 13685904 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6AA4144300; Tue, 4 Jun 2024 22:13:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717539218; cv=none; b=XrWIiHf9rOOIE+jfk1Lncacc2YLw6A0+0rJwVSdq9RRLM8+Suahqa6NpNWZGLrVyZC6e48gYRFMVrGOtXDUBG7ApVYZqPWK+Vzrscu1MwuKrHvh3KbG8V6jBX7kC0uipGEhFMpsjyDVz8LgBOxBnnDzmrgK1nQBeSS/qkoi6H+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717539218; c=relaxed/simple; bh=yc6ElQBcZA8tgKKGT53RjUXOd6H+SFj0vdcLHrYf8mo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rJrlK5X5EqwpPRRFphqylAXvUrga8Hu+1yiu6TpBRE3+eES8qKMhdMWiGl6H6F4ME/xuWngvoYKKgwVaoozB2V20oezdJ+JK4cUDuM2izZHUS3Kc/7BOLyUKebHpo7H4MdcftkRamb3kGO4Mj7h8OkXRNrkxpxUG9Ce+gc/Lh08= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=KaeGiJqK; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KaeGiJqK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717539217; x=1749075217; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yc6ElQBcZA8tgKKGT53RjUXOd6H+SFj0vdcLHrYf8mo=; b=KaeGiJqKC74xCURVceQZd5AxSd1geJE486M2Xwy9YBxmL3eSQrxivZVt asaNkBE9NPhtC9JNsOP2bJ3sGwxLugRcOw5F2HJ+4ZloKU9LYtEdE/9xh s/J2UnkAsZpdYkslbrny3ZUEhWcdgO3Kq3EbrnVsrvi1tRrATaL330KuR 1hIXLeCNHXWqyyxa/sxOnWHt99R3ubb481pGvwHRtV/D+oct3K2E8tlZO gOgB3Tqs9b/ej05/0TCuBglAw7cmjkbjhovl/mtId3rBTH1H3h2r6UHux XyP1J80owOyWip6HnhPOVlt2XLk5uQmio3BkF/0gsTMnbZi42dyt57BxZ w==; X-CSE-ConnectionGUID: l7ilxqUKTrOp/dDNY03Zow== X-CSE-MsgGUID: 0tWqwcDbRYeyhatbSqgtmg== X-IronPort-AV: E=McAfee;i="6600,9927,11093"; a="36635258" X-IronPort-AV: E=Sophos;i="6.08,214,1712646000"; d="scan'208";a="36635258" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2024 15:13:33 -0700 X-CSE-ConnectionGUID: KKCy8NccSemJUEV1mbMOIQ== X-CSE-MsgGUID: JkoBduhgSaSGLGRnaQZJQA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,214,1712646000"; d="scan'208";a="37503239" Received: from jbrandeb-spr1.jf.intel.com ([10.166.28.233]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2024 15:13:32 -0700 From: Jesse Brandeburg To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org Cc: Jesse Brandeburg , corbet@lwn.net, linux-doc@vger.kernel.org, Jacob Keller Subject: [PATCH iwl-next v1 2/5] ice: implement ethtool standard stats Date: Tue, 4 Jun 2024 15:13:22 -0700 Message-ID: <20240604221327.299184-3-jesse.brandeburg@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240604221327.299184-1-jesse.brandeburg@intel.com> References: <20240604221327.299184-1-jesse.brandeburg@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add support for MAC/pause/RMON stats. This enables reporting hardware statistics in a common way via: ethtool -S eth0 --all-groups and ethtool --include-statistics --show-pause eth0 While doing so, add support for one new stat, receive length error (RLEC), which is extremely unlikely to happen since most L2 frames have a type/length field specifying a "type", and raw ethernet frames aren't used much any longer. NOTE: I didn't implement Ctrl aka control frame stats because the hardware doesn't seem to implement support. Reviewed-by: Marcin Szycik Signed-off-by: Jesse Brandeburg --- Example output: Standard stats for ens785f1np1: eth-mac-FramesTransmittedOK: 296 eth-mac-FramesReceivedOK: 339 eth-mac-FrameCheckSequenceErrors: 0 eth-mac-OctetsTransmittedOK: 70410 eth-mac-OctetsReceivedOK: 51414 eth-mac-MulticastFramesXmittedOK: 124 eth-mac-BroadcastFramesXmittedOK: 1 eth-mac-MulticastFramesReceivedOK: 164 eth-mac-BroadcastFramesReceivedOK: 3 eth-mac-InRangeLengthErrors: 0 eth-mac-FrameTooLongErrors: 0 rmon-etherStatsUndersizePkts: 0 rmon-etherStatsOversizePkts: 0 rmon-etherStatsFragments: 0 rmon-etherStatsJabbers: 0 rx-rmon-etherStatsPkts64Octets: 31 rx-rmon-etherStatsPkts65to127Octets: 265 rx-rmon-etherStatsPkts128to255Octets: 26 rx-rmon-etherStatsPkts256to511Octets: 7 rx-rmon-etherStatsPkts512to1023Octets: 1 rx-rmon-etherStatsPkts1024to1522Octets: 6 rx-rmon-etherStatsPkts1523to9522Octets: 3 tx-rmon-etherStatsPkts64Octets: 25 tx-rmon-etherStatsPkts65to127Octets: 255 tx-rmon-etherStatsPkts128to255Octets: 1 tx-rmon-etherStatsPkts256to511Octets: 2 tx-rmon-etherStatsPkts512to1023Octets: 1 tx-rmon-etherStatsPkts1024to1522Octets: 1 tx-rmon-etherStatsPkts1523to9522Octets: 11 and Pause parameters for ens785f0np0: Autonegotiate: on RX: off TX: off RX negotiated: off TX negotiated: off Statistics: tx_pause_frames: 0 rx_pause_frames: 0 --- drivers/net/ethernet/intel/ice/ice_ethtool.c | 78 ++++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_main.c | 3 + drivers/net/ethernet/intel/ice/ice_type.h | 1 + 3 files changed, 82 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index 62c8205fceba..6f0a857f55c9 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -4282,6 +4282,81 @@ ice_get_module_eeprom(struct net_device *netdev, return 0; } +static void ice_get_eth_mac_stats(struct net_device *netdev, + struct ethtool_eth_mac_stats *mac_stats) +{ + struct ice_pf *pf = ice_netdev_to_pf(netdev); + struct ice_hw_port_stats *ps = &pf->stats; + + mac_stats->FramesTransmittedOK = ps->eth.tx_unicast + + ps->eth.tx_multicast + + ps->eth.tx_broadcast; + mac_stats->FramesReceivedOK = ps->eth.rx_unicast + + ps->eth.rx_multicast + + ps->eth.rx_broadcast; + mac_stats->FrameCheckSequenceErrors = ps->crc_errors; + mac_stats->OctetsTransmittedOK = ps->eth.tx_bytes; + mac_stats->OctetsReceivedOK = ps->eth.rx_bytes; + mac_stats->MulticastFramesXmittedOK = ps->eth.tx_multicast; + mac_stats->BroadcastFramesXmittedOK = ps->eth.tx_broadcast; + mac_stats->MulticastFramesReceivedOK = ps->eth.rx_multicast; + mac_stats->BroadcastFramesReceivedOK = ps->eth.rx_broadcast; + mac_stats->InRangeLengthErrors = ps->rx_len_errors; + mac_stats->FrameTooLongErrors = ps->rx_oversize; +} + +static void ice_get_pause_stats(struct net_device *netdev, + struct ethtool_pause_stats *pause_stats) +{ + struct ice_pf *pf = ice_netdev_to_pf(netdev); + struct ice_hw_port_stats *ps = &pf->stats; + + pause_stats->tx_pause_frames = ps->link_xon_tx + ps->link_xoff_tx; + pause_stats->rx_pause_frames = ps->link_xon_rx + ps->link_xoff_rx; +} + +static const struct ethtool_rmon_hist_range ice_rmon_ranges[] = { + { 0, 64 }, + { 65, 127 }, + { 128, 255 }, + { 256, 511 }, + { 512, 1023 }, + { 1024, 1522 }, + { 1523, 9522 }, + {} +}; + +static void ice_get_rmon_stats(struct net_device *netdev, + struct ethtool_rmon_stats *rmon, + const struct ethtool_rmon_hist_range **ranges) +{ + struct ice_pf *pf = ice_netdev_to_pf(netdev); + struct ice_hw_port_stats *ps = &pf->stats; + + rmon->undersize_pkts = ps->rx_undersize; + rmon->oversize_pkts = ps->rx_oversize; + rmon->fragments = ps->rx_fragments; + rmon->jabbers = ps->rx_jabber; + + rmon->hist[0] = ps->rx_size_64; + rmon->hist[1] = ps->rx_size_127; + rmon->hist[2] = ps->rx_size_255; + rmon->hist[3] = ps->rx_size_511; + rmon->hist[4] = ps->rx_size_1023; + rmon->hist[5] = ps->rx_size_1522; + rmon->hist[6] = ps->rx_size_big; + + rmon->hist_tx[0] = ps->tx_size_64; + rmon->hist_tx[1] = ps->tx_size_127; + rmon->hist_tx[2] = ps->tx_size_255; + rmon->hist_tx[3] = ps->tx_size_511; + rmon->hist_tx[4] = ps->tx_size_1023; + rmon->hist_tx[5] = ps->tx_size_1522; + rmon->hist_tx[6] = ps->tx_size_big; + + *ranges = ice_rmon_ranges; +} + static const struct ethtool_ops ice_ethtool_ops = { .cap_rss_ctx_supported = true, .supported_coalesce_params = ETHTOOL_COALESCE_USECS | @@ -4329,6 +4404,9 @@ static const struct ethtool_ops ice_ethtool_ops = { .set_fecparam = ice_set_fecparam, .get_module_info = ice_get_module_info, .get_module_eeprom = ice_get_module_eeprom, + .get_eth_mac_stats = ice_get_eth_mac_stats, + .get_pause_stats = ice_get_pause_stats, + .get_rmon_stats = ice_get_rmon_stats, }; static const struct ethtool_ops ice_ethtool_safe_mode_ops = { diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index f60c022f7960..4db3a6056f41 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -7034,6 +7034,9 @@ void ice_update_pf_stats(struct ice_pf *pf) &prev_ps->mac_remote_faults, &cur_ps->mac_remote_faults); + ice_stat_update32(hw, GLPRT_RLEC(port), pf->stat_prev_loaded, + &prev_ps->rx_len_errors, &cur_ps->rx_len_errors); + ice_stat_update32(hw, GLPRT_RUC(port), pf->stat_prev_loaded, &prev_ps->rx_undersize, &cur_ps->rx_undersize); diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h index f0796a93f428..b156d01196e2 100644 --- a/drivers/net/ethernet/intel/ice/ice_type.h +++ b/drivers/net/ethernet/intel/ice/ice_type.h @@ -1007,6 +1007,7 @@ struct ice_hw_port_stats { u64 error_bytes; /* errbc */ u64 mac_local_faults; /* mlfc */ u64 mac_remote_faults; /* mrfc */ + u64 rx_len_errors; /* rlec */ u64 link_xon_rx; /* lxonrxc */ u64 link_xoff_rx; /* lxoffrxc */ u64 link_xon_tx; /* lxontxc */ From patchwork Tue Jun 4 22:13:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Brandeburg X-Patchwork-Id: 13685903 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78942143C4D; Tue, 4 Jun 2024 22:13:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717539218; cv=none; b=jureE6T3NvpdOqcuFH2aplmo5TtaVuaInjjDYPC5vyK+qvNOZhTulwLpj46KxZJDTogYJhmlM2gZoqpls3l+u7VdIV9ZDm/AosgB4P6B7F5zYFbZjpf87teVCumXEPgf6wYu1LW76z7dFfrZHit49N88mzg97oK/2wolJW3TasQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717539218; c=relaxed/simple; bh=sPI1vmf9knwUD727FBcKhAG4rMv2hV9/5rA9aOi+/7A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NIghR8AQxy4BzaYnU8IW3ktKFJCNmcHfEkbNcDvd7fV3q22ernxotF1QIUwjtk0aVCYNGUcY7nMlb/rnvKCwRjhNMwpJQ+7eJgUPidSVTAxqNTnjdm59cZyS87AI+QfYzsd0YswawX8SKg5bF0Heswq3eayNb2BDotINZA3rGcI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=LF5x3aPa; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="LF5x3aPa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717539217; x=1749075217; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sPI1vmf9knwUD727FBcKhAG4rMv2hV9/5rA9aOi+/7A=; b=LF5x3aPa0inuv+Rrnrz5/RuZ/uW5j4xdVbpEwy/HdjCIHoHU8wilxl3d ecOr+WlBGpSAYTm5qKCSXGJ57PkCvVktkJNNTNfYDwfXE3rDe5Qt/Keq3 yuUeq3QzqMWgEBZdT0ZE36/olb06W/l3EBdmTvNGhzvgmqsxI/Z+X/00X zFw9T0W3TV5W2fPdTomh2RRsDIkvVRp9IHhtpiyFwEz6SHFnHDM6iFk37 QYAzNFahy8abPMVHx/b4HEolQUNrwh1mFHvfdTu4uHkrYWWeq7A4Nt0AI thm5388zochYBbq3qbQmu+Ld0LF/l3+CS5O8+mRizmT3LTfpmfhvmRrm5 g==; X-CSE-ConnectionGUID: gG7X9sKEQI64EAG8OIT4sQ== X-CSE-MsgGUID: xLfF0gv8QuSCGkf5HWqmlw== X-IronPort-AV: E=McAfee;i="6600,9927,11093"; a="36635262" X-IronPort-AV: E=Sophos;i="6.08,214,1712646000"; d="scan'208";a="36635262" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2024 15:13:33 -0700 X-CSE-ConnectionGUID: SWJB63lcQD+crIeTePZKCg== X-CSE-MsgGUID: NbgbaTUIQAWvWMxL/mN2fQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,214,1712646000"; d="scan'208";a="37503242" Received: from jbrandeb-spr1.jf.intel.com ([10.166.28.233]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2024 15:13:32 -0700 From: Jesse Brandeburg To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org Cc: Jesse Brandeburg , corbet@lwn.net, linux-doc@vger.kernel.org, Jacob Keller Subject: [PATCH iwl-next v1 3/5] ice: add tracking of good transmit timestamps Date: Tue, 4 Jun 2024 15:13:23 -0700 Message-ID: <20240604221327.299184-4-jesse.brandeburg@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240604221327.299184-1-jesse.brandeburg@intel.com> References: <20240604221327.299184-1-jesse.brandeburg@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org As a pre-requisite to implementing timestamp statistics, start tracking successful PTP timestamps. There already existed a trace event, but add a counter as well so it can be displayed by the next patch. Good count is a u64 as it is much more likely to be incremented. The existing error stats are all u32 as before, and are less likely so will wrap less. Reviewed-by: Jacob Keller Signed-off-by: Jesse Brandeburg --- drivers/net/ethernet/intel/ice/ice_ptp.c | 9 +++++++++ drivers/net/ethernet/intel/ice/ice_ptp.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index 0f17fc1181d2..ff0ba81d0694 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -628,6 +628,9 @@ void ice_ptp_complete_tx_single_tstamp(struct ice_ptp_tx *tx) if (tstamp) { shhwtstamps.hwtstamp = ns_to_ktime(tstamp); ice_trace(tx_tstamp_complete, skb, idx); + + /* Count the number of Tx timestamps that succeeded */ + pf->ptp.tx_hwtstamp_good++; } skb_tstamp_tx(skb, &shhwtstamps); @@ -686,6 +689,7 @@ static void ice_ptp_process_tx_tstamp(struct ice_ptp_tx *tx) { struct ice_ptp_port *ptp_port; unsigned long flags; + u32 tstamp_good = 0; struct ice_pf *pf; struct ice_hw *hw; u64 tstamp_ready; @@ -786,11 +790,16 @@ static void ice_ptp_process_tx_tstamp(struct ice_ptp_tx *tx) if (tstamp) { shhwtstamps.hwtstamp = ns_to_ktime(tstamp); ice_trace(tx_tstamp_complete, skb, idx); + + /* Count the number of Tx timestamps that succeeded */ + tstamp_good++; } skb_tstamp_tx(skb, &shhwtstamps); dev_kfree_skb_any(skb); } + + pf->ptp.tx_hwtstamp_good += tstamp_good; } /** diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.h b/drivers/net/ethernet/intel/ice/ice_ptp.h index 3af20025043a..2b15f2b58789 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.h +++ b/drivers/net/ethernet/intel/ice/ice_ptp.h @@ -253,6 +253,7 @@ struct ice_ptp { struct ptp_clock *clock; struct hwtstamp_config tstamp_config; u64 reset_time; + u64 tx_hwtstamp_good; u32 tx_hwtstamp_skipped; u32 tx_hwtstamp_timeouts; u32 tx_hwtstamp_flushed; From patchwork Tue Jun 4 22:13:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Brandeburg X-Patchwork-Id: 13685905 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D61514C5B8; Tue, 4 Jun 2024 22:13:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717539219; cv=none; b=mXzpF7golB70QhpQgdF+xXrTsKGPfI0smcC0DLmu9kZ0s++vj3MpEZF/9l4d8DQDwwxtDquJLBkquNPa9bJaE/Ey2jqOAz6bkLc7h1f/aaSs4Sp7tiGSF8Fct/SVk0ZJ2HNHxP4+lEkKxCoabtpiFKOwj4yyMkyDFKAb/0GLvio= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717539219; c=relaxed/simple; bh=rL5kinlQFFzU1XTq/6TzJBFgGwuFIH/m9QaI0R7Q2QI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HfA16lYcbP2yhUGLafTDxT+/Lt2MHI+bzzVSYLIO+9KRB+LS5D+cOSBW58tZ0OcgDlOr3LQEoguxVvK3wzwDES6KzThd+K+wGGzLv5eN6U+qzJ8hVv/P8rAXrPXJ6N6zoiWkh3saWrdTKmEo7p/HeRzuoR5nLWCG3c1kMp/8mzM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Ejdxuo5e; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ejdxuo5e" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717539218; x=1749075218; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rL5kinlQFFzU1XTq/6TzJBFgGwuFIH/m9QaI0R7Q2QI=; b=Ejdxuo5eDHOsK6YYFYmiBjDZU1m6CzIdFqkECBwAdjZJocQeT5BM8dBI zCtXjETbSddIjwojBLjXHwzyd6zTiNMXwHbO+QVLYXe9HTwrT9eYvxjdM Iz1PgPFwSOVU4NRf3r/H0aTNLNwWc8+6VukOyF0Xn43/8n50A7Q5EEao1 4vlR260fM+PZxGqu2kgX2i495dX3JGX62COKuE1EJVyZJgjYibI3VdeJm 4tqveFgeC+rEDQZwzCF7VwDxA4eTpEtlWXpCFoy+5lRH4mYp1CS9zBzIn tFarXdiaPH96UKNs8Lf+6tltIVk/k+vccn30EH82/s2PkvnbJqKzGmOuL A==; X-CSE-ConnectionGUID: s0KhUZgJRWWxmv65yA+shg== X-CSE-MsgGUID: XtTirt37RNSy5e9zKemxug== X-IronPort-AV: E=McAfee;i="6600,9927,11093"; a="36635265" X-IronPort-AV: E=Sophos;i="6.08,214,1712646000"; d="scan'208";a="36635265" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2024 15:13:33 -0700 X-CSE-ConnectionGUID: 8ueFfticQIuvX4QYVHfsiw== X-CSE-MsgGUID: WKaPZkS4T1OFBSWIH2Cx7g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,214,1712646000"; d="scan'208";a="37503245" Received: from jbrandeb-spr1.jf.intel.com ([10.166.28.233]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2024 15:13:33 -0700 From: Jesse Brandeburg To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org Cc: Jesse Brandeburg , corbet@lwn.net, linux-doc@vger.kernel.org, Jacob Keller Subject: [PATCH iwl-next v1 4/5] ice: implement transmit hardware timestamp statistics Date: Tue, 4 Jun 2024 15:13:24 -0700 Message-ID: <20240604221327.299184-5-jesse.brandeburg@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240604221327.299184-1-jesse.brandeburg@intel.com> References: <20240604221327.299184-1-jesse.brandeburg@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org The kernel now has common statistics for transmit timestamps, so implement them in the ice driver. use via ethtool -I -T eth0 Reviewed-by: Jacob Keller Signed-off-by: Jesse Brandeburg Reviewed-by: Hariprasad Kelam --- $ sudo ethtool -I -T eth0 Time stamping parameters for eth0: Capabilities: hardware-transmit software-transmit hardware-receive software-receive software-system-clock hardware-raw-clock PTP Hardware Clock: 0 Hardware Transmit Timestamp Modes: off on Hardware Receive Filter Modes: none all Statistics: tx_pkts: 17 tx_lost: 0 tx_err: 0 --- drivers/net/ethernet/intel/ice/ice_ethtool.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index 6f0a857f55c9..97a7a0632a1d 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -4357,6 +4357,23 @@ static void ice_get_rmon_stats(struct net_device *netdev, *ranges = ice_rmon_ranges; } +/* ice_get_ts_stats - provide timestamping stats + * @netdev: the netdevice pointer from ethtool + * @ts_stats: the ethtool data structure to fill in + */ +static void ice_get_ts_stats(struct net_device *netdev, + struct ethtool_ts_stats *ts_stats) +{ + struct ice_pf *pf = ice_netdev_to_pf(netdev); + struct ice_ptp *ptp = &pf->ptp; + + ts_stats->pkts = ptp->tx_hwtstamp_good; + ts_stats->err = ptp->tx_hwtstamp_skipped + + ptp->tx_hwtstamp_flushed + + ptp->tx_hwtstamp_discarded; + ts_stats->lost = ptp->tx_hwtstamp_timeouts; +} + static const struct ethtool_ops ice_ethtool_ops = { .cap_rss_ctx_supported = true, .supported_coalesce_params = ETHTOOL_COALESCE_USECS | @@ -4407,6 +4424,7 @@ static const struct ethtool_ops ice_ethtool_ops = { .get_eth_mac_stats = ice_get_eth_mac_stats, .get_pause_stats = ice_get_pause_stats, .get_rmon_stats = ice_get_rmon_stats, + .get_ts_stats = ice_get_ts_stats, }; static const struct ethtool_ops ice_ethtool_safe_mode_ops = { From patchwork Tue Jun 4 22:13:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Brandeburg X-Patchwork-Id: 13685907 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B547A14D294; Tue, 4 Jun 2024 22:13:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717539220; cv=none; b=VZNQIgNB//w4Y+GwQ+WKJbFrXvSIUoeWrlUgFO643ehU5RvFKsGXeSwBl3Mb+pBnZYDtvyF03I80DTqF4F68dsUa1dZsW6xnutGZ3x+Uw4w3BtZtWV/f5OOsnYkmCA56dH/3CLaRKwWZWcVenRcY2hSxAkdIFCn/4IS+5xhZkWg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717539220; c=relaxed/simple; bh=fS98vqohV9oe9FbfzsYVfJwcOwXTsR8rG2R5oRi/hjk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h08mAXoSdrWRwSD3AazGBpltQ8TfZGXtv6H/xvJ1AuVTzvgggcW5kj6rNpP0UAwQOwtOj+T7/TLJegHggKQT8wR524K5qkzlAhNIPwSTiN07Z8SDTGJEFIELk1pVfluVZVaAIapiUZdctZTxUKkrv0CIOKlUzTwXPXNiDi041ds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=lIKLzfbD; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lIKLzfbD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717539219; x=1749075219; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fS98vqohV9oe9FbfzsYVfJwcOwXTsR8rG2R5oRi/hjk=; b=lIKLzfbDMnH7XPglHJDJukG5W66FxmYCyZpWRjUrCvG0nLB49ngYVgAB 11a/cdDZOJ9wL/Pc/cZ1fm0niSuk/mzYs5PJDLuZLlnX0RFiHgnHQWsNO 2Wn6H4nr0ohXVdMnT4o+73g6Yjwz2ZEsZfEQuRqLPfgCnmFOq5sNap/7f Tg/Kdz4LxBIAzVqtuDz6BwBqtFollizPmH2/NFx8kEK/y3RlKSFyubIdX Xd7nuIsL2VnvrBM44l73d01QELJhcR662uFfk7gIZDo/LDW+MhiHw01Yu PIzB2pc/SD1S66AJQnsIG2TYb7/g5nCXYVd85syBptlW5+4Vynp7R9ChX A==; X-CSE-ConnectionGUID: 9F7fTZVsT1ur/+XMRVB+ag== X-CSE-MsgGUID: B+ohG06lT5es3OtyVr1Jxw== X-IronPort-AV: E=McAfee;i="6600,9927,11093"; a="36635269" X-IronPort-AV: E=Sophos;i="6.08,214,1712646000"; d="scan'208";a="36635269" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2024 15:13:34 -0700 X-CSE-ConnectionGUID: yHK2DBGBRDK6I3osiZqexw== X-CSE-MsgGUID: OrFDi9UVS46mbqk8IAoQtA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,214,1712646000"; d="scan'208";a="37503250" Received: from jbrandeb-spr1.jf.intel.com ([10.166.28.233]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2024 15:13:33 -0700 From: Jesse Brandeburg To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org Cc: Jesse Brandeburg , corbet@lwn.net, linux-doc@vger.kernel.org, Jacob Keller Subject: [PATCH iwl-next v1 5/5] ice: refactor to use helpers Date: Tue, 4 Jun 2024 15:13:25 -0700 Message-ID: <20240604221327.299184-6-jesse.brandeburg@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240604221327.299184-1-jesse.brandeburg@intel.com> References: <20240604221327.299184-1-jesse.brandeburg@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Use the ice_netdev_to_pf() helper in more places and remove a bunch of boilerplate code. Not every instance could be replaced due to use of the netdev_priv() output or the vsi variable within a bunch of functions. Reviewed-by: Jacob Keller Signed-off-by: Jesse Brandeburg Reviewed-by: Przemek Kitszel --- drivers/net/ethernet/intel/ice/ice_ethtool.c | 42 ++++++------------- .../net/ethernet/intel/ice/ice_flex_pipe.c | 8 +--- drivers/net/ethernet/intel/ice/ice_lag.c | 5 +-- drivers/net/ethernet/intel/ice/ice_main.c | 7 +--- drivers/net/ethernet/intel/ice/ice_sriov.c | 3 +- 5 files changed, 19 insertions(+), 46 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index 97a7a0632a1d..2d307e7d9863 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -469,8 +469,7 @@ static int ice_get_regs_len(struct net_device __always_unused *netdev) static void ice_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p) { - struct ice_netdev_priv *np = netdev_priv(netdev); - struct ice_pf *pf = np->vsi->back; + struct ice_pf *pf = ice_netdev_to_pf(netdev); struct ice_hw *hw = &pf->hw; u32 *regs_buf = (u32 *)p; unsigned int i; @@ -483,8 +482,7 @@ ice_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p) static u32 ice_get_msglevel(struct net_device *netdev) { - struct ice_netdev_priv *np = netdev_priv(netdev); - struct ice_pf *pf = np->vsi->back; + struct ice_pf *pf = ice_netdev_to_pf(netdev); #ifndef CONFIG_DYNAMIC_DEBUG if (pf->hw.debug_mask) @@ -497,8 +495,7 @@ static u32 ice_get_msglevel(struct net_device *netdev) static void ice_set_msglevel(struct net_device *netdev, u32 data) { - struct ice_netdev_priv *np = netdev_priv(netdev); - struct ice_pf *pf = np->vsi->back; + struct ice_pf *pf = ice_netdev_to_pf(netdev); #ifndef CONFIG_DYNAMIC_DEBUG if (ICE_DBG_USER & data) @@ -512,8 +509,7 @@ static void ice_set_msglevel(struct net_device *netdev, u32 data) static int ice_get_eeprom_len(struct net_device *netdev) { - struct ice_netdev_priv *np = netdev_priv(netdev); - struct ice_pf *pf = np->vsi->back; + struct ice_pf *pf = ice_netdev_to_pf(netdev); return (int)pf->hw.flash.flash_size; } @@ -522,9 +518,7 @@ static int ice_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom, u8 *bytes) { - struct ice_netdev_priv *np = netdev_priv(netdev); - struct ice_vsi *vsi = np->vsi; - struct ice_pf *pf = vsi->back; + struct ice_pf *pf = ice_netdev_to_pf(netdev); struct ice_hw *hw = &pf->hw; struct device *dev; int ret; @@ -623,8 +617,7 @@ static u64 ice_link_test(struct net_device *netdev) */ static u64 ice_eeprom_test(struct net_device *netdev) { - struct ice_netdev_priv *np = netdev_priv(netdev); - struct ice_pf *pf = np->vsi->back; + struct ice_pf *pf = ice_netdev_to_pf(netdev); netdev_info(netdev, "EEPROM test\n"); return !!(ice_nvm_validate_checksum(&pf->hw)); @@ -938,9 +931,8 @@ static int ice_lbtest_receive_frames(struct ice_rx_ring *rx_ring) */ static u64 ice_loopback_test(struct net_device *netdev) { - struct ice_netdev_priv *np = netdev_priv(netdev); - struct ice_vsi *orig_vsi = np->vsi, *test_vsi; - struct ice_pf *pf = orig_vsi->back; + struct ice_pf *pf = ice_netdev_to_pf(netdev); + struct ice_vsi *test_vsi; u8 *tx_frame __free(kfree) = NULL; u8 broadcast[ETH_ALEN], ret = 0; int num_frames, valid_frames; @@ -1029,8 +1021,7 @@ static u64 ice_loopback_test(struct net_device *netdev) */ static u64 ice_intr_test(struct net_device *netdev) { - struct ice_netdev_priv *np = netdev_priv(netdev); - struct ice_pf *pf = np->vsi->back; + struct ice_pf *pf = ice_netdev_to_pf(netdev); u16 swic_old = pf->sw_int_count; netdev_info(netdev, "interrupt test\n"); @@ -1058,9 +1049,8 @@ static void ice_self_test(struct net_device *netdev, struct ethtool_test *eth_test, u64 *data) { - struct ice_netdev_priv *np = netdev_priv(netdev); + struct ice_pf *pf = ice_netdev_to_pf(netdev); bool if_running = netif_running(netdev); - struct ice_pf *pf = np->vsi->back; struct device *dev; dev = ice_pf_to_dev(pf); @@ -1384,9 +1374,7 @@ static int ice_nway_reset(struct net_device *netdev) */ static u32 ice_get_priv_flags(struct net_device *netdev) { - struct ice_netdev_priv *np = netdev_priv(netdev); - struct ice_vsi *vsi = np->vsi; - struct ice_pf *pf = vsi->back; + struct ice_pf *pf = ice_netdev_to_pf(netdev); u32 i, ret_flags = 0; for (i = 0; i < ICE_PRIV_FLAG_ARRAY_SIZE; i++) { @@ -4128,9 +4116,7 @@ static int ice_get_module_info(struct net_device *netdev, struct ethtool_modinfo *modinfo) { - struct ice_netdev_priv *np = netdev_priv(netdev); - struct ice_vsi *vsi = np->vsi; - struct ice_pf *pf = vsi->back; + struct ice_pf *pf = ice_netdev_to_pf(netdev); struct ice_hw *hw = &pf->hw; u8 sff8472_comp = 0; u8 sff8472_swap = 0; @@ -4202,12 +4188,10 @@ static int ice_get_module_eeprom(struct net_device *netdev, struct ethtool_eeprom *ee, u8 *data) { - struct ice_netdev_priv *np = netdev_priv(netdev); + struct ice_pf *pf = ice_netdev_to_pf(netdev); #define SFF_READ_BLOCK_SIZE 8 u8 value[SFF_READ_BLOCK_SIZE] = { 0 }; u8 addr = ICE_I2C_EEPROM_DEV_ADDR; - struct ice_vsi *vsi = np->vsi; - struct ice_pf *pf = vsi->back; struct ice_hw *hw = &pf->hw; bool is_sfp = false; unsigned int i, j; diff --git a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c index 20d5db88c99f..4c322bed716c 100644 --- a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c +++ b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c @@ -574,9 +574,7 @@ ice_destroy_tunnel(struct ice_hw *hw, u16 index, enum ice_tunnel_type type, int ice_udp_tunnel_set_port(struct net_device *netdev, unsigned int table, unsigned int idx, struct udp_tunnel_info *ti) { - struct ice_netdev_priv *np = netdev_priv(netdev); - struct ice_vsi *vsi = np->vsi; - struct ice_pf *pf = vsi->back; + struct ice_pf *pf = ice_netdev_to_pf(netdev); enum ice_tunnel_type tnl_type; int status; u16 index; @@ -598,9 +596,7 @@ int ice_udp_tunnel_set_port(struct net_device *netdev, unsigned int table, int ice_udp_tunnel_unset_port(struct net_device *netdev, unsigned int table, unsigned int idx, struct udp_tunnel_info *ti) { - struct ice_netdev_priv *np = netdev_priv(netdev); - struct ice_vsi *vsi = np->vsi; - struct ice_pf *pf = vsi->back; + struct ice_pf *pf = ice_netdev_to_pf(netdev); enum ice_tunnel_type tnl_type; int status; diff --git a/drivers/net/ethernet/intel/ice/ice_lag.c b/drivers/net/ethernet/intel/ice/ice_lag.c index 1ccb572ce285..cdb0e59aeb26 100644 --- a/drivers/net/ethernet/intel/ice/ice_lag.c +++ b/drivers/net/ethernet/intel/ice/ice_lag.c @@ -1640,11 +1640,8 @@ static void ice_lag_chk_disabled_bond(struct ice_lag *lag, void *ptr) */ static void ice_lag_disable_sriov_bond(struct ice_lag *lag) { - struct ice_netdev_priv *np; - struct ice_pf *pf; + struct ice_pf *pf = ice_netdev_to_pf(lag->netdev); - np = netdev_priv(lag->netdev); - pf = np->vsi->back; ice_clear_feature_support(pf, ICE_F_SRIOV_LAG); } diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 4db3a6056f41..9d852b169ead 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -7798,8 +7798,7 @@ static int ice_change_mtu(struct net_device *netdev, int new_mtu) */ static int ice_eth_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) { - struct ice_netdev_priv *np = netdev_priv(netdev); - struct ice_pf *pf = np->vsi->back; + struct ice_pf *pf = ice_netdev_to_pf(netdev); switch (cmd) { case SIOCGHWTSTAMP: @@ -8027,9 +8026,7 @@ static int ice_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, struct net_device *dev, u32 filter_mask, int nlflags) { - struct ice_netdev_priv *np = netdev_priv(dev); - struct ice_vsi *vsi = np->vsi; - struct ice_pf *pf = vsi->back; + struct ice_pf *pf = ice_netdev_to_pf(dev); u16 bmode; bmode = pf->first_sw->bridge_mode; diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c b/drivers/net/ethernet/intel/ice/ice_sriov.c index 067712f4923f..adcc2f967bab 100644 --- a/drivers/net/ethernet/intel/ice/ice_sriov.c +++ b/drivers/net/ethernet/intel/ice/ice_sriov.c @@ -1317,8 +1317,7 @@ ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event) */ int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena) { - struct ice_netdev_priv *np = netdev_priv(netdev); - struct ice_pf *pf = np->vsi->back; + struct ice_pf *pf = ice_netdev_to_pf(netdev); struct ice_vsi *vf_vsi; struct device *dev; struct ice_vf *vf;