add v2 FW logging for ice driver
Subsystems (5)
v7 cover add v2 FW logging for ice driver
FW log support was added to the ice driver, but that version is no longer supported. There is a newer version of FW logging (v2) that adds more control knobs to get the exact data out of the FW for debugging.
Additionally, instead of dumping the FW log output to syslog, dump it to debugfs. The FW log data is really just binary data that the FW log team decodes to determine what happens so the translation from binary to some text output just slows things down and results in potential dropped data. The structure for the debugfs entry is: /sys/kernel/debug/ice/<pci device>/fwlog
Once enabled the FW log data is received as ARQ events that the driver processes.
The FW logging is across all the PFs on the device, so restrict the commands to only PF0.
The following new device parameters are added:
- fwlog_supported (read-only): does the FW support FW logging
- fwlog_enabled (read/write): is FW logging currently running
- fwlog_level (read/write): the log level enabled, valid values are 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_resolution (read/write): 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.
This patch series adds the following set of devlink commands:
devlink dev param set <pci dev> name fwlog_enabled value <true/false> cmode runtime devlink dev param set <pci dev> name fwlog_level value <0-4> cmode runtime devlink dev param set <pci dev> name fwlog_resolution value <1-128> cmode runtime
---
v7:
- removed dev_info() in ice_debugfs_command_read() since it wasn't needed
- refactored ice_debugfs_command_read() to split the copying of the data and the freeing of the buffers. This allows for better error recovery in case the copy_to_user() fails
- changed allocation of fwlog buffers and structure from kernel memory to virtual memory (vmalloc/vzalloc)
- fixed a compile bug
v6:
- removed cache_cfg() based on feedback
- a couple of other minor changes based on feedback
v5:
- handle devlink reload path correctly so debugfs directories don't get added twice
- fix issue where code wrapped with CONFIG_DEBUG_FS was causing sparc compile issues with multiple defines
v4:
- actually changed the modes in ice.rst for new params
v3:
- fixed ice.rst to have proper mode for new params and fixed formatting v2:
- removed some unused admin queue commands
- updated copyright in ice_fwlog.[ch] to 2022
- moved defines in structures under the variables and added blank line
- removed a couple of unused defines
- changed fwlog_support_ena to fwlog_supported to be clearer
- consolidated ice_devlink_param_id enum together
- changed ice_fwlog_set_support_ena() to ice_fwlog_set_supported()
- consolidated return status logic in ice_devlink_fwlog_enabled_set()
- pull up functions in ice_fwlog.c where appropriate
- add newline for FW Logging Commands comment
- changed any new u[8/16] loop variables to int
- moved ice_pf_fwlog_deinit() from patch 5 to patch 4
- changed error message to be clearer
- updated Documentation/networking/devlink/ice.rst
- updated commit messages with examples of devlink commands and using debugfs to get log files
Paul M Stillwell Jr (5):
ice: remove FW logging code
ice: enable devlink to check FW logging status
ice: add ability to query/set FW log level and resolution
ice: disable FW logging on driver unload
ice: use debugfs to output FW log data
Documentation/networking/devlink/ice.rst | 39 ++ drivers/net/ethernet/intel/ice/Makefile | 5 +- drivers/net/ethernet/intel/ice/ice.h | 22 ++ .../net/ethernet/intel/ice/ice_adminq_cmd.h | 160 ++++---- drivers/net/ethernet/intel/ice/ice_common.c | 218 +---------- drivers/net/ethernet/intel/ice/ice_common.h | 1 - drivers/net/ethernet/intel/ice/ice_debugfs.c | 115 ++++++ drivers/net/ethernet/intel/ice/ice_devlink.c | 200 +++++++++- drivers/net/ethernet/intel/ice/ice_fwlog.c | 367 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_fwlog.h | 57 +++ drivers/net/ethernet/intel/ice/ice_main.c | 100 ++++- drivers/net/ethernet/intel/ice/ice_type.h | 23 +- 12 files changed, 990 insertions(+), 317 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_debugfs.c create mode 100644 drivers/net/ethernet/intel/ice/ice_fwlog.c create mode 100644 drivers/net/ethernet/intel/ice/ice_fwlog.h
Signature · 6 lines
2.35.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v7 1/5 ice: remove FW logging code
The FW logging code doesn't work because there is no way to set cq_ena or uart_ena so remove the code. This code is the original (v1) way of FW logging so it should be replaced with the v2 way.
--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 78 ------- drivers/net/ethernet/intel/ice/ice_common.c | 218 ------------------ drivers/net/ethernet/intel/ice/ice_common.h | 1 - drivers/net/ethernet/intel/ice/ice_main.c | 3 - drivers/net/ethernet/intel/ice/ice_type.h | 20 -- 5 files changed, 320 deletions(-)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +0 -78
@@ -1953,78 +1953,6 @@ struct ice_aqc_add_rdma_qset_data {struct ice_aqc_add_tx_rdma_qset_entry rdma_qsets[]; }; -/* Configure Firmware Logging Command (indirect 0xFF09) -* Logging Information Read Response (indirect 0xFF10) -* Note: The 0xFF10 command has no input parameters. -*/ -struct ice_aqc_fw_logging { -u8 log_ctrl; -#define ICE_AQC_FW_LOG_AQ_EN BIT(0) -#define ICE_AQC_FW_LOG_UART_EN BIT(1) -u8 rsvd0; -u8 log_ctrl_valid;/* Not used by 0xFF10 Response */ -#define ICE_AQC_FW_LOG_AQ_VALID BIT(0) -#define ICE_AQC_FW_LOG_UART_VALID BIT(1) -u8 rsvd1[5 ]; -__le32 addr_high; -__le32 addr_low; -}; - -enum ice_aqc_fw_logging_mod { -ICE_AQC_FW_LOG_ID_GENERAL =0 , -ICE_AQC_FW_LOG_ID_CTRL , -ICE_AQC_FW_LOG_ID_LINK , -ICE_AQC_FW_LOG_ID_LINK_TOPO , -ICE_AQC_FW_LOG_ID_DNL , -ICE_AQC_FW_LOG_ID_I2C , -ICE_AQC_FW_LOG_ID_SDP , -ICE_AQC_FW_LOG_ID_MDIO , -ICE_AQC_FW_LOG_ID_ADMINQ , -ICE_AQC_FW_LOG_ID_HDMA , -ICE_AQC_FW_LOG_ID_LLDP , -ICE_AQC_FW_LOG_ID_DCBX , -ICE_AQC_FW_LOG_ID_DCB , -ICE_AQC_FW_LOG_ID_NETPROXY , -ICE_AQC_FW_LOG_ID_NVM , -ICE_AQC_FW_LOG_ID_AUTH , -ICE_AQC_FW_LOG_ID_VPD , -ICE_AQC_FW_LOG_ID_IOSF , -ICE_AQC_FW_LOG_ID_PARSER , -ICE_AQC_FW_LOG_ID_SW , -ICE_AQC_FW_LOG_ID_SCHEDULER , -ICE_AQC_FW_LOG_ID_TXQ , -ICE_AQC_FW_LOG_ID_RSVD , -ICE_AQC_FW_LOG_ID_POST , -ICE_AQC_FW_LOG_ID_WATCHDOG , -ICE_AQC_FW_LOG_ID_TASK_DISPATCH , -ICE_AQC_FW_LOG_ID_MNG , -ICE_AQC_FW_LOG_ID_MAX , -}; - -/* Defines for both above FW logging command/response buffers */ -#define ICE_AQC_FW_LOG_ID_S 0 -#define ICE_AQC_FW_LOG_ID_M (0xFFF << ICE_AQC_FW_LOG_ID_S) - -#define ICE_AQC_FW_LOG_CONF_SUCCESS 0/* Used by response */ -#define ICE_AQC_FW_LOG_CONF_BAD_INDX BIT(12)/* Used by response */ - -#define ICE_AQC_FW_LOG_EN_S 12 -#define ICE_AQC_FW_LOG_EN_M (0xF << ICE_AQC_FW_LOG_EN_S) -#define ICE_AQC_FW_LOG_INFO_EN BIT(12)/* Used by command */ -#define ICE_AQC_FW_LOG_INIT_EN BIT(13)/* Used by command */ -#define ICE_AQC_FW_LOG_FLOW_EN BIT(14)/* Used by command */ -#define ICE_AQC_FW_LOG_ERR_EN BIT(15)/* Used by command */ - -/* Get/Clear FW Log (indirect 0xFF11) */ -struct ice_aqc_get_clear_fw_log { -u8 flags; -#define ICE_AQC_FW_LOG_CLEAR BIT(0) -#define ICE_AQC_FW_LOG_MORE_DATA_AVAIL BIT(1) -u8 rsvd1[7 ]; -__le32 addr_high; -__le32 addr_low; -}; -/* Download Package (indirect 0x0C40) */ /* Also used for Update Package (indirect 0x0C41 and 0x0C42) */ struct ice_aqc_download_pkg {
@@ -2184,8 +2112,6 @@ struct ice_aq_desc {struct ice_aqc_add_rdma_qset add_rdma_qset;struct ice_aqc_add_get_update_free_vsi vsi_cmd;struct ice_aqc_add_update_free_vsi_resp add_update_free_vsi_res; -struct ice_aqc_fw_logging fw_logging; -struct ice_aqc_get_clear_fw_log get_clear_fw_log;struct ice_aqc_download_pkg download_pkg;struct ice_aqc_driver_shared_params drv_shared_params;struct ice_aqc_set_mac_lb set_mac_lb;
@@ -2368,10 +2294,6 @@ enum ice_adminq_opc {/* Standalone Commands/Events */ ice_aqc_opc_event_lan_overflow = 0x1001, - -/* debug commands */ - ice_aqc_opc_fw_logging =0xFF09 , - ice_aqc_opc_fw_logging_info = 0xFF10, };#endif /* _ICE_ADMINQ_CMD_H_ */
drivers/net/ethernet/intel/ice/ice_common.c +0 -218
236 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_common.h +0 -1
@@ -188,7 +188,6 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 q_handle, struct ice_sq_cd *cd);int ice_replay_vsi (struct ice_hw *hw,u16 vsi_handle);void ice_replay_post (struct ice_hw *hw); -void ice_output_fw_log (struct ice_hw *hw,struct ice_aq_desc *desc,void *buf);struct ice_q_ctx *ice_get_lan_q_ctx (struct ice_hw *hw,u16 vsi_handle,u8 tc,u16 q_handle);int ice_sbq_rw_reg (struct ice_hw *hw,struct ice_sbq_msg_input *in);
drivers/net/ethernet/intel/ice/ice_main.c +0 -3
@@ -1642,9 +1642,6 @@ static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type)if (!ice_is_malicious_vf (pf, &event, i, pending))ice_vc_process_vf_msg (pf, &event);break ; -case ice_aqc_opc_fw_logging: -ice_output_fw_log (hw, &event.desc, event.msg_buf); -break ;case ice_aqc_opc_lldp_set_mib_change:ice_dcb_process_lldp_set_mib_change (pf, &event);break ;
drivers/net/ethernet/intel/ice/ice_type.h +0 -20
@@ -727,24 +727,6 @@ struct ice_switch_info {DECLARE_BITMAP (prof_res_bm[ICE_MAX_NUM_PROFILES ],ICE_MAX_FV_WORDS ); }; -/* FW logging configuration */ -struct ice_fw_log_evnt { -u8 cfg :4 ;/* New event enables to configure */ -u8 cur :4 ;/* Current/active event enables */ -}; - -struct ice_fw_log_cfg { -u8 cq_en :1 ;/* FW logging is enabled via the control queue */ -u8 uart_en :1 ;/* FW logging is enabled via UART for all PFs */ -u8 actv_evnts;/* Cumulation of currently enabled log events */ - -#define ICE_FW_LOG_EVNT_INFO (ICE_AQC_FW_LOG_INFO_EN >> ICE_AQC_FW_LOG_EN_S) -#define ICE_FW_LOG_EVNT_INIT (ICE_AQC_FW_LOG_INIT_EN >> ICE_AQC_FW_LOG_EN_S) -#define ICE_FW_LOG_EVNT_FLOW (ICE_AQC_FW_LOG_FLOW_EN >> ICE_AQC_FW_LOG_EN_S) -#define ICE_FW_LOG_EVNT_ERR (ICE_AQC_FW_LOG_ERR_EN >> ICE_AQC_FW_LOG_EN_S) -struct ice_fw_log_evnt evnts[ICE_AQC_FW_LOG_ID_MAX ]; -}; -/* Enum defining the different states of the mailbox snapshot in the * PF-VF mailbox overflow detection algorithm. The snapshot can be in * states:
@@ -877,8 +859,6 @@ struct ice_hw {u8 fw_patch;/* firmware patch version */ u32 fw_build;/* firmware build number */ -struct ice_fw_log_cfg fw_log; -/* Device max aggregate bandwidths corresponding to the GL_PWR_MODE_CTL * register. Used for determining the ITR/INTRL granularity during * initialization.
Signature · 6 lines
2.35.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v7 2/5 ice: enable devlink to check FW logging status
In reply to Paul M Stillwell JrUsers want the ability to debug FW issues by retrieving the FW logs from the E8xx devices. Enable devlink to query the driver to see if the NVM image allows FW logging and to see if FW logging is currently running. The set command is not supported at this time.
This is the beginning of the v2 for FW logging.
pick bfdfb2dc6192 ice: add ability to query/set FW log level and resolution
--- drivers/net/ethernet/intel/ice/Makefile | 3 +- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 81 ++++++++++++ drivers/net/ethernet/intel/ice/ice_common.c | 2 + drivers/net/ethernet/intel/ice/ice_devlink.c | 73 ++++++++++- drivers/net/ethernet/intel/ice/ice_fwlog.c | 117 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_fwlog.h | 52 ++++++++ drivers/net/ethernet/intel/ice/ice_type.h | 4 + 7 files changed, 330 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_fwlog.c create mode 100644 drivers/net/ethernet/intel/ice/ice_fwlog.h
drivers/net/ethernet/intel/ice/Makefile +2 -1
@@ -33,7 +33,8 @@ ice-y := ice_main.o \ ice_lag.o \ ice_ethtool.o \ ice_repr.o \ - ice_tc_lib.o + ice_tc_lib.o \ + ice_fwlog.o ice-$(CONFIG_PCI_IOV) += \ ice_sriov.o \ ice_virtchnl.o \
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +81 -0
99 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_common.c +2 -0
@@ -879,6 +879,8 @@ int ice_init_hw(struct ice_hw *hw)if (status) goto err_unroll_cqinit; +ice_fwlog_set_supported (hw); + status =ice_clear_pf_cfg (hw);if (status) goto err_unroll_cqinit;
drivers/net/ethernet/intel/ice/ice_devlink.c +72 -1
97 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_fwlog.c new file +117 -0
117 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_fwlog.h new file +52 -0
52 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_type.h +4 -0
@@ -17,6 +17,7 @@#include "ice_protocol_type.h" #include "ice_sbq_cmd.h" #include "ice_vlan_mode.h" +#include "ice_fwlog.h" static inline bool ice_is_tc_ena (unsigned long bitmap,u8 tc) {
@@ -859,6 +860,9 @@ struct ice_hw {u8 fw_patch;/* firmware patch version */ u32 fw_build;/* firmware build number */ +bool fwlog_supported;/* does hardware support FW logging? */ +bool fwlog_ena;/* currently logging? */ +/* Device max aggregate bandwidths corresponding to the GL_PWR_MODE_CTL * register. Used for determining the ITR/INTRL granularity during * initialization.
Signature · 6 lines
2.35.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v7 3/5 ice: add ability to query/set FW log level and resolution
In reply to Paul M Stillwell JrThe E8xx has the ability to change the FW log level and the granularity at which the logs get output. Enable the ability to see what the current values are and to change them.
The following devlink commands are now supported:
devlink dev param set <pci dev> name fwlog_enabled value <true/false> cmode runtime devlink dev param set <pci dev> name fwlog_level value <0-4> cmode runtime devlink dev param set <pci dev> name fwlog_resolution value <1-128> cmode runtime
--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 2 + drivers/net/ethernet/intel/ice/ice_common.c | 4 +- drivers/net/ethernet/intel/ice/ice_devlink.c | 131 ++++++++- drivers/net/ethernet/intel/ice/ice_fwlog.c | 260 +++++++++++++++++- drivers/net/ethernet/intel/ice/ice_fwlog.h | 5 + drivers/net/ethernet/intel/ice/ice_type.h | 1 + 6 files changed, 395 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +2 -0
@@ -2374,6 +2374,8 @@ enum ice_adminq_opc { ice_aqc_opc_event_lan_overflow =0x1001 ,/* FW Logging Commands */ + ice_aqc_opc_fw_logs_config =0xFF30 , + ice_aqc_opc_fw_logs_register =0xFF31 , ice_aqc_opc_fw_logs_query = 0xFF32, };
drivers/net/ethernet/intel/ice/ice_common.c +3 -1
@@ -879,7 +879,9 @@ int ice_init_hw(struct ice_hw *hw)if (status) goto err_unroll_cqinit; -ice_fwlog_set_supported (hw); + status =ice_fwlog_init (hw); +if (status) +ice_debug (hw,ICE_DBG_FW_LOG ,"Error initializing FW logging: %d\n" , status); status =ice_clear_pf_cfg (hw);if (status)
drivers/net/ethernet/intel/ice/ice_devlink.c +129 -2
155 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_fwlog.c +255 -5
286 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_fwlog.h +5 -0
@@ -49,4 +49,9 @@ struct ice_fwlog_cfg {void ice_fwlog_set_supported (struct ice_hw *hw);bool ice_fwlog_supported (struct ice_hw *hw); +int ice_fwlog_init (struct ice_hw *hw); +int ice_fwlog_set (struct ice_hw *hw,struct ice_fwlog_cfg *cfg); +int ice_fwlog_get (struct ice_hw *hw,struct ice_fwlog_cfg *cfg); +int ice_fwlog_register (struct ice_hw *hw); +int ice_fwlog_unregister (struct ice_hw *hw);#endif /* _ICE_FWLOG_H_ */
drivers/net/ethernet/intel/ice/ice_type.h +1 -0
@@ -860,6 +860,7 @@ struct ice_hw {u8 fw_patch;/* firmware patch version */ u32 fw_build;/* firmware build number */ +struct ice_fwlog_cfg fwlog_cfg;bool fwlog_supported;/* does hardware support FW logging? */ bool fwlog_ena;/* currently logging? */
Signature · 6 lines
2.35.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v7 3/5] ice: add ability to query/set FW log level and resolution
Quoted 274 lines · Paul M Stillwell Jr
The E8xx has the ability to change the FW log level and the granularity at which the logs get output. Enable the ability to see what the current values are and to change them.
The following devlink commands are now supported:
devlink dev param set <pci dev> name
fwlog_enabledvalue <true/false> cmode runtime devlink dev param set <pci dev> namefwlog_levelvalue <0-4> cmode runtime devlink dev param set <pci dev> namefwlog_resolutionvalue <1-128> cmode runtimeSigned-off-by Paul M Stillwell Jr <[email protected]>--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 2 + drivers/net/ethernet/intel/ice/ice_common.c | 4 +- drivers/net/ethernet/intel/ice/ice_devlink.c | 131 ++++++++- drivers/net/ethernet/intel/ice/ice_fwlog.c | 260 +++++++++++++++++- drivers/net/ethernet/intel/ice/ice_fwlog.h | 5 + drivers/net/ethernet/intel/ice/ice_type.h | 1 + 6 files changed, 395 insertions(+), 8 deletions(-)drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +2
-0@@ -2374,6 +2374,8 @@ enum ice_adminq_opc { ice_aqc_opc_event_lan_overflow =0x1001 ,/* FW Logging Commands */ + ice_aqc_opc_fw_logs_config =0xFF30 , + ice_aqc_opc_fw_logs_register =0xFF31 , ice_aqc_opc_fw_logs_query = 0xFF32, };drivers/net/ethernet/intel/ice/ice_common.c +3
-1@@ -879,7 +879,9 @@ int ice_init_hw(struct ice_hw *hw)if (status) goto err_unroll_cqinit; -ice_fwlog_set_supported (hw); + status =ice_fwlog_init (hw); +if (status) +ice_debug (hw,ICE_DBG_FW_LOG ,"Error initializing FW logging: %d\n" , status); status =ice_clear_pf_cfg (hw);if (status)drivers/net/ethernet/intel/ice/ice_devlink.c +129
-2@@ -374,6 +374,8 @@ enum ice_devlink_param_id {ICE_DEVLINK_PARAM_ID_TX_BALANCE ,ICE_DEVLINK_PARAM_ID_FWLOG_SUPPORTED ,ICE_DEVLINK_PARAM_ID_FWLOG_ENABLED , +ICE_DEVLINK_PARAM_ID_FWLOG_LEVEL , + ICE_DEVLINK_PARAM_ID_FWLOG_RESOLUTION, };/** @@ -1430,8 +1432,111 @@ static int ice_devlink_fwlog_enabled_set(struct devlink *devlink, u32 id, struct devlink_param_gset_ctx *ctx) { - /* set operation is unsupported at this time */ - return -EOPNOTSUPP; + struct ice_pf *pf = devlink_priv(devlink); +struct ice_hw *hw = &pf->hw; +int status; + +/* only support fw log commands on PF 0 */ +if (hw->bus.func) +return -EOPNOTSUPP ; + +if (hw->fwlog_ena == ctx->val.vbool) +return 0 ; + + hw->fwlog_ena = ctx->val.vbool; + +if (hw->fwlog_ena) + hw->fwlog_cfg.options |=ICE_FWLOG_OPTION_ARQ_ENA ; +else + hw->fwlog_cfg.options &= ~ICE_FWLOG_OPTION_ARQ_ENA ; + +/* send the cfg to FW and register for events */ + status =ice_fwlog_set (hw, &hw->fwlog_cfg); +if (status) +return status; + +return hw->fwlog_ena ?ice_fwlog_register (hw) :ice_fwlog_unregister (hw); +} + +static int +ice_devlink_fwlog_level_get (struct devlink *devlink,u32 id, +struct devlink_param_gset_ctx *ctx) +{ +struct ice_pf *pf =devlink_priv (devlink); + +/* only support fw log commands on PF 0 */ +if (pf->hw.bus.func) +return -EOPNOTSUPP ; + +/* all the log levels are the same so pick the first one */ + ctx->val.vu8 = pf->hw.fwlog_cfg.module_entries[0 ].log_level; + +return 0 ; +} + +static int +ice_devlink_fwlog_level_set (struct devlink *devlink,u32 id, +struct devlink_param_gset_ctx *ctx) +{ +struct ice_pf *pf =devlink_priv (devlink); +struct ice_fwlog_cfg *cfg; +int i; + +if (pf->hw.bus.func) +return -EOPNOTSUPP ; + +if (ctx->val.vu8 >=ICE_FWLOG_LEVEL_INVALID ) { +dev_err (ice_pf_to_dev (pf),"Log level is greater than allowed! %d\n" , + ctx->val.vu8); +return -EINVAL ; + } + + cfg = &pf->hw.fwlog_cfg; + +/* update the log level for all modules to the same thing. this gets +* written to the FW when the user says enable logging +*/ +for (i =0 ; i <ICE_AQC_FW_LOG_ID_MAX ; i++) + cfg->module_entries[i].log_level = ctx->val.vu8; + +return 0 ; +} + +static int +ice_devlink_fwlog_resolution_get (struct devlink *devlink,u32 id, +struct devlink_param_gset_ctx *ctx) +{ +struct ice_pf *pf =devlink_priv (devlink); + +/* only support fw log commands on PF 0 */ +if (pf->hw.bus.func) +return -EOPNOTSUPP ; + + ctx->val.vu8 = pf->hw.fwlog_cfg.log_resolution; + +return 0 ; +} + +static int +ice_devlink_fwlog_resolution_set (struct devlink *devlink,u32 id, +struct devlink_param_gset_ctx *ctx) +{ +struct ice_pf *pf =devlink_priv (devlink); + +/* only support fw log commands on PF 0 */ +if (pf->hw.bus.func) +return -EOPNOTSUPP ; + +if (ctx->val.vu8 <ICE_AQC_FW_LOG_MIN_RESOLUTION || + ctx->val.vu8 >ICE_AQC_FW_LOG_MAX_RESOLUTION ) { +dev_err (ice_pf_to_dev (pf),"Log resolution is out of range. Should be between 1 - 128: %d\n" , + ctx->val.vu8); +return -EINVAL ; + } + + pf->hw.fwlog_cfg.log_resolution = ctx->val.vu8; + +return 0 ; } static const struct devlink_param ice_devlink_params[] = {@@ -1455,6 +1560,18 @@ static const struct devlink_param ice_devlink_params[] = { ice_devlink_fwlog_enabled_get, ice_devlink_fwlog_enabled_set, NULL), +DEVLINK_PARAM_DRIVER (ICE_DEVLINK_PARAM_ID_FWLOG_LEVEL , +"fwlog_level" ,DEVLINK_PARAM_TYPE_U8 , +BIT (DEVLINK_PARAM_CMODE_RUNTIME ), + ice_devlink_fwlog_level_get, + ice_devlink_fwlog_level_set, +NULL ), +DEVLINK_PARAM_DRIVER (ICE_DEVLINK_PARAM_ID_FWLOG_RESOLUTION , +"fwlog_resolution" ,DEVLINK_PARAM_TYPE_U8 , +BIT (DEVLINK_PARAM_CMODE_RUNTIME ), + ice_devlink_fwlog_resolution_get, + ice_devlink_fwlog_resolution_set, + NULL), };static void ice_devlink_free (void *devlink_ptr)@@ -1559,6 +1676,16 @@ int ice_devlink_register_params(struct ice_pf *pf)ICE_DEVLINK_PARAM_ID_FWLOG_ENABLED , value); + value.vu8 =ICE_FWLOG_LEVEL_NORMAL ; +devlink_param_driverinit_value_set (devlink, +ICE_DEVLINK_PARAM_ID_FWLOG_LEVEL , + value); + +/* set the default value for the FW to pack 10 messages per AQ event */ + value.vu8 =10 ; +devlink_param_driverinit_value_set (devlink, +ICE_DEVLINK_PARAM_ID_FWLOG_RESOLUTION , + value);return 0 ; }drivers/net/ethernet/intel/ice/ice_fwlog.c +54
-0@@ -4,6 +4,146 @@#include "ice_common.h" #include "ice_fwlog.h" +/** +* valid_module_entries - validate all the module entry IDs and log levels +* @hw: pointer to the HW structure +* @entries: entries to validate +* @num_entries: number of entries to validate +*/ +static bool +valid_module_entries (struct ice_hw *hw,struct ice_fwlog_module_entry *entries, +u16 num_entries) +{ +int i; + +if (!entries) { +ice_debug (hw,ICE_DBG_FW_LOG ,"Null ice_fwlog_module_entry array\n" ); +return false; + } + +if (!num_entries) { +ice_debug (hw,ICE_DBG_FW_LOG ,"num_entries must be non-zero\n" ); +return false; + } + +for (i =0 ; i < num_entries; i++) { +struct ice_fwlog_module_entry *entry = &entries[i]; + +if (entry->module_id >=ICE_AQC_FW_LOG_ID_MAX ) { +ice_debug (hw,ICE_DBG_FW_LOG ,"Invalid module_id %u, max valid module_id is %u\n" , + entry->module_id,ICE_AQC_FW_LOG_ID_MAX -1 ); +return false; + } + +if (entry->log_level >=ICE_FWLOG_LEVEL_INVALID ) { +ice_debug (hw,ICE_DBG_FW_LOG ,"Invalid log_level %u, max valid log_level is %u\n" , + entry->log_level, +ICE_AQC_FW_LOG_ID_MAX -1 ); +return false; + } + } + +return true; +} + +/** +* valid_cfg - validate entire configuration +* @hw: pointer to the HW structure +* @cfg: config to validate +*/ +static bool valid_cfg (struct ice_hw *hw,struct ice_fwlog_cfg *cfg) +{ +if (!cfg) { +ice_debug (hw,ICE_DBG_FW_LOG ,"Null ice_fwlog_cfg\n" ); +return false; + } +
drivers/net/ethernet/intel/ice/ice_fwlog.c line 70
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_fwlog.c +10
-0+if (cfg->log_resolution <ICE_AQC_FW_LOG_MIN_RESOLUTION || + cfg->log_resolution >ICE_AQC_FW_LOG_MAX_RESOLUTION ) { +ice_debug (hw,ICE_DBG_FW_LOG ,"Unsupported log_resolution %u, must be between %u and %u\n" , + cfg->log_resolution,ICE_AQC_FW_LOG_MIN_RESOLUTION , +ICE_AQC_FW_LOG_MAX_RESOLUTION ); +return false; + } + +return valid_module_entries (hw, cfg->module_entries, + ICE_AQC_FW_LOG_ID_MAX))
^^^^
missing semi-colon? -------------------------------------|
Then it's fixed in 5/5.
I like to use
git rebase -x 'make W=1 C=1 M=pwd/drivers/net/ethernet/intel/ice'
to test each patch compiles.
Quoted 241 lines
drivers/net/ethernet/intel/ice/ice_fwlog.c +191
-5+} + +/** +* ice_fwlog_init - Initialize FW logging configuration +* @hw: pointer to the HW structure +* +* This function should be called on driver initialization during +* ice_init_hw(). +*/ +int ice_fwlog_init (struct ice_hw *hw) +{ +int status; + +ice_fwlog_set_supported (hw); + +if (ice_fwlog_supported (hw)) { +/* read the current config from the FW and store it */ + status =ice_fwlog_get (hw, &hw->fwlog_cfg); +if (status) +return status; + } + +return 0 ; +} + +/** +* ice_aq_fwlog_set - Set FW logging configuration AQ command (0xFF30) +* @hw: pointer to the HW structure +* @entries: entries to configure +* @num_entries: number of @entries +* @options: options from ice_fwlog_cfg->options structure +* @log_resolution: logging resolution +*/ +static int +ice_aq_fwlog_set (struct ice_hw *hw,struct ice_fwlog_module_entry *entries, +u16 num_entries,u16 options,u16 log_resolution) +{ +struct ice_aqc_fw_log_cfg_resp *fw_modules; +struct ice_aqc_fw_log *cmd; +struct ice_aq_desc desc; +int status; +int i; + + fw_modules =kcalloc (num_entries,sizeof (*fw_modules),GFP_KERNEL ); +if (!fw_modules) +return -ENOMEM ; + +for (i =0 ; i < num_entries; i++) { + fw_modules[i].module_identifier = +cpu_to_le16 (entries[i].module_id); + fw_modules[i].log_level = entries[i].log_level; + } + +ice_fill_dflt_direct_cmd_desc (&desc, ice_aqc_opc_fw_logs_config); + desc.flags |=cpu_to_le16 (ICE_AQ_FLAG_RD ); + + cmd = &desc.params.fw_log; + + cmd->cmd_flags =ICE_AQC_FW_LOG_CONF_SET_VALID ; + cmd->ops.cfg.log_resolution =cpu_to_le16 (log_resolution); + cmd->ops.cfg.mdl_cnt =cpu_to_le16 (num_entries); + +if (options &ICE_FWLOG_OPTION_ARQ_ENA ) + cmd->cmd_flags |=ICE_AQC_FW_LOG_CONF_AQ_EN ; +if (options &ICE_FWLOG_OPTION_UART_ENA ) + cmd->cmd_flags |=ICE_AQC_FW_LOG_CONF_UART_EN ; + + status =ice_aq_send_cmd (hw, &desc, fw_modules, +sizeof (*fw_modules) * num_entries, +NULL ); + +kfree (fw_modules); + +return status; +} +/** * ice_fwlog_supported - Cached for whether FW supports FW logging or not * @hw: pointer to the HW structure @@ -16,13 +156,102 @@ bool ice_fwlog_supported(struct ice_hw *hw)return hw->fwlog_supported; } +/** +* ice_fwlog_set - Set the firmware logging settings +* @hw: pointer to the HW structure +* @cfg: config used to set firmware logging +* +* This function should be called whenever the driver needs to set the firmware +* logging configuration. It can be called on initialization, reset, or during +* runtime. +* +* If the PF wishes to receive FW logging then it must register via +* ice_fwlog_register. Note, that ice_fwlog_register does not need to be called +* for init. +*/ +int ice_fwlog_set (struct ice_hw *hw,struct ice_fwlog_cfg *cfg) +{ +int status; + +if (!ice_fwlog_supported (hw)) +return -EOPNOTSUPP ; + +if (!valid_cfg (hw, cfg)) +return -EINVAL ; + + status =ice_aq_fwlog_set (hw, cfg->module_entries, +ICE_AQC_FW_LOG_ID_MAX , cfg->options, + cfg->log_resolution); + +return status; +} + +/** +* ice_aq_fwlog_register - Register PF for firmware logging events (0xFF31) +* @hw: pointer to the HW structure +* @reg: true to register and false to unregister +*/ +static int ice_aq_fwlog_register (struct ice_hw *hw,bool reg) +{ +struct ice_aq_desc desc; + +ice_fill_dflt_direct_cmd_desc (&desc, ice_aqc_opc_fw_logs_register); + +if (reg) + desc.params.fw_log.cmd_flags =ICE_AQC_FW_LOG_AQ_REGISTER ; + +return ice_aq_send_cmd (hw, &desc,NULL ,0 ,NULL ); +} + +/** +* ice_fwlog_register - Register the PF for firmware logging +* @hw: pointer to the HW structure +* +* After this call the PF will start to receive firmware logging based on the +* configuration set in ice_fwlog_set. +*/ +int ice_fwlog_register (struct ice_hw *hw) +{ +int status; + +if (!ice_fwlog_supported (hw)) +return -EOPNOTSUPP ; + + status =ice_aq_fwlog_register (hw, true); +if (status) +ice_debug (hw,ICE_DBG_FW_LOG ,"Failed to register for firmware logging events over ARQ\n" ); +else + hw->fwlog_cfg.options |=ICE_FWLOG_OPTION_IS_REGISTERED ; + +return status; +} + +/** +* ice_fwlog_unregister - Unregister the PF from firmware logging +* @hw: pointer to the HW structure +*/ +int ice_fwlog_unregister (struct ice_hw *hw) +{ +int status; + +if (!ice_fwlog_supported (hw)) +return -EOPNOTSUPP ; + + status =ice_aq_fwlog_register (hw, false); +if (status) +ice_debug (hw,ICE_DBG_FW_LOG ,"Failed to unregister from firmware logging events over ARQ\n" ); +else + hw->fwlog_cfg.options &= ~ICE_FWLOG_OPTION_IS_REGISTERED ; + +return status; +} +/** * ice_aq_fwlog_get - Get the current firmware logging configuration (0xFF32) * @hw: pointer to the HW structure * @cfg: firmware logging configuration to populate */ -static int -ice_aq_fwlog_get (struct ice_hw *hw,struct ice_fwlog_cfg *cfg) +static int ice_aq_fwlog_get (struct ice_hw *hw,struct ice_fwlog_cfg *cfg) {struct ice_aqc_fw_log_cfg_resp *fw_modules;struct ice_aqc_fw_log *cmd;@@ -102,9 +331,8 @@ void ice_fwlog_set_supported(struct ice_hw *hw)if (!cfg)return ; -/* don't call ice_fwlog_get() because that would overwrite the cached -* configuration from the call to ice_fwlog_init(), which is expected to -* be called prior to this function +/* don't call ice_fwlog_get() because that would check to see if FW +* logging is supported which is what the driver is determining now */ status =ice_aq_fwlog_get (hw, cfg);if (status)@@ -115,3 +343,25 @@ void ice_fwlog_set_supported(struct ice_hw *hw)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 ; +}drivers/net/ethernet/intel/ice/ice_fwlog.h +5
-0@@ -49,4 +49,9 @@ struct ice_fwlog_cfg {void ice_fwlog_set_supported (struct ice_hw *hw);bool ice_fwlog_supported (struct ice_hw *hw); +int ice_fwlog_init (struct ice_hw *hw); +int ice_fwlog_set (struct ice_hw *hw,struct ice_fwlog_cfg *cfg); +int ice_fwlog_get (struct ice_hw *hw,struct ice_fwlog_cfg *cfg); +int ice_fwlog_register (struct ice_hw *hw); +int ice_fwlog_unregister (struct ice_hw *hw);#endif /* _ICE_FWLOG_H_ */ drivers/net/ethernet/intel/ice/ice_type.h +0
-0
drivers/net/ethernet/intel/ice/ice_type.h struct ice_hw { · line 866
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_type.h +1
-0@@ -860,6 +860,7 @@ struct ice_hw {u8 fw_patch;/* firmware patch version */ u32 fw_build;/* firmware build number */ +struct ice_fwlog_cfg fwlog_cfg;bool fwlog_supported;/* does hardware support FW logging? */ bool fwlog_ena;/* currently logging? */
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v7 4/5 ice: disable FW logging on driver unload
In reply to Paul M Stillwell JrThe FW is running in it's own context irregardless of what the driver is doing. In this case, if the driver previously registered for FW log events and then the driver unloads without informing the FW to unregister for FW log events then the FW still has a timer running to output FW logs.
The next time the driver loads and tries to register for FW log events then the FW returns an error, but still enables the continued outputting of FW logs. This causes an IO error to devlink which isn't intuitive since the logs are still being output.
Fix this by disabling FW logging when the driver is being unloaded.
--- drivers/net/ethernet/intel/ice/ice_main.c | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/net/ethernet/intel/ice/ice_main.c +29 -0
@@ -4679,6 +4679,33 @@ static void ice_unregister_netdev(struct ice_vsi *vsi)clear_bit (ICE_VSI_NETDEV_REGISTERED , vsi->state); } +/** +* ice_pf_fwlog_deinit - clear FW logging metadata on device exit +* @pf: pointer to the PF struct +*/ +static void ice_pf_fwlog_deinit (struct ice_pf *pf) +{ +struct ice_hw *hw = &pf->hw; + +/* make sure FW logging is disabled to not put the FW in a weird state +* for the next driver load +*/ +if (hw->fwlog_ena) { +int status; + + hw->fwlog_cfg.options &= ~ICE_FWLOG_OPTION_ARQ_ENA ; + status =ice_fwlog_set (hw, &hw->fwlog_cfg); +if (status) +dev_warn (ice_pf_to_dev (pf),"Unable to turn off FW logging, status: %d\n" , + status); + + status =ice_fwlog_unregister (hw); +if (status) +dev_warn (ice_pf_to_dev (pf),"Unable to unregister FW logging, status: %d\n" , + status); + } +} +/** * ice_cfg_netdev - Allocate, configure and register a netdev * @vsi: the VSI associated with the new netdev
@@ -5416,6 +5443,8 @@ static void ice_remove(struct pci_dev *pdev)msleep (100 ); } +ice_pf_fwlog_deinit (pf); +if (test_bit (ICE_FLAG_SRIOV_ENA , pf->flags)) {set_bit (ICE_VF_RESETS_DISABLED , pf->state);ice_free_vfs (pf);
Signature · 6 lines
2.35.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v7 5/5 ice: use debugfs to output FW log data
In reply to Paul M Stillwell JrThe FW log data can be quite large so we don't want to use syslog. Instead take advantage of debugfs to write the data to.
The file is binary data and users should send them to us to work with the FW team to decode them.
An example of how to retrieve the data using debugfs is:
cat /sys/kernel/debug/ice/0000\:18\:00.0/fwlog > fwlog
Also updated the documentation to add the new parameters.
--- Documentation/networking/devlink/ice.rst | 39 ++++++ drivers/net/ethernet/intel/ice/Makefile | 4 +- drivers/net/ethernet/intel/ice/ice.h | 22 ++++ .../net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + drivers/net/ethernet/intel/ice/ice_debugfs.c | 115 ++++++++++++++++ drivers/net/ethernet/intel/ice/ice_fwlog.c | 2 +- drivers/net/ethernet/intel/ice/ice_main.c | 124 ++++++++++++++---- 7 files changed, 278 insertions(+), 29 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_debugfs.c
Documentation/networking/devlink/ice.rst +39 -0
@@ -7,6 +7,45 @@ ice devlink support This document describes the devlink features implemented by the ``ice`` device driver. +Parameters +============= + +.. list-table:: Driver-specific parameters implemented + :widths: 5 5 5 85 + + * - Name + - Type + - Mode + - Description + * - ``fwlog_supported`` + - Boolean + - runtime + - This parameter indicates to the user whether FW loggiing is supported + or not in the currently loaded FW. + * - ``fwlog_enabled`` + - Boolean + - runtime + - This parameter indicates to the user whether the driver is currently + getting FW logs or not. + * - ``fwlog_level`` + - u8 + - runtime + - This parameter indicates the current log level. Each level includes the + messages from the previous/lower level. Valid values are + + * ``0`` - no logging + * ``1`` - error logging + * ``2`` - warning logging + * ``3`` - normal logging + * ``4`` - verbose logging + * - ``fwlog_resolution`` + - u8 + - runtime + - This parameter indicates 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. + Info versions =============
drivers/net/ethernet/intel/ice/Makefile +3 -1
@@ -34,7 +34,8 @@ ice-y := ice_main.o \ ice_ethtool.o \ ice_repr.o \ ice_tc_lib.o \ - ice_fwlog.o + ice_fwlog.o \ + ice_debugfs.o ice-$(CONFIG_PCI_IOV) += \ ice_sriov.o \ ice_virtchnl.o \
@@ -49,3 +50,4 @@ ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.o ice-$(CONFIG_ICE_SWITCHDEV) += ice_eswitch.o ice-$(CONFIG_ICE_GNSS) += ice_gnss.o +ice-$(CONFIG_DEBUG_FS) += ice_debugfs.o
drivers/net/ethernet/intel/ice/ice.h +22 -0
@@ -552,6 +552,7 @@ struct ice_pf {struct ice_vsi_stats **vsi_stats;struct ice_sw *first_sw;/* first switch created by firmware */ u16 eswitch_mode;/* current mode of eswitch */ +struct dentry *ice_debugfs_pf;struct ice_vfs vfs;DECLARE_BITMAP (features,ICE_F_MAX );DECLARE_BITMAP (state,ICE_STATE_NBITS );
@@ -634,6 +635,8 @@ struct ice_pf {#define ICE_VF_AGG_NODE_ID_START 65#define ICE_MAX_VF_AGG_NODES 32struct ice_agg_node vf_agg_node[ICE_MAX_VF_AGG_NODES ]; +struct list_head fwlog_data_list; +u8 fwlog_list_count; };struct ice_netdev_priv {
@@ -648,6 +651,15 @@ struct ice_netdev_priv {struct list_head tc_indr_block_priv_list; }; +struct ice_fwlog_data { +struct list_head list; +u16 data_size; +u8 *data; +}; + +/* define the maximum number of items that can be in the list */ +#define ICE_FWLOG_MAX_SIZE 128 +/** * ice_vector_ch_enabled * @qv: pointer to q_vector, can be NULL
@@ -872,6 +884,16 @@ static inline bool ice_is_adq_active(struct ice_pf *pf)return false; } +#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);
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +1 -0
@@ -2377,6 +2377,7 @@ enum ice_adminq_opc { ice_aqc_opc_fw_logs_config =0xFF30 , ice_aqc_opc_fw_logs_register =0xFF31 , ice_aqc_opc_fw_logs_query =0xFF32 , + ice_aqc_opc_fw_logs_event = 0xFF33, };#endif /* _ICE_ADMINQ_CMD_H_ */
drivers/net/ethernet/intel/ice/ice_debugfs.c new file +115 -0
115 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_fwlog.c +1 -1
@@ -67,7 +67,7 @@ static bool valid_cfg(struct ice_hw *hw, struct ice_fwlog_cfg *cfg) }return valid_module_entries (hw, cfg->module_entries, - ICE_AQC_FW_LOG_ID_MAX)) +ICE_AQC_FW_LOG_ID_MAX ); }/**
drivers/net/ethernet/intel/ice/ice_main.c +97 -27
170 lines not on this page · raw message
Signature · 6 lines
2.35.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net-next v7 5/5] ice: use debugfs to output FW log data
Quoted 285 lines · Paul M Stillwell Jr
The FW log data can be quite large so we don't want to use syslog. Instead take advantage of debugfs to write the data to.
The file is binary data and users should send them to us to work with the FW team to decode them.
An example of how to retrieve the data using debugfs is:
cat /sys/kernel/debug/ice/0000\:18\:00.0/fwlog > fwlog
Also updated the documentation to add the new parameters.
Signed-off-by Paul M Stillwell Jr <[email protected]>--- Documentation/networking/devlink/ice.rst | 39 ++++++ drivers/net/ethernet/intel/ice/Makefile | 4 +- drivers/net/ethernet/intel/ice/ice.h | 22 ++++ .../net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + drivers/net/ethernet/intel/ice/ice_debugfs.c | 115 ++++++++++++++++ drivers/net/ethernet/intel/ice/ice_fwlog.c | 2 +- drivers/net/ethernet/intel/ice/ice_main.c | 124 ++++++++++++++---- 7 files changed, 278 insertions(+), 29 deletions(-)create mode 100644
drivers/net/ethernet/intel/ice/ice_debugfs.cDocumentation/networking/devlink/ice.rst +39
-0@@ -7,6 +7,45 @@ ice devlink support This document describes the devlink features implemented by the ``ice`` device driver. +Parameters +============= + +.. list-table:: Driver-specific parameters implemented + :widths: 5 5 5 85 + + * - Name + - Type + - Mode + - Description + * - ``fwlog_supported`` + - Boolean + - runtime + - This parameter indicates to the user whether FW loggiing is supported + or not in the currently loaded FW. + * - ``fwlog_enabled`` + - Boolean + - runtime + - This parameter indicates to the user whether the driver is currently + getting FW logs or not. + * - ``fwlog_level`` + - u8 + - runtime + - This parameter indicates the current log level. Each level includes the + messages from the previous/lower level. Valid values are + + * ``0`` - no logging + * ``1`` - error logging + * ``2`` - warning logging + * ``3`` - normal logging + * ``4`` - verbose logging + * - ``fwlog_resolution`` + - u8 + - runtime + - This parameter indicates 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. + Info versions =============drivers/net/ethernet/intel/ice/Makefile +3
-1@@ -34,7 +34,8 @@ ice-y := ice_main.o \ ice_ethtool.o \ ice_repr.o \ ice_tc_lib.o \ - ice_fwlog.o + ice_fwlog.o \ + ice_debugfs.o ice-$(CONFIG_PCI_IOV) += \ ice_sriov.o \ ice_virtchnl.o \@@ -49,3 +50,4 @@ ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.o ice-$(CONFIG_ICE_SWITCHDEV) += ice_eswitch.o ice-$(CONFIG_ICE_GNSS) += ice_gnss.o +ice-$(CONFIG_DEBUG_FS) += ice_debugfs.odrivers/net/ethernet/intel/ice/ice.h +22
-0@@ -552,6 +552,7 @@ struct ice_pf {struct ice_vsi_stats **vsi_stats;struct ice_sw *first_sw;/* first switch created by firmware */ u16 eswitch_mode;/* current mode of eswitch */ +struct dentry *ice_debugfs_pf;struct ice_vfs vfs;DECLARE_BITMAP (features,ICE_F_MAX );DECLARE_BITMAP (state,ICE_STATE_NBITS );@@ -634,6 +635,8 @@ struct ice_pf {#define ICE_VF_AGG_NODE_ID_START 65#define ICE_MAX_VF_AGG_NODES 32struct ice_agg_node vf_agg_node[ICE_MAX_VF_AGG_NODES ]; +struct list_head fwlog_data_list; +u8 fwlog_list_count; };struct ice_netdev_priv {@@ -648,6 +651,15 @@ struct ice_netdev_priv {struct list_head tc_indr_block_priv_list; }; +struct ice_fwlog_data { +struct list_head list; +u16 data_size; +u8 *data; +}; + +/* define the maximum number of items that can be in the list */ +#define ICE_FWLOG_MAX_SIZE 128 +/** * ice_vector_ch_enabled * @qv: pointer to q_vector, can be NULL @@ -872,6 +884,16 @@ static inline bool ice_is_adq_active(struct ice_pf *pf)return false; } +#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);drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +1
-0@@ -2377,6 +2377,7 @@ enum ice_adminq_opc { ice_aqc_opc_fw_logs_config =0xFF30 , ice_aqc_opc_fw_logs_register =0xFF31 , ice_aqc_opc_fw_logs_query =0xFF32 , + ice_aqc_opc_fw_logs_event = 0xFF33, };#endif /* _ICE_ADMINQ_CMD_H_ */ drivers/net/ethernet/intel/ice/ice_debugfs.c new file +115
-0@@ -0,0 +1,115 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (c) 2022, Intel Corporation. */ + +#include <linux/fs.h> +#include <linux/debugfs.h> +#include <linux/random.h> +#include "ice.h" + +static struct dentry *ice_debugfs_root; + +/** +* ice_debugfs_command_read - read from command datum +* @filp: the opened file +* @buffer: where to write the data for the user to read +* @count: the size of the user's buffer +* @ppos: file position offset +*/ +static ssize_t ice_debugfs_command_read (struct file *filp,char __user *buffer, +size_t count,loff_t *ppos) +{ +struct ice_pf *pf = filp->private_data; +struct ice_fwlog_data *log, *tmp_log; +int data_copied =0 ; +int copy_count =0 ; + +if (list_empty (&pf->fwlog_data_list)) { +return 0 ; + } + +list_for_each_entry (log, &pf->fwlog_data_list, list) { +u16 cur_buf_len = log->data_size; +int retval; + +if (cur_buf_len >= count) +break ; + + retval =copy_to_user (buffer, log->data, cur_buf_len); +if (retval) +return -EFAULT ; + + data_copied += cur_buf_len; + buffer += cur_buf_len; + count -= cur_buf_len; + *ppos += cur_buf_len; + copy_count++; + } + +/* only free the data once we know there weren't any errors */ +list_for_each_entry_safe (log, tmp_log, &pf->fwlog_data_list, list) { +if (!copy_count) +break ; + +vfree (log->data); +list_del (&log->list); +vfree (log); + pf->fwlog_list_count--; + copy_count--; + } + +return data_copied; +} + +static const struct file_operations ice_debugfs_command_fops = { + .owner =THIS_MODULE , + .open = simple_open, + .read = ice_debugfs_command_read, +}; + +/** +* ice_debugfs_fwlog_init - setup the debugfs directory +* @pf: the ice that is starting up +*/ +void ice_debugfs_fwlog_init (struct ice_pf *pf) +{ +const char *name =pci_name (pf->pdev); +struct dentry *pfile; + +/* only support fw log commands on PF 0 */ +if (pf->hw.bus.func) +return ; + + pf->ice_debugfs_pf =debugfs_create_dir (name, ice_debugfs_root); +if (IS_ERR (pf->ice_debugfs_pf)) +return ; + + pfile =debugfs_create_file ("fwlog" ,0400 , pf->ice_debugfs_pf, pf, + &ice_debugfs_command_fops); +if (!pfile) + goto create_failed; + +return ; + +create_failed: +dev_err (ice_pf_to_dev (pf),"debugfs dir/file for %s failed\n" , name); +debugfs_remove_recursive (pf->ice_debugfs_pf); +} + +/** +* ice_debugfs_init - create root directory for debugfs entries +*/ +void ice_debugfs_init (void ) +{ + ice_debugfs_root =debugfs_create_dir (KBUILD_MODNAME ,NULL ); +if (IS_ERR (ice_debugfs_root)) +pr_info ("init of debugfs failed\n" ); +} + +/** +* ice_debugfs_exit - remove debugfs entries +*/ +void ice_debugfs_exit (void ) +{ +debugfs_remove_recursive (ice_debugfs_root); + ice_debugfs_root =NULL ; +}drivers/net/ethernet/intel/ice/ice_fwlog.c +0
-0
drivers/net/ethernet/intel/ice/ice_fwlog.c static bool valid_cfg(struct ice_hw *hw, struct ice_fwlog_cfg *cfg) · line 70
Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_fwlog.c +1
-1@@ -67,7 +67,7 @@ static bool valid_cfg(struct ice_hw *hw, struct ice_fwlog_cfg *cfg) }return valid_module_entries (hw, cfg->module_entries, - ICE_AQC_FW_LOG_ID_MAX)) +ICE_AQC_FW_LOG_ID_MAX );
appears to be a compilation fix for 3/5?
Quoted 174 lines
drivers/net/ethernet/intel/ice/ice_fwlog.c +0
-0}/** drivers/net/ethernet/intel/ice/ice_main.c +94
-27@@ -1369,6 +1369,43 @@ ice_handle_link_event(struct ice_pf *pf, struct ice_rq_event_info *event)return status; } +/** +* ice_get_fwlog_data - copy the FW log data from ARQ event +* @pf: PF that the FW log event is associated with +* @event: event structure containing FW log data +*/ +static void +ice_get_fwlog_data (struct ice_pf *pf,struct ice_rq_event_info *event) +{ +struct device *dev =ice_pf_to_dev (pf); +struct ice_fwlog_data *fwlog; + +if (pf->fwlog_list_count >=ICE_FWLOG_MAX_SIZE ) +return ; + + fwlog =vmalloc (sizeof (*fwlog)); +if (!fwlog) { +dev_warn (dev,"Couldn't allocate memory for FWlog element\n" ); +return ; + } + +INIT_LIST_HEAD (&fwlog->list); + + fwlog->data_size =le16_to_cpu (event->desc.datalen); + fwlog->data =vzalloc (fwlog->data_size); +if (!fwlog->data) { +dev_warn (dev,"Couldn't allocate memory for FWlog data\n" ); +vfree (fwlog); +return ; + } + +memcpy (fwlog->data, event->msg_buf, fwlog->data_size); + +list_add_tail (&fwlog->list, &pf->fwlog_data_list); + + pf->fwlog_list_count++; +} +enum ice_aq_task_state {ICE_AQ_TASK_WAITING =0 ,ICE_AQ_TASK_COMPLETE ,@@ -1642,6 +1679,9 @@ static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type)if (!ice_is_malicious_vf (pf, &event, i, pending))ice_vc_process_vf_msg (pf, &event);break ; +case ice_aqc_opc_fw_logs_event: +ice_get_fwlog_data (pf, &event); +break ;case ice_aqc_opc_lldp_set_mib_change:ice_dcb_process_lldp_set_mib_change (pf, &event);break ;@@ -4679,33 +4719,6 @@ static void ice_unregister_netdev(struct ice_vsi *vsi)clear_bit (ICE_VSI_NETDEV_REGISTERED , vsi->state); } -/** -* ice_pf_fwlog_deinit - clear FW logging metadata on device exit -* @pf: pointer to the PF struct -*/ -static void ice_pf_fwlog_deinit (struct ice_pf *pf) -{ -struct ice_hw *hw = &pf->hw; - -/* make sure FW logging is disabled to not put the FW in a weird state -* for the next driver load -*/ -if (hw->fwlog_ena) { -int status; - - hw->fwlog_cfg.options &= ~ICE_FWLOG_OPTION_ARQ_ENA ; - status =ice_fwlog_set (hw, &hw->fwlog_cfg); -if (status) -dev_warn (ice_pf_to_dev (pf),"Unable to turn off FW logging, status: %d\n" , - status); - - status =ice_fwlog_unregister (hw); -if (status) -dev_warn (ice_pf_to_dev (pf),"Unable to unregister FW logging, status: %d\n" , - status); - } -} -/** * ice_cfg_netdev - Allocate, configure and register a netdev * @vsi: the VSI associated with the new netdev @@ -4832,6 +4845,56 @@ static void ice_deinit_eth(struct ice_pf *pf)ice_decfg_netdev (vsi); } +/** +* ice_pf_fwlog_init - initialize FW logging on device init +* @pf: pointer to the PF struct +*/ +static void ice_pf_fwlog_init (struct ice_pf *pf) +{ +/* only supported on PF 0 */ +if (pf->hw.bus.func) +return ; + +INIT_LIST_HEAD (&pf->fwlog_data_list); +} + +/** +* ice_pf_fwlog_deinit - clear FW logging metadata on device exit +* @pf: pointer to the PF struct +*/ +static void ice_pf_fwlog_deinit (struct ice_pf *pf) +{ +struct ice_fwlog_data *fwlog, *fwlog_tmp; +struct ice_hw *hw = &pf->hw; + +/* only supported on PF 0 */ +if (pf->hw.bus.func) +return ; + +/* make sure FW logging is disabled to not put the FW in a weird state +* for the next driver load +*/ +if (hw->fwlog_ena) { +int status; + + hw->fwlog_cfg.options &= ~ICE_FWLOG_OPTION_ARQ_ENA ; + status =ice_fwlog_set (hw, &hw->fwlog_cfg); +if (status) +dev_warn (ice_pf_to_dev (pf),"Unable to turn off FW logging, status: %d\n" , + status); + + status =ice_fwlog_unregister (hw); +if (status) +dev_warn (ice_pf_to_dev (pf),"Unable to unregister FW logging, status: %d\n" , + status); + } + +list_for_each_entry_safe (fwlog, fwlog_tmp, &pf->fwlog_data_list, list) { +vfree (fwlog->data); +vfree (fwlog); + } +} +static int ice_init_dev (struct ice_pf *pf) {struct device *dev =ice_pf_to_dev (pf);@@ -5334,6 +5397,9 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) hw->debug_mask = debug;#endif +ice_pf_fwlog_init (pf); +ice_debugfs_fwlog_init (pf); + err =ice_init (pf);if (err) goto err_init;@@ -5444,6 +5510,7 @@ static void ice_remove(struct pci_dev *pdev) }ice_pf_fwlog_deinit (pf); +ice_debugfs_exit ();if (test_bit (ICE_FLAG_SRIOV_ENA , pf->flags)) {set_bit (ICE_VF_RESETS_DISABLED , pf->state);@@ -5907,10 +5974,13 @@ static int __init ice_module_init(void)return -ENOMEM ; }
drivers/net/ethernet/intel/ice/ice_main.c static int __init ice_module_init(void) · line 5986
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_main.c +3
-0+ice_debugfs_init (); + status =pci_register_driver (&ice_driver);if (status) {pr_err ("failed to register PCI driver, err %d\n" , status);destroy_workqueue (ice_wq); +ice_debugfs_exit (); }return status;
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
kernel test robot
build botRe: [Intel-wired-lan] [PATCH net-next v7 5/5] ice: use debugfs to output FW log data
In reply to Paul M Stillwell JrThank you for the patch! Perhaps something to improve:
Hi Paul,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on tnguy-next-queue/dev-queue] [cannot apply to net-next/master linus/master v6.2-rc4 next-20230120] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Paul-M-Stillwell-Jr/ice-remove-FW-logging-code/20230121-073744 base: https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue patch link: https://lore.kernel.org/r/20230120233511.131-6-paul.m.stillwell.jr%40intel.com patch subject: [Intel-wired-lan] [PATCH net-next v7 5/5] ice: use debugfs to output FW log data config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20230121/[email protected]/config) compiler: mips-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/a540cbc88b6aa6de989fb8793df30f96f927ba3e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Paul-M-Stillwell-Jr/ice-remove-FW-logging-code/20230121-073744 git checkout a540cbc88b6aa6de989fb8793df30f96f927ba3e
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/net/
If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <[email protected]>
All warnings (new ones prefixed by >>):
In file included from include/linux/device.h:15,
from include/linux/dma-mapping.h:7,
from include/linux/skbuff.h:31,
from include/net/net_namespace.h:43,
from include/linux/netdevice.h:38,
from drivers/net/ethernet/intel/ice/ice.h:12,
from drivers/net/ethernet/intel/ice/ice_main.c:9:
drivers/net/ethernet/intel/ice/ice_main.c: In function 'ice_map_hw_addr':
drivers/net/ethernet/intel/ice/ice_main.c:652:30: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type 'resource_size_t' {aka 'unsigned int'} [-Wformat=]
652 | dev_err(dev, "%s: remap at offset %llu failed\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:144:56: note: in expansion of macro 'dev_fmt'
144 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/net/ethernet/intel/ice/ice_main.c:652:17: note: in expansion of macro 'dev_err'
652 | dev_err(dev, "%s: remap at offset %llu failed\n",
| ^~~~~~~
drivers/net/ethernet/intel/ice/ice_main.c:652:54: note: format string is defined here
652 | dev_err(dev, "%s: remap at offset %llu failed\n",
| ~~~^
| |
| long long unsigned int
| %u
drivers/net/ethernet/intel/ice/ice_main.c: In function 'ice_get_fwlog_data':
drivers/net/ethernet/intel/ice/ice_main.c:1386:17: error: implicit declaration of function 'vmalloc'; did you mean 'kvmalloc'? [-Werror=implicit-function-declaration]
1386 | fwlog = vmalloc(sizeof(*fwlog));
| ^~~~~~~
| kvmalloc
>> drivers/net/ethernet/intel/ice/ice_main.c:1386:15: warning: assignment to 'struct ice_fwlog_data *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
1386 | fwlog = vmalloc(sizeof(*fwlog));
| ^
drivers/net/ethernet/intel/ice/ice_main.c:1395:23: error: implicit declaration of function 'vzalloc'; did you mean 'kvzalloc'? [-Werror=implicit-function-declaration]
1395 | fwlog->data = vzalloc(fwlog->data_size);
| ^~~~~~~
| kvzalloc
>> drivers/net/ethernet/intel/ice/ice_main.c:1395:21: warning: assignment to 'u8 *' {aka 'unsigned char *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
1395 | fwlog->data = vzalloc(fwlog->data_size);
| ^
drivers/net/ethernet/intel/ice/ice_main.c:1398:17: error: implicit declaration of function 'vfree'; did you mean 'kvfree'? [-Werror=implicit-function-declaration]
1398 | vfree(fwlog);
| ^~~~~
| kvfreecc1: some warnings being treated as errors
vim +1386 drivers/net/ethernet/intel/ice/ice_main.c
1371
1372 /**
1373 * ice_get_fwlog_data - copy the FW log data from ARQ event
1374 * @pf: PF that the FW log event is associated with
1375 * @event: event structure containing FW log data
1376 */
1377 static void
1378 ice_get_fwlog_data(struct ice_pf *pf, struct ice_rq_event_info *event)
1379 {
1380 struct device *dev = ice_pf_to_dev(pf);
1381 struct ice_fwlog_data *fwlog;
1382
1383 if (pf->fwlog_list_count >= ICE_FWLOG_MAX_SIZE)
1384 return;
1385
> 1386 fwlog = vmalloc(sizeof(*fwlog));
1387 if (!fwlog) {
1388 dev_warn(dev, "Couldn't allocate memory for FWlog element\n");
1389 return;
1390 }
1391
1392 INIT_LIST_HEAD(&fwlog->list);
1393
1394 fwlog->data_size = le16_to_cpu(event->desc.datalen);
> 1395 fwlog->data = vzalloc(fwlog->data_size); 1396 if (!fwlog->data) {
1397 dev_warn(dev, "Couldn't allocate memory for FWlog data\n");
1398 vfree(fwlog);
1399 return;
1400 }
1401
1402 memcpy(fwlog->data, event->msg_buf, fwlog->data_size);
1403
1404 list_add_tail(&fwlog->list, &pf->fwlog_data_list);
1405
1406 pf->fwlog_list_count++;
1407 }
1408
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
kernel test robot
build botRe: [Intel-wired-lan] [PATCH net-next v7 5/5] ice: use debugfs to output FW log data
In reply to Paul M Stillwell JrThank you for the patch! Yet something to improve:
Hi Paul,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tnguy-next-queue/dev-queue] [cannot apply to net-next/master linus/master v6.2-rc4 next-20230120] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Paul-M-Stillwell-Jr/ice-remove-FW-logging-code/20230121-073744 base: https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue patch link: https://lore.kernel.org/r/20230120233511.131-6-paul.m.stillwell.jr%40intel.com patch subject: [Intel-wired-lan] [PATCH net-next v7 5/5] ice: use debugfs to output FW log data config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20230121/[email protected]/config) compiler: mips-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/a540cbc88b6aa6de989fb8793df30f96f927ba3e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Paul-M-Stillwell-Jr/ice-remove-FW-logging-code/20230121-073744 git checkout a540cbc88b6aa6de989fb8793df30f96f927ba3e
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
drivers/net/ethernet/intel/ice/ice_debugfs.c: In function 'ice_debugfs_command_read':
>> drivers/net/ethernet/intel/ice/ice_debugfs.c:53:17: error: implicit declaration of function 'vfree'; did you mean 'kvfree'? [-Werror=implicit-function-declaration]
53 | vfree(log->data);
| ^~~~~
| kvfreecc1: some warnings being treated as errors
vim +53 drivers/net/ethernet/intel/ice/ice_debugfs.c
10
11 /**
12 * ice_debugfs_command_read - read from command datum
13 * @filp: the opened file
14 * @buffer: where to write the data for the user to read
15 * @count: the size of the user's buffer
16 * @ppos: file position offset
17 */
18 static ssize_t ice_debugfs_command_read(struct file *filp, char __user *buffer,
19 size_t count, loff_t *ppos)
20 {
21 struct ice_pf *pf = filp->private_data;
22 struct ice_fwlog_data *log, *tmp_log;
23 int data_copied = 0;
24 int copy_count = 0;
25
26 if (list_empty(&pf->fwlog_data_list)) {
27 return 0;
28 }
29
30 list_for_each_entry(log, &pf->fwlog_data_list, list) {
31 u16 cur_buf_len = log->data_size;
32 int retval;
33
34 if (cur_buf_len >= count)
35 break;
36
37 retval = copy_to_user(buffer, log->data, cur_buf_len);
38 if (retval)
39 return -EFAULT;
40
41 data_copied += cur_buf_len;
42 buffer += cur_buf_len;
43 count -= cur_buf_len;
44 *ppos += cur_buf_len;
45 copy_count++;
46 }
47
48 /* only free the data once we know there weren't any errors */
49 list_for_each_entry_safe(log, tmp_log, &pf->fwlog_data_list, list) {
50 if (!copy_count)
51 break;
52
> 53 vfree(log->data);
54 list_del(&log->list);
55 vfree(log);
56 pf->fwlog_list_count--;
57 copy_count--;
58 }
59
60 return data_copied;
61 }
62 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests