From nobody Thu Nov 28 18:54:07 2024 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 4C80418FDD8; Mon, 30 Sep 2024 13:39:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727703586; cv=none; b=j/JGxr4IS8pwGGAdXcDjTLY0p/xUz17p7RMVsk8ZaAOtn7nrzgAOVh7FgnPVI04luj7G6erYSMH7EKUxwyyAHisSHXr2TXtV/njV49zpvcoE9lZ9IG5F215hipNFwyHwdpVau2eobaYZv2WbibpbeLoBNlR9Am6iH6cCW3ZFMuc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727703586; c=relaxed/simple; bh=JCSvlWIGIEw74emQ4ZNe7qlzrCnW+h6y0sYrUv7Lo4A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ht5+KfD/W4L9irvSioFDn2+jjKJ8RT8frfl3t8o+ya7/Ki8322Cod6Yf8y2MKkZE5HSVT3bQPHpz9xwC4E6hqbaWO/Q2o68nhcUqzIfvtOssajj4IN1032zyeghpz3EmjYmJJS6Cz3AxDcfMNtQ3kCGx/EbLERBW97FXWhRrTvU= 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=kqAQVM5b; arc=none smtp.client-ip=198.175.65.20 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="kqAQVM5b" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727703584; x=1759239584; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JCSvlWIGIEw74emQ4ZNe7qlzrCnW+h6y0sYrUv7Lo4A=; b=kqAQVM5bf6hfqD+6aGR/W+ebRW0Fj4tv/SE6YDPL9Dyiqzi2VkTIBruC 2JhH9AiKwi/g4/QC9Dpoz0Qz2hksNvl6s2X2YQbWHa8LjZ0NL4NJuva1s w8gucc7LOC0/5qYqOrzCtjKG6NYCNAA6emW9xrlH5Fe+LCqTLC5OHQ7Dj ubXq3TW6quxzkRDFLMl1dz32TDk2jzjzrd0M615bl6hHzzQu7uE2c7icI pubyS9VnNX2LnKcQuf4ztFr5LybT/bnIYtM5Mt/8RU5D9raonTizVpvF5 RRQ6QACoMc4z4PYYyWPwz3+2gMxrRJF9GwkAUJdungBB+CtPEjSEePy2q w==; X-CSE-ConnectionGUID: t1IHbVZVTKqYr36P5HFk6w== X-CSE-MsgGUID: qT9Cn0XcRfmMhgtsQnMVmA== X-IronPort-AV: E=McAfee;i="6700,10204,11211"; a="26601092" X-IronPort-AV: E=Sophos;i="6.11,165,1725346800"; d="scan'208";a="26601092" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2024 06:39:44 -0700 X-CSE-ConnectionGUID: +/md04YMS0yXxV6TI8bqLg== X-CSE-MsgGUID: 2kqFHJ+QTgW2RrqYeHubAA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,165,1725346800"; d="scan'208";a="104109712" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa001.fm.intel.com with ESMTP; 30 Sep 2024 06:39:39 -0700 Received: from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 03D3028169; Mon, 30 Sep 2024 14:39:37 +0100 (IST) From: Przemek Kitszel To: intel-wired-lan@lists.osuosl.org, Tony Nguyen Cc: netdev@vger.kernel.org, Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn , linux-kernel@vger.kernel.org, Jiri Pirko , Jakub Kicinski , Simon Horman , Przemek Kitszel , Igor Bagnucki , Wojciech Drewek , Mateusz Polchlopek , Pucha Himasekhar Reddy Subject: [PATCH 6/7] ice: dump ethtool stats and skb by Tx hang devlink health reporter Date: Mon, 30 Sep 2024 15:37:24 +0200 Message-Id: <20240930133724.610512-7-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240930133724.610512-1-przemyslaw.kitszel@intel.com> References: <20240930133724.610512-1-przemyslaw.kitszel@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Print the ethtool stats and skb diagnostic information as part of Tx hang devlink health dump. Move the declarations of ethtool functions that devlink health uses out to a new file: ice_ethtool_common.h To utilize our existing ethtool code in this context, convert it to non-static. Reviewed-by: Igor Bagnucki Reviewed-by: Wojciech Drewek Reviewed-by: Simon Horman Signed-off-by: Mateusz Polchlopek Tested-by: Pucha Himasekhar Reddy (A Co= ntingent worker at Intel) Signed-off-by: Przemek Kitszel --- drivers/net/ethernet/intel/ice/ice_ethtool.h | 2 + .../ethernet/intel/ice/ice_ethtool_common.h | 19 ++++++++++ .../net/ethernet/intel/ice/devlink/health.c | 37 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_ethtool.c | 10 ++--- 4 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_ethtool_common.h diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.h b/drivers/net/eth= ernet/intel/ice/ice_ethtool.h index 9acccae38625..fd021d2813f8 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.h +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.h @@ -4,6 +4,8 @@ #ifndef _ICE_ETHTOOL_H_ #define _ICE_ETHTOOL_H_ =20 +#include "ice_ethtool_common.h" + struct ice_phy_type_to_ethtool { u64 aq_link_speed; u8 link_mode; diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool_common.h b/drivers/= net/ethernet/intel/ice/ice_ethtool_common.h new file mode 100644 index 000000000000..0c772056f006 --- /dev/null +++ b/drivers/net/ethernet/intel/ice/ice_ethtool_common.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2024, Intel Corporation. */ + +#ifndef _ICE_ETHTOOL_COMMON_H_ +#define _ICE_ETHTOOL_COMMON_H_ + +/** + * DOC: ice_ethtool_common.h + * + * This header is for ethtool related code that is reused in other places. + */ + +void ice_get_strings(struct net_device *netdev, u32 stringset, u8 *data); +int ice_get_sset_count(struct net_device *netdev, int sset); +void ice_get_ethtool_stats(struct net_device *netdev, + struct ethtool_stats __always_unused *stats, + u64 *data); + +#endif /* _ICE_ETHTOOL_COMMON_H_ */ diff --git a/drivers/net/ethernet/intel/ice/devlink/health.c b/drivers/net/= ethernet/intel/ice/devlink/health.c index b8c5a1c372dc..1626c5171152 100644 --- a/drivers/net/ethernet/intel/ice/devlink/health.c +++ b/drivers/net/ethernet/intel/ice/devlink/health.c @@ -3,6 +3,7 @@ =20 #include "health.h" #include "ice.h" +#include "ice_ethtool_common.h" =20 #define ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, obj, name) \ devlink_fmsg_put(fmsg, #name, (obj)->name) @@ -26,6 +27,36 @@ static void ice_devlink_health_report(struct devlink_hea= lth_reporter *reporter, devlink_health_report(reporter, msg, priv_ctx); } =20 +static void ice_dump_ethtool_stats_to_fmsg(struct devlink_fmsg *fmsg, + struct net_device *netdev) +{ + const u32 string_set =3D ETH_SS_STATS; + u64 *stats; + u8 *names; + int scnt; + + scnt =3D ice_get_sset_count(netdev, string_set); + devlink_fmsg_put(fmsg, "stats-cnt", (u32)scnt); + if (scnt <=3D 0) + return; + + names =3D kcalloc(scnt, ETH_GSTRING_LEN, GFP_KERNEL); + stats =3D kcalloc(scnt, sizeof(*stats), GFP_KERNEL); + if (!names || !stats) + goto out; + + ice_get_strings(netdev, string_set, names); + ice_get_ethtool_stats(netdev, NULL, stats); + + devlink_fmsg_obj_nest_start(fmsg); + for (int i =3D 0; i < scnt; ++i) + devlink_fmsg_put(fmsg, &names[i * ETH_GSTRING_LEN], stats[i]); + devlink_fmsg_obj_nest_end(fmsg); +out: + kfree(names); + kfree(stats); +} + /** * ice_fmsg_put_ptr - put hex value of pointer into fmsg * @@ -57,6 +88,9 @@ static int ice_tx_hang_reporter_dump(struct devlink_healt= h_reporter *reporter, struct netlink_ext_ack *extack) { struct ice_tx_hang_event *event =3D priv_ctx; + struct sk_buff *skb; + + skb =3D event->tx_ring->tx_buf->skb; =20 if (!event) return 0; @@ -71,8 +105,11 @@ static int ice_tx_hang_reporter_dump(struct devlink_hea= lth_reporter *reporter, devlink_fmsg_put(fmsg, "irq-mapping", event->tx_ring->q_vector->name); ice_fmsg_put_ptr(fmsg, "desc-ptr", event->tx_ring->desc); ice_fmsg_put_ptr(fmsg, "dma-ptr", (void *)(long)event->tx_ring->dma); + ice_fmsg_put_ptr(fmsg, "skb-ptr", skb); devlink_fmsg_binary_pair_put(fmsg, "desc", event->tx_ring->desc, event->tx_ring->count * sizeof(struct ice_tx_desc)); + devlink_fmsg_dump_skb(fmsg, skb); + ice_dump_ethtool_stats_to_fmsg(fmsg, event->tx_ring->vsi->netdev); devlink_fmsg_obj_nest_end(fmsg); =20 return 0; diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/eth= ernet/intel/ice/ice_ethtool.c index 2924ac61300d..85a3b2326e7b 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -1529,7 +1529,7 @@ __ice_get_strings(struct net_device *netdev, u32 stri= ngset, u8 *data, } } =20 -static void ice_get_strings(struct net_device *netdev, u32 stringset, u8 *= data) +void ice_get_strings(struct net_device *netdev, u32 stringset, u8 *data) { struct ice_netdev_priv *np =3D netdev_priv(netdev); =20 @@ -1909,7 +1909,7 @@ static int ice_set_priv_flags(struct net_device *netd= ev, u32 flags) return ret; } =20 -static int ice_get_sset_count(struct net_device *netdev, int sset) +int ice_get_sset_count(struct net_device *netdev, int sset) { switch (sset) { case ETH_SS_STATS: @@ -2012,9 +2012,9 @@ __ice_get_ethtool_stats(struct net_device *netdev, } } =20 -static void -ice_get_ethtool_stats(struct net_device *netdev, - struct ethtool_stats __always_unused *stats, u64 *data) +void ice_get_ethtool_stats(struct net_device *netdev, + struct ethtool_stats __always_unused *stats, + u64 *data) { struct ice_netdev_priv *np =3D netdev_priv(netdev); =20 --=20 2.39.3