From patchwork Thu Jun 6 22:46:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Brandeburg X-Patchwork-Id: 1944781 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=x68D3Mqi; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VwKGK47Bcz20KL for ; Fri, 7 Jun 2024 08:47:21 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 287C14198B; Thu, 6 Jun 2024 22:47:17 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id LsQBqNdN_8Fs; Thu, 6 Jun 2024 22:47:16 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 1AAD9417A1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1717714036; bh=PNxH2XjWJhLMq+/z00Npmviymv9bKOZgjtPosJEh+3Q=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=x68D3MqiVbGnrzLPcdKX7B5R1Ux+H/lrcv5PCn8P8uhqQEykW6j/NhWxocRzKQ6ms oGVRZzkTVMvEkcZBAKk0fe4zJO8CffzsNHpx5+pdT21n+2yh3B+UM7E1/VBzKpZHlS nPwfX9roBMFsnuvvckPyeyinWhQiuDkvHxLXBs1POduhTRuRLGAj4gUs+qd0lO042N eXCOzz0DzwdkgshzjH5fVRlBqm/zdVsDxKYCFVb78u1lTo/0zpqlUvJBC0Xx1uZt5u vlAHIcPuSVxlj4bnDWe7in4vQbZ4yhmZHP0eUbWubi1sJ22RVKDB4//lP8cAHVogxb gZbpYv2x1bQMQ== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 1AAD9417A1; Thu, 6 Jun 2024 22:47:16 +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 1FA691BF94D for ; Thu, 6 Jun 2024 22:47:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 0B26084987 for ; Thu, 6 Jun 2024 22:47:13 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id WGyvdCFpvLsi for ; Thu, 6 Jun 2024 22:47:12 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.19; helo=mgamail.intel.com; envelope-from=jesse.brandeburg@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 4BB58849C0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 4BB58849C0 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by smtp1.osuosl.org (Postfix) with ESMTPS id 4BB58849C0 for ; Thu, 6 Jun 2024 22:47:12 +0000 (UTC) X-CSE-ConnectionGUID: VVjZ3Ns2Qbm98ezSg/zzTw== X-CSE-MsgGUID: BXnNhhXQQEy/YaSwQViDtA== X-IronPort-AV: E=McAfee;i="6600,9927,11095"; a="14224003" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="14224003" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 15:47:11 -0700 X-CSE-ConnectionGUID: hSq34+ReTMSf+Ga1+VM6uQ== X-CSE-MsgGUID: GVlBoXQZQcKFnX4OC5EiAQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="38243833" 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; 06 Jun 2024 15:47:11 -0700 From: Jesse Brandeburg To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org Date: Thu, 6 Jun 2024 15:46:55 -0700 Message-ID: <20240606224701.359706-2-jesse.brandeburg@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240606224701.359706-1-jesse.brandeburg@intel.com> References: <20240606224701.359706-1-jesse.brandeburg@intel.com> MIME-Version: 1.0 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=1717714032; x=1749250032; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JwHQnooLsYQJEJd80jekD4Sd5j4++MqVQNbMLJLcE+I=; b=PufJixHDkjeqDFsim3NV/wX8t4wiyWwqhg6wBEBurui5VHpKPygNAe1Q fFHtcw/M+4KJcWdACpvMv3aKPZ1eLsyWcMI7IMat0IEVXXC3k+p4pKM67 cJrO5y0VqFFoDMpoa+sWKgyN48H1Odzh7GqH8Sv9kzw656izAWqSlQHwB 3VGynR2yKlNOcnzKXDzTcrY4Y7dEj+YgZd5+EIRWUoIwXxKE9Js95qD8z aJUHt1JwNVxfd5wEoAWavpOyA5yYAWmT21qwUUIWVFyD8+dmAVKdvgRqy zQvvs0nBCdlDI6oWQxSiBuggyeSf9kN9C+AyJqDI8zErMEN5DcJTnFcfj g==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com 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=PufJixHD Subject: [Intel-wired-lan] [PATCH iwl-next v2 1/5] net: docs: add missing features that can have stats 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: linux-doc@vger.kernel.org, corbet@lwn.net, Jacob Keller , Jakub Kicinski , Rahul Rameshbabu Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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 Reviewed-by: Rahul Rameshbabu Reviewed-by: Jakub Kicinski Signed-off-by: Jesse Brandeburg Reviewed-by: Simon Horman --- v2: fix up a mixup of backticks and quotes (Jakub) 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..06f01c0cd65a 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 Thu Jun 6 22:46:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Brandeburg X-Patchwork-Id: 1944782 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=1+WYmG9f; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VwKGM5qssz20KL for ; Fri, 7 Jun 2024 08:47:23 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 07F5041A17; Thu, 6 Jun 2024 22:47:20 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id YV8BuBdrrlnF; Thu, 6 Jun 2024 22:47:18 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org BBB83419A8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1717714038; bh=Cp/JzRvsHEvqWcdg4saZL+UNU7El3bhLGAuEICEc+pU=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=1+WYmG9f8veJi8e7MKdNE1iv5MHcqVOjF/jPiJ9nkoyc+vO+m38Tab5nAPY7+erkT EcuHBZ6RH59Rt0hQjPQ72VNAXwNNOEB4Xs2NtF4q8i2oGulQmIs/i4Z3bzz7tLpj5x /7VMUskCcJBALoToeOsux1mhfR+kDkFNeTcqQW91viJtCgnrmphVtmS8JtD6LLO1jn UCSD/7pR9XoXYvLhn2UjpvfCNv+9FcreSfE+qBMVJzPikoZh5nXYaktOJflrhdLJuO bV+ccKn+/leUWiKOsThD+recf21Ug8p2UyBTT/quPQ8PUMIjfLPXNEol07VCflXuxj R50qJhBVyNTdg== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id BBB83419A8; Thu, 6 Jun 2024 22:47:18 +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 6BCBC1BF94D for ; Thu, 6 Jun 2024 22:47:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 908D8849D5 for ; Thu, 6 Jun 2024 22:47:13 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id SObidwTvkKdk for ; Thu, 6 Jun 2024 22:47:12 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.19; helo=mgamail.intel.com; envelope-from=jesse.brandeburg@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 95992849C5 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 95992849C5 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by smtp1.osuosl.org (Postfix) with ESMTPS id 95992849C5 for ; Thu, 6 Jun 2024 22:47:12 +0000 (UTC) X-CSE-ConnectionGUID: 507TjpFQTpueY71asV+CaA== X-CSE-MsgGUID: Exf+gy5sTmmXKSphGAC8pQ== X-IronPort-AV: E=McAfee;i="6600,9927,11095"; a="14224008" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="14224008" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 15:47:11 -0700 X-CSE-ConnectionGUID: 6JcK29OMTbGGHw21LXkmhQ== X-CSE-MsgGUID: l9QUanyGT4uGKSYYm2uiHw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="38243837" 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; 06 Jun 2024 15:47:11 -0700 From: Jesse Brandeburg To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org Date: Thu, 6 Jun 2024 15:46:56 -0700 Message-ID: <20240606224701.359706-3-jesse.brandeburg@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240606224701.359706-1-jesse.brandeburg@intel.com> References: <20240606224701.359706-1-jesse.brandeburg@intel.com> MIME-Version: 1.0 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=1717714033; x=1749250033; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=svAUTzKkGC+kHc/rLGAMIv+fBkOndfX3PQZ5NKI7qpU=; b=m7pZO0P1Gba5JoFwCDjUrSIn99vC9SglUX0VMODwIR/7XsGuVQ+UH+UO Xctlx6oDy0jN5Z1JLBz21VwqP902nFBtIxIgUrC7WMoeWiUkINT9tM/sf GCuHTTOZLjdoPYnRDiuXksrwhBQ3rgSx4P8U4zUPIvHx+Hmh3Ewj8SQNM +8pEgJn3eWZZFE+G3uzYUKu+GuCaPx8w1cv0TLCGUnx9ayeg08JU2JsyC JIagOXIYYY01EvryLSZwxTy/+W+M9R5LXjhRPaTMdIZlrt2VhiocMuQIO vZGKSkgB2yCSMEdkjSCUraiMQ1v1jZCSFCjdiHYn+W3dV47kMEH0YYNbt w==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com 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=m7pZO0P1 Subject: [Intel-wired-lan] [PATCH iwl-next v2 2/5] ice: implement ethtool standard stats 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: linux-doc@vger.kernel.org, corbet@lwn.net, Marcin Szycik , Jacob Keller , Jakub Kicinski Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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 Reviewed-by: Jacob Keller Reviewed-by: Jakub Kicinski Signed-off-by: Jesse Brandeburg Reviewed-by: Simon Horman --- 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 Thu Jun 6 22:46:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Brandeburg X-Patchwork-Id: 1944784 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=rgXkOPSt; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VwKGT4DdMz20KL for ; Fri, 7 Jun 2024 08:47:29 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id B03AB41A09; Thu, 6 Jun 2024 22:47:21 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id HhglHocmqWqa; Thu, 6 Jun 2024 22:47:21 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 0FD5D41975 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1717714041; bh=wzqYBDChU7u2uBfBKR4TXHcMpcDZ1MqxqT2KmGwAbL8=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=rgXkOPStmshLkU0BTuxud8ts592yREUsCj0Qbx6CKv7GGDmdNQXsBVHu9D3guIz0T iGaHDmyX2163KIaGNg/LBfWkPZVzE3U2x6ABLjS331uVfUQmmp9eppKaVm9YLve231 XvsjadYPk9ifVxGvNdh5O0ZZ5ZDZFOYo3vVTHej0jgFzSxnK8PJibbbKiok9gnU0a2 rQVHXioj4xV3XlTNVMSlNIC06odgyxlqSo+QeYBwFRuM9mnA2BkwXMu1DGsrgDqAPZ ELYPcIbItVkn5cflwSsegilFO3vYtGqIeNYj+GcofiQHltUcGSYq5oCuXWyn/pKjWf OSvQ4QveEfuJg== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 0FD5D41975; Thu, 6 Jun 2024 22:47:21 +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 8D4E11BF94D for ; Thu, 6 Jun 2024 22:47:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id E578D849C0 for ; Thu, 6 Jun 2024 22:47:13 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id z_rbBHH9Xrh3 for ; Thu, 6 Jun 2024 22:47:13 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.19; helo=mgamail.intel.com; envelope-from=jesse.brandeburg@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 2617E84987 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 2617E84987 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by smtp1.osuosl.org (Postfix) with ESMTPS id 2617E84987 for ; Thu, 6 Jun 2024 22:47:12 +0000 (UTC) X-CSE-ConnectionGUID: t2HyqRwzTnuqaxKo6VP34A== X-CSE-MsgGUID: /Qjq2ED+SxiBKr4BNQeJaA== X-IronPort-AV: E=McAfee;i="6600,9927,11095"; a="14224012" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="14224012" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 15:47:12 -0700 X-CSE-ConnectionGUID: Ka3nhXjBQ5KrvMiFuZ/iyw== X-CSE-MsgGUID: 71bnbA24R+CR341US9FiRQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="38243840" 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; 06 Jun 2024 15:47:11 -0700 From: Jesse Brandeburg To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org Date: Thu, 6 Jun 2024 15:46:57 -0700 Message-ID: <20240606224701.359706-4-jesse.brandeburg@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240606224701.359706-1-jesse.brandeburg@intel.com> References: <20240606224701.359706-1-jesse.brandeburg@intel.com> MIME-Version: 1.0 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=1717714033; x=1749250033; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IQbaN1PyCav0Y/g6MkJYTJ58TbA4AQLCkvXvbv1VlrM=; b=h3d7ZFZPz8qbEbY5zv7ArhA94jIzfBOs5tGCtImF1TmCYjJtaX9dS7ov QEY+jdmpWZS9B4XKDpyn+8/cPx9qptacv73EpRVAjMhmi8mCWOIRbylnr YYnduE2z9On5m11umt6/COvKGVfE9bVfjXiJc2vf55KhGr1Ly7K46JfSs l2f68/e0fhlw1+sSsQ2qUuA6geKPAbtwMe/l0JDfmEFHdlNH6BPbFX/7U PFdLLNtJSYJRRSQT4AZN4P8R1JrA6nz30V38FHPj/i/gnD2SJUPpuoqyP wlNP1aB3tuuYvi0hjRqCd8TW0TYia9IZHArn5MznYWiBtFyOXtIOOEGYp g==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com 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=h3d7ZFZP Subject: [Intel-wired-lan] [PATCH iwl-next v2 3/5] ice: add tracking of good transmit timestamps 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: Jacob Keller , Jakub Kicinski , linux-doc@vger.kernel.org, corbet@lwn.net Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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 Reviewed-by: Jakub Kicinski Signed-off-by: Jesse Brandeburg Reviewed-by: Simon Horman --- 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 Thu Jun 6 22:46:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Brandeburg X-Patchwork-Id: 1944783 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=Ub6FZqDj; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VwKGQ4gBZz20KL for ; Fri, 7 Jun 2024 08:47:26 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id E7D3141A65; Thu, 6 Jun 2024 22:47:20 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id obL0F0M0YCXX; Thu, 6 Jun 2024 22:47:20 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 2504841975 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1717714040; bh=QHZWE1jzYQM56FmPiNRTUmQAAVXkhoyOzlMZcegm/hA=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=Ub6FZqDjy59gcWhMI0xCPss6tgzZ/c1QDxF5N21DkpvVLu9+AnHF3EKrDidbtamMC Zd+N4rPgVbMQzIXLuaXQWXoV+tnSyFgFNfKR91KAaLY9qu3pd37snaf6jiAQk6/4Z/ sSSPhba4FinGVtiZEu8XHxGPs/7NIWieOFy8xlOZbpaGuvpzLDfmF/mbK1sas4XplM Cu+4X3casEKscTlAaMqBwK8dPFTYU28bZ2wBeIM1k1225VoNGQkVvEWfk/nfQ6RYEt l8m8FpSP53deV7RHKUBQHUrXVzMPctB9dJck/E414dgTNk6ysGSuMDu+jKUkrSFsX2 NSmJfZOsd+M1Q== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 2504841975; Thu, 6 Jun 2024 22:47:20 +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 7C87C1BF94D for ; Thu, 6 Jun 2024 22:47:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id CCE54849C5 for ; Thu, 6 Jun 2024 22:47:13 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 8Z_l0dKC81vv for ; Thu, 6 Jun 2024 22:47:13 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.19; helo=mgamail.intel.com; envelope-from=jesse.brandeburg@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 1A5CE849C0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 1A5CE849C0 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by smtp1.osuosl.org (Postfix) with ESMTPS id 1A5CE849C0 for ; Thu, 6 Jun 2024 22:47:12 +0000 (UTC) X-CSE-ConnectionGUID: Nl7njW7PTtOXdD4+g+8i7Q== X-CSE-MsgGUID: U1EcHtxbStOONZOH94JKZQ== X-IronPort-AV: E=McAfee;i="6600,9927,11095"; a="14224016" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="14224016" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 15:47:12 -0700 X-CSE-ConnectionGUID: Ruw+N1/qSvi/splh/Vr6bg== X-CSE-MsgGUID: +aZnIgdAR6CkgvddpW3EBA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="38243843" 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; 06 Jun 2024 15:47:12 -0700 From: Jesse Brandeburg To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org Date: Thu, 6 Jun 2024 15:46:58 -0700 Message-ID: <20240606224701.359706-5-jesse.brandeburg@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240606224701.359706-1-jesse.brandeburg@intel.com> References: <20240606224701.359706-1-jesse.brandeburg@intel.com> MIME-Version: 1.0 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=1717714033; x=1749250033; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WJPwdnA8Lj4NLq97gnr8zSK5cfQQDsGNC1zvghOKkgw=; b=S8q2Qg5kbO5BrQ04hsTQHdqosIIIhv434aHEn+0NttkdjS5ZQ0k0635U 0k67IbWe9WQvQS8MgmC78GxaHuZ17ruFN3GmlSaS9n3CCiC1e5K7BrXh8 LDTOT4+EG6fCM+dnUxIOdtujvbSyNeiBnRw7gXhpLUglI/YOWOh/3UWlT vv0Tz/8U5ElC0eD2+xOG5HuF4AGxa/ueR3WRx+O8gsU9OogMzWqlsEc1p sez+EO+AjWLkKkqTwA7YFG8/ssG1yqTIx8H4nTVskWlAATrP11u9dvdXR 4StGx3/ntsYgBJDafBSvXOBnSiDaVEpnMinsWSqkCnMxt5ydQcg6y73Wa A==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com 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=S8q2Qg5k Subject: [Intel-wired-lan] [PATCH iwl-next v2 4/5] ice: implement transmit hardware timestamp statistics 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: linux-doc@vger.kernel.org, corbet@lwn.net, Hariprasad Kelam , Jacob Keller , Jakub Kicinski Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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 Reviewed-by: Jakub Kicinski Reviewed-by: Hariprasad Kelam Signed-off-by: Jesse Brandeburg Reviewed-by: Simon Horman --- $ 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 Thu Jun 6 22:46:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Brandeburg X-Patchwork-Id: 1944785 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=Pf4TiY/F; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 4VwKGX3J9Kz20KL for ; Fri, 7 Jun 2024 08:47:32 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id F1C7B41992; Thu, 6 Jun 2024 22:47:22 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id MCj79C-KxIrD; Thu, 6 Jun 2024 22:47:22 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 1155441996 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1717714042; bh=05AgwmspICETQrAVQS7hhOQgESGI55RymPG83Z0cMSs=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=Pf4TiY/F+zFWEUTFcepn/xOaqeTPybUI5v/23dvQb+TUhNLj9Ihz7e5LUPqeFx+AP UTgrMti/M2kBGmoEtLoubSDRTzCJ/ED7BUsy75YdV/haOF+DWyKgkLHA5t+no0IHr6 xlzhHLzpWC8+xroj4pAOp6SPDuGMwwBcUFbkLaS5JG/tebrNNESvOvXEI3YudEXj21 LcVaEW6bbHRMPp2vFnHE0L8kQOFjAZ9y+ETEWzoDoUm09uQl4fdtmOo7as8ifPBGKe GNX9LFQKXL4AIMGb5iGz27rndZQY7qvQXJYIoVFKO8G/la88NcHVBre5ESWUQHjVpE bjHMcF2shsHlg== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 1155441996; Thu, 6 Jun 2024 22:47:22 +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 912E11BF94D for ; Thu, 6 Jun 2024 22:47:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 6609184987 for ; Thu, 6 Jun 2024 22:47:14 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id iLrCtiWR8uR5 for ; Thu, 6 Jun 2024 22:47:13 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.19; helo=mgamail.intel.com; envelope-from=jesse.brandeburg@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 67191849CE DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 67191849CE Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by smtp1.osuosl.org (Postfix) with ESMTPS id 67191849CE for ; Thu, 6 Jun 2024 22:47:13 +0000 (UTC) X-CSE-ConnectionGUID: PfLqUPqhQhSTP0JtsPGBQA== X-CSE-MsgGUID: eXvfvuP1QHmTUmHJ8u3QpA== X-IronPort-AV: E=McAfee;i="6600,9927,11095"; a="14224025" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="14224025" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 15:47:12 -0700 X-CSE-ConnectionGUID: W0oErCYOTGmUGRXmPz73Fg== X-CSE-MsgGUID: UHpe3H35QQSOucNSDb8eyA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="38243847" 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; 06 Jun 2024 15:47:12 -0700 From: Jesse Brandeburg To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org Date: Thu, 6 Jun 2024 15:46:59 -0700 Message-ID: <20240606224701.359706-6-jesse.brandeburg@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240606224701.359706-1-jesse.brandeburg@intel.com> References: <20240606224701.359706-1-jesse.brandeburg@intel.com> MIME-Version: 1.0 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=1717714033; x=1749250033; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bJs0A7U00c7oKj2hmhzU3KoY/dE5B1Se23w5Fft/kQk=; b=UTA+a9em7DOdSCsOBjMlq8pa2lyWHtyVXBfeMMxYMJJ9Hdx8sZlmqi6B ZLfh+GdFMhfdGmkOHp2K9wPPtkJcC/vqmLLqZJNfS0z7IxHLVVbWxEG2V 0NkLylTq1CZjFuuFebhbULKeBvq1R7r1/1DIw0sfkn2lHnrBJppIEH0vM oNOwQyDQ2GohqDDxdT2XSslFxrJfJyDJAqDLF4aDTsZ+8A5q3T/vOq4oU uG8NrmtTp5va9E2tC5nQ0q7hZkePhTIr1etUsC01uo3uCgIbR+CNVBZhA E+jS+J9u/2ov9egZ41f2wh8WrrfaRHZfwj7Qt866fs3WNZMqvs3ELPego A==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com 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=UTA+a9em Subject: [Intel-wired-lan] [PATCH iwl-next v2 5/5] ice: refactor to use helpers 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: linux-doc@vger.kernel.org, Przemek Kitszel , corbet@lwn.net, Jacob Keller , Jakub Kicinski Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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 Reviewed-by: Przemek Kitszel Reviewed-by: Jakub Kicinski Signed-off-by: Jesse Brandeburg Reviewed-by: Simon Horman --- 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;