// SPDX-License-Identifier: GPL-2.0-only /* * NXP Wireless LAN device driver: debugfs * * Copyright 2011-2020 NXP */ #include <linux/debugfs.h> #include "main.h" #include "11n.h" static struct dentry *mwifiex_dfs_dir; static char *bss_modes[] = …; /* * Proc info file read handler. * * This function is called when the 'info' file is opened for reading. * It prints the following driver related information - * - Driver name * - Driver version * - Driver extended version * - Interface name * - BSS mode * - Media state (connected or disconnected) * - MAC address * - Total number of Tx bytes * - Total number of Rx bytes * - Total number of Tx packets * - Total number of Rx packets * - Total number of dropped Tx packets * - Total number of dropped Rx packets * - Total number of corrupted Tx packets * - Total number of corrupted Rx packets * - Carrier status (on or off) * - Tx queue status (started or stopped) * * For STA mode drivers, it also prints the following extra - * - ESSID * - BSSID * - Channel * - Region code * - Multicast count * - Multicast addresses */ static ssize_t mwifiex_info_read(struct file *file, char __user *ubuf, size_t count, loff_t *ppos) { … } /* * Proc getlog file read handler. * * This function is called when the 'getlog' file is opened for reading * It prints the following log information - * - Number of multicast Tx frames * - Number of failed packets * - Number of Tx retries * - Number of multicast Tx retries * - Number of duplicate frames * - Number of RTS successes * - Number of RTS failures * - Number of ACK failures * - Number of fragmented Rx frames * - Number of multicast Rx frames * - Number of FCS errors * - Number of Tx frames * - WEP ICV error counts * - Number of received beacons * - Number of missed beacons */ static ssize_t mwifiex_getlog_read(struct file *file, char __user *ubuf, size_t count, loff_t *ppos) { … } /* Sysfs histogram file read handler. * * This function is called when the 'histogram' file is opened for reading * It prints the following histogram information - * - Number of histogram samples * - Receive packet number of each rx_rate * - Receive packet number of each snr * - Receive packet number of each nosie_flr * - Receive packet number of each signal streath */ static ssize_t mwifiex_histogram_read(struct file *file, char __user *ubuf, size_t count, loff_t *ppos) { … } static ssize_t mwifiex_histogram_write(struct file *file, const char __user *ubuf, size_t count, loff_t *ppos) { … } static struct mwifiex_debug_info info; /* * Proc debug file read handler. * * This function is called when the 'debug' file is opened for reading * It prints the following log information - * - Interrupt count * - WMM AC VO packets count * - WMM AC VI packets count * - WMM AC BE packets count * - WMM AC BK packets count * - Maximum Tx buffer size * - Tx buffer size * - Current Tx buffer size * - Power Save mode * - Power Save state * - Deep Sleep status * - Device wakeup required status * - Number of wakeup tries * - Host Sleep configured status * - Host Sleep activated status * - Number of Tx timeouts * - Number of command timeouts * - Last timed out command ID * - Last timed out command action * - Last command ID * - Last command action * - Last command index * - Last command response ID * - Last command response index * - Last event * - Last event index * - Number of host to card command failures * - Number of sleep confirm command failures * - Number of host to card data failure * - Number of deauthentication events * - Number of disassociation events * - Number of link lost events * - Number of deauthentication commands * - Number of association success commands * - Number of association failure commands * - Number of commands sent * - Number of data packets sent * - Number of command responses received * - Number of events received * - Tx BA stream table (TID, RA) * - Rx reorder table (TID, TA, Start window, Window size, Buffer) */ static ssize_t mwifiex_debug_read(struct file *file, char __user *ubuf, size_t count, loff_t *ppos) { … } static u32 saved_reg_type, saved_reg_offset, saved_reg_value; /* * Proc regrdwr file write handler. * * This function is called when the 'regrdwr' file is opened for writing * * This function can be used to write to a register. */ static ssize_t mwifiex_regrdwr_write(struct file *file, const char __user *ubuf, size_t count, loff_t *ppos) { … } /* * Proc regrdwr file read handler. * * This function is called when the 'regrdwr' file is opened for reading * * This function can be used to read from a register. */ static ssize_t mwifiex_regrdwr_read(struct file *file, char __user *ubuf, size_t count, loff_t *ppos) { … } /* Proc debug_mask file read handler. * This function is called when the 'debug_mask' file is opened for reading * This function can be used read driver debugging mask value. */ static ssize_t mwifiex_debug_mask_read(struct file *file, char __user *ubuf, size_t count, loff_t *ppos) { … } /* Proc debug_mask file read handler. * This function is called when the 'debug_mask' file is opened for reading * This function can be used read driver debugging mask value. */ static ssize_t mwifiex_debug_mask_write(struct file *file, const char __user *ubuf, size_t count, loff_t *ppos) { … } /* debugfs verext file write handler. * This function is called when the 'verext' file is opened for write */ static ssize_t mwifiex_verext_write(struct file *file, const char __user *ubuf, size_t count, loff_t *ppos) { … } /* Proc verext file read handler. * This function is called when the 'verext' file is opened for reading * This function can be used read driver exteneed verion string. */ static ssize_t mwifiex_verext_read(struct file *file, char __user *ubuf, size_t count, loff_t *ppos) { … } /* Proc memrw file write handler. * This function is called when the 'memrw' file is opened for writing * This function can be used to write to a memory location. */ static ssize_t mwifiex_memrw_write(struct file *file, const char __user *ubuf, size_t count, loff_t *ppos) { … } /* Proc memrw file read handler. * This function is called when the 'memrw' file is opened for reading * This function can be used to read from a memory location. */ static ssize_t mwifiex_memrw_read(struct file *file, char __user *ubuf, size_t count, loff_t *ppos) { … } static u32 saved_offset = …, saved_bytes = …; /* * Proc rdeeprom file write handler. * * This function is called when the 'rdeeprom' file is opened for writing * * This function can be used to write to a RDEEPROM location. */ static ssize_t mwifiex_rdeeprom_write(struct file *file, const char __user *ubuf, size_t count, loff_t *ppos) { … } /* * Proc rdeeprom read write handler. * * This function is called when the 'rdeeprom' file is opened for reading * * This function can be used to read from a RDEEPROM location. */ static ssize_t mwifiex_rdeeprom_read(struct file *file, char __user *ubuf, size_t count, loff_t *ppos) { … } /* Proc hscfg file write handler * This function can be used to configure the host sleep parameters. */ static ssize_t mwifiex_hscfg_write(struct file *file, const char __user *ubuf, size_t count, loff_t *ppos) { … } /* Proc hscfg file read handler * This function can be used to read host sleep configuration * parameters from driver. */ static ssize_t mwifiex_hscfg_read(struct file *file, char __user *ubuf, size_t count, loff_t *ppos) { … } static ssize_t mwifiex_timeshare_coex_read(struct file *file, char __user *ubuf, size_t count, loff_t *ppos) { … } static ssize_t mwifiex_timeshare_coex_write(struct file *file, const char __user *ubuf, size_t count, loff_t *ppos) { … } static ssize_t mwifiex_reset_write(struct file *file, const char __user *ubuf, size_t count, loff_t *ppos) { … } #define MWIFIEX_DFS_ADD_FILE(name) … #define MWIFIEX_DFS_FILE_OPS(name) … #define MWIFIEX_DFS_FILE_READ_OPS(name) … #define MWIFIEX_DFS_FILE_WRITE_OPS(name) … MWIFIEX_DFS_FILE_READ_OPS(info); MWIFIEX_DFS_FILE_READ_OPS(debug); MWIFIEX_DFS_FILE_READ_OPS(getlog); MWIFIEX_DFS_FILE_OPS(regrdwr); MWIFIEX_DFS_FILE_OPS(rdeeprom); MWIFIEX_DFS_FILE_OPS(memrw); MWIFIEX_DFS_FILE_OPS(hscfg); MWIFIEX_DFS_FILE_OPS(histogram); MWIFIEX_DFS_FILE_OPS(debug_mask); MWIFIEX_DFS_FILE_OPS(timeshare_coex); MWIFIEX_DFS_FILE_WRITE_OPS(reset); MWIFIEX_DFS_FILE_OPS(verext); /* * This function creates the debug FS directory structure and the files. */ void mwifiex_dev_debugfs_init(struct mwifiex_private *priv) { … } /* * This function removes the debug FS directory structure and the files. */ void mwifiex_dev_debugfs_remove(struct mwifiex_private *priv) { … } /* * This function creates the top level proc directory. */ void mwifiex_debugfs_init(void) { … } /* * This function removes the top level proc directory. */ void mwifiex_debugfs_remove(void) { … }