From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>,
<intel-wired-lan@lists.osuosl.org>
Cc: Brett Creeley <brett.creeley@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH net-next v9 2/5] ice: enable debugfs to check FW logging status
Date: Fri, 3 Mar 2023 15:21:00 -0800 [thread overview]
Message-ID: <e24a43ff-e411-87c3-dfe0-f45d463aa3dc@intel.com> (raw)
In-Reply-To: <20230302215109.124-3-paul.m.stillwell.jr@intel.com>
On 3/2/2023 1:51 PM, Paul M Stillwell Jr wrote:
[...]
> +#ifdef CONFIG_DEBUG_FS
> +void ice_debugfs_fwlog_init(struct ice_pf *pf);
> +void ice_debugfs_init(void);
> +void ice_debugfs_exit(void);
> +#else
> +static inline void ice_debugfs_fwlog_init(struct ice_pf *pf) { }
> +static inline void ice_debugfs_init(void) { }
> +static inline void ice_debugfs_exit(void) { }
> +#endif /* CONFIG_DEBUG_FS */
> +
> bool netif_is_ice(struct net_device *dev);
> int ice_vsi_setup_tx_rings(struct ice_vsi *vsi);
> int ice_vsi_setup_rx_rings(struct ice_vsi *vsi);
> @@ -934,6 +945,18 @@ int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout,
> int ice_open(struct net_device *netdev);
> int ice_open_internal(struct net_device *netdev);
> int ice_stop(struct net_device *netdev);
> +#ifdef CONFIG_DEBUG_FS
> +int
> +ice_pf_fwlog_update_modules(struct ice_pf *pf, u8 log_level,
> + unsigned long events);
> +#else
> +static int
> +ice_pf_fwlog_update_modules(struct ice_pf *pf, u8 log_level,
> + unsigned long events)
> +{
> + return -EOPNOTSUPP;
> +}
> +#endif /* CONFIG_DEBUG_FS */
This could be put with the ifdef above
> void ice_service_task_schedule(struct ice_pf *pf);
> int ice_load(struct ice_pf *pf);
> void ice_unload(struct ice_pf *pf);
[...]
> +/* Set FW Logging configuration (indirect 0xFF30)
> + * Query FW Logging (indirect 0xFF32)
> + */
> +struct ice_aqc_fw_log {
> + u8 cmd_flags;
> +#define ICE_AQC_FW_LOG_CONF_UART_EN BIT(0)
> +#define ICE_AQC_FW_LOG_CONF_AQ_EN BIT(1)
> +#define ICE_AQC_FW_LOG_QUERY_REGISTERED BIT(2)
> +#define ICE_AQC_FW_LOG_CONF_SET_VALID BIT(3)
> +#define ICE_AQC_FW_LOG_AQ_REGISTER BIT(0)
> +#define ICE_AQC_FW_LOG_AQ_QUERY BIT(2)
> +#define ICE_AQC_FW_LOG_PERSISTENT BIT(0)
> + u8 rsp_flag;
Please add a newline between the member and the defines that relate to
it. Please check this for other instances/needs as well.
[...]
> +#include <linux/vmalloc.h>
> +
Any particular reason this isn't with everything else (and alphabetized)?
> +#include <linux/fs.h>
> +#include <linux/debugfs.h>
> +#include <linux/random.h>
> +#include "ice.h"
> +
> +static struct dentry *ice_debugfs_root;
> +
> +static const char *module_id_to_name(u16 module_id)
> +{
> + switch (module_id) {
> + case ICE_AQC_FW_LOG_ID_GENERAL:
> + return "General";
> + case ICE_AQC_FW_LOG_ID_CTRL:
> + return "Control (Resets + Autoload)";
> + case ICE_AQC_FW_LOG_ID_LINK:
> + return "Link Management";
> + case ICE_AQC_FW_LOG_ID_LINK_TOPO:
> + return "Link Topology Detection";
> + case ICE_AQC_FW_LOG_ID_DNL:
> + return "DNL";
> + case ICE_AQC_FW_LOG_ID_I2C:
> + return "I2C";
> + case ICE_AQC_FW_LOG_ID_SDP:
> + return "SDP";
> + case ICE_AQC_FW_LOG_ID_MDIO:
> + return "MDIO";
> + case ICE_AQC_FW_LOG_ID_ADMINQ:
> + return "Admin Queue";
> + case ICE_AQC_FW_LOG_ID_HDMA:
> + return "HDMA";
> + case ICE_AQC_FW_LOG_ID_LLDP:
> + return "LLDP";
> + case ICE_AQC_FW_LOG_ID_DCBX:
> + return "DCBX";
> + case ICE_AQC_FW_LOG_ID_DCB:
> + return "DCB";
> + case ICE_AQC_FW_LOG_ID_XLR:
> + return "XLR";
> + case ICE_AQC_FW_LOG_ID_NVM:
> + return "NVM";
> + case ICE_AQC_FW_LOG_ID_AUTH:
> + return "Authentication";
> + case ICE_AQC_FW_LOG_ID_VPD:
> + return "VPD";
> + case ICE_AQC_FW_LOG_ID_IOSF:
> + return "IOSF";
> + case ICE_AQC_FW_LOG_ID_PARSER:
> + return "Parser";
> + case ICE_AQC_FW_LOG_ID_SW:
> + return "Switch";
> + case ICE_AQC_FW_LOG_ID_SCHEDULER:
> + return "Scheduler";
> + case ICE_AQC_FW_LOG_ID_TXQ:
> + return "Tx Queue Management";
> + case ICE_AQC_FW_LOG_ID_POST:
> + return "Post";
> + case ICE_AQC_FW_LOG_ID_WATCHDOG:
> + return "Watchdog";
> + case ICE_AQC_FW_LOG_ID_TASK_DISPATCH:
> + return "Task Dispatcher";
> + case ICE_AQC_FW_LOG_ID_MNG:
> + return "Manageability";
> + case ICE_AQC_FW_LOG_ID_SYNCE:
> + return "Synce";
> + case ICE_AQC_FW_LOG_ID_HEALTH:
> + return "Health";
> + case ICE_AQC_FW_LOG_ID_TSDRV:
> + return "Time Sync";
> + case ICE_AQC_FW_LOG_ID_PFREG:
> + return "PF Registration";
> + case ICE_AQC_FW_LOG_ID_MDLVER:
> + return "Module Version";
> + default:
> + return "Unsupported";
> + }
> +}
> +
> +static const char *log_level_to_name(u8 log_level)
> +{
> + switch (log_level) {
> + case ICE_FWLOG_LEVEL_NONE:
> + return "None";
> + case ICE_FWLOG_LEVEL_ERROR:
> + return "Error";
> + case ICE_FWLOG_LEVEL_WARNING:
> + return "Warning";
> + case ICE_FWLOG_LEVEL_NORMAL:
> + return "Normal";
> + case ICE_FWLOG_LEVEL_VERBOSE:
> + return "Verbose";
> + default:
> + return "Unsupported";
> + }
> +}
> +
> +static void ice_print_fwlog_config(struct ice_hw *hw, struct ice_fwlog_cfg *cfg)
> +{
> + struct device *dev = ice_pf_to_dev((struct ice_pf *)(hw->back));
I don't believe this casting is needed.
> + u16 i;
> +
> + dev_info(dev, "Log_resolution: %d\n", cfg->log_resolution);
> + dev_info(dev, "Options: 0x%04x\n", cfg->options);
> + dev_info(dev, "\tarq_ena: %s\n",
> + (cfg->options &
> + ICE_FWLOG_OPTION_ARQ_ENA) ? "true" : "false");
> + dev_info(dev, "\tuart_ena: %s\n",
> + (cfg->options &
> + ICE_FWLOG_OPTION_UART_ENA) ? "true" : "false");
> + dev_info(dev, "\trunning: %s\n",
> + (cfg->options &
> + ICE_FWLOG_OPTION_IS_REGISTERED) ? "true" : "false");
> +
> + dev_info(dev, "Module Entries:\n");
> + for (i = 0; i < ICE_AQC_FW_LOG_ID_MAX; i++) {
> + struct ice_fwlog_module_entry *entry =
> + &cfg->module_entries[i];
> +
> + dev_info(dev, "\tModule ID %d (%s) Log Level %d (%s)\n",
> + entry->module_id, module_id_to_name(entry->module_id),
> + entry->log_level, log_level_to_name(entry->log_level));
> + }
> +}
> +
> +/**
> + * ice_fwlog_dump_cfg - Dump current FW logging configuration
> + * @hw: pointer to the HW structure
> + */
> +static void ice_fwlog_dump_cfg(struct ice_hw *hw)
> +{
> + struct device *dev = ice_pf_to_dev((struct ice_pf *)(hw->back));
same here
> + struct ice_fwlog_cfg *cfg;
> + int status;
> +
> + cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
> + if (!cfg)
> + return;
> +
> + status = ice_fwlog_get(hw, cfg);
> + if (status) {
> + kfree(cfg);
> + return;
> + }
> +
> + dev_info(dev, "Running FWLOG Configuration:\n");
> + ice_print_fwlog_config(hw, cfg);
> +
> + kfree(cfg);
> +}
[...]
> +
> +/**
> + * ice_fwlog_get - Get the firmware logging settings
> + * @hw: pointer to the HW structure
> + * @cfg: config to populate based on current firmware logging settings
> + */
> +int ice_fwlog_get(struct ice_hw *hw, struct ice_fwlog_cfg *cfg)
> +{
> + int status;
> +
> + if (!ice_fwlog_supported(hw))
> + return -EOPNOTSUPP;
> +
> + if (!cfg)
> + return -EINVAL;
> +
> + status = ice_aq_fwlog_get(hw, cfg);
> + if (status)
> + return status;
> +
> + return 0;
This can be 'return ice_aq_fwlog_get(hw, cfg);'
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
next prev parent reply other threads:[~2023-03-03 23:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-02 21:51 [Intel-wired-lan] [PATCH net-next v9 0/5] add v2 FW logging for ice driver Paul M Stillwell Jr
2023-03-02 21:51 ` [Intel-wired-lan] [PATCH net-next v9 1/5] ice: remove FW logging code Paul M Stillwell Jr
2023-03-02 21:51 ` [Intel-wired-lan] [PATCH net-next v9 2/5] ice: enable debugfs to check FW logging status Paul M Stillwell Jr
2023-03-03 23:21 ` Tony Nguyen [this message]
2023-03-06 22:00 ` Paul M Stillwell Jr
2023-03-02 21:51 ` [Intel-wired-lan] [PATCH net-next v9 3/5] ice: add ability to set FW log configuration Paul M Stillwell Jr
2023-03-03 1:23 ` kernel test robot
2023-03-03 23:21 ` Tony Nguyen
2023-03-06 22:11 ` Paul M Stillwell Jr
2023-03-02 21:51 ` [Intel-wired-lan] [PATCH net-next v9 4/5] ice: enable FW logging based on stored configuration Paul M Stillwell Jr
2023-03-03 23:22 ` Tony Nguyen
2023-03-06 22:14 ` Paul M Stillwell Jr
2023-03-02 21:51 ` [Intel-wired-lan] [PATCH net-next v9 5/5] ice: add ability to enable FW logging and capture data Paul M Stillwell Jr
2023-03-03 23:23 ` Tony Nguyen
2023-03-08 23:22 ` Paul M Stillwell Jr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e24a43ff-e411-87c3-dfe0-f45d463aa3dc@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=brett.creeley@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=paul.m.stillwell.jr@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox