Skip to content

Commit 96a9a93

Browse files
pmstillwanguy11
authored andcommitted
ice: configure FW logging
Users want the ability to debug FW issues by retrieving the FW logs from the E8xx devices. Use debugfs to allow the user to configure the log level and number of messages for FW logging. If FW logging is supported on the E8xx then the file 'fwlog' will be created under the PCI device ID for the ice driver. If the file does not exist then either the E8xx doesn't support FW logging or debugfs is not enabled on the system. One thing users want to do is control which events are reported. The user can read and write the 'fwlog/modules/<module name>' to get/set the log levels. Each module in the FW that supports logging ht as a file under 'fwlog/modules' that supports reading (to see what the current log level is) and writing (to change the log level). The format to set the log levels for a module are: # echo <log level> > /sys/kernel/debug/ice/0000\:18\:00.0/fwlog/modules/<module> The supported log levels are: * none * error * warning * normal * verbose Each level includes the messages from the previous/lower level The modules that are supported are: * general * ctrl * link * link_topo * dnl * i2c * sdp * mdio * adminq * hdma * lldp * dcbx * dcb * xlr * nvm * auth * vpd * iosf * parser * sw * scheduler * txq * rsvd * post * watchdog * task_dispatch * mng * synce * health * tsdrv * pfreg * mdlver * all The module 'all' is a special module which allows the user to read or write to all of the modules. The following example command would set the DCB module to the 'normal' log level: # echo normal > /sys/kernel/debug/ice/0000\:18\:00.0/fwlog/modules/dcb If the user wants to set the DCB, Link, and the AdminQ modules to 'verbose' then the commands are: # echo verbose > /sys/kernel/debug/ice/0000\:18\:00.0/fwlog/modules/dcb # echo verbose > /sys/kernel/debug/ice/0000\:18\:00.0/fwlog/modules/link # echo verbose > /sys/kernel/debug/ice/0000\:18\:00.0/fwlog/modules/adminq If the user wants to set all modules to the 'warning' level then the command is: # echo warning > /sys/kernel/debug/ice/0000\:18\:00.0/fwlog/modules/all If the user wants to disable logging for a module then they can set the level to 'none'. An example setting the 'watchdog' module is: # echo none > /sys/kernel/debug/ice/0000\:18\:00.0/fwlog/modules/watchdog If the user wants to see what the log level is for a specific module then the command is: # cat /sys/kernel/debug/ice/0000\:18\:00.0/fwlog/modules/dcb This will return the log level for the DCB module. If the user wants to see the log level for all the modules then the command is: # cat /sys/kernel/debug/ice/0000\:18\:00.0/fwlog/modules/all Writing to the module file will update the configuration, but NOT enable the configuration (that is a separate command). In addition to configuring the modules, the user can also configure the number of log messages (nr_messages) to include in a single Admin Receive Queue (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. To see/change the resolution the user can read/write the 'fwlog/nr_messages' file. An example changing the value to 50 is # echo 50 > /sys/kernel/debug/ice/0000\:18\:00.0/fwlog/nr_messages To see the current value of 'nr_messages' then the command is: # cat /sys/kernel/debug/ice/0000\:18\:00.0/fwlog/nr_messages Signed-off-by: Paul M Stillwell Jr <[email protected]> Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]>
1 parent 1953fc7 commit 96a9a93

File tree

9 files changed

+796
-1
lines changed

9 files changed

+796
-1
lines changed

