Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 48EFAC6FD19 for ; Mon, 13 Mar 2023 23:19:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id ED5E8409FA; Mon, 13 Mar 2023 23:19:10 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org ED5E8409FA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1678749551; bh=IuVkcPAFfIvk/Xr4/Xv97mQV2r3qcAuwUgEcY6HP924=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=ag4GWzf5kDwsT45qKeH/KQX3QiIsngOyUBP7RXxIf83wPRkA9rz7LqWrjqW2MSd7g 5BW8VwnMrAjA4yVQ6u60Q6CybZaQfNH6xdhRrJovVWiHnhOotanxiVi4s1JyN19g/B zEMA/3piVS7+xB1mpz5fldY1xaQQL4D94KWUeo1qThjk9JlmP+2DG6219LlL7vSxWJ fDRB5mLvdZA/FWHeO7VtlR/SSBhLPcXPXvbUtBAgNydWVPXheM3XsdAdPatiUY05em Bo+YU34mNKCje7eq8n4XWhFrOWHqCqU9XhUYp4BKrV53vff1JmvRdUyBZSWKAMlx0r s007H03HoygjQ== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VIcQyObd8Jo2; Mon, 13 Mar 2023 23:19:09 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 9932340A38; Mon, 13 Mar 2023 23:19:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 9932340A38 Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 308EE1BF377 for ; Mon, 13 Mar 2023 23:19:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id ADA14410E7 for ; Mon, 13 Mar 2023 23:18:58 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org ADA14410E7 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FxjzuN6BcLyp for ; Mon, 13 Mar 2023 23:18:57 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 1677A41548 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by smtp4.osuosl.org (Postfix) with ESMTPS id 1677A41548 for ; Mon, 13 Mar 2023 23:18:57 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="335979589" X-IronPort-AV: E=Sophos;i="5.98,258,1673942400"; d="scan'208";a="335979589" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2023 16:18:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="743076280" X-IronPort-AV: E=Sophos;i="5.98,258,1673942400"; d="scan'208";a="743076280" Received: from pmstillw-desk1.amr.corp.intel.com ([10.212.10.39]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2023 16:18:55 -0700 From: Paul M Stillwell Jr To: intel-wired-lan@lists.osuosl.org Date: Mon, 13 Mar 2023 16:18:39 -0700 Message-Id: <20230313231841.113-4-paul.m.stillwell.jr@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230313231841.113-1-paul.m.stillwell.jr@intel.com> References: <20230313231841.113-1-paul.m.stillwell.jr@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=1678749537; x=1710285537; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=W8JT4+RWggrGDMQlN+YPTOLuvzlsjMykkrJuqL9+37c=; b=C/20GvHA+Z7QpsXIJ4hqLpjMWdFexQKmsI8c5bp6mbN7CJ5Cos+N0RHy uoy8Ih8J7qFjRYTRMhxo9XLyiFA661mkw1sxP0IuhJK9GnPs3vE+ZxLyi VyLPqYacFqiHmR66mim0QQK+AuhcOGxwE3+XPQjvvkmYLB2R6NGMfpSTb zZtq6Bj5qWfVuGW37xTX5s8mYHDVtvtFoHQdvZqSW7PUwWWzazqnKbLfc X2g9QRsPUBSL4EEenkWIsjhBIIgDVQhO6F/aXekebzwFc3olMLkuEM9+L j98v8NUqDiDstpowifmxxZEqH+J3WpSxXwO1PnJRwfBSVaYlCYYQaws3/ A==; X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=C/20GvHA Subject: [Intel-wired-lan] [PATCH net-next v11 3/5] ice: add ability to set FW log configuration 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: Brett Creeley Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" The FW log has several configuration options to control what gets output and how often it gets output. Allow the user to set the log level, events, and how often the FW generates messages with data in them (resolution). The command to set the configuration looks like: update fwlog_cfg where fwlog_level is a value from 0-4 as described below Each level includes the messages from the previous/lower level 0 - no logging 1 - error logging 2 - warning logging 3 - normal logging 4 - verbose logging fwlog_events is a value from 0-32 that represents the module to receive events for. The values are sent as a hex value where each bit represents a specific module. The module values are: 0 (0x00) - General 1 (0x01) - Control (Resets + Autoload) 2 (0x02) - Link Management 3 (0x03) - Link Topology Detection 4 (0x04) - DNL 5 (0x05) - I2C 6 (0x06) - SDP 7 (0x07) - MDIO 8 (0x08) - Admin Queue 9 (0x09) - HDMA 10 (0x0A) - LLDP 11 (0x0B) - DCBX 12 (0x0C) - DCB 13 (0x0D) - XLR 14 (0x0E) - NVM 15 (0x0F) - Authentication 16 (0x10) - VPD 17 (0x11) - IOSF 18 (0x12) - Parser 19 (0x13) - Switch 20 (0x14) - Scheduler 21 (0x15) - Tx Queue Management 22 (0x16) - Unsupported 23 (0x17) - Post 24 (0x18) - Watchdog 25 (0x19) - Task Dispatcher 26 (0x1A) - Manageability 27 (0x1B) - Synce 28 (0x1C) - Health 29 (0x1D) - Time Sync 30 (0x1E) - PF Registration 31 (0x1F) - Module Version fwlog_resolution is the number of log messages to included in a single ARQ event. The range is 1-128 (1 means push every log message, 128 means push only when the max AQ command buffer is full). The suggested value is 10. An example command to update the FW log configuration is: echo update fwlog_cfg 4 0x82414821 50 > /sys/kernel/debug/ice/0000\:18\:00.0/fwlog The above command would set the log level to 4 (Verbose) for the following modules 0 (0x00) - General 5 (0x05) - I2C 11 (0x0B) - DCBX 14 (0x0E) - NVM 16 (0x10) - VPD 22 (0x16) - Unsupported 25 (0x19) - Task Dispatcher 31 (0x1F) - Module Version The setting of the configuration does NOT enable FW logging, that is a separate command. There are effectively 2 configurations at this point: the one that is currently running and the staged configuration. To allow the user to see what is going on the 'dump fwlog_cfg' command now shows the 'Running' config and the 'Staged' config. This allows the user to be able to compare the currently running configuration with what will be enabled when the user executes the command to enable the staged configuration. Co-developed-by: Brett Creeley Signed-off-by: Brett Creeley Signed-off-by: Paul M Stillwell Jr --- v11: - changed 'events' variable to be u32 instead of unsigned long since the FW expects a 32-bit value. This caused some changes to a few functions that pass 'events' and changed the parsing in debugfs. Also fixed an issue with i386 cross compile where BIT_ULL() was being used incorrectly and causing compiler issues on i386 because the value was larger than the variable. v10 at: https://lore.kernel.org/intel-wired-lan/20230308235102.170-4-paul.m.stillwell.jr@intel.com/ --- drivers/net/ethernet/intel/ice/ice.h | 2 +- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 3 ++ drivers/net/ethernet/intel/ice/ice_debugfs.c | 35 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_main.c | 37 +++++++++++++++++++ 4 files changed, 76 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h index 5b44e400b740..8269f033e84d 100644 --- a/drivers/net/ethernet/intel/ice/ice.h +++ b/drivers/net/ethernet/intel/ice/ice.h @@ -879,7 +879,7 @@ void ice_debugfs_init(void); void ice_debugfs_exit(void); int ice_pf_fwlog_update_modules(struct ice_pf *pf, u8 log_level, - unsigned long events); + u32 events); #else static inline void ice_debugfs_fwlog_init(struct ice_pf *pf) { } static inline void ice_debugfs_init(void) { } diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h index 80e5376ca064..558a17d38918 100644 --- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h @@ -2092,6 +2092,9 @@ struct ice_aqc_fw_log { } sync; struct { __le16 log_resolution; +#define ICE_AQC_FW_LOG_MIN_RESOLUTION (1) +#define ICE_AQC_FW_LOG_MAX_RESOLUTION (128) + __le16 mdl_cnt; } cfg; } ops; diff --git a/drivers/net/ethernet/intel/ice/ice_debugfs.c b/drivers/net/ethernet/intel/ice/ice_debugfs.c index 1319ec3e97b1..cb1b578e929e 100644 --- a/drivers/net/ethernet/intel/ice/ice_debugfs.c +++ b/drivers/net/ethernet/intel/ice/ice_debugfs.c @@ -146,6 +146,8 @@ static void ice_fwlog_dump_cfg(struct ice_hw *hw) dev_info(dev, "Running FWLOG Configuration:\n"); ice_print_fwlog_config(hw, cfg); + dev_info(dev, "Staged FWLOG Configuration:\n"); + ice_print_fwlog_config(hw, &hw->fwlog_cfg); kfree(cfg); } @@ -199,10 +201,43 @@ ice_debugfs_command_write(struct file *filp, const char __user *buf, if (argc == 2 && !strncmp(argv[0], "dump", 4) && !strncmp(argv[1], "fwlog_cfg", 9)) { ice_fwlog_dump_cfg(&pf->hw); + } else if (argc == 5 && !strncmp(argv[0], "update", 6) && + !strncmp(argv[1], "fwlog_cfg", 9)) { + struct ice_hw *hw = &pf->hw; + u8 log_level, resolution; + u32 events; + + ret = kstrtou8(argv[2], 0, &log_level); + if (ret) + goto command_write_error; + + ret = kstrtouint(argv[3], 0, &events); + if (ret) + goto command_write_error; + + ret = kstrtou8(argv[4], 0, &resolution); + if (ret) + goto command_write_error; + + if (resolution < ICE_AQC_FW_LOG_MIN_RESOLUTION || + resolution > ICE_AQC_FW_LOG_MAX_RESOLUTION) { + dev_err(dev, "Invalid FW log resolution %d, value must be between %d - %d\n", + resolution, ICE_AQC_FW_LOG_MIN_RESOLUTION, + ICE_AQC_FW_LOG_MAX_RESOLUTION); + ret = -EINVAL; + goto command_write_error; + } + + ret = ice_pf_fwlog_update_modules(pf, log_level, events); + if (ret) + goto command_write_error; + + hw->fwlog_cfg.log_resolution = resolution; } else { dev_info(dev, "unknown or invalid command '%s'\n", cmd_buf); dev_info(dev, "available commands\n"); dev_info(dev, "\t dump fwlog_cfg\n"); + dev_info(dev, "\t update fwlog_cfg "); ret = -EINVAL; goto command_write_error; } diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 47b95a1185f6..a5ce84d84843 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -4552,6 +4552,43 @@ static void ice_print_wake_reason(struct ice_pf *pf) dev_info(ice_pf_to_dev(pf), "Wake reason: %s", wake_str); } +/** + * ice_pf_fwlog_update_modules - update 1 or more modules via debugfs + * @pf: pointer to the PF struct + * @log_level: log_level to use for the @events + * @events: events to update + */ +int ice_pf_fwlog_update_modules(struct ice_pf *pf, u8 log_level, + u32 events) +{ + struct ice_fwlog_module_entry *entries; + struct ice_hw *hw = &pf->hw; + u16 max_bits; + int i; + + if (log_level >= ICE_FWLOG_LEVEL_INVALID) { + dev_err(ice_pf_to_dev(pf), "Invalid FW log level %u, all level(s) >= %u are invalid\n", + log_level, ICE_FWLOG_LEVEL_INVALID); + return -EINVAL; + } + + entries = (struct ice_fwlog_module_entry *)hw->fwlog_cfg.module_entries; + + max_bits = min_t(u32, BITS_PER_TYPE(u32), + ICE_AQC_FW_LOG_ID_MAX); + + /* look for the set bits in events. the driver can't use any of the + * built in bitops because they all need an unsigned long type which + * events is not + */ + for (i = 0; i < max_bits; i++) { + if (BIT(i) & events) + entries[i].log_level = log_level; + } + + return 0; +} + /** * ice_register_netdev - register netdev * @vsi: pointer to the VSI struct -- 2.35.1 _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan