2 * NXP Wireless LAN device driver: debugfs
4 * Copyright 2011-2020 NXP
6 * This software file (the "File") is distributed by NXP
7 * under the terms of the GNU General Public License Version 2, June 1991
8 * (the "License"). You may use, redistribute and/or modify this File in
9 * accordance with the terms and conditions of the License, a copy of which
10 * is available by writing to the Free Software Foundation, Inc.,
11 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
12 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
14 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
16 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
17 * this warranty disclaimer.
20 #include <linux/debugfs.h>
26 static struct dentry
*mwifiex_dfs_dir
;
28 static char *bss_modes
[] = {
43 * Proc info file read handler.
45 * This function is called when the 'info' file is opened for reading.
46 * It prints the following driver related information -
49 * - Driver extended version
52 * - Media state (connected or disconnected)
54 * - Total number of Tx bytes
55 * - Total number of Rx bytes
56 * - Total number of Tx packets
57 * - Total number of Rx packets
58 * - Total number of dropped Tx packets
59 * - Total number of dropped Rx packets
60 * - Total number of corrupted Tx packets
61 * - Total number of corrupted Rx packets
62 * - Carrier status (on or off)
63 * - Tx queue status (started or stopped)
65 * For STA mode drivers, it also prints the following extra -
71 * - Multicast addresses
74 mwifiex_info_read(struct file
*file
, char __user
*ubuf
,
75 size_t count
, loff_t
*ppos
)
77 struct mwifiex_private
*priv
=
78 (struct mwifiex_private
*) file
->private_data
;
79 struct net_device
*netdev
= priv
->netdev
;
80 struct netdev_hw_addr
*ha
;
81 struct netdev_queue
*txq
;
82 unsigned long page
= get_zeroed_page(GFP_KERNEL
);
83 char *p
= (char *) page
, fmt
[64];
84 struct mwifiex_bss_info info
;
91 memset(&info
, 0, sizeof(info
));
92 ret
= mwifiex_get_bss_info(priv
, &info
);
96 mwifiex_drv_get_driver_version(priv
->adapter
, fmt
, sizeof(fmt
) - 1);
98 mwifiex_get_ver_ext(priv
, 0);
100 p
+= sprintf(p
, "driver_name = " "\"mwifiex\"\n");
101 p
+= sprintf(p
, "driver_version = %s", fmt
);
102 p
+= sprintf(p
, "\nverext = %s", priv
->version_str
);
103 p
+= sprintf(p
, "\ninterface_name=\"%s\"\n", netdev
->name
);
105 if (info
.bss_mode
>= ARRAY_SIZE(bss_modes
))
106 p
+= sprintf(p
, "bss_mode=\"%d\"\n", info
.bss_mode
);
108 p
+= sprintf(p
, "bss_mode=\"%s\"\n", bss_modes
[info
.bss_mode
]);
110 p
+= sprintf(p
, "media_state=\"%s\"\n",
111 (!priv
->media_connected
? "Disconnected" : "Connected"));
112 p
+= sprintf(p
, "mac_address=\"%pM\"\n", netdev
->dev_addr
);
114 if (GET_BSS_ROLE(priv
) == MWIFIEX_BSS_ROLE_STA
) {
115 p
+= sprintf(p
, "multicast_count=\"%d\"\n",
116 netdev_mc_count(netdev
));
117 p
+= sprintf(p
, "essid=\"%.*s\"\n", info
.ssid
.ssid_len
,
119 p
+= sprintf(p
, "bssid=\"%pM\"\n", info
.bssid
);
120 p
+= sprintf(p
, "channel=\"%d\"\n", (int) info
.bss_chan
);
121 p
+= sprintf(p
, "country_code = \"%s\"\n", info
.country_code
);
122 p
+= sprintf(p
, "region_code=\"0x%x\"\n",
123 priv
->adapter
->region_code
);
125 netdev_for_each_mc_addr(ha
, netdev
)
126 p
+= sprintf(p
, "multicast_address[%d]=\"%pM\"\n",
130 p
+= sprintf(p
, "num_tx_bytes = %lu\n", priv
->stats
.tx_bytes
);
131 p
+= sprintf(p
, "num_rx_bytes = %lu\n", priv
->stats
.rx_bytes
);
132 p
+= sprintf(p
, "num_tx_pkts = %lu\n", priv
->stats
.tx_packets
);
133 p
+= sprintf(p
, "num_rx_pkts = %lu\n", priv
->stats
.rx_packets
);
134 p
+= sprintf(p
, "num_tx_pkts_dropped = %lu\n", priv
->stats
.tx_dropped
);
135 p
+= sprintf(p
, "num_rx_pkts_dropped = %lu\n", priv
->stats
.rx_dropped
);
136 p
+= sprintf(p
, "num_tx_pkts_err = %lu\n", priv
->stats
.tx_errors
);
137 p
+= sprintf(p
, "num_rx_pkts_err = %lu\n", priv
->stats
.rx_errors
);
138 p
+= sprintf(p
, "carrier %s\n", ((netif_carrier_ok(priv
->netdev
))
140 p
+= sprintf(p
, "tx queue");
141 for (i
= 0; i
< netdev
->num_tx_queues
; i
++) {
142 txq
= netdev_get_tx_queue(netdev
, i
);
143 p
+= sprintf(p
, " %d:%s", i
, netif_tx_queue_stopped(txq
) ?
144 "stopped" : "started");
146 p
+= sprintf(p
, "\n");
148 ret
= simple_read_from_buffer(ubuf
, count
, ppos
, (char *) page
,
149 (unsigned long) p
- page
);
157 * Proc getlog file read handler.
159 * This function is called when the 'getlog' file is opened for reading
160 * It prints the following log information -
161 * - Number of multicast Tx frames
162 * - Number of failed packets
163 * - Number of Tx retries
164 * - Number of multicast Tx retries
165 * - Number of duplicate frames
166 * - Number of RTS successes
167 * - Number of RTS failures
168 * - Number of ACK failures
169 * - Number of fragmented Rx frames
170 * - Number of multicast Rx frames
171 * - Number of FCS errors
172 * - Number of Tx frames
173 * - WEP ICV error counts
174 * - Number of received beacons
175 * - Number of missed beacons
178 mwifiex_getlog_read(struct file
*file
, char __user
*ubuf
,
179 size_t count
, loff_t
*ppos
)
181 struct mwifiex_private
*priv
=
182 (struct mwifiex_private
*) file
->private_data
;
183 unsigned long page
= get_zeroed_page(GFP_KERNEL
);
184 char *p
= (char *) page
;
186 struct mwifiex_ds_get_stats stats
;
191 memset(&stats
, 0, sizeof(stats
));
192 ret
= mwifiex_get_stats_info(priv
, &stats
);
209 "wepicverrcnt-1 %u\n"
210 "wepicverrcnt-2 %u\n"
211 "wepicverrcnt-3 %u\n"
212 "wepicverrcnt-4 %u\n"
215 stats
.mcast_tx_frame
,
224 stats
.mcast_rx_frame
,
227 stats
.wep_icv_error
[0],
228 stats
.wep_icv_error
[1],
229 stats
.wep_icv_error
[2],
230 stats
.wep_icv_error
[3],
235 ret
= simple_read_from_buffer(ubuf
, count
, ppos
, (char *) page
,
236 (unsigned long) p
- page
);
243 /* Sysfs histogram file read handler.
245 * This function is called when the 'histogram' file is opened for reading
246 * It prints the following histogram information -
247 * - Number of histogram samples
248 * - Receive packet number of each rx_rate
249 * - Receive packet number of each snr
250 * - Receive packet number of each nosie_flr
251 * - Receive packet number of each signal streath
254 mwifiex_histogram_read(struct file
*file
, char __user
*ubuf
,
255 size_t count
, loff_t
*ppos
)
257 struct mwifiex_private
*priv
=
258 (struct mwifiex_private
*)file
->private_data
;
260 struct mwifiex_histogram_data
*phist_data
;
262 unsigned long page
= get_zeroed_page(GFP_KERNEL
);
263 char *p
= (char *)page
;
268 if (!priv
|| !priv
->hist_data
)
270 phist_data
= priv
->hist_data
;
273 "total samples = %d\n",
274 atomic_read(&phist_data
->num_samples
));
277 "rx rates (in Mbps): 0=1M 1=2M 2=5.5M 3=11M 4=6M 5=9M 6=12M\n"
278 "7=18M 8=24M 9=36M 10=48M 11=54M 12-27=MCS0-15(BW20) 28-43=MCS0-15(BW40)\n");
280 if (ISSUPP_11ACENABLED(priv
->adapter
->fw_cap_info
)) {
282 "44-53=MCS0-9(VHT:BW20) 54-63=MCS0-9(VHT:BW40) 64-73=MCS0-9(VHT:BW80)\n\n");
284 p
+= sprintf(p
, "\n");
287 for (i
= 0; i
< MWIFIEX_MAX_RX_RATES
; i
++) {
288 value
= atomic_read(&phist_data
->rx_rate
[i
]);
290 p
+= sprintf(p
, "rx_rate[%02d] = %d\n", i
, value
);
293 if (ISSUPP_11ACENABLED(priv
->adapter
->fw_cap_info
)) {
294 for (i
= MWIFIEX_MAX_RX_RATES
; i
< MWIFIEX_MAX_AC_RX_RATES
;
296 value
= atomic_read(&phist_data
->rx_rate
[i
]);
298 p
+= sprintf(p
, "rx_rate[%02d] = %d\n",
303 for (i
= 0; i
< MWIFIEX_MAX_SNR
; i
++) {
304 value
= atomic_read(&phist_data
->snr
[i
]);
306 p
+= sprintf(p
, "snr[%02ddB] = %d\n", i
, value
);
308 for (i
= 0; i
< MWIFIEX_MAX_NOISE_FLR
; i
++) {
309 value
= atomic_read(&phist_data
->noise_flr
[i
]);
311 p
+= sprintf(p
, "noise_flr[%02ddBm] = %d\n",
312 (int)(i
-128), value
);
314 for (i
= 0; i
< MWIFIEX_MAX_SIG_STRENGTH
; i
++) {
315 value
= atomic_read(&phist_data
->sig_str
[i
]);
317 p
+= sprintf(p
, "sig_strength[-%02ddBm] = %d\n",
321 ret
= simple_read_from_buffer(ubuf
, count
, ppos
, (char *)page
,
322 (unsigned long)p
- page
);
328 mwifiex_histogram_write(struct file
*file
, const char __user
*ubuf
,
329 size_t count
, loff_t
*ppos
)
331 struct mwifiex_private
*priv
= (void *)file
->private_data
;
333 if (priv
&& priv
->hist_data
)
334 mwifiex_hist_data_reset(priv
);
338 static struct mwifiex_debug_info info
;
341 * Proc debug file read handler.
343 * This function is called when the 'debug' file is opened for reading
344 * It prints the following log information -
346 * - WMM AC VO packets count
347 * - WMM AC VI packets count
348 * - WMM AC BE packets count
349 * - WMM AC BK packets count
350 * - Maximum Tx buffer size
352 * - Current Tx buffer size
355 * - Deep Sleep status
356 * - Device wakeup required status
357 * - Number of wakeup tries
358 * - Host Sleep configured status
359 * - Host Sleep activated status
360 * - Number of Tx timeouts
361 * - Number of command timeouts
362 * - Last timed out command ID
363 * - Last timed out command action
365 * - Last command action
366 * - Last command index
367 * - Last command response ID
368 * - Last command response index
371 * - Number of host to card command failures
372 * - Number of sleep confirm command failures
373 * - Number of host to card data failure
374 * - Number of deauthentication events
375 * - Number of disassociation events
376 * - Number of link lost events
377 * - Number of deauthentication commands
378 * - Number of association success commands
379 * - Number of association failure commands
380 * - Number of commands sent
381 * - Number of data packets sent
382 * - Number of command responses received
383 * - Number of events received
384 * - Tx BA stream table (TID, RA)
385 * - Rx reorder table (TID, TA, Start window, Window size, Buffer)
388 mwifiex_debug_read(struct file
*file
, char __user
*ubuf
,
389 size_t count
, loff_t
*ppos
)
391 struct mwifiex_private
*priv
=
392 (struct mwifiex_private
*) file
->private_data
;
393 unsigned long page
= get_zeroed_page(GFP_KERNEL
);
394 char *p
= (char *) page
;
400 ret
= mwifiex_get_debug_info(priv
, &info
);
404 p
+= mwifiex_debug_info_to_buffer(priv
, p
, &info
);
406 ret
= simple_read_from_buffer(ubuf
, count
, ppos
, (char *) page
,
407 (unsigned long) p
- page
);
414 static u32 saved_reg_type
, saved_reg_offset
, saved_reg_value
;
417 * Proc regrdwr file write handler.
419 * This function is called when the 'regrdwr' file is opened for writing
421 * This function can be used to write to a register.
424 mwifiex_regrdwr_write(struct file
*file
,
425 const char __user
*ubuf
, size_t count
, loff_t
*ppos
)
429 u32 reg_type
= 0, reg_offset
= 0, reg_value
= UINT_MAX
;
431 buf
= memdup_user_nul(ubuf
, min(count
, (size_t)(PAGE_SIZE
- 1)));
435 sscanf(buf
, "%u %x %x", ®_type
, ®_offset
, ®_value
);
437 if (reg_type
== 0 || reg_offset
== 0) {
441 saved_reg_type
= reg_type
;
442 saved_reg_offset
= reg_offset
;
443 saved_reg_value
= reg_value
;
452 * Proc regrdwr file read handler.
454 * This function is called when the 'regrdwr' file is opened for reading
456 * This function can be used to read from a register.
459 mwifiex_regrdwr_read(struct file
*file
, char __user
*ubuf
,
460 size_t count
, loff_t
*ppos
)
462 struct mwifiex_private
*priv
=
463 (struct mwifiex_private
*) file
->private_data
;
464 unsigned long addr
= get_zeroed_page(GFP_KERNEL
);
465 char *buf
= (char *) addr
;
466 int pos
= 0, ret
= 0;
472 if (!saved_reg_type
) {
473 /* No command has been given */
474 pos
+= snprintf(buf
, PAGE_SIZE
, "0");
477 /* Set command has been given */
478 if (saved_reg_value
!= UINT_MAX
) {
479 ret
= mwifiex_reg_write(priv
, saved_reg_type
, saved_reg_offset
,
482 pos
+= snprintf(buf
, PAGE_SIZE
, "%u 0x%x 0x%x\n",
483 saved_reg_type
, saved_reg_offset
,
486 ret
= simple_read_from_buffer(ubuf
, count
, ppos
, buf
, pos
);
490 /* Get command has been given */
491 ret
= mwifiex_reg_read(priv
, saved_reg_type
,
492 saved_reg_offset
, ®_value
);
498 pos
+= snprintf(buf
, PAGE_SIZE
, "%u 0x%x 0x%x\n", saved_reg_type
,
499 saved_reg_offset
, reg_value
);
501 ret
= simple_read_from_buffer(ubuf
, count
, ppos
, buf
, pos
);
508 /* Proc debug_mask file read handler.
509 * This function is called when the 'debug_mask' file is opened for reading
510 * This function can be used read driver debugging mask value.
513 mwifiex_debug_mask_read(struct file
*file
, char __user
*ubuf
,
514 size_t count
, loff_t
*ppos
)
516 struct mwifiex_private
*priv
=
517 (struct mwifiex_private
*)file
->private_data
;
518 unsigned long page
= get_zeroed_page(GFP_KERNEL
);
519 char *buf
= (char *)page
;
526 pos
+= snprintf(buf
, PAGE_SIZE
, "debug mask=0x%08x\n",
527 priv
->adapter
->debug_mask
);
528 ret
= simple_read_from_buffer(ubuf
, count
, ppos
, buf
, pos
);
534 /* Proc debug_mask file read handler.
535 * This function is called when the 'debug_mask' file is opened for reading
536 * This function can be used read driver debugging mask value.
539 mwifiex_debug_mask_write(struct file
*file
, const char __user
*ubuf
,
540 size_t count
, loff_t
*ppos
)
543 unsigned long debug_mask
;
544 struct mwifiex_private
*priv
= (void *)file
->private_data
;
547 buf
= memdup_user_nul(ubuf
, min(count
, (size_t)(PAGE_SIZE
- 1)));
551 if (kstrtoul(buf
, 0, &debug_mask
)) {
556 priv
->adapter
->debug_mask
= debug_mask
;
563 /* debugfs verext file write handler.
564 * This function is called when the 'verext' file is opened for write
567 mwifiex_verext_write(struct file
*file
, const char __user
*ubuf
,
568 size_t count
, loff_t
*ppos
)
572 struct mwifiex_private
*priv
= (void *)file
->private_data
;
575 memset(buf
, 0, sizeof(buf
));
577 if (copy_from_user(&buf
, ubuf
, min_t(size_t, sizeof(buf
) - 1, count
)))
580 ret
= kstrtou32(buf
, 10, &versionstrsel
);
584 priv
->versionstrsel
= versionstrsel
;
589 /* Proc verext file read handler.
590 * This function is called when the 'verext' file is opened for reading
591 * This function can be used read driver exteneed verion string.
594 mwifiex_verext_read(struct file
*file
, char __user
*ubuf
,
595 size_t count
, loff_t
*ppos
)
597 struct mwifiex_private
*priv
=
598 (struct mwifiex_private
*)file
->private_data
;
602 mwifiex_get_ver_ext(priv
, priv
->versionstrsel
);
603 ret
= snprintf(buf
, sizeof(buf
), "version string: %s\n",
606 return simple_read_from_buffer(ubuf
, count
, ppos
, buf
, ret
);
609 /* Proc memrw file write handler.
610 * This function is called when the 'memrw' file is opened for writing
611 * This function can be used to write to a memory location.
614 mwifiex_memrw_write(struct file
*file
, const char __user
*ubuf
, size_t count
,
619 struct mwifiex_ds_mem_rw mem_rw
;
621 struct mwifiex_private
*priv
= (void *)file
->private_data
;
624 buf
= memdup_user_nul(ubuf
, min(count
, (size_t)(PAGE_SIZE
- 1)));
628 ret
= sscanf(buf
, "%c %x %x", &cmd
, &mem_rw
.addr
, &mem_rw
.value
);
634 if ((cmd
== 'r') || (cmd
== 'R')) {
635 cmd_action
= HostCmd_ACT_GEN_GET
;
637 } else if ((cmd
== 'w') || (cmd
== 'W')) {
638 cmd_action
= HostCmd_ACT_GEN_SET
;
644 memcpy(&priv
->mem_rw
, &mem_rw
, sizeof(mem_rw
));
645 if (mwifiex_send_cmd(priv
, HostCmd_CMD_MEM_ACCESS
, cmd_action
, 0,
656 /* Proc memrw file read handler.
657 * This function is called when the 'memrw' file is opened for reading
658 * This function can be used to read from a memory location.
661 mwifiex_memrw_read(struct file
*file
, char __user
*ubuf
,
662 size_t count
, loff_t
*ppos
)
664 struct mwifiex_private
*priv
= (void *)file
->private_data
;
665 unsigned long addr
= get_zeroed_page(GFP_KERNEL
);
666 char *buf
= (char *)addr
;
672 pos
+= snprintf(buf
, PAGE_SIZE
, "0x%x 0x%x\n", priv
->mem_rw
.addr
,
674 ret
= simple_read_from_buffer(ubuf
, count
, ppos
, buf
, pos
);
680 static u32 saved_offset
= -1, saved_bytes
= -1;
683 * Proc rdeeprom file write handler.
685 * This function is called when the 'rdeeprom' file is opened for writing
687 * This function can be used to write to a RDEEPROM location.
690 mwifiex_rdeeprom_write(struct file
*file
,
691 const char __user
*ubuf
, size_t count
, loff_t
*ppos
)
695 int offset
= -1, bytes
= -1;
697 buf
= memdup_user_nul(ubuf
, min(count
, (size_t)(PAGE_SIZE
- 1)));
701 sscanf(buf
, "%d %d", &offset
, &bytes
);
703 if (offset
== -1 || bytes
== -1) {
707 saved_offset
= offset
;
717 * Proc rdeeprom read write handler.
719 * This function is called when the 'rdeeprom' file is opened for reading
721 * This function can be used to read from a RDEEPROM location.
724 mwifiex_rdeeprom_read(struct file
*file
, char __user
*ubuf
,
725 size_t count
, loff_t
*ppos
)
727 struct mwifiex_private
*priv
=
728 (struct mwifiex_private
*) file
->private_data
;
729 unsigned long addr
= get_zeroed_page(GFP_KERNEL
);
730 char *buf
= (char *) addr
;
732 u8 value
[MAX_EEPROM_DATA
];
737 if (saved_offset
== -1) {
738 /* No command has been given */
739 pos
= snprintf(buf
, PAGE_SIZE
, "0");
743 /* Get command has been given */
744 ret
= mwifiex_eeprom_read(priv
, (u16
) saved_offset
,
745 (u16
) saved_bytes
, value
);
751 pos
= snprintf(buf
, PAGE_SIZE
, "%d %d ", saved_offset
, saved_bytes
);
753 for (i
= 0; i
< saved_bytes
; i
++)
754 pos
+= scnprintf(buf
+ pos
, PAGE_SIZE
- pos
, "%d ", value
[i
]);
757 ret
= simple_read_from_buffer(ubuf
, count
, ppos
, buf
, pos
);
763 /* Proc hscfg file write handler
764 * This function can be used to configure the host sleep parameters.
767 mwifiex_hscfg_write(struct file
*file
, const char __user
*ubuf
,
768 size_t count
, loff_t
*ppos
)
770 struct mwifiex_private
*priv
= (void *)file
->private_data
;
773 struct mwifiex_ds_hs_cfg hscfg
;
774 int conditions
= HS_CFG_COND_DEF
;
775 u32 gpio
= HS_CFG_GPIO_DEF
, gap
= HS_CFG_GAP_DEF
;
777 buf
= memdup_user_nul(ubuf
, min(count
, (size_t)(PAGE_SIZE
- 1)));
781 arg_num
= sscanf(buf
, "%d %x %x", &conditions
, &gpio
, &gap
);
783 memset(&hscfg
, 0, sizeof(struct mwifiex_ds_hs_cfg
));
786 mwifiex_dbg(priv
->adapter
, ERROR
,
787 "Too many arguments\n");
792 if (arg_num
>= 1 && arg_num
< 3)
793 mwifiex_set_hs_params(priv
, HostCmd_ACT_GEN_GET
,
794 MWIFIEX_SYNC_CMD
, &hscfg
);
797 if (conditions
== HS_CFG_CANCEL
) {
798 mwifiex_cancel_hs(priv
, MWIFIEX_ASYNC_CMD
);
802 hscfg
.conditions
= conditions
;
809 hscfg
.is_invoke_hostcmd
= false;
810 mwifiex_set_hs_params(priv
, HostCmd_ACT_GEN_SET
,
811 MWIFIEX_SYNC_CMD
, &hscfg
);
813 mwifiex_enable_hs(priv
->adapter
);
814 clear_bit(MWIFIEX_IS_HS_ENABLING
, &priv
->adapter
->work_flags
);
821 /* Proc hscfg file read handler
822 * This function can be used to read host sleep configuration
823 * parameters from driver.
826 mwifiex_hscfg_read(struct file
*file
, char __user
*ubuf
,
827 size_t count
, loff_t
*ppos
)
829 struct mwifiex_private
*priv
= (void *)file
->private_data
;
830 unsigned long addr
= get_zeroed_page(GFP_KERNEL
);
831 char *buf
= (char *)addr
;
833 struct mwifiex_ds_hs_cfg hscfg
;
838 mwifiex_set_hs_params(priv
, HostCmd_ACT_GEN_GET
,
839 MWIFIEX_SYNC_CMD
, &hscfg
);
841 pos
= snprintf(buf
, PAGE_SIZE
, "%u 0x%x 0x%x\n", hscfg
.conditions
,
842 hscfg
.gpio
, hscfg
.gap
);
844 ret
= simple_read_from_buffer(ubuf
, count
, ppos
, buf
, pos
);
851 mwifiex_timeshare_coex_read(struct file
*file
, char __user
*ubuf
,
852 size_t count
, loff_t
*ppos
)
854 struct mwifiex_private
*priv
= file
->private_data
;
860 if (priv
->adapter
->fw_api_ver
!= MWIFIEX_FW_V15
)
863 ret
= mwifiex_send_cmd(priv
, HostCmd_CMD_ROBUST_COEX
,
864 HostCmd_ACT_GEN_GET
, 0, ×hare_coex
, true);
868 len
= sprintf(buf
, "%d\n", timeshare_coex
);
869 return simple_read_from_buffer(ubuf
, count
, ppos
, buf
, len
);
873 mwifiex_timeshare_coex_write(struct file
*file
, const char __user
*ubuf
,
874 size_t count
, loff_t
*ppos
)
877 struct mwifiex_private
*priv
= file
->private_data
;
881 if (priv
->adapter
->fw_api_ver
!= MWIFIEX_FW_V15
)
884 memset(kbuf
, 0, sizeof(kbuf
));
886 if (copy_from_user(&kbuf
, ubuf
, min_t(size_t, sizeof(kbuf
) - 1, count
)))
889 if (strtobool(kbuf
, ×hare_coex
))
892 ret
= mwifiex_send_cmd(priv
, HostCmd_CMD_ROBUST_COEX
,
893 HostCmd_ACT_GEN_SET
, 0, ×hare_coex
, true);
901 mwifiex_reset_write(struct file
*file
,
902 const char __user
*ubuf
, size_t count
, loff_t
*ppos
)
904 struct mwifiex_private
*priv
= file
->private_data
;
905 struct mwifiex_adapter
*adapter
= priv
->adapter
;
909 rc
= kstrtobool_from_user(ubuf
, count
, &result
);
916 if (adapter
->if_ops
.card_reset
) {
917 dev_info(adapter
->dev
, "Resetting per request\n");
918 adapter
->if_ops
.card_reset(adapter
);
924 #define MWIFIEX_DFS_ADD_FILE(name) do { \
925 debugfs_create_file(#name, 0644, priv->dfs_dev_dir, priv, \
926 &mwifiex_dfs_##name##_fops); \
929 #define MWIFIEX_DFS_FILE_OPS(name) \
930 static const struct file_operations mwifiex_dfs_##name##_fops = { \
931 .read = mwifiex_##name##_read, \
932 .write = mwifiex_##name##_write, \
933 .open = simple_open, \
936 #define MWIFIEX_DFS_FILE_READ_OPS(name) \
937 static const struct file_operations mwifiex_dfs_##name##_fops = { \
938 .read = mwifiex_##name##_read, \
939 .open = simple_open, \
942 #define MWIFIEX_DFS_FILE_WRITE_OPS(name) \
943 static const struct file_operations mwifiex_dfs_##name##_fops = { \
944 .write = mwifiex_##name##_write, \
945 .open = simple_open, \
949 MWIFIEX_DFS_FILE_READ_OPS(info
);
950 MWIFIEX_DFS_FILE_READ_OPS(debug
);
951 MWIFIEX_DFS_FILE_READ_OPS(getlog
);
952 MWIFIEX_DFS_FILE_OPS(regrdwr
);
953 MWIFIEX_DFS_FILE_OPS(rdeeprom
);
954 MWIFIEX_DFS_FILE_OPS(memrw
);
955 MWIFIEX_DFS_FILE_OPS(hscfg
);
956 MWIFIEX_DFS_FILE_OPS(histogram
);
957 MWIFIEX_DFS_FILE_OPS(debug_mask
);
958 MWIFIEX_DFS_FILE_OPS(timeshare_coex
);
959 MWIFIEX_DFS_FILE_WRITE_OPS(reset
);
960 MWIFIEX_DFS_FILE_OPS(verext
);
963 * This function creates the debug FS directory structure and the files.
966 mwifiex_dev_debugfs_init(struct mwifiex_private
*priv
)
968 if (!mwifiex_dfs_dir
|| !priv
)
971 priv
->dfs_dev_dir
= debugfs_create_dir(priv
->netdev
->name
,
974 if (!priv
->dfs_dev_dir
)
977 MWIFIEX_DFS_ADD_FILE(info
);
978 MWIFIEX_DFS_ADD_FILE(debug
);
979 MWIFIEX_DFS_ADD_FILE(getlog
);
980 MWIFIEX_DFS_ADD_FILE(regrdwr
);
981 MWIFIEX_DFS_ADD_FILE(rdeeprom
);
983 MWIFIEX_DFS_ADD_FILE(memrw
);
984 MWIFIEX_DFS_ADD_FILE(hscfg
);
985 MWIFIEX_DFS_ADD_FILE(histogram
);
986 MWIFIEX_DFS_ADD_FILE(debug_mask
);
987 MWIFIEX_DFS_ADD_FILE(timeshare_coex
);
988 MWIFIEX_DFS_ADD_FILE(reset
);
989 MWIFIEX_DFS_ADD_FILE(verext
);
993 * This function removes the debug FS directory structure and the files.
996 mwifiex_dev_debugfs_remove(struct mwifiex_private
*priv
)
1001 debugfs_remove_recursive(priv
->dfs_dev_dir
);
1005 * This function creates the top level proc directory.
1008 mwifiex_debugfs_init(void)
1010 if (!mwifiex_dfs_dir
)
1011 mwifiex_dfs_dir
= debugfs_create_dir("mwifiex", NULL
);
1015 * This function removes the top level proc directory.
1018 mwifiex_debugfs_remove(void)
1020 debugfs_remove(mwifiex_dfs_dir
);