drivers/net/ethernet/intel/ice/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ ice-y := ice_main.o \
3434
ice_lag.o \
3535
ice_ethtool.o \
3636
ice_repr.o \
37-
ice_tc_lib.o
37+
ice_tc_lib.o \
38+
ice_fwlog.o \
39+
ice_debugfs.o
3840
ice-$(CONFIG_PCI_IOV) += \
3941
ice_sriov.o \
4042
ice_virtchnl.o \

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,10 @@ struct ice_pf {
571571
struct ice_vsi_stats **vsi_stats;
572572
struct ice_sw *first_sw; /* first switch created by firmware */
573573
u16 eswitch_mode; /* current mode of eswitch */
574+
struct dentry *ice_debugfs_pf;
575+
struct dentry *ice_debugfs_pf_fwlog;
576+
/* keep track of all the dentrys for FW log modules */
577+
struct dentry **ice_debugfs_pf_fwlog_modules;
574578
struct ice_vfs vfs;
575579
DECLARE_BITMAP(features, ICE_F_MAX);
576580
DECLARE_BITMAP(state, ICE_STATE_NBITS);
@@ -890,6 +894,11 @@ static inline bool ice_is_adq_active(struct ice_pf *pf)
890894
return false;
891895
}
892896

897+
void ice_debugfs_fwlog_init(struct ice_pf *pf);
898+
void ice_debugfs_init(void);
899+
void ice_debugfs_exit(void);
900+
void ice_pf_fwlog_update_module(struct ice_pf *pf, int log_level, int module);
901+
893902
bool netif_is_ice(const struct net_device *dev);
894903
int ice_vsi_setup_tx_rings(struct ice_vsi *vsi);
895904
int ice_vsi_setup_rx_rings(struct ice_vsi *vsi);

drivers/net/ethernet/intel/ice/ice_adminq_cmd.h

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,6 +2356,81 @@ struct ice_aqc_event_lan_overflow {
23562356
u8 reserved[8];
23572357
};
23582358

