From patchwork Wed Jul 3 12:59:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Polchlopek X-Patchwork-Id: 1956235 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=qw26Cvko; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (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 4WDgF64lWvz1xpN for ; Wed, 3 Jul 2024 23:12:58 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 9382D60EE4; Wed, 3 Jul 2024 13:12:53 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id vMxVMHwbvzPX; Wed, 3 Jul 2024 13:12:52 +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 smtp3.osuosl.org B99A160EBD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1720012372; bh=ApskI2yMkSmseC74OxkxR4eVj3v2fTd7V2fCqPSrhkU=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=qw26CvkowyrtF+hTQzyHbsFlM+h4naTz0EXHJYV6g3AoAYGBvWiGG6fzCGEJDH9Lx 9SY5ISHYWM94CAZCJvJhyTd+rSRp5cCnt0q2QUK4HBWhxCWDyqlvnmM5hnA6jrNw6x xFpnIupQRtoPxTVpWlc1I5TJR51v1Ra4CZ+BMSjN7KNmZIjpA0eZrZ/tocWaBxx2bG +nDglrwCCnwnn9Dcrq5TjA8mhh0zk6orHhUOcGPL95huD7bkWPOBCsHB6yAozURb5s Dgc7ytHFsh8CjViUo/Zee2RlZ9pX/dnwp2LtqLra9gFg3Gd7hGJBlU9IjfErQMO5qd LTLt4SiLizDOw== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id B99A160EBD; Wed, 3 Jul 2024 13:12:52 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 1712D1BF31B for ; Wed, 3 Jul 2024 13:12:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 02F0040359 for ; Wed, 3 Jul 2024 13:12:45 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 5qVT7GKkF_c8 for ; Wed, 3 Jul 2024 13:12:43 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.11; helo=mgamail.intel.com; envelope-from=mateusz.polchlopek@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 6BF1140500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 6BF1140500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by smtp2.osuosl.org (Postfix) with ESMTPS id 6BF1140500 for ; Wed, 3 Jul 2024 13:12:43 +0000 (UTC) X-CSE-ConnectionGUID: 1DHTP38kSuGuYaY7NFY4/A== X-CSE-MsgGUID: kBPiAV/tRqShhnIVyAT0tg== X-IronPort-AV: E=McAfee;i="6700,10204,11121"; a="27857160" X-IronPort-AV: E=Sophos;i="6.09,182,1716274800"; d="scan'208";a="27857160" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jul 2024 06:12:38 -0700 X-CSE-ConnectionGUID: DrTqlxLwTLmwOVCNYOkuNg== X-CSE-MsgGUID: Ivv7E3kfSDONtAeCIQtGqA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,182,1716274800"; d="scan'208";a="46321600" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa010.fm.intel.com with ESMTP; 03 Jul 2024 06:12:34 -0700 Received: from fedora.igk.intel.com (Metan_eth.igk.intel.com [10.123.220.124]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 0985328779; Wed, 3 Jul 2024 14:12:32 +0100 (IST) From: Mateusz Polchlopek To: intel-wired-lan@lists.osuosl.org Date: Wed, 3 Jul 2024 08:59:21 -0400 Message-Id: <20240703125922.5625-6-mateusz.polchlopek@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20240703125922.5625-1-mateusz.polchlopek@intel.com> References: <20240703125922.5625-1-mateusz.polchlopek@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=1720012364; x=1751548364; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=77S0g48ldeSDpH72ehXpHc4TRRYY3yYTmc4CKjzLGmU=; b=KKA/Ofeon8gXUz4r7cMwG/Qi7S4DdoRedPqRXAk9lQd/R8+D8zo3TDkU maIer40kaNsOrl7NnNxhgIKtlygr85xPc58a+6260Nb3IP/itr1tOotEB YCWHoTLml15KBRU6WaFD3L3RjZbW6feN4zHTrYo3zqTzZystC9baCklDc 9IK3QxIZlt2rfhtA1qhu+gn24mLjKncSat3KThqUa4SzOg7LpUHdcULL5 WD28+OnVxOn8OjRQz1wGbZzl+GZaYGiXhtku1upvXaWhnKVdTrTjfj/cs Hdbw8z4PZ9x06Mw2uqTavHBtD8GHKGxNkMuDorv6z8MhU3VZt7BVxBHle A==; X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=KKA/Ofeo Subject: [Intel-wired-lan] [PATCH iwl-next v1 5/6] ice: Add MDD logging via devlink health 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: willemb@google.com, Wojciech Drewek , Ben Shelton , dwaipayanray1@gmail.com, Mateusz Polchlopek , linux-kernel@vger.kernel.org, Igor Bagnucki , joe@perches.com, edumazet@google.com, netdev@vger.kernel.org, apw@canonical.com, lukas.bulwahn@gmail.com, akpm@linux-foundation.org, Przemek Kitszel Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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 Co-developed-by: Przemek Kitszel Signed-off-by: Przemek Kitszel Reviewed-by: Igor Bagnucki Reviewed-by: Wojciech Drewek Signed-off-by: Mateusz Polchlopek Reviewed-by: Simon Horman --- .../intel/ice/devlink/devlink_health.c | 77 +++++++++++++++++++ .../intel/ice/devlink/devlink_health.h | 11 +++ 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.c b/drivers/net/ethernet/intel/ice/devlink/devlink_health.c index d6956bba1da2..d19fd3ebe76f 100644 --- a/drivers/net/ethernet/intel/ice/devlink/devlink_health.c +++ b/drivers/net/ethernet/intel/ice/devlink/devlink_health.c @@ -33,6 +33,79 @@ static void ice_devlink_health_report(struct devlink_health_reporter *reporter, } } +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_devlink_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_devlink_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) { @@ -155,6 +228,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); /** @@ -167,6 +241,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); } @@ -188,6 +263,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); } @@ -207,5 +283,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/devlink/devlink_health.h b/drivers/net/ethernet/intel/ice/devlink/devlink_health.h index 984b8f9f56d4..01abd3d8f31e 100644 --- a/drivers/net/ethernet/intel/ice/devlink/devlink_health.h +++ b/drivers/net/ethernet/intel/ice/devlink/devlink_health.h @@ -16,18 +16,29 @@ 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 */ struct ice_health { struct devlink_health_reporter *tx_hang; + struct devlink_health_reporter *mdd; }; 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_devlink_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, struct ice_tx_ring *tx_ring, u16 vsi_num, u32 head, u32 intr); diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 246dcfe54397..904a4d2f9a59 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -1820,6 +1820,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_devlink_report_mdd_event(pf, ICE_MDD_SRC_TX_PQM, pf_num, + vf_num, event, queue); wr32(hw, GL_MDET_TX_PQM, 0xffffffff); } @@ -1833,6 +1835,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_devlink_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); } @@ -1846,6 +1850,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_devlink_report_mdd_event(pf, ICE_MDD_SRC_RX, pf_num, + vf_num, event, queue); wr32(hw, GL_MDET_RX, 0xffffffff); }