From patchwork Wed Aug 21 13:37:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 13771641 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 8F8CC1A7AD5 for ; Wed, 21 Aug 2024 13:37:35 +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=1724247457; cv=none; b=i1bLisaOmW/5N/+zITTIpGt+LigLlKWb0ba9kz7OFj4glTfDrXGlzx0mLWaLmd3UDbtNZ+h9PA1kL0XgGJugnIncCRkV30iEwPMX3HCdp5zBW2hEKo8Q8wd63c8pbJ+MbnVGueJR9VvSjAtz6wqjs2JYqKFUr2TUCG2pkIe7TXs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724247457; c=relaxed/simple; bh=C8ttAvSNO0SlJh14VqyZzsFEn/LBgTrhy1JJwP90Xqw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=V7AMDUEpbsTJCeTr7Dd1kp8wvSQxmKig9PVhAFTw1MrcH2AUW3AcMlqhiJTFggRCnIMNCQPXp90EWRzUvUGnsa+aQACOdZ42SrfBztAmQ1sgGnt4nTz3siuksrI1SEzuhWmednkOaKRIwW7ZfnIZH5sWAihQ1cqF4nsYk6McSVY= 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=YtMAH+1a; 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="YtMAH+1a" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724247456; x=1755783456; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C8ttAvSNO0SlJh14VqyZzsFEn/LBgTrhy1JJwP90Xqw=; b=YtMAH+1aQoJxw9FDl+kNrP6slZpO8i/NiQeCEwcjUYfr1KJZfoAD5kyo 72FP2U+X/KWrljW34aM+rab1UHQYRJPnGHf3UqwJTx7dUmtblKs7LDK69 Agjhog+X97pcp8qnw0ZtnnKG4F++C2aMZI6QGNggxxPxJrIBWp5TxFnNA VYJjrDEBC5oicnnF6cGwV78iH5CaRhIaAnxqGcERmlzhNWb3aJ9S6EXrs CKEWbVco7lA0MaqBIk4Rbq1R0hVwwL/EqTDC/5E1nR/vqDgO/wYKn73Hr 7QguvH2fAKIRmr3RNHsesNAvATCvUefmhIt2SU2afyfRvyE4G3nlbAyGE g==; X-CSE-ConnectionGUID: qsy6KPSxS4eLafA7WsGrJg== X-CSE-MsgGUID: KMDIyS4/QpGAbS0H9a0INg== X-IronPort-AV: E=McAfee;i="6700,10204,11171"; a="45131421" X-IronPort-AV: E=Sophos;i="6.10,164,1719903600"; d="scan'208";a="45131421" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Aug 2024 06:37:35 -0700 X-CSE-ConnectionGUID: fNRBsvOzQiqaDIwWjW+qyg== X-CSE-MsgGUID: yBz4ED8wSNyTjDDGjTxQQQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,164,1719903600"; d="scan'208";a="61071255" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa008.fm.intel.com with ESMTP; 21 Aug 2024 06:37:31 -0700 Received: from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17]) by irvmail002.ir.intel.com (Postfix) with ESMTP id F2B782878D; Wed, 21 Aug 2024 14:37:28 +0100 (IST) From: Przemek Kitszel To: intel-wired-lan@lists.osuosl.org, Jiri Pirko , Tony Nguyen Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Paolo Abeni , Jakub Kicinski , nex.sw.ncis.osdt.itp.upstreaming@intel.com, apw@canonical.com, joe@perches.com, dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com, akpm@linux-foundation.org, willemb@google.com, Przemek Kitszel , Wojciech Drewek , Simon Horman , Mateusz Polchlopek Subject: [PATCH iwl-next v3 1/6] checkpatch: don't complain on _Generic() use Date: Wed, 21 Aug 2024 15:37:09 +0200 Message-Id: <20240821133714.61417-2-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240821133714.61417-1-przemyslaw.kitszel@intel.com> References: <20240821133714.61417-1-przemyslaw.kitszel@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Improve CamelCase recognition logic to avoid reporting on _Generic() use. Other C keywords, such as _Bool, are intentionally omitted, as those should be rather avoided in new source code. Reviewed-by: Wojciech Drewek Reviewed-by: Simon Horman Signed-off-by: Mateusz Polchlopek Signed-off-by: Przemek Kitszel --- scripts/checkpatch.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 39032224d504..d609d47144ff 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -5858,6 +5858,8 @@ sub process { #CamelCase if ($var !~ /^$Constant$/ && $var =~ /[A-Z][a-z]|[a-z][A-Z]/ && +#Ignore C keywords + $var !~ /^_Generic$/ && #Ignore some autogenerated defines and enum values $var !~ /^(?:[A-Z]+_){1,5}[A-Z]{1,3}[a-z]/ && #Ignore Page variants From patchwork Wed Aug 21 13:37:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 13771642 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 A083C1A7AFA for ; Wed, 21 Aug 2024 13:37: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=1724247458; cv=none; b=YuBSVU4wRl+TsX5ueCR8p63NbTxc9m+eUp/ukOLOz0mDP4J2ehQrWYYsL0XgvGcjtOjA0tNrv3MZ4O+laq8Uttxhjyj3jpaDD/W+AkiTGgN1BXFASz6K0IhyIIi7GAdlupvu17XQQrpEbpnjU8LAoFkHCs5+pRDCZmsOzu5Sp5k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724247458; c=relaxed/simple; bh=qitX9JQl+WyawhjAqWcOOFfcGblZAsoaspxmb9DYPOA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AOtawW7lHAwxfq5uB/z3P29nGZ6wDuJPALrp4VtTKse0IUvYSlxNLFSlZJ3yGzXi1rSProSOCIsxk3dHtA1uv8cfqAWM3TGbF8t84FmjNbtl+q0+WJ2pYcDfFglRzwH33/eANb+8jRS74OuXixcNVV3fbCGjYH9TWZh27OG3Kxw= 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=PG/vLyr0; 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="PG/vLyr0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724247457; x=1755783457; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qitX9JQl+WyawhjAqWcOOFfcGblZAsoaspxmb9DYPOA=; b=PG/vLyr0yNOShCMMQxUMufkH9Vqu+WlHpx1mXJaENLnEBVNxRrdUMBLl 3MY7+3v7vUnUTZWGLEj3O9vilx9iFy2TAOXNd8cZjhXU+oGOiLlrJPng0 KUnT5+SB53LSCxOeyLZ7J/mfqnIANc93JTSkh/wPHjdpVIfwDssGxgiV6 6/H26BF4BuZp5Ip6P1kjZsqpCT/S4/S6sOumHVxQMI1zm/u1pA/CtlFfd L0jyb+pNXC60EPRQ7f/nHzVJ2aty0N03cU5ce7gmPj985TEi3Z2+nXNgr I784eECEsuGWkvyq9J9f9ohsLwWVUqXUOTuz01YO8+jYzEsdSzazG8uot A==; X-CSE-ConnectionGUID: ClyRoDFVTNm6C2IC91UIsg== X-CSE-MsgGUID: tyTtdQ8eQx+mszQ6caExEw== X-IronPort-AV: E=McAfee;i="6700,10204,11171"; a="45131438" X-IronPort-AV: E=Sophos;i="6.10,164,1719903600"; d="scan'208";a="45131438" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Aug 2024 06:37:36 -0700 X-CSE-ConnectionGUID: uTDmp3cfQ0iRcc1xjKBj9w== X-CSE-MsgGUID: n51exEYgQSmLUuP2ZUxS+w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,164,1719903600"; d="scan'208";a="61071268" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa008.fm.intel.com with ESMTP; 21 Aug 2024 06:37:32 -0700 Received: from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 2A1D628793; Wed, 21 Aug 2024 14:37:30 +0100 (IST) From: Przemek Kitszel To: intel-wired-lan@lists.osuosl.org, Jiri Pirko , Tony Nguyen Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Paolo Abeni , Jakub Kicinski , nex.sw.ncis.osdt.itp.upstreaming@intel.com, apw@canonical.com, joe@perches.com, dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com, akpm@linux-foundation.org, willemb@google.com, Przemek Kitszel , Wojciech Drewek , Simon Horman , Mateusz Polchlopek Subject: [PATCH iwl-next v3 2/6] devlink: add devlink_fmsg_put() macro Date: Wed, 21 Aug 2024 15:37:10 +0200 Message-Id: <20240821133714.61417-3-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240821133714.61417-1-przemyslaw.kitszel@intel.com> References: <20240821133714.61417-1-przemyslaw.kitszel@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 devlink_fmsg_put() that dispatches based on the type of the value to put, example: bool -> devlink_fmsg_bool_pair_put(). Reviewed-by: Wojciech Drewek Reviewed-by: Simon Horman Signed-off-by: Mateusz Polchlopek Signed-off-by: Przemek Kitszel Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) --- include/net/devlink.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/net/devlink.h b/include/net/devlink.h index db5eff6cb60f..85739bb731c1 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -1261,6 +1261,17 @@ enum devlink_trap_group_generic_id { .min_burst = _min_burst, \ } +#define devlink_fmsg_put(fmsg, name, value) ( \ + _Generic((value), \ + bool : devlink_fmsg_bool_pair_put, \ + u8 : devlink_fmsg_u8_pair_put, \ + u16 : devlink_fmsg_u32_pair_put, \ + u32 : devlink_fmsg_u32_pair_put, \ + u64 : devlink_fmsg_u64_pair_put, \ + char * : devlink_fmsg_string_pair_put, \ + const char * : devlink_fmsg_string_pair_put) \ + (fmsg, name, (value))) + enum { /* device supports reload operations */ DEVLINK_F_RELOAD = 1UL << 0, From patchwork Wed Aug 21 13:37:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 13771643 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 277CF1A4ACB for ; Wed, 21 Aug 2024 13:37:37 +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=1724247459; cv=none; b=NkNBwb2ZMme4pyslVFArpwHvG+Ts928pw0NhHHAtGu6lcp0Wh7cFn9570Y/RVMYZhegcBr+SbDGy202mui7cc37hlDiaqDkhDon2jwU5giK9HLp5NeLGTv8TAlJJ+z+8KsrDCmab2XRpakqxn6bKazadE4GhEprRrZDwzPqqfPs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724247459; c=relaxed/simple; bh=QPmskJAMY7kwcxg9T107P/LUn+rAvKsXQShM9Ol1yTE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oBDWvO8IxAmr32s7pBGxm6SWgTDjwYcvKnm9ayt7tJ9k80Z4+5VtfSKVw3oIN9Puc6E9eVFbdoBPdPXr0gA+CG6SgXlV1O4GiHNU3mwyumBsfsN87Y2404GflkXp1gpVTL+QWrT9dUUB4bNcJZCzXLjKl7EoMjY9ODN+xrluFEE= 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=h3oNrNO6; 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="h3oNrNO6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724247458; x=1755783458; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QPmskJAMY7kwcxg9T107P/LUn+rAvKsXQShM9Ol1yTE=; b=h3oNrNO6RNVwtFZvz6mdP5XC3Mv5HBjF/1z/jjUH2BzAVfj8cUVpeL+s nN9lWaRgADQqFvZ2YaGs5lLpqxUnXmwSlXBvR+GRZfTcFazpV+glNhu3S TS8CrYbo/CTij55c39DgKpTNJL+IoGf1K20n1DqMOADFRvFHu0iyLFfXw 05n3zfRaJjh/TkdRkRT9f5Y2ROZQbldADesXWB/IXCgivEnvewEB5D6E0 Xf5Ay2712ujBNXVbwcNE2MaA6aW5lupjtLX63+E/krj5UAT9tmyrpscbS uh4NrU9kCtbWO5aNlgdO5XXpZ2HdlpmTJLXRyD32VfCQnazh/7FvF4vH9 A==; X-CSE-ConnectionGUID: CNIlHxwGRDKhT/1ZmlnRZg== X-CSE-MsgGUID: g9agXqFvTWeyF6Hft8aubg== X-IronPort-AV: E=McAfee;i="6700,10204,11171"; a="45131459" X-IronPort-AV: E=Sophos;i="6.10,164,1719903600"; d="scan'208";a="45131459" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Aug 2024 06:37:37 -0700 X-CSE-ConnectionGUID: 13FzARkAQZiWZyP/3+xA2w== X-CSE-MsgGUID: ilyMIsHpTLewkBXmH0UkPA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,164,1719903600"; d="scan'208";a="61071273" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa008.fm.intel.com with ESMTP; 21 Aug 2024 06:37:33 -0700 Received: from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 545A828795; Wed, 21 Aug 2024 14:37:31 +0100 (IST) From: Przemek Kitszel To: intel-wired-lan@lists.osuosl.org, Jiri Pirko , Tony Nguyen Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Paolo Abeni , Jakub Kicinski , nex.sw.ncis.osdt.itp.upstreaming@intel.com, apw@canonical.com, joe@perches.com, dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com, akpm@linux-foundation.org, willemb@google.com, Mateusz Polchlopek , Przemek Kitszel Subject: [PATCH iwl-next v3 3/6] devlink: add devlink_fmsg_dump_skb() function Date: Wed, 21 Aug 2024 15:37:11 +0200 Message-Id: <20240821133714.61417-4-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240821133714.61417-1-przemyslaw.kitszel@intel.com> References: <20240821133714.61417-1-przemyslaw.kitszel@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 From: Mateusz Polchlopek Add devlink_fmsg_dump_skb() function that adds some diagnostic information about skb (like length, pkt type, MAC, etc) to devlink fmsg mechanism using bunch of devlink_fmsg_put() function calls. Signed-off-by: Mateusz Polchlopek Signed-off-by: Przemek Kitszel Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) --- include/net/devlink.h | 2 ++ net/devlink/health.c | 67 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/include/net/devlink.h b/include/net/devlink.h index 85739bb731c1..7f5b36554778 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -1268,6 +1268,7 @@ enum devlink_trap_group_generic_id { u16 : devlink_fmsg_u32_pair_put, \ u32 : devlink_fmsg_u32_pair_put, \ u64 : devlink_fmsg_u64_pair_put, \ + int : devlink_fmsg_u32_pair_put, \ char * : devlink_fmsg_string_pair_put, \ const char * : devlink_fmsg_string_pair_put) \ (fmsg, name, (value))) @@ -2018,6 +2019,7 @@ int devlink_compat_switch_id_get(struct net_device *dev, int devlink_nl_port_handle_fill(struct sk_buff *msg, struct devlink_port *devlink_port); size_t devlink_nl_port_handle_size(struct devlink_port *devlink_port); +void devlink_fmsg_dump_skb(struct devlink_fmsg *fmsg, const struct sk_buff *skb); #else diff --git a/net/devlink/health.c b/net/devlink/health.c index acb8c0e174bb..b98ca650284c 100644 --- a/net/devlink/health.c +++ b/net/devlink/health.c @@ -1241,3 +1241,70 @@ int devlink_nl_health_reporter_test_doit(struct sk_buff *skb, return reporter->ops->test(reporter, info->extack); } + +/** + * devlink_fmsg_dump_skb - Dump sk_buffer structure + * @fmsg: devlink formatted message pointer + * @skb: pointer to skb + * + * Dump diagnostic information about sk_buff structure, like headroom, length, + * tailroom, MAC, etc. + */ +void devlink_fmsg_dump_skb(struct devlink_fmsg *fmsg, const struct sk_buff *skb) +{ + struct skb_shared_info *sh = skb_shinfo(skb); + struct sock *sk = skb->sk; + bool has_mac, has_trans; + + has_mac = skb_mac_header_was_set(skb); + has_trans = skb_transport_header_was_set(skb); + + devlink_fmsg_pair_nest_start(fmsg, "skb"); + devlink_fmsg_obj_nest_start(fmsg); + devlink_fmsg_put(fmsg, "actual len", skb->len); + devlink_fmsg_put(fmsg, "head len", skb_headlen(skb)); + devlink_fmsg_put(fmsg, "data len", skb->data_len); + devlink_fmsg_put(fmsg, "tail len", skb_tailroom(skb)); + devlink_fmsg_put(fmsg, "MAC", has_mac ? skb->mac_header : -1); + devlink_fmsg_put(fmsg, "MAC len", + has_mac ? skb_mac_header_len(skb) : -1); + devlink_fmsg_put(fmsg, "network hdr", skb->network_header); + devlink_fmsg_put(fmsg, "network hdr len", + has_trans ? skb_network_header_len(skb) : -1); + devlink_fmsg_put(fmsg, "transport hdr", + has_trans ? skb->transport_header : -1); + devlink_fmsg_put(fmsg, "csum", skb->csum); + devlink_fmsg_put(fmsg, "csum_ip_summed", (u8)skb->ip_summed); + devlink_fmsg_put(fmsg, "csum_complete_sw", !!skb->csum_complete_sw); + devlink_fmsg_put(fmsg, "csum_valid", !!skb->csum_valid); + devlink_fmsg_put(fmsg, "csum_level", (u8)skb->csum_level); + devlink_fmsg_put(fmsg, "sw_hash", !!skb->sw_hash); + devlink_fmsg_put(fmsg, "l4_hash", !!skb->l4_hash); + devlink_fmsg_put(fmsg, "proto", ntohs(skb->protocol)); + devlink_fmsg_put(fmsg, "pkt_type", (u8)skb->pkt_type); + devlink_fmsg_put(fmsg, "iif", skb->skb_iif); + + if (sk) { + devlink_fmsg_pair_nest_start(fmsg, "sk"); + devlink_fmsg_obj_nest_start(fmsg); + devlink_fmsg_put(fmsg, "family", sk->sk_type); + devlink_fmsg_put(fmsg, "type", sk->sk_type); + devlink_fmsg_put(fmsg, "proto", sk->sk_protocol); + devlink_fmsg_obj_nest_end(fmsg); + devlink_fmsg_pair_nest_end(fmsg); + } + + devlink_fmsg_obj_nest_end(fmsg); + devlink_fmsg_pair_nest_end(fmsg); + + devlink_fmsg_pair_nest_start(fmsg, "shinfo"); + devlink_fmsg_obj_nest_start(fmsg); + devlink_fmsg_put(fmsg, "tx_flags", sh->tx_flags); + devlink_fmsg_put(fmsg, "nr_frags", sh->nr_frags); + devlink_fmsg_put(fmsg, "gso_size", sh->gso_size); + devlink_fmsg_put(fmsg, "gso_type", sh->gso_type); + devlink_fmsg_put(fmsg, "gso_segs", sh->gso_segs); + devlink_fmsg_obj_nest_end(fmsg); + devlink_fmsg_pair_nest_end(fmsg); +} +EXPORT_SYMBOL_GPL(devlink_fmsg_dump_skb); From patchwork Wed Aug 21 13:37:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 13771644 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 AE8E71A4AB6 for ; Wed, 21 Aug 2024 13:37:42 +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=1724247464; cv=none; b=ZPot731nzUuAwkFv13GQ8q7wnSLhGM30PFJNZ31I0IV5BNM24OjYnLwd/p0/SwAbc7K4H8I+2zBwf/SKnLSNwv+Ntjt9QpoC40jBTj7kYOgdBcOup0qhjHn/WGT79Y5AmPUVrXI4WSZn7MkZR9HDCH0HT36FEacPG+b49kZ89k0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724247464; c=relaxed/simple; bh=Lo92JzGSPvW7JIhzn8YUg9F5HiG5kztdbTrYNNJw7zs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lOclQTNEBVr9LUuijUt/UWgsDvmaVXzzslPp14TWlToMa0kfjCTvTiL3wxEQgG3lFT4rrJTSqby+43leIbcq/xGZDPDZbNVLY2ZxRcW638vHX57Hxw6SIGJkP6zpN1gbHCrUqjgZsqPjT9cz/wsTWVQt0jiJgvxbrYpjDDLKC3w= 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=F4h2RB49; 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="F4h2RB49" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724247462; x=1755783462; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Lo92JzGSPvW7JIhzn8YUg9F5HiG5kztdbTrYNNJw7zs=; b=F4h2RB49FpscX0yPVhJE65Yh7p6cxLmRTVELCAv1zZPLiMWXsxBMQ0nr zN+PBtGO5isjeqagpoMNwt6H20+1ibfSwMNRjTE4ht5D6lB0nDd32Tx5K wLsQHe7/wPy7KrrCTSPGLc0bDtKEPkmBYt77IVnNDrKN/kq3GmFuWgN/0 xfWmjKyjCALe8J2GqHgIWKGPW/1Yg2XpPKiD2n4LL13TwfkgoNlP/+N0D mi6U5qXJhYZfE8eP3+EC5o1tQK9/RHANekoqwjYTEWXGsOkwV7tZrFuAS 6wmJC2BdTGF+xzcQG2933AtepFNtAVtL9ogw7SXUbwjKTElBLT0GA2y9r Q==; X-CSE-ConnectionGUID: NGi6/cNHToOpbcHshKCjLQ== X-CSE-MsgGUID: 9/iDDlbzRimbn9XLHK67JA== X-IronPort-AV: E=McAfee;i="6700,10204,11171"; a="45131486" X-IronPort-AV: E=Sophos;i="6.10,164,1719903600"; d="scan'208";a="45131486" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Aug 2024 06:37:38 -0700 X-CSE-ConnectionGUID: DUHs8gyJRMu8GefB45+G4Q== X-CSE-MsgGUID: qIfE3EbfQceIfKcFkynjTQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,164,1719903600"; d="scan'208";a="61071287" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa008.fm.intel.com with ESMTP; 21 Aug 2024 06:37:34 -0700 Received: from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 748ED28796; Wed, 21 Aug 2024 14:37:32 +0100 (IST) From: Przemek Kitszel To: intel-wired-lan@lists.osuosl.org, Jiri Pirko , Tony Nguyen Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Paolo Abeni , Jakub Kicinski , nex.sw.ncis.osdt.itp.upstreaming@intel.com, apw@canonical.com, joe@perches.com, dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com, akpm@linux-foundation.org, willemb@google.com, Przemek Kitszel , Igor Bagnucki , Wojciech Drewek , Mateusz Polchlopek Subject: [PATCH iwl-next v3 4/6] ice: add Tx hang devlink health reporter Date: Wed, 21 Aug 2024 15:37:12 +0200 Message-Id: <20240821133714.61417-5-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240821133714.61417-1-przemyslaw.kitszel@intel.com> References: <20240821133714.61417-1-przemyslaw.kitszel@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 Tx hang devlink health reporter, see struct ice_tx_hang_event to see what is reported. Subsequent commits will extend it by more info, for now it dumps descriptors with little metadata. Reviewed-by: Igor Bagnucki Reviewed-by: Wojciech Drewek Co-developed-by: Mateusz Polchlopek Signed-off-by: Mateusz Polchlopek Signed-off-by: Przemek Kitszel Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) --- drivers/net/ethernet/intel/ice/Makefile | 1 + .../intel/ice/devlink/devlink_health.h | 48 +++++ drivers/net/ethernet/intel/ice/ice.h | 2 + .../intel/ice/devlink/devlink_health.c | 188 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_main.c | 18 +- 5 files changed, 252 insertions(+), 5 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/devlink/devlink_health.h create mode 100644 drivers/net/ethernet/intel/ice/devlink/devlink_health.c diff --git a/drivers/net/ethernet/intel/ice/Makefile b/drivers/net/ethernet/intel/ice/Makefile index 3307d551f431..f2baba82480c 100644 --- a/drivers/net/ethernet/intel/ice/Makefile +++ b/drivers/net/ethernet/intel/ice/Makefile @@ -33,6 +33,7 @@ ice-y := ice_main.o \ ice_idc.o \ devlink/devlink.o \ devlink/devlink_port.o \ + devlink/devlink_health.o \ ice_sf_eth.o \ ice_sf_vsi_vlan_ops.o \ ice_ddp.o \ diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink_health.h b/drivers/net/ethernet/intel/ice/devlink/devlink_health.h new file mode 100644 index 000000000000..c50ef34cd244 --- /dev/null +++ b/drivers/net/ethernet/intel/ice/devlink/devlink_health.h @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2024, Intel Corporation. */ + +#ifndef _DEVLINK_HEALTH_H_ +#define _DEVLINK_HEALTH_H_ + +#include + +/** + * DOC: devlink_health.h + * + * This header file stores everything that is needed for broadly understood + * devlink health mechanism for ice driver. + */ + +struct ice_pf; +struct ice_tx_ring; + +/** + * struct ice_health - stores ice devlink health reporters and accompanied data + * @tx_hang: devlink health reporter for tx_hang event + * @tx_hang_buf: pre-allocated place to put info for Tx hang reporter from + * non-sleeping context + * @tx_ring: ring that the hang occured on + * @head: descriptior head + * @intr: interrupt register value + * @vsi_num: VSI owning the queue that the hang occured on + */ +struct ice_health { + struct devlink_health_reporter *tx_hang; + struct_group_tagged(ice_health_tx_hang_buf, tx_hang_buf, + struct ice_tx_ring *tx_ring; + u32 head; + u32 intr; + u16 vsi_num; + ); +}; + + +void ice_health_init(struct ice_pf *pf); +void ice_health_deinit(struct ice_pf *pf); +void ice_health_clear(struct ice_pf *pf); + +void ice_prep_tx_hang_report(struct ice_pf *pf, struct ice_tx_ring *tx_ring, + u16 vsi_num, u32 head, u32 intr); +void ice_report_tx_hang(struct ice_pf *pf); + +#endif /* _DEVLINK_HEALTH_H_ */ diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h index 0046684004ff..d2f2ed2d4bfa 100644 --- a/drivers/net/ethernet/intel/ice/ice.h +++ b/drivers/net/ethernet/intel/ice/ice.h @@ -78,6 +78,7 @@ #include "ice_irq.h" #include "ice_dpll.h" #include "ice_adapter.h" +#include "devlink/devlink_health.h" #define ICE_BAR0 0 #define ICE_REQ_DESC_MULTIPLE 32 @@ -667,6 +668,7 @@ struct ice_pf { struct ice_agg_node vf_agg_node[ICE_MAX_VF_AGG_NODES]; struct ice_dplls dplls; struct device *hwmon_dev; + struct ice_health health_reporters; }; extern struct workqueue_struct *ice_lag_wq; diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink_health.c b/drivers/net/ethernet/intel/ice/devlink/devlink_health.c new file mode 100644 index 000000000000..193dd4d00578 --- /dev/null +++ b/drivers/net/ethernet/intel/ice/devlink/devlink_health.c @@ -0,0 +1,188 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (c) 2024, Intel Corporation. */ + +#include "devlink_health.h" +#include "ice.h" + +#define ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, obj, name) \ + devlink_fmsg_put(fmsg, #name, (obj)->name) + +/** + * ice_devlink_health_report - boilerplate to call given @reporter + * + * @reporter: devlink health reporter to call, do nothing on NULL + * @msg: message to pass up, "event name" is fine + * @priv_ctx: typically some event struct + */ +static void ice_devlink_health_report(struct devlink_health_reporter *reporter, + const char *msg, void *priv_ctx) +{ + if (!reporter) + return; + + /* We do not do auto recovering, so return value of the below function + * will always be 0, thus we do ignore it. + */ + devlink_health_report(reporter, msg, priv_ctx); +} + +/** + * ice_fmsg_put_ptr - put hex value of pointer into fmsg + * + * @fmsg: devlink fmsg under construction + * @name: name to pass + * @ptr: 64 bit value to print as hex and put into fmsg + */ +static void ice_fmsg_put_ptr(struct devlink_fmsg *fmsg, const char *name, + void *ptr) +{ + char buf[sizeof(ptr) * 3]; + + sprintf(buf, "%p", ptr); + devlink_fmsg_put(fmsg, name, buf); +} + +struct ice_tx_hang_event { + u32 head; + u32 intr; + u16 vsi_num; + u16 queue; + u16 next_to_clean; + u16 next_to_use; + struct ice_tx_ring *tx_ring; +}; + +static int ice_tx_hang_reporter_dump(struct devlink_health_reporter *reporter, + struct devlink_fmsg *fmsg, void *priv_ctx, + struct netlink_ext_ack *extack) +{ + struct ice_tx_hang_event *event = priv_ctx; + + if (!event) + return 0; + + devlink_fmsg_obj_nest_start(fmsg); + ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, event, head); + ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, event, intr); + ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, event, vsi_num); + ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, event, queue); + ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, event, next_to_clean); + ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, event, next_to_use); + 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); + devlink_fmsg_binary_pair_put(fmsg, "desc", event->tx_ring->desc, + event->tx_ring->count * sizeof(struct ice_tx_desc)); + devlink_fmsg_obj_nest_end(fmsg); + + return 0; +} + +void ice_prep_tx_hang_report(struct ice_pf *pf, struct ice_tx_ring *tx_ring, + u16 vsi_num, u32 head, u32 intr) +{ + struct ice_health_tx_hang_buf *buf = &pf->health_reporters.tx_hang_buf; + + buf->tx_ring = tx_ring; + buf->vsi_num = vsi_num; + buf->head = head; + buf->intr = intr; +} + +void ice_report_tx_hang(struct ice_pf *pf) +{ + struct ice_health_tx_hang_buf *buf = &pf->health_reporters.tx_hang_buf; + struct ice_tx_ring *tx_ring = buf->tx_ring; + + struct ice_tx_hang_event ev = { + .head = buf->head, + .intr = buf->intr, + .vsi_num = buf->vsi_num, + .queue = tx_ring->q_index, + .next_to_clean = tx_ring->next_to_clean, + .next_to_use = tx_ring->next_to_use, + .tx_ring = tx_ring, + }; + + ice_devlink_health_report(pf->health_reporters.tx_hang, "Tx hang", &ev); +} + +static struct devlink_health_reporter * +ice_init_devlink_rep(struct ice_pf *pf, + const struct devlink_health_reporter_ops *ops) +{ + struct devlink *devlink = priv_to_devlink(pf); + struct devlink_health_reporter *rep; + const u64 graceful_period = 0; + + rep = devl_health_reporter_create(devlink, ops, graceful_period, pf); + if (IS_ERR(rep)) { + struct device *dev = ice_pf_to_dev(pf); + + dev_err(dev, "failed to create devlink %s health report er", + ops->name); + return NULL; + } + return rep; +} + +#define ICE_DEFINE_HEALTH_REPORTER_OPS(_name) \ + static const struct devlink_health_reporter_ops ice_ ## _name ## _reporter_ops = { \ + .name = #_name, \ + .dump = ice_ ## _name ## _reporter_dump, \ +} + +ICE_DEFINE_HEALTH_REPORTER_OPS(tx_hang); + +/** + * ice_health_init - allocate and init all ice devlink health reporters and + * accompanied data + * + * @pf: PF struct + */ +void ice_health_init(struct ice_pf *pf) +{ + struct ice_health *reps = &pf->health_reporters; + + reps->tx_hang = ice_init_devlink_rep(pf, &ice_tx_hang_reporter_ops); +} + +/** + * ice_deinit_devl_reporter - destroy given devlink health reporter + * @reporter: reporter to destroy + */ +static void ice_deinit_devl_reporter(struct devlink_health_reporter *reporter) +{ + if (reporter) + devl_health_reporter_destroy(reporter); +} + +/** + * ice_health_deinit - deallocate all ice devlink health reporters and + * accompanied data + * + * @pf: PF struct + */ +void ice_health_deinit(struct ice_pf *pf) +{ + ice_deinit_devl_reporter(pf->health_reporters.tx_hang); +} + +static +void ice_health_assign_healthy_state(struct devlink_health_reporter *reporter) +{ + if (reporter) + devlink_health_reporter_state_update(reporter, + DEVLINK_HEALTH_REPORTER_STATE_HEALTHY); +} + +/** + * ice_health_clear - clear devlink health issues after a reset + * @pf: the PF device structure + * + * Mark the PF in healthy state again after a reset has completed. + */ +void ice_health_clear(struct ice_pf *pf) +{ + ice_health_assign_healthy_state(pf->health_reporters.tx_hang); +} diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 6f3ce0893cd9..be679ba02211 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -2351,9 +2351,11 @@ static void ice_service_task(struct work_struct *work) struct ice_pf *pf = container_of(work, struct ice_pf, serv_task); unsigned long start_time = jiffies; - /* subtasks */ + if (pf->health_reporters.tx_hang_buf.tx_ring) { + ice_report_tx_hang(pf); + pf->health_reporters.tx_hang_buf.tx_ring = NULL; + } - /* process reset requests first */ ice_reset_subtask(pf); /* bail if a reset/recovery cycle is pending or rebuild failed */ @@ -5036,14 +5038,16 @@ static int ice_init_devlink(struct ice_pf *pf) return err; ice_devlink_init_regions(pf); + ice_health_init(pf); ice_devlink_register(pf); return 0; } static void ice_deinit_devlink(struct ice_pf *pf) { ice_devlink_unregister(pf); + ice_health_deinit(pf); ice_devlink_destroy_regions(pf); ice_devlink_unregister_params(pf); } @@ -7724,6 +7728,8 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type) /* if we get here, reset flow is successful */ clear_bit(ICE_RESET_FAILED, pf->state); + ice_health_clear(pf); + ice_plug_aux_dev(pf); if (ice_is_feature_supported(pf, ICE_F_SRIOV_LAG)) ice_lag_rebuild(pf); @@ -8214,16 +8220,18 @@ void ice_tx_timeout(struct net_device *netdev, unsigned int txqueue) if (tx_ring) { struct ice_hw *hw = &pf->hw; - u32 head, val = 0; + u32 head, intr = 0; head = FIELD_GET(QTX_COMM_HEAD_HEAD_M, rd32(hw, QTX_COMM_HEAD(vsi->txq_map[txqueue]))); /* Read interrupt register */ - val = rd32(hw, GLINT_DYN_CTL(tx_ring->q_vector->reg_idx)); + intr = rd32(hw, GLINT_DYN_CTL(tx_ring->q_vector->reg_idx)); netdev_info(netdev, "tx_timeout: VSI_num: %d, Q %u, NTC: 0x%x, HW_HEAD: 0x%x, NTU: 0x%x, INT: 0x%x\n", vsi->vsi_num, txqueue, tx_ring->next_to_clean, - head, tx_ring->next_to_use, val); + head, tx_ring->next_to_use, intr); + + ice_prep_tx_hang_report(pf, tx_ring, vsi->vsi_num, head, intr); } pf->tx_timeout_last_recovery = jiffies; From patchwork Wed Aug 21 13:37:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 13771645 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 068241ACDF9 for ; Wed, 21 Aug 2024 13:37:43 +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=1724247465; cv=none; b=gYt0yPXHUsNq0j8VCveUAH7qI94DDHYYGSC2TMA2uS6KQfCp98tVIwJV1BnFlzi6j/PM7ulmauob/GPduK4Y9vcxXppsCSdiUBV64P/pymC38IIafdMcjpcUNxysC7dA0n67jDuyZ4ec5Mdf7QbeOZz/kgmVfYGsw3FgY0frVpg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724247465; c=relaxed/simple; bh=mFPXl/q79lOeWvFuLlYuGgUCK3FfoNFy+V5ehUucfeE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CsxxNoAC9j6sjF5qIxXZscGlZAVk7xe0vtD4MuDc03zYG08128E7BYQnMnrYNMWGEvnEY6yVicE5gOEXBeKRPSX4W/LEc8jwR49CpLk+XuFJh36Y+SQNtRAFyEaCGWnMQc0EULoCMXsxl9wkUnVedUh/1iKzxPTQz00mPvvmf6Q= 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=hl1bz3hC; 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="hl1bz3hC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724247464; x=1755783464; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mFPXl/q79lOeWvFuLlYuGgUCK3FfoNFy+V5ehUucfeE=; b=hl1bz3hC1Gm7L4+gl3Nl/5Ob9bPvdl1tzcW9GPkWRuKmgyA9kI8UHgaf 6ZXURQKbXw1o5FyqghTaEonvr53HLlCrNBXSMxk3Hg3a4hVjbfiLEH2X5 uR3du1pLFZjsL5e+JLZzyu+sRfWRg2FjvNuEcZk/gmmYw/JyrQrDTXRSC gN5Lo7u9tFhdC7sCssYiGWj0F2pMHTqPfH54EPv/Vrguppm+TBdUbaDGu vES8bSvFj6Tf9RALnFEfIDdZvmCqt+W5/gEmrRQI8JCq423WDfu7e9nBW sZfufC2jlYc/daP37Ci+fvANSvadTQqkM8JY+JKlfum5M8VTFN61PEG1p Q==; X-CSE-ConnectionGUID: jpUfPP3DSIGc6El4lM50eQ== X-CSE-MsgGUID: ly+qzYlvS6abJCnM/Y5PNQ== X-IronPort-AV: E=McAfee;i="6700,10204,11171"; a="45131502" X-IronPort-AV: E=Sophos;i="6.10,164,1719903600"; d="scan'208";a="45131502" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Aug 2024 06:37:40 -0700 X-CSE-ConnectionGUID: 4q48cYtRQLOV/dce3Je44w== X-CSE-MsgGUID: CLZM7ciGSEytKBwPPRCSZA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,164,1719903600"; d="scan'208";a="61071294" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa008.fm.intel.com with ESMTP; 21 Aug 2024 06:37:36 -0700 Received: from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17]) by irvmail002.ir.intel.com (Postfix) with ESMTP id BAB842878C; Wed, 21 Aug 2024 14:37:33 +0100 (IST) From: Przemek Kitszel To: intel-wired-lan@lists.osuosl.org, Jiri Pirko , Tony Nguyen Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Paolo Abeni , Jakub Kicinski , nex.sw.ncis.osdt.itp.upstreaming@intel.com, apw@canonical.com, joe@perches.com, dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com, akpm@linux-foundation.org, willemb@google.com, Przemek Kitszel , Igor Bagnucki , Wojciech Drewek , Simon Horman , Mateusz Polchlopek Subject: [PATCH iwl-next v3 5/6] ice: dump ethtool stats and skb by Tx hang devlink health reporter Date: Wed, 21 Aug 2024 15:37:13 +0200 Message-Id: <20240821133714.61417-6-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240821133714.61417-1-przemyslaw.kitszel@intel.com> References: <20240821133714.61417-1-przemyslaw.kitszel@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 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 Signed-off-by: Przemek Kitszel Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) --- drivers/net/ethernet/intel/ice/ice_ethtool.h | 2 + .../ethernet/intel/ice/ice_ethtool_common.h | 19 ++++++++++ .../intel/ice/devlink/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/ethernet/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_ +#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/devlink_health.c b/drivers/net/ethernet/intel/ice/devlink/devlink_health.c index 193dd4d00578..086042260235 100644 --- a/drivers/net/ethernet/intel/ice/devlink/devlink_health.c +++ b/drivers/net/ethernet/intel/ice/devlink/devlink_health.c @@ -3,6 +3,7 @@ #include "devlink_health.h" #include "ice.h" +#include "ice_ethtool_common.h" #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_health_reporter *reporter, devlink_health_report(reporter, msg, priv_ctx); } +static void ice_dump_ethtool_stats_to_fmsg(struct devlink_fmsg *fmsg, + struct net_device *netdev) +{ + const u32 string_set = ETH_SS_STATS; + u64 *stats; + u8 *names; + int scnt; + + scnt = ice_get_sset_count(netdev, string_set); + devlink_fmsg_put(fmsg, "stats-cnt", (u32)scnt); + if (scnt <= 0) + return; + + names = kcalloc(scnt, ETH_GSTRING_LEN, GFP_KERNEL); + stats = 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 = 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_health_reporter *reporter, struct netlink_ext_ack *extack) { struct ice_tx_hang_event *event = priv_ctx; + struct sk_buff *skb; + + skb = event->tx_ring->tx_buf->skb; if (!event) return 0; @@ -71,8 +105,11 @@ static int ice_tx_hang_reporter_dump(struct devlink_health_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); return 0; diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index 143c8b9e58fe..8c6bc94a0ed3 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 stringset, u8 *data, } } -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 = netdev_priv(netdev); @@ -1909,7 +1909,7 @@ static int ice_set_priv_flags(struct net_device *netdev, u32 flags) return ret; } -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, } } -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 = netdev_priv(netdev); From patchwork Wed Aug 21 13:37:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemek Kitszel X-Patchwork-Id: 13771646 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 C49301A4ACB for ; Wed, 21 Aug 2024 13:37:44 +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=1724247469; cv=none; b=Y9A6VFkQPvrklZPweovmspNeD3PmhEZn5F7PL9bYx2sRwZrcGuk3uZj3VzL0ST1FG9B//H8jguDQgEChWBlNpwO9GdZ+fHr+Rxmuq5fNz3iZGPDdzkz2jge6CF6EdOUTAgJEwtyiRffymFgw6IVlI9s2CodbBdP9rgQF828z5gM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724247469; c=relaxed/simple; bh=M+LGLsO6aHW85KReATgeWDiyIPwwnK4/2ijtzRWT8Ks=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JIhzoEQs4+npfT2yGvIa53dFAnGF8N7pmf3dIPYSeDGXY8RYVT+JhYaUddZGW+7iHNwXHg9eK/4rCu6yp5i9CYorJtfxx+vpaip4RVvHMlXlk78uqrpwzoC27N9vR01WpRe2XFQ2Llpkxff8w8zLKBD4zLTcIP/tyXvMPuXhCe4= 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=Ngzm1IUI; 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="Ngzm1IUI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724247464; x=1755783464; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=M+LGLsO6aHW85KReATgeWDiyIPwwnK4/2ijtzRWT8Ks=; b=Ngzm1IUICbqnTtvSGXahx9Y3bZT4URveuQyUIFuKUNbwq18whulMSk7j sJUNCislMnJbPUFODlDBDJV/gAIULFPftdzxzC9RHaHLBIHPXhNpeb3wu sjuPKhIcO2/6iSs0VZuSdu4v5GNot32/eQFJv2mK4qTN7OBSrSme3+3zl R6FRfp71+jVvX0ffZq81b1PCifa6eJ/iTenx8/3D59cbKU4pmXTktgnEa 41R0XD9ikmoUnENMxkKwUYdU6YTuTlXKeBZe2UA5LV9GoSYY/FC7ltxKo sTirgA95cAKt0zzanpnsWXcBUtOPkzHtGQ9lOAJfP6+qSUHWETk251s9f Q==; X-CSE-ConnectionGUID: TBdektVyTK+iNkZeF21Kqw== X-CSE-MsgGUID: yxVH9a3URLS+ARmTalr5qw== X-IronPort-AV: E=McAfee;i="6700,10204,11171"; a="45131525" X-IronPort-AV: E=Sophos;i="6.10,164,1719903600"; d="scan'208";a="45131525" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Aug 2024 06:37:41 -0700 X-CSE-ConnectionGUID: 6qP6Q+iKRQCyIXeQvyxbew== X-CSE-MsgGUID: yNkOXDtEShSYGBdDDlK33A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,164,1719903600"; d="scan'208";a="61071306" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa008.fm.intel.com with ESMTP; 21 Aug 2024 06:37:37 -0700 Received: from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 0CD802878D; Wed, 21 Aug 2024 14:37:34 +0100 (IST) From: Przemek Kitszel To: intel-wired-lan@lists.osuosl.org, Jiri Pirko , Tony Nguyen Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Paolo Abeni , Jakub Kicinski , nex.sw.ncis.osdt.itp.upstreaming@intel.com, apw@canonical.com, joe@perches.com, dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com, akpm@linux-foundation.org, willemb@google.com, Ben Shelton , Igor Bagnucki , Wojciech Drewek , Simon Horman , Mateusz Polchlopek , Przemek Kitszel Subject: [PATCH iwl-next v3 6/6] ice: Add MDD logging via devlink health Date: Wed, 21 Aug 2024 15:37:14 +0200 Message-Id: <20240821133714.61417-7-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240821133714.61417-1-przemyslaw.kitszel@intel.com> References: <20240821133714.61417-1-przemyslaw.kitszel@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 From: Ben Shelton Add a devlink health reporter for MDD events. The 'dump' handler will return the information captured in each call to ice_handle_mdd_event(). A device reset (CORER/PFR) will put the reporter back in healthy state. Signed-off-by: Ben Shelton Reviewed-by: Igor Bagnucki Reviewed-by: Wojciech Drewek Reviewed-by: Simon Horman Signed-off-by: Mateusz Polchlopek Co-developed-by: Przemek Kitszel Signed-off-by: Przemek Kitszel Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) --- .../intel/ice/devlink/devlink_health.h | 11 +++ .../intel/ice/devlink/devlink_health.c | 77 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_main.c | 6 ++ 3 files changed, 94 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink_health.h b/drivers/net/ethernet/intel/ice/devlink/devlink_health.h index c50ef34cd244..b67fdf1ebe7a 100644 --- a/drivers/net/ethernet/intel/ice/devlink/devlink_health.h +++ b/drivers/net/ethernet/intel/ice/devlink/devlink_health.h @@ -16,17 +16,26 @@ struct ice_pf; struct ice_tx_ring; +enum ice_mdd_src { + ICE_MDD_SRC_TX_PQM, + ICE_MDD_SRC_TX_TCLAN, + ICE_MDD_SRC_TX_TDPU, + ICE_MDD_SRC_RX, +}; + /** * struct ice_health - stores ice devlink health reporters and accompanied data * @tx_hang: devlink health reporter for tx_hang event + * @mdd: devlink health reporter for MDD detection event * @tx_hang_buf: pre-allocated place to put info for Tx hang reporter from * non-sleeping context * @tx_ring: ring that the hang occured on * @head: descriptior head * @intr: interrupt register value * @vsi_num: VSI owning the queue that the hang occured on */ struct ice_health { + struct devlink_health_reporter *mdd; struct devlink_health_reporter *tx_hang; struct_group_tagged(ice_health_tx_hang_buf, tx_hang_buf, struct ice_tx_ring *tx_ring; @@ -43,6 +52,8 @@ void ice_health_clear(struct ice_pf *pf); void ice_prep_tx_hang_report(struct ice_pf *pf, struct ice_tx_ring *tx_ring, u16 vsi_num, u32 head, u32 intr); +void ice_report_mdd_event(struct ice_pf *pf, enum ice_mdd_src src, u8 pf_num, + u16 vf_num, u8 event, u16 queue); void ice_report_tx_hang(struct ice_pf *pf); #endif /* _DEVLINK_HEALTH_H_ */ diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink_health.c b/drivers/net/ethernet/intel/ice/devlink/devlink_health.c index 086042260235..32cb28cee18c 100644 --- a/drivers/net/ethernet/intel/ice/devlink/devlink_health.c +++ b/drivers/net/ethernet/intel/ice/devlink/devlink_health.c @@ -27,6 +27,79 @@ static void ice_devlink_health_report(struct devlink_health_reporter *reporter, devlink_health_report(reporter, msg, priv_ctx); } +struct ice_mdd_event { + enum ice_mdd_src src; + u16 vf_num; + u16 queue; + u8 pf_num; + u8 event; +}; + +static const char *ice_mdd_src_to_str(enum ice_mdd_src src) +{ + switch (src) { + case ICE_MDD_SRC_TX_PQM: + return "tx_pqm"; + case ICE_MDD_SRC_TX_TCLAN: + return "tx_tclan"; + case ICE_MDD_SRC_TX_TDPU: + return "tx_tdpu"; + case ICE_MDD_SRC_RX: + return "rx"; + default: + return "invalid"; + } +} + +static int +ice_mdd_reporter_dump(struct devlink_health_reporter *reporter, + struct devlink_fmsg *fmsg, void *priv_ctx, + struct netlink_ext_ack *extack) +{ + struct ice_mdd_event *mdd_event = priv_ctx; + const char *src; + + if (!mdd_event) + return 0; + + src = ice_mdd_src_to_str(mdd_event->src); + + devlink_fmsg_obj_nest_start(fmsg); + devlink_fmsg_put(fmsg, "src", src); + ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, mdd_event, pf_num); + ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, mdd_event, vf_num); + ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, mdd_event, event); + ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, mdd_event, queue); + devlink_fmsg_obj_nest_end(fmsg); + + return 0; +} + +/** + * ice_report_mdd_event - Report an MDD event through devlink health + * @pf: the PF device structure + * @src: the HW block that was the source of this MDD event + * @pf_num: the pf_num on which the MDD event occurred + * @vf_num: the vf_num on which the MDD event occurred + * @event: the event type of the MDD event + * @queue: the queue on which the MDD event occurred + * + * Report an MDD event that has occurred on this PF. + */ +void ice_report_mdd_event(struct ice_pf *pf, enum ice_mdd_src src, u8 pf_num, + u16 vf_num, u8 event, u16 queue) +{ + struct ice_mdd_event ev = { + .src = src, + .pf_num = pf_num, + .vf_num = vf_num, + .event = event, + .queue = queue, + }; + + ice_devlink_health_report(pf->health_reporters.mdd, "MDD event", &ev); +} + static void ice_dump_ethtool_stats_to_fmsg(struct devlink_fmsg *fmsg, struct net_device *netdev) { @@ -169,6 +242,7 @@ ice_init_devlink_rep(struct ice_pf *pf, .dump = ice_ ## _name ## _reporter_dump, \ } +ICE_DEFINE_HEALTH_REPORTER_OPS(mdd); ICE_DEFINE_HEALTH_REPORTER_OPS(tx_hang); /** @@ -181,6 +255,7 @@ void ice_health_init(struct ice_pf *pf) { struct ice_health *reps = &pf->health_reporters; + reps->mdd = ice_init_devlink_rep(pf, &ice_mdd_reporter_ops); reps->tx_hang = ice_init_devlink_rep(pf, &ice_tx_hang_reporter_ops); } @@ -202,6 +277,7 @@ static void ice_deinit_devl_reporter(struct devlink_health_reporter *reporter) */ void ice_health_deinit(struct ice_pf *pf) { + ice_deinit_devl_reporter(pf->health_reporters.mdd); ice_deinit_devl_reporter(pf->health_reporters.tx_hang); } @@ -221,5 +297,6 @@ void ice_health_assign_healthy_state(struct devlink_health_reporter *reporter) */ void ice_health_clear(struct ice_pf *pf) { + ice_health_assign_healthy_state(pf->health_reporters.mdd); ice_health_assign_healthy_state(pf->health_reporters.tx_hang); } diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index be679ba02211..b8c593fe7dce 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -1803,6 +1803,8 @@ static void ice_handle_mdd_event(struct ice_pf *pf) if (netif_msg_tx_err(pf)) dev_info(dev, "Malicious Driver Detection event %d on TX queue %d PF# %d VF# %d\n", event, queue, pf_num, vf_num); + ice_report_mdd_event(pf, ICE_MDD_SRC_TX_PQM, pf_num, vf_num, + event, queue); wr32(hw, GL_MDET_TX_PQM, 0xffffffff); } @@ -1816,6 +1818,8 @@ static void ice_handle_mdd_event(struct ice_pf *pf) if (netif_msg_tx_err(pf)) dev_info(dev, "Malicious Driver Detection event %d on TX queue %d PF# %d VF# %d\n", event, queue, pf_num, vf_num); + ice_report_mdd_event(pf, ICE_MDD_SRC_TX_TCLAN, pf_num, vf_num, + event, queue); wr32(hw, GL_MDET_TX_TCLAN_BY_MAC(hw), U32_MAX); } @@ -1829,6 +1833,8 @@ static void ice_handle_mdd_event(struct ice_pf *pf) if (netif_msg_rx_err(pf)) dev_info(dev, "Malicious Driver Detection event %d on RX queue %d PF# %d VF# %d\n", event, queue, pf_num, vf_num); + ice_report_mdd_event(pf, ICE_MDD_SRC_RX, pf_num, vf_num, event, + queue); wr32(hw, GL_MDET_RX, 0xffffffff); }