2359+
enum ice_aqc_fw_logging_mod {
2360+
ICE_AQC_FW_LOG_ID_GENERAL = 0,
2361+
ICE_AQC_FW_LOG_ID_CTRL,
2362+
ICE_AQC_FW_LOG_ID_LINK,
2363+
ICE_AQC_FW_LOG_ID_LINK_TOPO,
2364+
ICE_AQC_FW_LOG_ID_DNL,
2365+
ICE_AQC_FW_LOG_ID_I2C,
2366+
ICE_AQC_FW_LOG_ID_SDP,
2367+
ICE_AQC_FW_LOG_ID_MDIO,
2368+
ICE_AQC_FW_LOG_ID_ADMINQ,
2369+
ICE_AQC_FW_LOG_ID_HDMA,
2370+
ICE_AQC_FW_LOG_ID_LLDP,
2371+
ICE_AQC_FW_LOG_ID_DCBX,
2372+
ICE_AQC_FW_LOG_ID_DCB,
2373+
ICE_AQC_FW_LOG_ID_XLR,
2374+
ICE_AQC_FW_LOG_ID_NVM,
2375+
ICE_AQC_FW_LOG_ID_AUTH,
2376+
ICE_AQC_FW_LOG_ID_VPD,
2377+
ICE_AQC_FW_LOG_ID_IOSF,
2378+
ICE_AQC_FW_LOG_ID_PARSER,
2379+
ICE_AQC_FW_LOG_ID_SW,
2380+
ICE_AQC_FW_LOG_ID_SCHEDULER,
2381+
ICE_AQC_FW_LOG_ID_TXQ,
2382+
ICE_AQC_FW_LOG_ID_RSVD,
2383+
ICE_AQC_FW_LOG_ID_POST,
2384+
ICE_AQC_FW_LOG_ID_WATCHDOG,
2385+
ICE_AQC_FW_LOG_ID_TASK_DISPATCH,
2386+
ICE_AQC_FW_LOG_ID_MNG,
2387+
ICE_AQC_FW_LOG_ID_SYNCE,
2388+
ICE_AQC_FW_LOG_ID_HEALTH,
2389+
ICE_AQC_FW_LOG_ID_TSDRV,
2390+
ICE_AQC_FW_LOG_ID_PFREG,
2391+
ICE_AQC_FW_LOG_ID_MDLVER,
2392+
ICE_AQC_FW_LOG_ID_MAX,
2393+
};
2394+
2395+
/* Set FW Logging configuration (indirect 0xFF30)
2396+
* Query FW Logging (indirect 0xFF32)
2397+
*/
2398+
struct ice_aqc_fw_log {
2399+
u8 cmd_flags;
2400+
#define ICE_AQC_FW_LOG_CONF_UART_EN BIT(0)
2401+
#define ICE_AQC_FW_LOG_CONF_AQ_EN BIT(1)
2402+
#define ICE_AQC_FW_LOG_QUERY_REGISTERED BIT(2)
2403+
#define ICE_AQC_FW_LOG_CONF_SET_VALID BIT(3)
2404+
#define ICE_AQC_FW_LOG_AQ_QUERY BIT(2)
2405+
2406+
u8 rsp_flag;
2407+
__le16 fw_rt_msb;
2408+
union {
2409+
struct {
2410+
__le32 fw_rt_lsb;
2411+
} sync;
2412+
struct {
2413+
__le16 log_resolution;
2414+
#define ICE_AQC_FW_LOG_MIN_RESOLUTION (1)
2415+
#define ICE_AQC_FW_LOG_MAX_RESOLUTION (128)
2416+
2417+
__le16 mdl_cnt;
2418+
} cfg;
2419+
} ops;
2420+
__le32 addr_high;
2421+
__le32 addr_low;
2422+
};
2423+
2424+
/* Response Buffer for:
2425+
* Set Firmware Logging Configuration (0xFF30)
2426+
* Query FW Logging (0xFF32)
2427+
*/
2428+
struct ice_aqc_fw_log_cfg_resp {
2429+
__le16 module_identifier;
2430+
u8 log_level;
2431+
u8 rsvd0;
2432+
};
2433+
23592434
/**
23602435
* struct ice_aq_desc - Admin Queue (AQ) descriptor
23612436
* @flags: ICE_AQ_FLAG_* flags
@@ -2446,6 +2521,7 @@ struct ice_aq_desc {
24462521
struct ice_aqc_get_cgu_ref_prio get_cgu_ref_prio;
24472522
struct ice_aqc_get_cgu_info get_cgu_info;
24482523
struct ice_aqc_driver_shared_params drv_shared_params;
2524+
struct ice_aqc_fw_log fw_log;
24492525
struct ice_aqc_set_mac_lb set_mac_lb;
24502526
struct ice_aqc_alloc_free_res_cmd sw_res_ctrl;
24512527
struct ice_aqc_set_mac_cfg set_mac_cfg;
@@ -2643,6 +2719,10 @@ enum ice_adminq_opc {
26432719

26442720
/* Standalone Commands/Events */
26452721
ice_aqc_opc_event_lan_overflow = 0x1001,
2722+
2723+
/* FW Logging Commands */
2724+
ice_aqc_opc_fw_logs_config = 0xFF30,
2725+
ice_aqc_opc_fw_logs_query = 0xFF32,
26462726
};
26472727

26482728
#endif /* _ICE_ADMINQ_CMD_H_ */

drivers/net/ethernet/intel/ice/ice_common.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,11 @@ int ice_init_hw(struct ice_hw *hw)
990990
if (status)
991991
goto err_unroll_cqinit;
992992

993+
status = ice_fwlog_init(hw);
994+
if (status)
995+
ice_debug(hw, ICE_DBG_FW_LOG, "Error initializing FW logging: %d\n",
996+
status);
997+
993998
status = ice_clear_pf_cfg(hw);
994999
if (status)
9951000
goto err_unroll_cqinit;
@@ -1139,6 +1144,7 @@ void ice_deinit_hw(struct ice_hw *hw)
11391144
ice_free_hw_tbls(hw);
11401145
mutex_destroy(&hw->tnl_lock);
11411146

1147+
ice_fwlog_deinit(hw);
11421148
ice_destroy_all_ctrlq(hw);
11431149

11441150
/* Clear VSI contexts if not already cleared */

0 commit comments

Comments
 (0)