> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-boun...@osuosl.org> On Behalf Of Paul 
> M Stillwell Jr
> Sent: Wednesday, November 29, 2023 4:57 AM
> To: intel-wired-...@lists.osuosl.org
> Cc: Stillwell Jr, Paul M <paul.m.stillwell...@intel.com>
> Subject: [Intel-wired-lan] [PATCH net-next v18 2/5] 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 suports logging has 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 <paul.m.stillwell...@intel.com>
> ---
> v17->v18: none
> v16->v17: updates based on community feedback
> - create a file per FW log module under 'fwlog/modules/' instead of having
>   a single file for all the modules. This simplifies the code for writing
>   the log level because we don't have to parse the module name
> - rename 'resolution' to 'nr_messages' to better reflect what it
>   represents
> - add a structure to track all the file dentries for the FW modules
> - moved ice_fwlog_deinit() from a subsequent patch to this patch because
>   the driver has to free the dentry tracking memory
> - removed the code that printed the entire FW log configuration; only
>   print the module info or the number of messages
> - fixed an issue where we were using the wrong length when copying data
>   from the user for parsing the command line
> - release memory sooner in ice_debugfs_parse_cmd_line() so it always
>  gets released
> v15->v16:
> - moved ice_debugfs_exit() to fix unreachable code issue
> - removed CONFIG_DEBUG_FS defines because they aren't needed
> v14->v15: changed PAGE_SIZE to ICE_AQ_MAX_BUF_LEN
> v13->v14: none
> v12->v13: pulled out 'enable' code and put into a separate patch
> v11->v12:
> - rewrote debugfs code to use separate file for reading/writing
>   the configuration status (fwlog/modules)
> - added a file for configuring the resolution (fwlog/resolution)
> v10->v11: none
> no data on previous versions
> ---
>  drivers/net/ethernet/intel/ice/Makefile       |   4 +-
>  drivers/net/ethernet/intel/ice/ice.h          |   9 +
>  .../net/ethernet/intel/ice/ice_adminq_cmd.h   |  80 +++
>  drivers/net/ethernet/intel/ice/ice_common.c   |   5 +
>  drivers/net/ethernet/intel/ice/ice_debugfs.c  | 482 ++++++++++++++++++
>  drivers/net/ethernet/intel/ice/ice_fwlog.c    | 259 ++++++++++
>  drivers/net/ethernet/intel/ice/ice_fwlog.h    |  56 ++
>  drivers/net/ethernet/intel/ice/ice_main.c     |  21 +
>  drivers/net/ethernet/intel/ice/ice_type.h     |   4 +
>  9 files changed, 919 insertions(+), 1 deletion(-)
>  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
>

Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pu...@intel.com> (A 
Contingent worker at Intel)

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Reply via email to