Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
nu11secur1ty
GitHub Repository: nu11secur1ty/Kali-Linux
Path: blob/master/ALFA-W1F1/RTL8814AU/core/rtw_debug.c
1307 views
1
/******************************************************************************
2
*
3
* Copyright(c) 2007 - 2019 Realtek Corporation.
4
*
5
* This program is free software; you can redistribute it and/or modify it
6
* under the terms of version 2 of the GNU General Public License as
7
* published by the Free Software Foundation.
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*
14
*****************************************************************************/
15
#define _RTW_DEBUG_C_
16
17
#include <drv_types.h>
18
#include <hal_data.h>
19
20
#ifdef CONFIG_RTW_DEBUG
21
const char *rtw_log_level_str[] = {
22
"_DRV_NONE_ = 0",
23
"_DRV_ALWAYS_ = 1",
24
"_DRV_ERR_ = 2",
25
"_DRV_WARNING_ = 3",
26
"_DRV_INFO_ = 4",
27
"_DRV_DEBUG_ = 5",
28
"_DRV_MAX_ = 6",
29
};
30
#endif
31
32
#ifdef CONFIG_DEBUG_RTL871X
33
u64 GlobalDebugComponents = 0;
34
#endif /* CONFIG_DEBUG_RTL871X */
35
36
#include <rtw_version.h>
37
38
#ifdef CONFIG_TDLS
39
#define TDLS_DBG_INFO_SPACE_BTWN_ITEM_AND_VALUE 41
40
#endif
41
42
void dump_drv_version(void *sel)
43
{
44
RTW_PRINT_SEL(sel, "%s %s\n", DRV_NAME, DRIVERVERSION);
45
//RTW_PRINT_SEL(sel, "build time: %s %s\n", __DATE__, __TIME__);
46
}
47
48
void dump_drv_cfg(void *sel)
49
{
50
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24))
51
char *kernel_version = utsname()->release;
52
53
RTW_PRINT_SEL(sel, "\nKernel Version: %s\n", kernel_version);
54
#endif
55
56
RTW_PRINT_SEL(sel, "Driver Version: %s\n", DRIVERVERSION);
57
RTW_PRINT_SEL(sel, "------------------------------------------------\n");
58
#ifdef CONFIG_IOCTL_CFG80211
59
RTW_PRINT_SEL(sel, "CFG80211\n");
60
#ifdef RTW_USE_CFG80211_STA_EVENT
61
RTW_PRINT_SEL(sel, "RTW_USE_CFG80211_STA_EVENT\n");
62
#endif
63
#ifdef CONFIG_RADIO_WORK
64
RTW_PRINT_SEL(sel, "CONFIG_RADIO_WORK\n");
65
#endif
66
#else
67
RTW_PRINT_SEL(sel, "WEXT\n");
68
#endif
69
70
RTW_PRINT_SEL(sel, "DBG:%d\n", DBG);
71
#ifdef CONFIG_RTW_DEBUG
72
RTW_PRINT_SEL(sel, "CONFIG_RTW_DEBUG\n");
73
#endif
74
75
#ifdef CONFIG_CONCURRENT_MODE
76
RTW_PRINT_SEL(sel, "CONFIG_CONCURRENT_MODE\n");
77
#endif
78
79
#ifdef CONFIG_POWER_SAVING
80
RTW_PRINT_SEL(sel, "CONFIG_POWER_SAVING\n");
81
#ifdef CONFIG_IPS
82
RTW_PRINT_SEL(sel, "CONFIG_IPS\n");
83
#endif
84
#ifdef CONFIG_LPS
85
RTW_PRINT_SEL(sel, "CONFIG_LPS\n");
86
#ifdef CONFIG_LPS_LCLK
87
RTW_PRINT_SEL(sel, "CONFIG_LPS_LCLK\n");
88
#ifdef CONFIG_DETECT_CPWM_BY_POLLING
89
RTW_PRINT_SEL(sel, "CONFIG_DETECT_CPWM_BY_POLLING\n");
90
#endif
91
#endif /*CONFIG_LPS_LCLK*/
92
#ifdef CONFIG_LPS_CHK_BY_TP
93
RTW_PRINT_SEL(sel, "CONFIG_LPS_CHK_BY_TP\n");
94
#endif
95
#ifdef CONFIG_LPS_ACK
96
RTW_PRINT_SEL(sel, "CONFIG_LPS_ACK\n");
97
#endif
98
#endif/*CONFIG_LPS*/
99
#endif
100
101
#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
102
RTW_PRINT_SEL(sel, "LOAD_PHY_PARA_FROM_FILE - REALTEK_CONFIG_PATH=%s\n", REALTEK_CONFIG_PATH);
103
#if defined(CONFIG_MULTIDRV) || defined(REALTEK_CONFIG_PATH_WITH_IC_NAME_FOLDER)
104
RTW_PRINT_SEL(sel, "LOAD_PHY_PARA_FROM_FILE - REALTEK_CONFIG_PATH_WITH_IC_NAME_FOLDER\n");
105
#endif
106
107
/* configurations about TX power */
108
#ifdef CONFIG_CALIBRATE_TX_POWER_BY_REGULATORY
109
RTW_PRINT_SEL(sel, "CONFIG_CALIBRATE_TX_POWER_BY_REGULATORY\n");
110
#endif
111
#ifdef CONFIG_CALIBRATE_TX_POWER_TO_MAX
112
RTW_PRINT_SEL(sel, "CONFIG_CALIBRATE_TX_POWER_TO_MAX\n");
113
#endif
114
#endif
115
RTW_PRINT_SEL(sel, "RTW_DEF_MODULE_REGULATORY_CERT=0x%02x\n", RTW_DEF_MODULE_REGULATORY_CERT);
116
117
RTW_PRINT_SEL(sel, "CONFIG_TXPWR_BY_RATE=%d\n", CONFIG_TXPWR_BY_RATE);
118
RTW_PRINT_SEL(sel, "CONFIG_TXPWR_BY_RATE_EN=%d\n", CONFIG_TXPWR_BY_RATE_EN);
119
RTW_PRINT_SEL(sel, "CONFIG_TXPWR_LIMIT=%d\n", CONFIG_TXPWR_LIMIT);
120
RTW_PRINT_SEL(sel, "CONFIG_TXPWR_LIMIT_EN=%d\n", CONFIG_TXPWR_LIMIT_EN);
121
122
123
#ifdef CONFIG_DISABLE_ODM
124
RTW_PRINT_SEL(sel, "CONFIG_DISABLE_ODM\n");
125
#endif
126
127
#ifdef CONFIG_MINIMAL_MEMORY_USAGE
128
RTW_PRINT_SEL(sel, "CONFIG_MINIMAL_MEMORY_USAGE\n");
129
#endif
130
131
RTW_PRINT_SEL(sel, "CONFIG_RTW_ADAPTIVITY_EN = %d\n", CONFIG_RTW_ADAPTIVITY_EN);
132
#if (CONFIG_RTW_ADAPTIVITY_EN)
133
RTW_PRINT_SEL(sel, "ADAPTIVITY_MODE = %s\n", (CONFIG_RTW_ADAPTIVITY_MODE) ? "carrier_sense" : "normal");
134
#endif
135
136
#ifdef CONFIG_WOWLAN
137
RTW_PRINT_SEL(sel, "CONFIG_WOWLAN - ");
138
139
#ifdef CONFIG_GPIO_WAKEUP
140
RTW_PRINT_SEL(sel, "CONFIG_GPIO_WAKEUP - WAKEUP_GPIO_IDX:%d\n", WAKEUP_GPIO_IDX);
141
#endif
142
#endif
143
144
#ifdef CONFIG_TDLS
145
RTW_PRINT_SEL(sel, "CONFIG_TDLS\n");
146
#endif
147
148
#ifdef CONFIG_RTW_80211R
149
RTW_PRINT_SEL(sel, "CONFIG_RTW_80211R\n");
150
#endif
151
152
#ifdef CONFIG_RTW_NETIF_SG
153
RTW_PRINT_SEL(sel, "CONFIG_RTW_NETIF_SG\n");
154
#endif
155
156
#ifdef CONFIG_RTW_WIFI_HAL
157
RTW_PRINT_SEL(sel, "CONFIG_RTW_WIFI_HAL\n");
158
#endif
159
160
#ifdef CONFIG_RTW_TPT_MODE
161
RTW_PRINT_SEL(sel, "CONFIG_RTW_TPT_MODE\n");
162
#endif
163
164
#ifdef CONFIG_USB_HCI
165
#ifdef CONFIG_SUPPORT_USB_INT
166
RTW_PRINT_SEL(sel, "CONFIG_SUPPORT_USB_INT\n");
167
#endif
168
#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
169
RTW_PRINT_SEL(sel, "CONFIG_USB_INTERRUPT_IN_PIPE\n");
170
#endif
171
#ifdef CONFIG_USB_TX_AGGREGATION
172
RTW_PRINT_SEL(sel, "CONFIG_USB_TX_AGGREGATION\n");
173
#endif
174
#ifdef CONFIG_USB_RX_AGGREGATION
175
RTW_PRINT_SEL(sel, "CONFIG_USB_RX_AGGREGATION\n");
176
#endif
177
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_TX
178
RTW_PRINT_SEL(sel, "CONFIG_USE_USB_BUFFER_ALLOC_TX\n");
179
#endif
180
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
181
RTW_PRINT_SEL(sel, "CONFIG_USE_USB_BUFFER_ALLOC_RX\n");
182
#endif
183
#ifdef CONFIG_PREALLOC_RECV_SKB
184
RTW_PRINT_SEL(sel, "CONFIG_PREALLOC_RECV_SKB\n");
185
#endif
186
#ifdef CONFIG_FIX_NR_BULKIN_BUFFER
187
RTW_PRINT_SEL(sel, "CONFIG_FIX_NR_BULKIN_BUFFER\n");
188
#endif
189
#endif /*CONFIG_USB_HCI*/
190
191
#ifdef CONFIG_SDIO_HCI
192
#ifdef CONFIG_TX_AGGREGATION
193
RTW_PRINT_SEL(sel, "CONFIG_TX_AGGREGATION\n");
194
#endif
195
#ifdef CONFIG_RX_AGGREGATION
196
RTW_PRINT_SEL(sel, "CONFIG_RX_AGGREGATION\n");
197
#endif
198
#ifdef RTW_XMIT_THREAD_HIGH_PRIORITY
199
RTW_PRINT_SEL(sel, "RTW_XMIT_THREAD_HIGH_PRIORITY\n");
200
#endif
201
#ifdef RTW_XMIT_THREAD_HIGH_PRIORITY_AGG
202
RTW_PRINT_SEL(sel, "RTW_XMIT_THREAD_HIGH_PRIORITY_AGG\n");
203
#endif
204
205
#ifdef DBG_SDIO
206
RTW_PRINT_SEL(sel, "DBG_SDIO = %d\n", DBG_SDIO);
207
#endif
208
#endif /*CONFIG_SDIO_HCI*/
209
210
#ifdef CONFIG_PCI_HCI
211
#endif
212
213
RTW_PRINT_SEL(sel, "CONFIG_IFACE_NUMBER = %d\n", CONFIG_IFACE_NUMBER);
214
#ifdef CONFIG_MI_WITH_MBSSID_CAM
215
RTW_PRINT_SEL(sel, "CONFIG_MI_WITH_MBSSID_CAM\n");
216
#endif
217
#ifdef CONFIG_SWTIMER_BASED_TXBCN
218
RTW_PRINT_SEL(sel, "CONFIG_SWTIMER_BASED_TXBCN\n");
219
#endif
220
#ifdef CONFIG_FW_HANDLE_TXBCN
221
RTW_PRINT_SEL(sel, "CONFIG_FW_HANDLE_TXBCN\n");
222
RTW_PRINT_SEL(sel, "CONFIG_LIMITED_AP_NUM = %d\n", CONFIG_LIMITED_AP_NUM);
223
#endif
224
#ifdef CONFIG_CLIENT_PORT_CFG
225
RTW_PRINT_SEL(sel, "CONFIG_CLIENT_PORT_CFG\n");
226
#endif
227
#ifdef CONFIG_PCI_TX_POLLING
228
RTW_PRINT_SEL(sel, "CONFIG_PCI_TX_POLLING\n");
229
#endif
230
RTW_PRINT_SEL(sel, "CONFIG_RTW_UP_MAPPING_RULE = %s\n", (CONFIG_RTW_UP_MAPPING_RULE == 1) ? "dscp" : "tos");
231
232
RTW_PRINT_SEL(sel, "\n=== XMIT-INFO ===\n");
233
RTW_PRINT_SEL(sel, "NR_XMITFRAME = %d\n", NR_XMITFRAME);
234
RTW_PRINT_SEL(sel, "NR_XMITBUFF = %d\n", NR_XMITBUFF);
235
RTW_PRINT_SEL(sel, "MAX_XMITBUF_SZ = %d\n", MAX_XMITBUF_SZ);
236
RTW_PRINT_SEL(sel, "NR_XMIT_EXTBUFF = %d\n", NR_XMIT_EXTBUFF);
237
RTW_PRINT_SEL(sel, "MAX_XMIT_EXTBUF_SZ = %d\n", MAX_XMIT_EXTBUF_SZ);
238
RTW_PRINT_SEL(sel, "MAX_CMDBUF_SZ = %d\n", MAX_CMDBUF_SZ);
239
240
RTW_PRINT_SEL(sel, "\n=== RECV-INFO ===\n");
241
RTW_PRINT_SEL(sel, "NR_RECVFRAME = %d\n", NR_RECVFRAME);
242
RTW_PRINT_SEL(sel, "NR_RECVBUFF = %d\n", NR_RECVBUFF);
243
RTW_PRINT_SEL(sel, "MAX_RECVBUF_SZ = %d\n", MAX_RECVBUF_SZ);
244
245
}
246
247
void dump_log_level(void *sel)
248
{
249
#ifdef CONFIG_RTW_DEBUG
250
int i;
251
252
RTW_PRINT_SEL(sel, "drv_log_level:%d\n", rtw_drv_log_level);
253
for (i = 0; i <= _DRV_MAX_; i++) {
254
if (rtw_log_level_str[i])
255
RTW_PRINT_SEL(sel, "%c %s = %d\n",
256
(rtw_drv_log_level == i) ? '+' : ' ', rtw_log_level_str[i], i);
257
}
258
#else
259
RTW_PRINT_SEL(sel, "CONFIG_RTW_DEBUG is disabled\n");
260
#endif
261
}
262
263
#ifdef CONFIG_SDIO_HCI
264
void sd_f0_reg_dump(void *sel, _adapter *adapter)
265
{
266
int i;
267
268
for (i = 0x0; i <= 0xff; i++) {
269
if (i % 16 == 0)
270
RTW_PRINT_SEL(sel, "0x%02x ", i);
271
272
_RTW_PRINT_SEL(sel, "%02x ", rtw_sd_f0_read8(adapter, i));
273
274
if (i % 16 == 15)
275
_RTW_PRINT_SEL(sel, "\n");
276
else if (i % 8 == 7)
277
_RTW_PRINT_SEL(sel, "\t");
278
}
279
}
280
281
void sdio_local_reg_dump(void *sel, _adapter *adapter)
282
{
283
int i, j = 1;
284
285
for (i = 0x0; i < 0x100; i += 4) {
286
if (j % 4 == 1)
287
RTW_PRINT_SEL(sel, "0x%02x", i);
288
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, (0x1025 << 16) | i));
289
if ((j++) % 4 == 0)
290
_RTW_PRINT_SEL(sel, "\n");
291
}
292
}
293
#endif /* CONFIG_SDIO_HCI */
294
295
void mac_reg_dump(void *sel, _adapter *adapter)
296
{
297
int i, j = 1;
298
299
RTW_PRINT_SEL(sel, "======= MAC REG =======\n");
300
301
for (i = 0x0; i < 0x800; i += 4) {
302
if (j % 4 == 1)
303
RTW_PRINT_SEL(sel, "0x%04x", i);
304
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
305
if ((j++) % 4 == 0)
306
_RTW_PRINT_SEL(sel, "\n");
307
}
308
309
#ifdef CONFIG_RTL8814A
310
{
311
for (i = 0x1000; i < 0x1650; i += 4) {
312
if (j % 4 == 1)
313
RTW_PRINT_SEL(sel, "0x%04x", i);
314
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
315
if ((j++) % 4 == 0)
316
_RTW_PRINT_SEL(sel, "\n");
317
}
318
}
319
#endif /* CONFIG_RTL8814A */
320
321
#if defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) ||defined(CONFIG_RTL8192F) || defined(CONFIG_RTL8822C) || defined(CONFIG_RTL8814B)
322
for (i = 0x1000; i < 0x1800; i += 4) {
323
if (j % 4 == 1)
324
RTW_PRINT_SEL(sel, "0x%04x", i);
325
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
326
if ((j++) % 4 == 0)
327
_RTW_PRINT_SEL(sel, "\n");
328
}
329
#endif /* CONFIG_RTL8822B or 8821c or 8192f*/
330
331
#if defined(CONFIG_RTL8814B)
332
for (i = 0x2000; i < 0x2800; i += 4) {
333
if (j % 4 == 1)
334
RTW_PRINT_SEL(sel, "0x%04x", i);
335
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
336
if ((j++) % 4 == 0)
337
_RTW_PRINT_SEL(sel, "\n");
338
}
339
340
for (i = 0x3000; i < 0x3800; i += 4) {
341
if (j % 4 == 1)
342
RTW_PRINT_SEL(sel, "0x%04x", i);
343
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
344
if ((j++) % 4 == 0)
345
_RTW_PRINT_SEL(sel, "\n");
346
}
347
#endif
348
349
}
350
351
void bb_reg_dump(void *sel, _adapter *adapter)
352
{
353
int i, j = 1;
354
355
RTW_PRINT_SEL(sel, "======= BB REG =======\n");
356
for (i = 0x800; i < 0x1000; i += 4) {
357
if (j % 4 == 1)
358
RTW_PRINT_SEL(sel, "0x%04x", i);
359
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
360
if ((j++) % 4 == 0)
361
_RTW_PRINT_SEL(sel, "\n");
362
}
363
364
#if defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8822C) || defined(CONFIG_RTL8814B)
365
for (i = 0x1800; i < 0x2000; i += 4) {
366
if (j % 4 == 1)
367
RTW_PRINT_SEL(sel, "0x%04x", i);
368
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
369
if ((j++) % 4 == 0)
370
_RTW_PRINT_SEL(sel, "\n");
371
}
372
#endif /* CONFIG_RTL8822B */
373
374
#if defined(CONFIG_RTL8822C) || defined(CONFIG_RTL8814B)
375
for (i = 0x2c00; i < 0x2c60; i += 4) {
376
if (j % 4 == 1)
377
RTW_PRINT_SEL(sel, "0x%04x", i);
378
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
379
if ((j++) % 4 == 0)
380
_RTW_PRINT_SEL(sel, "\n");
381
}
382
383
for (i = 0x2d00; i < 0x2df0; i += 4) {
384
if (j % 4 == 1)
385
RTW_PRINT_SEL(sel, "0x%04x", i);
386
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
387
if ((j++) % 4 == 0)
388
_RTW_PRINT_SEL(sel, "\n");
389
}
390
391
for (i = 0x4000; i < 0x4060; i += 4) {
392
if (j % 4 == 1)
393
RTW_PRINT_SEL(sel, "0x%04x", i);
394
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
395
if ((j++) % 4 == 0)
396
_RTW_PRINT_SEL(sel, "\n");
397
}
398
399
for (i = 0x4100; i < 0x4200; i += 4) {
400
if (j % 4 == 1)
401
RTW_PRINT_SEL(sel, "0x%04x", i);
402
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
403
if ((j++) % 4 == 0)
404
_RTW_PRINT_SEL(sel, "\n");
405
}
406
407
#endif /* CONFIG_RTL8822C || CONFIG_RTL8814B */
408
409
#if defined(CONFIG_RTL8814B)
410
for (i = 0x5200; i < 0x5400; i += 4) {
411
if (j % 4 == 1)
412
RTW_PRINT_SEL(sel, "0x%04x", i);
413
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
414
if ((j++) % 4 == 0)
415
_RTW_PRINT_SEL(sel, "\n");
416
}
417
#endif /* CONFIG_RTL8814B */
418
}
419
420
void bb_reg_dump_ex(void *sel, _adapter *adapter)
421
{
422
int i;
423
424
RTW_PRINT_SEL(sel, "======= BB REG =======\n");
425
for (i = 0x800; i < 0x1000; i += 4) {
426
RTW_PRINT_SEL(sel, "0x%04x", i);
427
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
428
_RTW_PRINT_SEL(sel, "\n");
429
}
430
431
#if defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8822C) || defined(CONFIG_RTL8814B)
432
for (i = 0x1800; i < 0x2000; i += 4) {
433
RTW_PRINT_SEL(sel, "0x%04x", i);
434
_RTW_PRINT_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
435
_RTW_PRINT_SEL(sel, "\n");
436
}
437
#endif /* CONFIG_RTL8822B */
438
}
439
440
void rf_reg_dump(void *sel, _adapter *adapter)
441
{
442
int i, j = 1, path;
443
u32 value;
444
u8 path_nums = GET_HAL_RFPATH_NUM(adapter);
445
446
RTW_PRINT_SEL(sel, "======= RF REG =======\n");
447
448
for (path = 0; path < path_nums; path++) {
449
RTW_PRINT_SEL(sel, "RF_Path(%x)\n", path);
450
for (i = 0; i < 0x100; i++) {
451
value = rtw_hal_read_rfreg(adapter, path, i, 0xffffffff);
452
if (j % 4 == 1)
453
RTW_PRINT_SEL(sel, "0x%02x ", i);
454
_RTW_PRINT_SEL(sel, " 0x%08x ", value);
455
if ((j++) % 4 == 0)
456
_RTW_PRINT_SEL(sel, "\n");
457
}
458
}
459
}
460
461
void rtw_sink_rtp_seq_dbg(_adapter *adapter, u8 *ehdr_pos)
462
{
463
struct recv_priv *precvpriv = &(adapter->recvpriv);
464
if (precvpriv->sink_udpport > 0) {
465
if (*((u16 *)(ehdr_pos + 0x24)) == cpu_to_be16(precvpriv->sink_udpport)) {
466
precvpriv->pre_rtp_rxseq = precvpriv->cur_rtp_rxseq;
467
precvpriv->cur_rtp_rxseq = be16_to_cpu(*((u16 *)(ehdr_pos + 0x2C)));
468
if (precvpriv->pre_rtp_rxseq + 1 != precvpriv->cur_rtp_rxseq) {
469
if(precvpriv->pre_rtp_rxseq == 65535 ) {
470
if( precvpriv->cur_rtp_rxseq != 0) {
471
RTW_INFO("%s : RTP Seq num from %d to %d\n", __FUNCTION__, precvpriv->pre_rtp_rxseq, precvpriv->cur_rtp_rxseq);
472
}
473
} else {
474
RTW_INFO("%s : RTP Seq num from %d to %d\n", __FUNCTION__, precvpriv->pre_rtp_rxseq, precvpriv->cur_rtp_rxseq);
475
}
476
}
477
}
478
}
479
}
480
481
void sta_rx_reorder_ctl_dump(void *sel, struct sta_info *sta)
482
{
483
struct recv_reorder_ctrl *reorder_ctl;
484
int i;
485
486
for (i = 0; i < 16; i++) {
487
reorder_ctl = &sta->recvreorder_ctrl[i];
488
if (reorder_ctl->ampdu_size != RX_AMPDU_SIZE_INVALID || reorder_ctl->indicate_seq != 0xFFFF) {
489
RTW_PRINT_SEL(sel, "tid=%d, enable=%d, ampdu_size=%u, indicate_seq=%u\n"
490
, i, reorder_ctl->enable, reorder_ctl->ampdu_size, reorder_ctl->indicate_seq
491
);
492
}
493
}
494
}
495
496
void dump_tx_rate_bmp(void *sel, struct dvobj_priv *dvobj)
497
{
498
_adapter *adapter = dvobj_get_primary_adapter(dvobj);
499
struct rf_ctl_t *rfctl = dvobj_to_rfctl(dvobj);
500
u8 bw;
501
502
RTW_PRINT_SEL(sel, "%-6s", "bw");
503
if (hal_chk_proto_cap(adapter, PROTO_CAP_11AC))
504
_RTW_PRINT_SEL(sel, " %-15s", "vht");
505
506
_RTW_PRINT_SEL(sel, " %-11s %-4s %-3s\n", "ht", "ofdm", "cck");
507
508
for (bw = CHANNEL_WIDTH_20; bw <= CHANNEL_WIDTH_160; bw++) {
509
if (!hal_is_bw_support(adapter, bw))
510
continue;
511
512
RTW_PRINT_SEL(sel, "%6s", ch_width_str(bw));
513
if (hal_chk_proto_cap(adapter, PROTO_CAP_11AC)) {
514
_RTW_PRINT_SEL(sel, " %03x %03x %03x %03x"
515
, RATE_BMP_GET_VHT_4SS(rfctl->rate_bmp_vht_by_bw[bw])
516
, RATE_BMP_GET_VHT_3SS(rfctl->rate_bmp_vht_by_bw[bw])
517
, RATE_BMP_GET_VHT_2SS(rfctl->rate_bmp_vht_by_bw[bw])
518
, RATE_BMP_GET_VHT_1SS(rfctl->rate_bmp_vht_by_bw[bw])
519
);
520
}
521
522
_RTW_PRINT_SEL(sel, " %02x %02x %02x %02x"
523
, bw <= CHANNEL_WIDTH_40 ? RATE_BMP_GET_HT_4SS(rfctl->rate_bmp_ht_by_bw[bw]) : 0
524
, bw <= CHANNEL_WIDTH_40 ? RATE_BMP_GET_HT_3SS(rfctl->rate_bmp_ht_by_bw[bw]) : 0
525
, bw <= CHANNEL_WIDTH_40 ? RATE_BMP_GET_HT_2SS(rfctl->rate_bmp_ht_by_bw[bw]) : 0
526
, bw <= CHANNEL_WIDTH_40 ? RATE_BMP_GET_HT_1SS(rfctl->rate_bmp_ht_by_bw[bw]) : 0
527
);
528
529
_RTW_PRINT_SEL(sel, " %03x %01x\n"
530
, bw <= CHANNEL_WIDTH_20 ? RATE_BMP_GET_OFDM(rfctl->rate_bmp_cck_ofdm) : 0
531
, bw <= CHANNEL_WIDTH_20 ? RATE_BMP_GET_CCK(rfctl->rate_bmp_cck_ofdm) : 0
532
);
533
}
534
}
535
536
void dump_adapters_status(void *sel, struct dvobj_priv *dvobj)
537
{
538
struct rf_ctl_t *rfctl = dvobj_to_rfctl(dvobj);
539
int i;
540
_adapter *iface;
541
u8 u_ch, u_bw, u_offset;
542
#if (defined(CONFIG_SUPPORT_MULTI_BCN) && defined(CONFIG_FW_HANDLE_TXBCN)) || defined(CONFIG_CLIENT_PORT_CFG)
543
char str_val[64] = {'\0'};
544
#endif
545
dump_mi_status(sel, dvobj);
546
547
#if defined(CONFIG_SUPPORT_MULTI_BCN) && defined(CONFIG_FW_HANDLE_TXBCN)
548
RTW_PRINT_SEL(sel, "[AP] LIMITED_AP_NUM:%d\n", CONFIG_LIMITED_AP_NUM);
549
RTW_PRINT_SEL(sel, "[AP] vap_map:0x%02x\n", dvobj->vap_map);
550
#endif
551
#ifdef CONFIG_HW_P0_TSF_SYNC
552
RTW_PRINT_SEL(sel, "[AP] p0 tsf sync port = %d\n", dvobj->p0_tsf.sync_port);
553
RTW_PRINT_SEL(sel, "[AP] p0 tsf timer offset = %d\n", dvobj->p0_tsf.offset);
554
#endif
555
#ifdef CONFIG_CLIENT_PORT_CFG
556
RTW_PRINT_SEL(sel, "[CLT] clt_num = %d\n", dvobj->clt_port.num);
557
RTW_PRINT_SEL(sel, "[CLT] clt_map = 0x%02x\n", dvobj->clt_port.bmp);
558
#endif
559
#ifdef CONFIG_FW_MULTI_PORT_SUPPORT
560
RTW_PRINT_SEL(sel, "[MI] default port id:%d\n\n", dvobj->dft.port_id);
561
#endif /* CONFIG_FW_MULTI_PORT_SUPPORT */
562
563
RTW_PRINT_SEL(sel, "dev status:%s%s\n\n"
564
, dev_is_surprise_removed(dvobj) ? " SR" : ""
565
, dev_is_drv_stopped(dvobj) ? " DS" : ""
566
);
567
568
#ifdef CONFIG_P2P
569
#define P2P_INFO_TITLE_FMT " %-3s %-4s"
570
#define P2P_INFO_TITLE_ARG , "lch", "p2ps"
571
#ifdef CONFIG_IOCTL_CFG80211
572
#define P2P_INFO_VALUE_FMT " %3u %c%3u"
573
#define P2P_INFO_VALUE_ARG , iface->wdinfo.listen_channel, iface->wdev_data.p2p_enabled ? 'e' : ' ', rtw_p2p_state(&iface->wdinfo)
574
#else
575
#define P2P_INFO_VALUE_FMT " %3u %4u"
576
#define P2P_INFO_VALUE_ARG , iface->wdinfo.listen_channel, rtw_p2p_state(&iface->wdinfo)
577
#endif
578
#define P2P_INFO_DASH "---------"
579
#else
580
#define P2P_INFO_TITLE_FMT ""
581
#define P2P_INFO_TITLE_ARG
582
#define P2P_INFO_VALUE_FMT ""
583
#define P2P_INFO_VALUE_ARG
584
#define P2P_INFO_DASH
585
#endif
586
587
#ifdef DBG_TSF_UPDATE
588
#define TSF_PAUSE_TIME_TITLE_FMT " %-5s"
589
#define TSF_PAUSE_TIME_TITLE_ARG , "tsfup"
590
#define TSF_PAUSE_TIME_VALUE_FMT " %5d"
591
#define TSF_PAUSE_TIME_VALUE_ARG , ((iface->mlmeextpriv.tsf_update_required && iface->mlmeextpriv.tsf_update_pause_stime) ? (rtw_get_passing_time_ms(iface->mlmeextpriv.tsf_update_pause_stime) > 99999 ? 99999 : rtw_get_passing_time_ms(iface->mlmeextpriv.tsf_update_pause_stime)) : 0)
592
#else
593
#define TSF_PAUSE_TIME_TITLE_FMT ""
594
#define TSF_PAUSE_TIME_TITLE_ARG
595
#define TSF_PAUSE_TIME_VALUE_FMT ""
596
#define TSF_PAUSE_TIME_VALUE_ARG
597
#endif
598
599
#if (defined(CONFIG_SUPPORT_MULTI_BCN) && defined(CONFIG_FW_HANDLE_TXBCN)) || defined(CONFIG_CLIENT_PORT_CFG)
600
#define INFO_FMT " %-4s"
601
#define INFO_ARG , "info"
602
#define INFO_CNT_FMT " %-20s"
603
#define INFO_CNT_ARG , str_val
604
#else
605
#define INFO_FMT ""
606
#define INFO_ARG
607
#define INFO_CNT_FMT ""
608
#define INFO_CNT_ARG
609
#endif
610
611
RTW_PRINT_SEL(sel, "%-2s %-15s %c %-3s %-3s %-3s %-17s %-4s %-7s"
612
P2P_INFO_TITLE_FMT
613
TSF_PAUSE_TIME_TITLE_FMT
614
" %s"INFO_FMT"\n"
615
, "id", "ifname", ' ', "bup", "nup", "ncd", "macaddr", "port", "ch"
616
P2P_INFO_TITLE_ARG
617
TSF_PAUSE_TIME_TITLE_ARG
618
, "status"INFO_ARG);
619
620
RTW_PRINT_SEL(sel, "---------------------------------------------------------------"
621
P2P_INFO_DASH
622
"-------\n");
623
624
for (i = 0; i < dvobj->iface_nums; i++) {
625
iface = dvobj->padapters[i];
626
if (iface) {
627
#if (defined(CONFIG_SUPPORT_MULTI_BCN) && defined(CONFIG_FW_HANDLE_TXBCN)) || defined(CONFIG_CLIENT_PORT_CFG)
628
_rtw_memset(&str_val, '\0', sizeof(str_val));
629
#endif
630
#if defined(CONFIG_SUPPORT_MULTI_BCN) && defined(CONFIG_FW_HANDLE_TXBCN)
631
if (MLME_IS_AP(iface) || MLME_IS_MESH(iface)) {
632
u8 len;
633
char *p = str_val;
634
char tmp_str[10] = {'\0'};
635
636
len = snprintf(tmp_str, sizeof(tmp_str), "%s", "ap_id:");
637
strncpy(p, tmp_str, len);
638
p += len;
639
_rtw_memset(&tmp_str, '\0', sizeof(tmp_str));
640
#ifdef DBG_HW_PORT
641
len = snprintf(tmp_str, sizeof(tmp_str), "%d (%d,%d)", iface->vap_id, iface->hw_port, iface->client_port);
642
#else
643
len = snprintf(tmp_str, sizeof(tmp_str), "%d", iface->vap_id);
644
#endif
645
strncpy(p, tmp_str, len);
646
}
647
#endif
648
#ifdef CONFIG_CLIENT_PORT_CFG
649
if (MLME_IS_STA(iface)) {
650
u8 len;
651
char *p = str_val;
652
char tmp_str[10] = {'\0'};
653
654
len = snprintf(tmp_str, sizeof(tmp_str), "%s", "c_pid:");
655
strncpy(p, tmp_str, len);
656
p += len;
657
_rtw_memset(&tmp_str, '\0', sizeof(tmp_str));
658
#ifdef DBG_HW_PORT
659
len = snprintf(tmp_str, sizeof(tmp_str), "%d (%d,%d)", iface->client_port, iface->hw_port, iface->client_port);
660
#else
661
len = snprintf(tmp_str, sizeof(tmp_str), "%d", iface->client_port);
662
#endif
663
strncpy(p, tmp_str, len);
664
}
665
#endif
666
667
RTW_PRINT_SEL(sel, "%2d %-15s %c %3u %3u %3u "MAC_FMT" %4hhu %3u,%u,%u"
668
P2P_INFO_VALUE_FMT
669
TSF_PAUSE_TIME_VALUE_FMT
670
" "MLME_STATE_FMT" " INFO_CNT_FMT"\n"
671
, i, iface->registered ? ADPT_ARG(iface) : NULL
672
, iface->registered ? 'R' : ' '
673
, iface->bup
674
, iface->netif_up
675
, iface->net_closed
676
, MAC_ARG(adapter_mac_addr(iface))
677
, rtw_hal_get_port(iface)
678
, iface->mlmeextpriv.cur_channel
679
, iface->mlmeextpriv.cur_bwmode
680
, iface->mlmeextpriv.cur_ch_offset
681
P2P_INFO_VALUE_ARG
682
TSF_PAUSE_TIME_VALUE_ARG
683
, MLME_STATE_ARG(iface)
684
INFO_CNT_ARG
685
);
686
}
687
}
688
689
RTW_PRINT_SEL(sel, "---------------------------------------------------------------"
690
P2P_INFO_DASH
691
"-------\n");
692
693
if (rtw_mi_get_ch_setting_union(dvobj_get_primary_adapter(dvobj), &u_ch, &u_bw, &u_offset))
694
RTW_PRINT_SEL(sel, "%55s %3u,%u,%u\n"
695
, "union:"
696
, u_ch, u_bw, u_offset);
697
698
RTW_PRINT_SEL(sel, "%55s %3u,%u,%u offch_state:%d\n"
699
, "oper:"
700
, dvobj->oper_channel
701
, dvobj->oper_bwmode
702
, dvobj->oper_ch_offset
703
, rfctl->offch_state
704
);
705
706
#ifdef CONFIG_DFS_MASTER
707
if (rfctl->radar_detect_ch != 0) {
708
RTW_PRINT_SEL(sel, "%55s %3u,%u,%u"
709
, "radar_detect:"
710
, rfctl->radar_detect_ch
711
, rfctl->radar_detect_bw
712
, rfctl->radar_detect_offset
713
);
714
715
if (rfctl->radar_detect_by_others)
716
_RTW_PRINT_SEL(sel, ", by AP of STA link");
717
else {
718
u32 non_ocp_ms;
719
u32 cac_ms;
720
u8 dfs_domain = rtw_odm_get_dfs_domain(dvobj);
721
722
_RTW_PRINT_SEL(sel, ", domain:%u", dfs_domain);
723
724
rtw_get_ch_waiting_ms(rfctl
725
, rfctl->radar_detect_ch
726
, rfctl->radar_detect_bw
727
, rfctl->radar_detect_offset
728
, &non_ocp_ms
729
, &cac_ms
730
);
731
732
if (non_ocp_ms)
733
_RTW_PRINT_SEL(sel, ", non_ocp:%d", non_ocp_ms);
734
if (cac_ms)
735
_RTW_PRINT_SEL(sel, ", cac:%d", cac_ms);
736
}
737
738
_RTW_PRINT_SEL(sel, "\n");
739
}
740
#endif /* CONFIG_DFS_MASTER */
741
}
742
743
#define SEC_CAM_ENT_ID_TITLE_FMT "%-2s"
744
#define SEC_CAM_ENT_ID_TITLE_ARG "id"
745
#define SEC_CAM_ENT_ID_VALUE_FMT "%2u"
746
#define SEC_CAM_ENT_ID_VALUE_ARG(id) (id)
747
748
#define SEC_CAM_ENT_TITLE_FMT "%-6s %-17s %-32s %-3s %-7s %-2s %-2s %-5s"
749
#define SEC_CAM_ENT_TITLE_ARG "ctrl", "addr", "key", "kid", "type", "MK", "GK", "valid"
750
#define SEC_CAM_ENT_VALUE_FMT "0x%04x "MAC_FMT" "KEY_FMT" %3u %-7s %2u %2u %5u"
751
#define SEC_CAM_ENT_VALUE_ARG(ent) \
752
(ent)->ctrl \
753
, MAC_ARG((ent)->mac) \
754
, KEY_ARG((ent)->key) \
755
, ((ent)->ctrl) & 0x03 \
756
, security_type_str((((ent)->ctrl) >> 2) & 0x07) \
757
, (((ent)->ctrl) >> 5) & 0x01 \
758
, (((ent)->ctrl) >> 6) & 0x01 \
759
, (((ent)->ctrl) >> 15) & 0x01
760
761
void dump_sec_cam_ent(void *sel, struct sec_cam_ent *ent, int id)
762
{
763
if (id >= 0) {
764
RTW_PRINT_SEL(sel, SEC_CAM_ENT_ID_VALUE_FMT " " SEC_CAM_ENT_VALUE_FMT"\n"
765
, SEC_CAM_ENT_ID_VALUE_ARG(id), SEC_CAM_ENT_VALUE_ARG(ent));
766
} else
767
RTW_PRINT_SEL(sel, SEC_CAM_ENT_VALUE_FMT"\n", SEC_CAM_ENT_VALUE_ARG(ent));
768
}
769
770
void dump_sec_cam_ent_title(void *sel, u8 has_id)
771
{
772
if (has_id) {
773
RTW_PRINT_SEL(sel, SEC_CAM_ENT_ID_TITLE_FMT " " SEC_CAM_ENT_TITLE_FMT"\n"
774
, SEC_CAM_ENT_ID_TITLE_ARG, SEC_CAM_ENT_TITLE_ARG);
775
} else
776
RTW_PRINT_SEL(sel, SEC_CAM_ENT_TITLE_FMT"\n", SEC_CAM_ENT_TITLE_ARG);
777
}
778
779
void dump_sec_cam(void *sel, _adapter *adapter)
780
{
781
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
782
struct cam_ctl_t *cam_ctl = &dvobj->cam_ctl;
783
struct sec_cam_ent ent;
784
int i;
785
786
RTW_PRINT_SEL(sel, "HW sec cam:\n");
787
dump_sec_cam_ent_title(sel, 1);
788
for (i = 0; i < cam_ctl->num; i++) {
789
rtw_sec_read_cam_ent(adapter, i, (u8 *)(&ent.ctrl), ent.mac, ent.key);
790
dump_sec_cam_ent(sel , &ent, i);
791
}
792
}
793
794
void dump_sec_cam_cache(void *sel, _adapter *adapter)
795
{
796
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
797
struct cam_ctl_t *cam_ctl = &dvobj->cam_ctl;
798
int i;
799
800
RTW_PRINT_SEL(sel, "SW sec cam cache:\n");
801
dump_sec_cam_ent_title(sel, 1);
802
for (i = 0; i < cam_ctl->num; i++) {
803
if (dvobj->cam_cache[i].ctrl != 0)
804
dump_sec_cam_ent(sel, &dvobj->cam_cache[i], i);
805
}
806
807
}
808
809
static u8 fwdl_test_chksum_fail = 0;
810
static u8 fwdl_test_wintint_rdy_fail = 0;
811
812
bool rtw_fwdl_test_trigger_chksum_fail(void)
813
{
814
if (fwdl_test_chksum_fail) {
815
RTW_PRINT("fwdl test case: trigger chksum_fail\n");
816
fwdl_test_chksum_fail--;
817
return _TRUE;
818
}
819
return _FALSE;
820
}
821
822
bool rtw_fwdl_test_trigger_wintint_rdy_fail(void)
823
{
824
if (fwdl_test_wintint_rdy_fail) {
825
RTW_PRINT("fwdl test case: trigger wintint_rdy_fail\n");
826
fwdl_test_wintint_rdy_fail--;
827
return _TRUE;
828
}
829
return _FALSE;
830
}
831
832
static u8 del_rx_ampdu_test_no_tx_fail = 0;
833
834
bool rtw_del_rx_ampdu_test_trigger_no_tx_fail(void)
835
{
836
if (del_rx_ampdu_test_no_tx_fail) {
837
RTW_PRINT("del_rx_ampdu test case: trigger no_tx_fail\n");
838
del_rx_ampdu_test_no_tx_fail--;
839
return _TRUE;
840
}
841
return _FALSE;
842
}
843
844
static u32 g_wait_hiq_empty_ms = 0;
845
846
u32 rtw_get_wait_hiq_empty_ms(void)
847
{
848
return g_wait_hiq_empty_ms;
849
}
850
851
static systime sta_linking_test_start_time = 0;
852
static u32 sta_linking_test_wait_ms = 0;
853
static u8 sta_linking_test_force_fail = 0;
854
855
void rtw_sta_linking_test_set_start(void)
856
{
857
sta_linking_test_start_time = rtw_get_current_time();
858
}
859
860
bool rtw_sta_linking_test_wait_done(void)
861
{
862
return rtw_get_passing_time_ms(sta_linking_test_start_time) >= sta_linking_test_wait_ms;
863
}
864
865
bool rtw_sta_linking_test_force_fail(void)
866
{
867
return sta_linking_test_force_fail;
868
}
869
870
#ifdef CONFIG_AP_MODE
871
static u16 ap_linking_test_force_auth_fail = 0;
872
static u16 ap_linking_test_force_asoc_fail = 0;
873
874
u16 rtw_ap_linking_test_force_auth_fail(void)
875
{
876
return ap_linking_test_force_auth_fail;
877
}
878
879
u16 rtw_ap_linking_test_force_asoc_fail(void)
880
{
881
return ap_linking_test_force_asoc_fail;
882
}
883
#endif
884
885
#ifdef CONFIG_PROC_DEBUG
886
ssize_t proc_set_write_reg(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
887
{
888
struct net_device *dev = data;
889
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
890
char tmp[32];
891
u32 addr, val, len;
892
893
if (count < 3) {
894
RTW_INFO("argument size is less than 3\n");
895
return -EFAULT;
896
}
897
898
if (count > sizeof(tmp)) {
899
rtw_warn_on(1);
900
return -EFAULT;
901
}
902
903
if (buffer && !copy_from_user(tmp, buffer, count)) {
904
905
int num = sscanf(tmp, "%x %x %x", &addr, &val, &len);
906
907
if (num != 3) {
908
RTW_INFO("invalid write_reg parameter!\n");
909
return count;
910
}
911
912
switch (len) {
913
case 1:
914
rtw_write8(padapter, addr, (u8)val);
915
break;
916
case 2:
917
rtw_write16(padapter, addr, (u16)val);
918
break;
919
case 4:
920
rtw_write32(padapter, addr, val);
921
break;
922
default:
923
RTW_INFO("error write length=%d", len);
924
break;
925
}
926
927
}
928
929
return count;
930
931
}
932
933
static u32 proc_get_read_addr = 0xeeeeeeee;
934
static u32 proc_get_read_len = 0x4;
935
936
int proc_get_read_reg(struct seq_file *m, void *v)
937
{
938
struct net_device *dev = m->private;
939
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
940
941
if (proc_get_read_addr == 0xeeeeeeee) {
942
RTW_PRINT_SEL(m, "address not initialized\n");
943
return 0;
944
}
945
946
switch (proc_get_read_len) {
947
case 1:
948
RTW_PRINT_SEL(m, "rtw_read8(0x%x)=0x%x\n", proc_get_read_addr, rtw_read8(padapter, proc_get_read_addr));
949
break;
950
case 2:
951
RTW_PRINT_SEL(m, "rtw_read16(0x%x)=0x%x\n", proc_get_read_addr, rtw_read16(padapter, proc_get_read_addr));
952
break;
953
case 4:
954
RTW_PRINT_SEL(m, "rtw_read32(0x%x)=0x%x\n", proc_get_read_addr, rtw_read32(padapter, proc_get_read_addr));
955
break;
956
default:
957
RTW_PRINT_SEL(m, "error read length=%d\n", proc_get_read_len);
958
break;
959
}
960
961
return 0;
962
}
963
964
ssize_t proc_set_read_reg(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
965
{
966
char tmp[16];
967
u32 addr, len;
968
969
if (count < 2) {
970
RTW_INFO("argument size is less than 2\n");
971
return -EFAULT;
972
}
973
974
if (count > sizeof(tmp)) {
975
rtw_warn_on(1);
976
return -EFAULT;
977
}
978
979
if (buffer && !copy_from_user(tmp, buffer, count)) {
980
981
int num = sscanf(tmp, "%x %x", &addr, &len);
982
983
if (num != 2) {
984
RTW_INFO("invalid read_reg parameter!\n");
985
return count;
986
}
987
988
proc_get_read_addr = addr;
989
990
proc_get_read_len = len;
991
}
992
993
return count;
994
995
}
996
997
int proc_get_rx_stat(struct seq_file *m, void *v)
998
{
999
_irqL irqL;
1000
_list *plist, *phead;
1001
struct net_device *dev = m->private;
1002
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
1003
struct sta_info *psta = NULL;
1004
struct stainfo_stats *pstats = NULL;
1005
struct sta_priv *pstapriv = &(adapter->stapriv);
1006
u32 i, j;
1007
u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
1008
u8 null_addr[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
1009
1010
_enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
1011
for (i = 0; i < NUM_STA; i++) {
1012
phead = &(pstapriv->sta_hash[i]);
1013
plist = get_next(phead);
1014
while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
1015
psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
1016
plist = get_next(plist);
1017
pstats = &psta->sta_stats;
1018
1019
if (pstats == NULL)
1020
continue;
1021
if ((_rtw_memcmp(psta->cmn.mac_addr, bc_addr, ETH_ALEN) != _TRUE)
1022
&& (_rtw_memcmp(psta->cmn.mac_addr, null_addr, ETH_ALEN) != _TRUE)
1023
&& (_rtw_memcmp(psta->cmn.mac_addr, adapter_mac_addr(adapter), ETH_ALEN) != _TRUE)) {
1024
RTW_PRINT_SEL(m, "MAC :\t\t"MAC_FMT "\n", MAC_ARG(psta->cmn.mac_addr));
1025
RTW_PRINT_SEL(m, "data_rx_cnt :\t%llu\n", sta_rx_data_uc_pkts(psta) - pstats->last_rx_data_uc_pkts);
1026
pstats->last_rx_data_uc_pkts = sta_rx_data_uc_pkts(psta);
1027
RTW_PRINT_SEL(m, "duplicate_cnt :\t%u\n", pstats->duplicate_cnt);
1028
pstats->duplicate_cnt = 0;
1029
RTW_PRINT_SEL(m, "rx_per_rate_cnt :\n");
1030
1031
for (j = 0; j < 0x60; j++) {
1032
RTW_PRINT_SEL(m, "%08u ", pstats->rxratecnt[j]);
1033
pstats->rxratecnt[j] = 0;
1034
if ((j%8) == 7)
1035
RTW_PRINT_SEL(m, "\n");
1036
}
1037
RTW_PRINT_SEL(m, "\n");
1038
}
1039
}
1040
}
1041
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
1042
return 0;
1043
}
1044
1045
int proc_get_tx_stat(struct seq_file *m, void *v)
1046
{
1047
_irqL irqL;
1048
_list *plist, *phead;
1049
struct net_device *dev = m->private;
1050
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
1051
struct sta_info *psta = NULL;
1052
u8 sta_mac[NUM_STA][ETH_ALEN] = {{0}};
1053
uint mac_id[NUM_STA];
1054
struct stainfo_stats *pstats = NULL;
1055
struct sta_priv *pstapriv = &(adapter->stapriv);
1056
struct sta_priv *pstapriv_primary = &(GET_PRIMARY_ADAPTER(adapter))->stapriv;
1057
u32 i, macid_rec_idx = 0;
1058
u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
1059
u8 null_addr[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
1060
struct submit_ctx gotc2h;
1061
1062
_enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
1063
for (i = 0; i < NUM_STA; i++) {
1064
phead = &(pstapriv->sta_hash[i]);
1065
plist = get_next(phead);
1066
while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
1067
psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
1068
plist = get_next(plist);
1069
if ((_rtw_memcmp(psta->cmn.mac_addr, bc_addr, ETH_ALEN) != _TRUE)
1070
&& (_rtw_memcmp(psta->cmn.mac_addr, null_addr, ETH_ALEN) != _TRUE)
1071
&& (_rtw_memcmp(psta->cmn.mac_addr, adapter_mac_addr(adapter), ETH_ALEN) != _TRUE)) {
1072
_rtw_memcpy(&sta_mac[macid_rec_idx][0], psta->cmn.mac_addr, ETH_ALEN);
1073
mac_id[macid_rec_idx] = psta->cmn.mac_id;
1074
macid_rec_idx++;
1075
}
1076
}
1077
}
1078
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
1079
for (i = 0; i < macid_rec_idx; i++) {
1080
_rtw_memcpy(pstapriv_primary->c2h_sta_mac, &sta_mac[i][0], ETH_ALEN);
1081
pstapriv_primary->c2h_adapter_id = adapter->iface_id;
1082
rtw_sctx_init(&gotc2h, 60);
1083
pstapriv_primary->gotc2h = &gotc2h;
1084
rtw_hal_reqtxrpt(adapter, mac_id[i]);
1085
if (rtw_sctx_wait(&gotc2h, __func__)) {
1086
psta = rtw_get_stainfo(pstapriv, &sta_mac[i][0]);
1087
if(psta) {
1088
pstats = &psta->sta_stats;
1089
#ifndef ROKU_PRIVATE
1090
RTW_PRINT_SEL(m, "data_sent_cnt :\t%u\n", pstats->tx_ok_cnt + pstats->tx_fail_cnt);
1091
RTW_PRINT_SEL(m, "success_cnt :\t%u\n", pstats->tx_ok_cnt);
1092
RTW_PRINT_SEL(m, "failure_cnt :\t%u\n", pstats->tx_fail_cnt);
1093
RTW_PRINT_SEL(m, "retry_cnt :\t%u\n\n", pstats->tx_retry_cnt);
1094
#else
1095
RTW_PRINT_SEL(m, "MAC: " MAC_FMT " sent: %u fail: %u retry: %u\n",
1096
MAC_ARG(&sta_mac[i][0]), pstats->tx_ok_cnt, pstats->tx_fail_cnt, pstats->tx_retry_cnt);
1097
#endif /* ROKU_PRIVATE */
1098
1099
} else
1100
RTW_PRINT_SEL(m, "STA is gone\n");
1101
} else {
1102
//to avoid c2h modify counters
1103
pstapriv_primary->gotc2h = NULL;
1104
_rtw_memset(pstapriv_primary->c2h_sta_mac, 0, ETH_ALEN);
1105
pstapriv_primary->c2h_adapter_id = CONFIG_IFACE_NUMBER;
1106
RTW_PRINT_SEL(m, "Warming : Query timeout, operation abort!!\n");
1107
break;
1108
}
1109
pstapriv_primary->gotc2h = NULL;
1110
_rtw_memset(pstapriv_primary->c2h_sta_mac, 0, ETH_ALEN);
1111
pstapriv_primary->c2h_adapter_id = CONFIG_IFACE_NUMBER;
1112
}
1113
return 0;
1114
}
1115
1116
int proc_get_fwstate(struct seq_file *m, void *v)
1117
{
1118
struct net_device *dev = m->private;
1119
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
1120
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
1121
1122
RTW_PRINT_SEL(m, "fwstate=0x%x\n", get_fwstate(pmlmepriv));
1123
1124
return 0;
1125
}
1126
1127
int proc_get_sec_info(struct seq_file *m, void *v)
1128
{
1129
struct net_device *dev = m->private;
1130
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
1131
struct security_priv *sec = &padapter->securitypriv;
1132
1133
RTW_PRINT_SEL(m, "auth_alg=0x%x, enc_alg=0x%x, auth_type=0x%x, enc_type=0x%x\n",
1134
sec->dot11AuthAlgrthm, sec->dot11PrivacyAlgrthm,
1135
sec->ndisauthtype, sec->ndisencryptstatus);
1136
1137
RTW_PRINT_SEL(m, "hw_decrypted=%d\n", sec->hw_decrypted);
1138
1139
#ifdef DBG_SW_SEC_CNT
1140
RTW_PRINT_SEL(m, "wep_sw_enc_cnt=%llu, %llu, %llu\n"
1141
, sec->wep_sw_enc_cnt_bc , sec->wep_sw_enc_cnt_mc, sec->wep_sw_enc_cnt_uc);
1142
RTW_PRINT_SEL(m, "wep_sw_dec_cnt=%llu, %llu, %llu\n"
1143
, sec->wep_sw_dec_cnt_bc , sec->wep_sw_dec_cnt_mc, sec->wep_sw_dec_cnt_uc);
1144
1145
RTW_PRINT_SEL(m, "tkip_sw_enc_cnt=%llu, %llu, %llu\n"
1146
, sec->tkip_sw_enc_cnt_bc , sec->tkip_sw_enc_cnt_mc, sec->tkip_sw_enc_cnt_uc);
1147
RTW_PRINT_SEL(m, "tkip_sw_dec_cnt=%llu, %llu, %llu\n"
1148
, sec->tkip_sw_dec_cnt_bc , sec->tkip_sw_dec_cnt_mc, sec->tkip_sw_dec_cnt_uc);
1149
1150
RTW_PRINT_SEL(m, "aes_sw_enc_cnt=%llu, %llu, %llu\n"
1151
, sec->aes_sw_enc_cnt_bc , sec->aes_sw_enc_cnt_mc, sec->aes_sw_enc_cnt_uc);
1152
RTW_PRINT_SEL(m, "aes_sw_dec_cnt=%llu, %llu, %llu\n"
1153
, sec->aes_sw_dec_cnt_bc , sec->aes_sw_dec_cnt_mc, sec->aes_sw_dec_cnt_uc);
1154
#endif /* DBG_SW_SEC_CNT */
1155
1156
return 0;
1157
}
1158
1159
int proc_get_mlmext_state(struct seq_file *m, void *v)
1160
{
1161
struct net_device *dev = m->private;
1162
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
1163
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
1164
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
1165
1166
RTW_PRINT_SEL(m, "pmlmeinfo->state=0x%x\n", pmlmeinfo->state);
1167
1168
return 0;
1169
}
1170
1171
#ifdef CONFIG_LAYER2_ROAMING
1172
int proc_get_roam_flags(struct seq_file *m, void *v)
1173
{
1174
struct net_device *dev = m->private;
1175
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
1176
1177
RTW_PRINT_SEL(m, "0x%02x\n", rtw_roam_flags(adapter));
1178
1179
return 0;
1180
}
1181
1182
ssize_t proc_set_roam_flags(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
1183
{
1184
struct net_device *dev = data;
1185
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
1186
1187
char tmp[32];
1188
u8 flags;
1189
1190
if (count < 1)
1191
return -EFAULT;
1192
1193
if (count > sizeof(tmp)) {
1194
rtw_warn_on(1);
1195
return -EFAULT;
1196
}
1197
1198
if (buffer && !copy_from_user(tmp, buffer, count)) {
1199
1200
int num = sscanf(tmp, "%hhx", &flags);
1201
1202
if (num == 1)
1203
rtw_assign_roam_flags(adapter, flags);
1204
}
1205
1206
return count;
1207
1208
}
1209
1210
int proc_get_roam_param(struct seq_file *m, void *v)
1211
{
1212
struct net_device *dev = m->private;
1213
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
1214
struct mlme_priv *mlme = &adapter->mlmepriv;
1215
1216
RTW_PRINT_SEL(m, "%12s %15s %26s %16s\n", "rssi_diff_th", "scanr_exp_ms", "scan_interval(unit:2 sec)", "rssi_threshold");
1217
RTW_PRINT_SEL(m, "%-15u %-13u %-27u %-11u\n"
1218
, mlme->roam_rssi_diff_th
1219
, mlme->roam_scanr_exp_ms
1220
, mlme->roam_scan_int
1221
, mlme->roam_rssi_threshold
1222
);
1223
1224
return 0;
1225
}
1226
1227
ssize_t proc_set_roam_param(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
1228
{
1229
struct net_device *dev = data;
1230
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
1231
struct mlme_priv *mlme = &adapter->mlmepriv;
1232
1233
char tmp[32];
1234
u8 rssi_diff_th;
1235
u32 scanr_exp_ms;
1236
u32 scan_int;
1237
u8 rssi_threshold;
1238
1239
if (count < 1)
1240
return -EFAULT;
1241
1242
if (count > sizeof(tmp)) {
1243
rtw_warn_on(1);
1244
return -EFAULT;
1245
}
1246
1247
if (buffer && !copy_from_user(tmp, buffer, count)) {
1248
1249
int num = sscanf(tmp, "%hhu %u %u %hhu", &rssi_diff_th, &scanr_exp_ms, &scan_int, &rssi_threshold);
1250
1251
if (num >= 1)
1252
mlme->roam_rssi_diff_th = rssi_diff_th;
1253
if (num >= 2)
1254
mlme->roam_scanr_exp_ms = scanr_exp_ms;
1255
if (num >= 3)
1256
mlme->roam_scan_int = scan_int;
1257
if (num >= 4)
1258
mlme->roam_rssi_threshold = rssi_threshold;
1259
}
1260
1261
return count;
1262
1263
}
1264
1265
ssize_t proc_set_roam_tgt_addr(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
1266
{
1267
struct net_device *dev = data;
1268
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
1269
1270
char tmp[32];
1271
u8 addr[ETH_ALEN];
1272
1273
if (count < 1)
1274
return -EFAULT;
1275
1276
if (count > sizeof(tmp)) {
1277
rtw_warn_on(1);
1278
return -EFAULT;
1279
}
1280
1281
if (buffer && !copy_from_user(tmp, buffer, count)) {
1282
1283
int num = sscanf(tmp, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", addr, addr + 1, addr + 2, addr + 3, addr + 4, addr + 5);
1284
if (num == 6)
1285
_rtw_memcpy(adapter->mlmepriv.roam_tgt_addr, addr, ETH_ALEN);
1286
1287
RTW_INFO("set roam_tgt_addr to "MAC_FMT"\n", MAC_ARG(adapter->mlmepriv.roam_tgt_addr));
1288
}
1289
1290
return count;
1291
}
1292
#endif /* CONFIG_LAYER2_ROAMING */
1293
1294
#ifdef CONFIG_RTW_80211R
1295
ssize_t proc_set_ft_flags(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
1296
{
1297
struct net_device *dev = data;
1298
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
1299
1300
char tmp[32];
1301
u8 flags;
1302
1303
if (count < 1)
1304
return -EFAULT;
1305
1306
if (count > sizeof(tmp)) {
1307
rtw_warn_on(1);
1308
return -EFAULT;
1309
}
1310
1311
if (buffer && !copy_from_user(tmp, buffer, count)) {
1312
int num = sscanf(tmp, "%hhx", &flags);
1313
1314
if (num == 1)
1315
adapter->mlmepriv.ft_roam.ft_flags = flags;
1316
}
1317
1318
return count;
1319
1320
}
1321
1322
int proc_get_ft_flags(struct seq_file *m, void *v)
1323
{
1324
struct net_device *dev = m->private;
1325
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
1326
1327
RTW_PRINT_SEL(m, "0x%02x\n", adapter->mlmepriv.ft_roam.ft_flags);
1328
1329
return 0;
1330
}
1331
#endif
1332
1333
int proc_get_qos_option(struct seq_file *m, void *v)
1334
{
1335
struct net_device *dev = m->private;
1336
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
1337
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
1338
1339
RTW_PRINT_SEL(m, "qos_option=%d\n", pmlmepriv->qospriv.qos_option);
1340
1341
return 0;
1342
}
1343
1344
int proc_get_ht_option(struct seq_file *m, void *v)
1345
{
1346
struct net_device *dev = m->private;
1347
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
1348
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
1349
1350
#ifdef CONFIG_80211N_HT
1351
RTW_PRINT_SEL(m, "ht_option=%d\n", pmlmepriv->htpriv.ht_option);
1352
#endif /* CONFIG_80211N_HT */
1353
1354
return 0;
1355
}
1356
1357
int proc_get_rf_info(struct seq_file *m, void *v)
1358
{
1359
struct net_device *dev = m->private;
1360
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
1361
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
1362
1363
RTW_PRINT_SEL(m, "cur_ch=%d, cur_bw=%d, cur_ch_offet=%d\n",
1364
pmlmeext->cur_channel, pmlmeext->cur_bwmode, pmlmeext->cur_ch_offset);
1365
1366
RTW_PRINT_SEL(m, "oper_ch=%d, oper_bw=%d, oper_ch_offet=%d\n",
1367
rtw_get_oper_ch(padapter), rtw_get_oper_bw(padapter), rtw_get_oper_choffset(padapter));
1368
1369
return 0;
1370
}
1371
1372
int proc_get_scan_param(struct seq_file *m, void *v)
1373
{
1374
struct net_device *dev = m->private;
1375
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
1376
struct mlme_ext_priv *mlmeext = &adapter->mlmeextpriv;
1377
struct ss_res *ss = &mlmeext->sitesurvey_res;
1378
1379
#define SCAN_PARAM_TITLE_FMT "%10s"
1380
#define SCAN_PARAM_VALUE_FMT "%-10u"
1381
#define SCAN_PARAM_TITLE_ARG , "scan_ch_ms"
1382
#define SCAN_PARAM_VALUE_ARG , ss->scan_ch_ms
1383
#ifdef CONFIG_80211N_HT
1384
#define SCAN_PARAM_TITLE_FMT_HT " %15s %13s"
1385
#define SCAN_PARAM_VALUE_FMT_HT " %-15u %-13u"
1386
#define SCAN_PARAM_TITLE_ARG_HT , "rx_ampdu_accept", "rx_ampdu_size"
1387
#define SCAN_PARAM_VALUE_ARG_HT , ss->rx_ampdu_accept, ss->rx_ampdu_size
1388
#else
1389
#define SCAN_PARAM_TITLE_FMT_HT ""
1390
#define SCAN_PARAM_VALUE_FMT_HT ""
1391
#define SCAN_PARAM_TITLE_ARG_HT
1392
#define SCAN_PARAM_VALUE_ARG_HT
1393
#endif
1394
#ifdef CONFIG_SCAN_BACKOP
1395
#define SCAN_PARAM_TITLE_FMT_BACKOP " %9s %12s"
1396
#define SCAN_PARAM_VALUE_FMT_BACKOP " %-9u %-12u"
1397
#define SCAN_PARAM_TITLE_ARG_BACKOP , "backop_ms", "scan_cnt_max"
1398
#define SCAN_PARAM_VALUE_ARG_BACKOP , ss->backop_ms, ss->scan_cnt_max
1399
#else
1400
#define SCAN_PARAM_TITLE_FMT_BACKOP ""
1401
#define SCAN_PARAM_VALUE_FMT_BACKOP ""
1402
#define SCAN_PARAM_TITLE_ARG_BACKOP
1403
#define SCAN_PARAM_VALUE_ARG_BACKOP
1404
#endif
1405
1406
RTW_PRINT_SEL(m,
1407
SCAN_PARAM_TITLE_FMT
1408
SCAN_PARAM_TITLE_FMT_HT
1409
SCAN_PARAM_TITLE_FMT_BACKOP
1410
"\n"
1411
SCAN_PARAM_TITLE_ARG
1412
SCAN_PARAM_TITLE_ARG_HT
1413
SCAN_PARAM_TITLE_ARG_BACKOP
1414
);
1415
1416
RTW_PRINT_SEL(m,
1417
SCAN_PARAM_VALUE_FMT
1418
SCAN_PARAM_VALUE_FMT_HT
1419
SCAN_PARAM_VALUE_FMT_BACKOP
1420
"\n"
1421
SCAN_PARAM_VALUE_ARG
1422
SCAN_PARAM_VALUE_ARG_HT
1423
SCAN_PARAM_VALUE_ARG_BACKOP
1424
);
1425
1426
return 0;
1427
}
1428
1429
ssize_t proc_set_scan_param(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
1430
{
1431
struct net_device *dev = data;
1432
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
1433
struct mlme_ext_priv *mlmeext = &adapter->mlmeextpriv;
1434
struct ss_res *ss = &mlmeext->sitesurvey_res;
1435
1436
char tmp[32] = {0};
1437
1438
u16 scan_ch_ms;
1439
#define SCAN_PARAM_INPUT_FMT "%hu"
1440
#define SCAN_PARAM_INPUT_ARG , &scan_ch_ms
1441
#ifdef CONFIG_80211N_HT
1442
u8 rx_ampdu_accept;
1443
u8 rx_ampdu_size;
1444
#define SCAN_PARAM_INPUT_FMT_HT " %hhu %hhu"
1445
#define SCAN_PARAM_INPUT_ARG_HT , &rx_ampdu_accept, &rx_ampdu_size
1446
#else
1447
#define SCAN_PARAM_INPUT_FMT_HT ""
1448
#define SCAN_PARAM_INPUT_ARG_HT
1449
#endif
1450
#ifdef CONFIG_SCAN_BACKOP
1451
u16 backop_ms;
1452
u8 scan_cnt_max;
1453
#define SCAN_PARAM_INPUT_FMT_BACKOP " %hu %hhu"
1454
#define SCAN_PARAM_INPUT_ARG_BACKOP , &backop_ms, &scan_cnt_max
1455
#else
1456
#define SCAN_PARAM_INPUT_FMT_BACKOP ""
1457
#define SCAN_PARAM_INPUT_ARG_BACKOP
1458
#endif
1459
1460
if (count < 1)
1461
return -EFAULT;
1462
1463
if (count > sizeof(tmp)) {
1464
rtw_warn_on(1);
1465
return -EFAULT;
1466
}
1467
1468
if (buffer && !copy_from_user(tmp, buffer, count)) {
1469
1470
int num = sscanf(tmp,
1471
SCAN_PARAM_INPUT_FMT
1472
SCAN_PARAM_INPUT_FMT_HT
1473
SCAN_PARAM_INPUT_FMT_BACKOP
1474
SCAN_PARAM_INPUT_ARG
1475
SCAN_PARAM_INPUT_ARG_HT
1476
SCAN_PARAM_INPUT_ARG_BACKOP
1477
);
1478
1479
if (num-- > 0)
1480
ss->scan_ch_ms = scan_ch_ms;
1481
#ifdef CONFIG_80211N_HT
1482
if (num-- > 0)
1483
ss->rx_ampdu_accept = rx_ampdu_accept;
1484
if (num-- > 0)
1485
ss->rx_ampdu_size = rx_ampdu_size;
1486
#endif
1487
#ifdef CONFIG_SCAN_BACKOP
1488
if (num-- > 0)
1489
ss->backop_ms = backop_ms;
1490
if (num-- > 0)
1491
ss->scan_cnt_max = scan_cnt_max;
1492
#endif
1493
}
1494
1495
return count;
1496
}
1497
1498
int proc_get_scan_abort(struct seq_file *m, void *v)
1499
{
1500
struct net_device *dev = m->private;
1501
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
1502
u32 pass_ms;
1503
1504
pass_ms = rtw_scan_abort_timeout(adapter, 10000);
1505
1506
RTW_PRINT_SEL(m, "%u\n", pass_ms);
1507
1508
return 0;
1509
}
1510
1511
#ifdef CONFIG_RTW_REPEATER_SON
1512
int proc_get_rson_data(struct seq_file *m, void *v)
1513
{
1514
struct net_device *dev = m->private;
1515
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
1516
char rson_data_str[256];
1517
1518
rtw_rson_get_property_str(padapter, rson_data_str);
1519
RTW_PRINT_SEL(m, "%s\n", rson_data_str);
1520
return 0;
1521
}
1522
1523
ssize_t proc_set_rson_data(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
1524
{
1525
struct net_device *dev = data;
1526
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
1527
struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
1528
char tmp[64] = {0};
1529
int num;
1530
u8 field[10], value[64];
1531
1532
if (count < 1)
1533
return -EFAULT;
1534
1535
if (count > sizeof(tmp)) {
1536
rtw_warn_on(1);
1537
return -EFAULT;
1538
}
1539
1540
if (buffer && !copy_from_user(tmp, buffer, count)) {
1541
num = sscanf(tmp, "%s %s", field, value);
1542
if (num != 2) {
1543
RTW_INFO("Invalid format : echo <field> <value> > son_data\n");
1544
return count;
1545
}
1546
RTW_INFO("field=%s value=%s\n", field, value);
1547
num = rtw_rson_set_property(padapter, field, value);
1548
if (num != 1) {
1549
RTW_INFO("Invalid field(%s) or value(%s)\n", field, value);
1550
return count;
1551
}
1552
}
1553
return count;
1554
}
1555
#endif /*CONFIG_RTW_REPEATER_SON*/
1556
1557
int proc_get_survey_info(struct seq_file *m, void *v)
1558
{
1559
_irqL irqL;
1560
struct net_device *dev = m->private;
1561
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
1562
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
1563
_queue *queue = &(pmlmepriv->scanned_queue);
1564
struct wlan_network *pnetwork = NULL;
1565
_list *plist, *phead;
1566
s32 notify_signal;
1567
s16 notify_noise = 0;
1568
u16 index = 0, ie_cap = 0;
1569
unsigned char *ie_wpa = NULL, *ie_wpa2 = NULL, *ie_wps = NULL;
1570
unsigned char *ie_p2p = NULL, *ssid = NULL;
1571
char flag_str[64];
1572
int ielen = 0;
1573
u32 wpsielen = 0;
1574
#ifdef CONFIG_RTW_MESH
1575
const char *ssid_title_str = "ssid/mesh_id";
1576
#else
1577
const char *ssid_title_str = "ssid";
1578
#endif
1579
1580
_enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
1581
phead = get_list_head(queue);
1582
if (!phead)
1583
goto _exit;
1584
plist = get_next(phead);
1585
if (!plist)
1586
goto _exit;
1587
1588
#ifdef CONFIG_RTW_REPEATER_SON
1589
rtw_rson_show_survey_info(m, plist, phead);
1590
#else
1591
1592
RTW_PRINT_SEL(m, "%5s %-17s %3s %-3s %-4s %-4s %5s %32s %32s\n", "index", "bssid", "ch", "RSSI", "SdBm", "Noise", "age", "flag", ssid_title_str);
1593
while (1) {
1594
if (rtw_end_of_queue_search(phead, plist) == _TRUE)
1595
break;
1596
1597
pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
1598
if (!pnetwork)
1599
break;
1600
1601
if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE &&
1602
is_same_network(&pmlmepriv->cur_network.network, &pnetwork->network, 0)) {
1603
notify_signal = translate_percentage_to_dbm(padapter->recvpriv.signal_strength);/* dbm */
1604
} else {
1605
notify_signal = translate_percentage_to_dbm(pnetwork->network.PhyInfo.SignalStrength);/* dbm */
1606
}
1607
1608
#ifdef CONFIG_BACKGROUND_NOISE_MONITOR
1609
if (IS_NM_ENABLE(padapter))
1610
notify_noise = rtw_noise_query_by_chan_num(padapter, pnetwork->network.Configuration.DSConfig);
1611
#endif
1612
1613
ie_wpa = rtw_get_wpa_ie(&pnetwork->network.IEs[12], &ielen, pnetwork->network.IELength - 12);
1614
ie_wpa2 = rtw_get_wpa2_ie(&pnetwork->network.IEs[12], &ielen, pnetwork->network.IELength - 12);
1615
ie_cap = rtw_get_capability(&pnetwork->network);
1616
ie_wps = rtw_get_wps_ie(&pnetwork->network.IEs[12], pnetwork->network.IELength - 12, NULL, &wpsielen);
1617
ie_p2p = rtw_get_p2p_ie(&pnetwork->network.IEs[12], pnetwork->network.IELength - 12, NULL, &ielen);
1618
ssid = pnetwork->network.Ssid.Ssid;
1619
sprintf(flag_str, "%s%s%s%s%s%s%s",
1620
(ie_wpa) ? "[WPA]" : "",
1621
(ie_wpa2) ? "[WPA2]" : "",
1622
(!ie_wpa && !ie_wpa && ie_cap & BIT(4)) ? "[WEP]" : "",
1623
(ie_wps) ? "[WPS]" : "",
1624
(pnetwork->network.InfrastructureMode == Ndis802_11IBSS) ? "[IBSS]" :
1625
(pnetwork->network.InfrastructureMode == Ndis802_11_mesh) ? "[MESH]" : "",
1626
(ie_cap & BIT(0)) ? "[ESS]" : "",
1627
(ie_p2p) ? "[P2P]" : "");
1628
RTW_PRINT_SEL(m, "%5d "MAC_FMT" %3d %3d %4d %4d %5d %32s %32s\n",
1629
++index,
1630
MAC_ARG(pnetwork->network.MacAddress),
1631
pnetwork->network.Configuration.DSConfig,
1632
(int)pnetwork->network.Rssi,
1633
notify_signal,
1634
notify_noise,
1635
rtw_get_passing_time_ms(pnetwork->last_scanned),
1636
flag_str,
1637
pnetwork->network.InfrastructureMode == Ndis802_11_mesh ? pnetwork->network.mesh_id.Ssid : pnetwork->network.Ssid.Ssid
1638
);
1639
plist = get_next(plist);
1640
}
1641
#endif
1642
_exit:
1643
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
1644
1645
return 0;
1646
}
1647
1648
ssize_t proc_set_survey_info(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
1649
{
1650
struct net_device *dev = data;
1651
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
1652
u8 _status = _FALSE;
1653
u8 ssc_chk;
1654
if (count < 1)
1655
return -EFAULT;
1656
1657
#if 1
1658
ssc_chk = rtw_sitesurvey_condition_check(padapter, _FALSE);
1659
if (ssc_chk != SS_ALLOW)
1660
goto exit;
1661
1662
rtw_ps_deny(padapter, PS_DENY_SCAN);
1663
if (_FAIL == rtw_pwr_wakeup(padapter))
1664
goto cancel_ps_deny;
1665
if (!rtw_is_adapter_up(padapter)) {
1666
RTW_INFO("scan abort!! adapter cannot use\n");
1667
goto cancel_ps_deny;
1668
}
1669
#else
1670
#ifdef CONFIG_MP_INCLUDED
1671
if (rtw_mp_mode_check(padapter)) {
1672
RTW_INFO("MP mode block Scan request\n");
1673
goto exit;
1674
}
1675
#endif
1676
if (rtw_is_scan_deny(padapter)) {
1677
RTW_INFO(FUNC_ADPT_FMT ": scan deny\n", FUNC_ADPT_ARG(padapter));
1678
goto exit;
1679
}
1680
1681
rtw_ps_deny(padapter, PS_DENY_SCAN);
1682
if (_FAIL == rtw_pwr_wakeup(padapter))
1683
goto cancel_ps_deny;
1684
1685
if (!rtw_is_adapter_up(padapter)) {
1686
RTW_INFO("scan abort!! adapter cannot use\n");
1687
goto cancel_ps_deny;
1688
}
1689
1690
if (rtw_mi_busy_traffic_check(padapter, _FALSE)) {
1691
RTW_INFO("scan abort!! BusyTraffic == _TRUE\n");
1692
goto cancel_ps_deny;
1693
}
1694
1695
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) && check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) {
1696
RTW_INFO("scan abort!! AP mode process WPS\n");
1697
goto cancel_ps_deny;
1698
}
1699
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING) == _TRUE) {
1700
RTW_INFO("scan abort!! fwstate=0x%x\n", pmlmepriv->fw_state);
1701
goto cancel_ps_deny;
1702
}
1703
1704
#ifdef CONFIG_CONCURRENT_MODE
1705
if (rtw_mi_buddy_check_fwstate(padapter,
1706
_FW_UNDER_SURVEY | _FW_UNDER_LINKING | WIFI_UNDER_WPS)) {
1707
RTW_INFO("scan abort!! buddy_fwstate check failed\n");
1708
goto cancel_ps_deny;
1709
}
1710
#endif
1711
#endif
1712
_status = rtw_set_802_11_bssid_list_scan(padapter, NULL);
1713
1714
cancel_ps_deny:
1715
rtw_ps_deny_cancel(padapter, PS_DENY_SCAN);
1716
exit:
1717
return count;
1718
}
1719
#ifdef ROKU_PRIVATE
1720
int proc_get_infra_ap(struct seq_file *m, void *v)
1721
{
1722
struct net_device *dev = m->private;
1723
struct sta_info *psta;
1724
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
1725
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
1726
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
1727
struct ht_priv_infra_ap *phtpriv = &pmlmepriv->htpriv_infra_ap;
1728
#ifdef CONFIG_80211AC_VHT
1729
struct vht_priv_infra_ap *pvhtpriv = &pmlmepriv->vhtpriv_infra_ap;
1730
#endif
1731
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
1732
struct wlan_network *cur_network = &(pmlmepriv->cur_network);
1733
struct sta_priv *pstapriv = &padapter->stapriv;
1734
1735
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
1736
psta = rtw_get_stainfo(pstapriv, cur_network->network.MacAddress);
1737
if (psta) {
1738
unsigned int i, j;
1739
unsigned int Rx_ss = 0, Tx_ss = 0;
1740
struct recv_reorder_ctrl *preorder_ctrl;
1741
1742
RTW_PRINT_SEL(m, "SSID=%s\n", pmlmeinfo->network.Ssid.Ssid);
1743
RTW_PRINT_SEL(m, "sta's macaddr:" MAC_FMT "\n", MAC_ARG(psta->cmn.mac_addr));
1744
RTW_PRINT_SEL(m, "Supported rate=");
1745
for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) {
1746
if (pmlmeinfo->SupportedRates_infra_ap[i] == 0)
1747
break;
1748
RTW_PRINT_SEL(m, " 0x%x", pmlmeinfo->SupportedRates_infra_ap[i]);
1749
}
1750
RTW_PRINT_SEL(m, "\n");
1751
#ifdef CONFIG_80211N_HT
1752
if (pmlmeinfo->ht_vht_received & BIT(0)) {
1753
RTW_PRINT_SEL(m, "Supported MCS set=");
1754
for (i = 0; i < 16 ; i++)
1755
RTW_PRINT_SEL(m, " 0x%02x", phtpriv->MCS_set_infra_ap[i]);
1756
RTW_PRINT_SEL(m, "\n");
1757
RTW_PRINT_SEL(m, "highest supported data rate=0x%x\n", phtpriv->rx_highest_data_rate_infra_ap);
1758
RTW_PRINT_SEL(m, "HT_supported_channel_width_set=0x%x\n", phtpriv->channel_width_infra_ap);
1759
RTW_PRINT_SEL(m, "sgi_20m=%d, sgi_40m=%d\n", phtpriv->sgi_20m_infra_ap, phtpriv->sgi_40m_infra_ap);
1760
RTW_PRINT_SEL(m, "ldpc_cap=0x%x, stbc_cap=0x%x\n", phtpriv->ldpc_cap_infra_ap, phtpriv->stbc_cap_infra_ap);
1761
RTW_PRINT_SEL(m, "HT_number_of_stream=%d\n", phtpriv->Rx_ss_infra_ap);
1762
}
1763
#endif
1764
1765
#ifdef CONFIG_80211AC_VHT
1766
if (pmlmeinfo->ht_vht_received & BIT(1)) {
1767
RTW_PRINT_SEL(m, "VHT_supported_channel_width_set=0x%x\n", pvhtpriv->channel_width_infra_ap);
1768
RTW_PRINT_SEL(m, "vht_ldpc_cap=0x%x, vht_stbc_cap=0x%x, vht_beamform_cap=0x%x\n", pvhtpriv->ldpc_cap_infra_ap, pvhtpriv->stbc_cap_infra_ap, pvhtpriv->beamform_cap_infra_ap);
1769
RTW_PRINT_SEL(m, "Rx_vht_mcs_map=0x%x, Tx_vht_mcs_map=0x%x\n", *(u16 *)pvhtpriv->vht_mcs_map_infra_ap, *(u16 *)pvhtpriv->vht_mcs_map_tx_infra_ap);
1770
RTW_PRINT_SEL(m, "VHT_number_of_stream=%d\n", pvhtpriv->number_of_streams_infra_ap);
1771
}
1772
#endif
1773
} else
1774
RTW_PRINT_SEL(m, "can't get sta's macaddr, cur_network's macaddr:" MAC_FMT "\n", MAC_ARG(cur_network->network.MacAddress));
1775
} else
1776
RTW_PRINT_SEL(m, "this only applies to STA mode\n");
1777
return 0;
1778
}
1779
1780
#endif /* ROKU_PRIVATE */
1781
1782
static int wireless_mode_to_str(u32 mode, char *str)
1783
{
1784
str[0]='\0';
1785
if (mode&WIRELESS_11A)
1786
sprintf(str+strlen(str),"%s","A/");
1787
if (mode&WIRELESS_11B)
1788
sprintf(str+strlen(str),"%s","B/");
1789
if (mode&WIRELESS_11G)
1790
sprintf(str+strlen(str),"%s","G/");
1791
if (mode&(WIRELESS_11_24N|WIRELESS_11_5N))
1792
sprintf(str+strlen(str),"%s","N/");
1793
if (mode&WIRELESS_11AC)
1794
sprintf(str+strlen(str),"%s","AC/");
1795
1796
if (strlen(str)>1)
1797
str[strlen(str)-1]='\0';
1798
1799
return strlen(str);
1800
}
1801
1802
int proc_get_ap_info(struct seq_file *m, void *v)
1803
{
1804
struct net_device *dev = m->private;
1805
struct sta_info *psta;
1806
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
1807
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
1808
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
1809
struct wlan_network *cur_network = &(pmlmepriv->cur_network);
1810
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
1811
struct sta_priv *pstapriv = &padapter->stapriv;
1812
char wl_mode[16];
1813
1814
/* ap vendor */
1815
char vendor[VENDOR_NAME_LEN] = {0};
1816
get_assoc_AP_Vendor(vendor,pmlmeinfo->assoc_AP_vendor);
1817
RTW_PRINT_SEL(m,"AP Vendor %s\n", vendor);
1818
1819
psta = rtw_get_stainfo(pstapriv, cur_network->network.MacAddress);
1820
if (psta) {
1821
wireless_mode_to_str(psta->wireless_mode, wl_mode);
1822
RTW_PRINT_SEL(m, "SSID=%s\n", cur_network->network.Ssid.Ssid);
1823
RTW_PRINT_SEL(m, "sta's macaddr:" MAC_FMT "\n", MAC_ARG(psta->cmn.mac_addr));
1824
RTW_PRINT_SEL(m, "cur_channel=%d, cur_bwmode=%d(%s), cur_ch_offset=%d\n", pmlmeext->cur_channel, pmlmeext->cur_bwmode, ch_width_str(pmlmeext->cur_bwmode), pmlmeext->cur_ch_offset);
1825
RTW_PRINT_SEL(m, "wireless_mode=0x%x(%s), rtsen=%d, cts2slef=%d\n", psta->wireless_mode, wl_mode, psta->rtsen, psta->cts2self);
1826
RTW_PRINT_SEL(m, "state=0x%x, aid=%d, macid=%d, raid=%d\n",
1827
psta->state, psta->cmn.aid, psta->cmn.mac_id, psta->cmn.ra_info.rate_id);
1828
#ifdef CONFIG_80211N_HT
1829
RTW_PRINT_SEL(m, "qos_en=%d, ht_en=%d, init_rate=%d\n", psta->qos_option, psta->htpriv.ht_option, psta->init_rate);
1830
RTW_PRINT_SEL(m, "bwmode=%d, ch_offset=%d, sgi_20m=%d,sgi_40m=%d\n"
1831
, psta->cmn.bw_mode, psta->htpriv.ch_offset, psta->htpriv.sgi_20m, psta->htpriv.sgi_40m);
1832
RTW_PRINT_SEL(m, "ampdu_enable = %d\n", psta->htpriv.ampdu_enable);
1833
RTW_PRINT_SEL(m, "agg_enable_bitmap=%x, candidate_tid_bitmap=%x\n", psta->htpriv.agg_enable_bitmap, psta->htpriv.candidate_tid_bitmap);
1834
RTW_PRINT_SEL(m, "ldpc_cap=0x%x, stbc_cap=0x%x, beamform_cap=0x%x\n", psta->htpriv.ldpc_cap, psta->htpriv.stbc_cap, psta->htpriv.beamform_cap);
1835
#endif /* CONFIG_80211N_HT */
1836
#ifdef CONFIG_80211AC_VHT
1837
RTW_PRINT_SEL(m, "vht_en=%d, vht_sgi_80m=%d\n", psta->vhtpriv.vht_option, psta->vhtpriv.sgi_80m);
1838
RTW_PRINT_SEL(m, "vht_ldpc_cap=0x%x, vht_stbc_cap=0x%x, vht_beamform_cap=0x%x\n", psta->vhtpriv.ldpc_cap, psta->vhtpriv.stbc_cap, psta->vhtpriv.beamform_cap);
1839
RTW_PRINT_SEL(m, "vht_mcs_map=0x%x, vht_highest_rate=0x%x, vht_ampdu_len=%d\n", *(u16 *)psta->vhtpriv.vht_mcs_map, psta->vhtpriv.vht_highest_rate, psta->vhtpriv.ampdu_len);
1840
#endif
1841
sta_rx_reorder_ctl_dump(m, psta);
1842
} else
1843
RTW_PRINT_SEL(m, "can't get sta's macaddr, cur_network's macaddr:" MAC_FMT "\n", MAC_ARG(cur_network->network.MacAddress));
1844
1845
return 0;
1846
}
1847
1848
ssize_t proc_reset_trx_info(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
1849
{
1850
struct net_device *dev = data;
1851
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
1852
struct recv_priv *precvpriv = &padapter->recvpriv;
1853
char cmd[32] = {0};
1854
u8 cnt = 0;
1855
1856
if (count > sizeof(cmd)) {
1857
rtw_warn_on(1);
1858
return -EFAULT;
1859
}
1860
1861
if (buffer && !copy_from_user(cmd, buffer, count)) {
1862
int num = sscanf(cmd, "%hhx", &cnt);
1863
1864
if (num == 1 && cnt == 0) {
1865
precvpriv->dbg_rx_ampdu_drop_count = 0;
1866
precvpriv->dbg_rx_ampdu_forced_indicate_count = 0;
1867
precvpriv->dbg_rx_ampdu_loss_count = 0;
1868
precvpriv->dbg_rx_dup_mgt_frame_drop_count = 0;
1869
precvpriv->dbg_rx_ampdu_window_shift_cnt = 0;
1870
precvpriv->dbg_rx_conflic_mac_addr_cnt = 0;
1871
precvpriv->dbg_rx_drop_count = 0;
1872
}
1873
}
1874
1875
return count;
1876
}
1877
1878
int proc_get_trx_info(struct seq_file *m, void *v)
1879
{
1880
struct net_device *dev = m->private;
1881
int i;
1882
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
1883
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
1884
struct recv_priv *precvpriv = &padapter->recvpriv;
1885
struct hw_xmit *phwxmit;
1886
u16 vo_params[4], vi_params[4], be_params[4], bk_params[4];
1887
1888
padapter->hal_func.read_wmmedca_reg(padapter, vo_params, vi_params, be_params, bk_params);
1889
1890
RTW_PRINT_SEL(m, "wmm_edca_vo, aifs = %u us, cw_min = %u, cw_max = %u, txop_limit = %u us\n", vo_params[0], vo_params[1], vo_params[2], vo_params[3]);
1891
RTW_PRINT_SEL(m, "wmm_edca_vi, aifs = %u us, cw_min = %u, cw_max = %u, txop_limit = %u us\n", vi_params[0], vi_params[1], vi_params[2], vi_params[3]);
1892
RTW_PRINT_SEL(m, "wmm_edca_be, aifs = %u us, cw_min = %u, cw_max = %u, txop_limit = %u us\n", be_params[0], be_params[1], be_params[2], be_params[3]);
1893
RTW_PRINT_SEL(m, "wmm_edca_bk, aifs = %u us, cw_min = %u, cw_max = %u, txop_limit = %u us\n", bk_params[0], bk_params[1], bk_params[2], bk_params[3]);
1894
1895
dump_os_queue(m, padapter);
1896
1897
RTW_PRINT_SEL(m, "free_xmitbuf_cnt=%d, free_xmitframe_cnt=%d\n"
1898
, pxmitpriv->free_xmitbuf_cnt, pxmitpriv->free_xmitframe_cnt);
1899
RTW_PRINT_SEL(m, "free_ext_xmitbuf_cnt=%d, free_xframe_ext_cnt=%d\n"
1900
, pxmitpriv->free_xmit_extbuf_cnt, pxmitpriv->free_xframe_ext_cnt);
1901
RTW_PRINT_SEL(m, "free_recvframe_cnt=%d\n"
1902
, precvpriv->free_recvframe_cnt);
1903
1904
for (i = 0; i < 4; i++) {
1905
phwxmit = pxmitpriv->hwxmits + i;
1906
RTW_PRINT_SEL(m, "%d, hwq.accnt=%d\n", i, phwxmit->accnt);
1907
}
1908
1909
rtw_hal_get_hwreg(padapter, HW_VAR_DUMP_MAC_TXFIFO, (u8 *)m);
1910
1911
#ifdef CONFIG_USB_HCI
1912
RTW_PRINT_SEL(m, "rx_urb_pending_cn=%d\n", ATOMIC_READ(&(precvpriv->rx_pending_cnt)));
1913
#endif
1914
1915
dump_rx_bh_tk(m, &GET_PRIMARY_ADAPTER(padapter)->recvpriv);
1916
1917
/* Folowing are RX info */
1918
RTW_PRINT_SEL(m, "RX: Count of Packets dropped by Driver: %llu\n", (unsigned long long)precvpriv->dbg_rx_drop_count);
1919
/* Counts of packets whose seq_num is less than preorder_ctrl->indicate_seq, Ex delay, retransmission, redundant packets and so on */
1920
RTW_PRINT_SEL(m, "Rx: Counts of Packets Whose Seq_Num Less Than Reorder Control Seq_Num: %llu\n", (unsigned long long)precvpriv->dbg_rx_ampdu_drop_count);
1921
/* How many times the Rx Reorder Timer is triggered. */
1922
RTW_PRINT_SEL(m, "Rx: Reorder Time-out Trigger Counts: %llu\n", (unsigned long long)precvpriv->dbg_rx_ampdu_forced_indicate_count);
1923
/* Total counts of packets loss */
1924
RTW_PRINT_SEL(m, "Rx: Packet Loss Counts: %llu\n", (unsigned long long)precvpriv->dbg_rx_ampdu_loss_count);
1925
RTW_PRINT_SEL(m, "Rx: Duplicate Management Frame Drop Count: %llu\n", (unsigned long long)precvpriv->dbg_rx_dup_mgt_frame_drop_count);
1926
RTW_PRINT_SEL(m, "Rx: AMPDU BA window shift Count: %llu\n", (unsigned long long)precvpriv->dbg_rx_ampdu_window_shift_cnt);
1927
/*The same mac addr counts*/
1928
RTW_PRINT_SEL(m, "Rx: Conflict MAC Address Frames Count: %llu\n", (unsigned long long)precvpriv->dbg_rx_conflic_mac_addr_cnt);
1929
return 0;
1930
}
1931
1932
int proc_get_rate_ctl(struct seq_file *m, void *v)
1933
{
1934
struct net_device *dev = m->private;
1935
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
1936
u8 data_rate = 0, sgi = 0, data_fb = 0;
1937
1938
if (adapter->fix_rate != 0xff) {
1939
data_rate = adapter->fix_rate & 0x7F;
1940
sgi = adapter->fix_rate >> 7;
1941
data_fb = adapter->data_fb ? 1 : 0;
1942
RTW_PRINT_SEL(m, "FIXED %s%s%s\n"
1943
, HDATA_RATE(data_rate)
1944
, data_rate > DESC_RATE54M ? (sgi ? " SGI" : " LGI") : ""
1945
, data_fb ? " FB" : ""
1946
);
1947
RTW_PRINT_SEL(m, "0x%02x %u\n", adapter->fix_rate, adapter->data_fb);
1948
} else
1949
RTW_PRINT_SEL(m, "RA\n");
1950
1951
return 0;
1952
}
1953
1954
#ifdef CONFIG_PHDYM_FW_FIXRATE
1955
void phydm_fw_fix_rate(void *dm_void, u8 en, u8 macid, u8 bw, u8 rate);
1956
#endif
1957
ssize_t proc_set_rate_ctl(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
1958
{
1959
struct net_device *dev = data;
1960
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
1961
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
1962
char tmp[32];
1963
u8 fix_rate = 0xFF;
1964
#ifdef CONFIG_PHDYM_FW_FIXRATE
1965
u8 bw = 0;
1966
#else
1967
u8 data_fb = 0;
1968
#endif
1969
1970
if (count < 1)
1971
return -EFAULT;
1972
1973
if (count > sizeof(tmp)) {
1974
rtw_warn_on(1);
1975
return -EFAULT;
1976
}
1977
1978
if (buffer && !copy_from_user(tmp, buffer, count)) {
1979
#ifdef CONFIG_PHDYM_FW_FIXRATE
1980
struct dm_struct *dm = adapter_to_phydm(adapter);
1981
u8 en = 1, macid = 255;
1982
_irqL irqL;
1983
_list *plist, *phead;
1984
struct sta_info *psta = NULL;
1985
struct sta_priv *pstapriv = &(adapter->stapriv);
1986
u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
1987
u8 null_addr[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
1988
uint mac_id[NUM_STA];
1989
int i, macid_rec_idx = 0;
1990
int num = sscanf(tmp, "%hhx %hhu %hhu", &fix_rate, &bw, &macid);
1991
1992
if (num < 1) {
1993
RTW_INFO("Invalid input!! \"ex: echo <rate> <bw> <macid> > /proc/.../rate_ctl\"\n");
1994
return count;
1995
}
1996
1997
if ((fix_rate == 0) || (fix_rate == 0xFF))
1998
en = 0;
1999
2000
if (macid != 255) {
2001
RTW_INFO("Call phydm_fw_fix_rate()--en[%d] mac_id[%d] bw[%d] fix_rate[%d]\n", en, macid, bw, fix_rate);
2002
phydm_fw_fix_rate(dm, en, macid, bw, fix_rate);
2003
return count;
2004
}
2005
2006
/* no specific macid, apply to all macids except bc/mc macid */
2007
_enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
2008
for (i = 0; i < NUM_STA; i++) {
2009
phead = &(pstapriv->sta_hash[i]);
2010
plist = get_next(phead);
2011
while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
2012
psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
2013
plist = get_next(plist);
2014
if ((_rtw_memcmp(psta->cmn.mac_addr, bc_addr, ETH_ALEN) != _TRUE)
2015
&& (_rtw_memcmp(psta->cmn.mac_addr, null_addr, ETH_ALEN) != _TRUE)
2016
&& (_rtw_memcmp(psta->cmn.mac_addr, adapter_mac_addr(adapter), ETH_ALEN) != _TRUE)) {
2017
mac_id[macid_rec_idx] = psta->cmn.mac_id;
2018
macid_rec_idx++;
2019
}
2020
}
2021
}
2022
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
2023
2024
for (i = 0; i < macid_rec_idx; i++) {
2025
RTW_INFO("Call phydm_fw_fix_rate()--en[%d] mac_id[%d] bw[%d] fix_rate[%d]\n", en, mac_id[i], bw, fix_rate);
2026
phydm_fw_fix_rate(dm, en, mac_id[i], bw, fix_rate);
2027
}
2028
#else
2029
int num = sscanf(tmp, "%hhx %hhu", &fix_rate, &data_fb);
2030
2031
if (num >= 1) {
2032
u8 fix_rate_ori = adapter->fix_rate;
2033
2034
adapter->fix_rate = fix_rate;
2035
if (fix_rate == 0xFF)
2036
hal_data->ForcedDataRate = 0;
2037
else
2038
hal_data->ForcedDataRate = hw_rate_to_m_rate(fix_rate & 0x7F);
2039
2040
if (adapter->fix_bw != 0xFF && fix_rate_ori != fix_rate)
2041
rtw_update_tx_rate_bmp(adapter_to_dvobj(adapter));
2042
}
2043
if (num >= 2)
2044
adapter->data_fb = data_fb ? 1 : 0;
2045
#endif
2046
}
2047
2048
return count;
2049
}
2050
2051
#ifdef CONFIG_AP_MODE
2052
int proc_get_bmc_tx_rate(struct seq_file *m, void *v)
2053
{
2054
struct net_device *dev = m->private;
2055
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
2056
2057
if (!MLME_IS_AP(adapter) && !MLME_IS_MESH(adapter)) {
2058
RTW_PRINT_SEL(m, "[ERROR] Not in SoftAP/Mesh mode !!\n");
2059
return 0;
2060
}
2061
2062
RTW_PRINT_SEL(m, " BMC Tx rate - %s\n", MGN_RATE_STR(adapter->bmc_tx_rate));
2063
return 0;
2064
}
2065
2066
ssize_t proc_set_bmc_tx_rate(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
2067
{
2068
struct net_device *dev = data;
2069
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
2070
char tmp[32];
2071
u8 bmc_tx_rate;
2072
2073
if (count < 1)
2074
return -EFAULT;
2075
2076
if (count > sizeof(tmp)) {
2077
rtw_warn_on(1);
2078
return -EFAULT;
2079
}
2080
2081
if (buffer && !copy_from_user(tmp, buffer, count)) {
2082
2083
int num = sscanf(tmp, "%hhx", &bmc_tx_rate);
2084
2085
if (num >= 1)
2086
/*adapter->bmc_tx_rate = hw_rate_to_m_rate(bmc_tx_rate);*/
2087
adapter->bmc_tx_rate = bmc_tx_rate;
2088
}
2089
2090
return count;
2091
}
2092
#endif /*CONFIG_AP_MODE*/
2093
2094
2095
int proc_get_tx_power_offset(struct seq_file *m, void *v)
2096
{
2097
struct net_device *dev = m->private;
2098
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
2099
2100
RTW_PRINT_SEL(m, "Tx power offset - %u\n", adapter->power_offset);
2101
return 0;
2102
}
2103
2104
ssize_t proc_set_tx_power_offset(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
2105
{
2106
struct net_device *dev = data;
2107
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
2108
char tmp[32];
2109
u8 power_offset = 0;
2110
2111
if (count < 1)
2112
return -EFAULT;
2113
2114
if (count > sizeof(tmp)) {
2115
rtw_warn_on(1);
2116
return -EFAULT;
2117
}
2118
2119
if (buffer && !copy_from_user(tmp, buffer, count)) {
2120
2121
int num = sscanf(tmp, "%hhu", &power_offset);
2122
2123
if (num >= 1) {
2124
if (power_offset > 5)
2125
power_offset = 0;
2126
2127
adapter->power_offset = power_offset;
2128
}
2129
}
2130
2131
return count;
2132
}
2133
2134
int proc_get_bw_ctl(struct seq_file *m, void *v)
2135
{
2136
struct net_device *dev = m->private;
2137
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
2138
u8 data_bw = 0;
2139
2140
if (adapter->fix_bw != 0xff) {
2141
data_bw = adapter->fix_bw;
2142
RTW_PRINT_SEL(m, "FIXED %s\n", ch_width_str(data_bw));
2143
} else
2144
RTW_PRINT_SEL(m, "Auto\n");
2145
2146
return 0;
2147
}
2148
2149
ssize_t proc_set_bw_ctl(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
2150
{
2151
struct net_device *dev = data;
2152
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
2153
char tmp[32];
2154
u8 fix_bw;
2155
2156
if (count < 1)
2157
return -EFAULT;
2158
2159
if (count > sizeof(tmp)) {
2160
rtw_warn_on(1);
2161
return -EFAULT;
2162
}
2163
2164
if (buffer && !copy_from_user(tmp, buffer, count)) {
2165
int num = sscanf(tmp, "%hhu", &fix_bw);
2166
2167
if (num >= 1) {
2168
u8 fix_bw_ori = adapter->fix_bw;
2169
2170
adapter->fix_bw = fix_bw;
2171
2172
if (adapter->fix_rate != 0xFF && fix_bw_ori != fix_bw)
2173
rtw_update_tx_rate_bmp(adapter_to_dvobj(adapter));
2174
}
2175
}
2176
2177
return count;
2178
}
2179
2180
#ifdef DBG_RX_COUNTER_DUMP
2181
int proc_get_rx_cnt_dump(struct seq_file *m, void *v)
2182
{
2183
struct net_device *dev = m->private;
2184
int i;
2185
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
2186
2187
RTW_PRINT_SEL(m, "BIT0- Dump RX counters of DRV\n");
2188
RTW_PRINT_SEL(m, "BIT1- Dump RX counters of MAC\n");
2189
RTW_PRINT_SEL(m, "BIT2- Dump RX counters of PHY\n");
2190
RTW_PRINT_SEL(m, "BIT3- Dump TRX data frame of DRV\n");
2191
RTW_PRINT_SEL(m, "dump_rx_cnt_mode = 0x%02x\n", adapter->dump_rx_cnt_mode);
2192
2193
return 0;
2194
}
2195
ssize_t proc_set_rx_cnt_dump(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
2196
{
2197
struct net_device *dev = data;
2198
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
2199
char tmp[32];
2200
u8 dump_rx_cnt_mode;
2201
2202
if (count < 1)
2203
return -EFAULT;
2204
2205
if (count > sizeof(tmp)) {
2206
rtw_warn_on(1);
2207
return -EFAULT;
2208
}
2209
2210
if (buffer && !copy_from_user(tmp, buffer, count)) {
2211
2212
int num = sscanf(tmp, "%hhx", &dump_rx_cnt_mode);
2213
2214
if (num == 1) {
2215
rtw_dump_phy_rxcnts_preprocess(adapter, dump_rx_cnt_mode);
2216
adapter->dump_rx_cnt_mode = dump_rx_cnt_mode;
2217
}
2218
}
2219
2220
return count;
2221
}
2222
#endif
2223
2224
ssize_t proc_set_fwdl_test_case(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
2225
{
2226
char tmp[32];
2227
2228
if (count < 1)
2229
return -EFAULT;
2230
2231
if (count > sizeof(tmp)) {
2232
rtw_warn_on(1);
2233
return -EFAULT;
2234
}
2235
2236
if (buffer && !copy_from_user(tmp, buffer, count))
2237
sscanf(tmp, "%hhu %hhu", &fwdl_test_chksum_fail, &fwdl_test_wintint_rdy_fail);
2238
2239
return count;
2240
}
2241
2242
ssize_t proc_set_del_rx_ampdu_test_case(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
2243
{
2244
char tmp[32];
2245
2246
if (count < 1)
2247
return -EFAULT;
2248
2249
if (count > sizeof(tmp)) {
2250
rtw_warn_on(1);
2251
return -EFAULT;
2252
}
2253
2254
if (buffer && !copy_from_user(tmp, buffer, count))
2255
sscanf(tmp, "%hhu", &del_rx_ampdu_test_no_tx_fail);
2256
2257
return count;
2258
}
2259
2260
ssize_t proc_set_wait_hiq_empty(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
2261
{
2262
char tmp[32];
2263
2264
if (count < 1)
2265
return -EFAULT;
2266
2267
if (count > sizeof(tmp)) {
2268
rtw_warn_on(1);
2269
return -EFAULT;
2270
}
2271
2272
if (buffer && !copy_from_user(tmp, buffer, count))
2273
sscanf(tmp, "%u", &g_wait_hiq_empty_ms);
2274
2275
return count;
2276
}
2277
2278
ssize_t proc_set_sta_linking_test(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
2279
{
2280
char tmp[32];
2281
2282
if (count < 1)
2283
return -EFAULT;
2284
2285
if (count > sizeof(tmp)) {
2286
rtw_warn_on(1);
2287
return -EFAULT;
2288
}
2289
2290
if (buffer && !copy_from_user(tmp, buffer, count)) {
2291
u32 wait_ms = 0;
2292
u8 force_fail = 0;
2293
int num = sscanf(tmp, "%u %hhu", &wait_ms, &force_fail);
2294
2295
if (num >= 1)
2296
sta_linking_test_wait_ms = wait_ms;
2297
if (num >= 2)
2298
sta_linking_test_force_fail = force_fail;
2299
}
2300
2301
return count;
2302
}
2303
2304
#ifdef CONFIG_AP_MODE
2305
ssize_t proc_set_ap_linking_test(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
2306
{
2307
char tmp[32];
2308
2309
if (count < 1)
2310
return -EFAULT;
2311
2312
if (count > sizeof(tmp)) {
2313
rtw_warn_on(1);
2314
return -EFAULT;
2315
}
2316
2317
if (buffer && !copy_from_user(tmp, buffer, count)) {
2318
u16 force_auth_fail = 0;
2319
u16 force_asoc_fail = 0;
2320
int num = sscanf(tmp, "%hu %hu", &force_auth_fail, &force_asoc_fail);
2321
2322
if (num >= 1)
2323
ap_linking_test_force_auth_fail = force_auth_fail;
2324
if (num >= 2)
2325
ap_linking_test_force_asoc_fail = force_asoc_fail;
2326
}
2327
2328
return count;
2329
}
2330
#endif /* CONFIG_AP_MODE */
2331
2332
int proc_get_ps_dbg_info(struct seq_file *m, void *v)
2333
{
2334
struct net_device *dev = m->private;
2335
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
2336
struct dvobj_priv *dvobj = padapter->dvobj;
2337
struct debug_priv *pdbgpriv = &dvobj->drv_dbg;
2338
2339
RTW_PRINT_SEL(m, "dbg_sdio_alloc_irq_cnt=%d\n", pdbgpriv->dbg_sdio_alloc_irq_cnt);
2340
RTW_PRINT_SEL(m, "dbg_sdio_free_irq_cnt=%d\n", pdbgpriv->dbg_sdio_free_irq_cnt);
2341
RTW_PRINT_SEL(m, "dbg_sdio_alloc_irq_error_cnt=%d\n", pdbgpriv->dbg_sdio_alloc_irq_error_cnt);
2342
RTW_PRINT_SEL(m, "dbg_sdio_free_irq_error_cnt=%d\n", pdbgpriv->dbg_sdio_free_irq_error_cnt);
2343
RTW_PRINT_SEL(m, "dbg_sdio_init_error_cnt=%d\n", pdbgpriv->dbg_sdio_init_error_cnt);
2344
RTW_PRINT_SEL(m, "dbg_sdio_deinit_error_cnt=%d\n", pdbgpriv->dbg_sdio_deinit_error_cnt);
2345
RTW_PRINT_SEL(m, "dbg_suspend_error_cnt=%d\n", pdbgpriv->dbg_suspend_error_cnt);
2346
RTW_PRINT_SEL(m, "dbg_suspend_cnt=%d\n", pdbgpriv->dbg_suspend_cnt);
2347
RTW_PRINT_SEL(m, "dbg_resume_cnt=%d\n", pdbgpriv->dbg_resume_cnt);
2348
RTW_PRINT_SEL(m, "dbg_resume_error_cnt=%d\n", pdbgpriv->dbg_resume_error_cnt);
2349
RTW_PRINT_SEL(m, "dbg_deinit_fail_cnt=%d\n", pdbgpriv->dbg_deinit_fail_cnt);
2350
RTW_PRINT_SEL(m, "dbg_carddisable_cnt=%d\n", pdbgpriv->dbg_carddisable_cnt);
2351
RTW_PRINT_SEL(m, "dbg_ps_insuspend_cnt=%d\n", pdbgpriv->dbg_ps_insuspend_cnt);
2352
RTW_PRINT_SEL(m, "dbg_dev_unload_inIPS_cnt=%d\n", pdbgpriv->dbg_dev_unload_inIPS_cnt);
2353
RTW_PRINT_SEL(m, "dbg_scan_pwr_state_cnt=%d\n", pdbgpriv->dbg_scan_pwr_state_cnt);
2354
RTW_PRINT_SEL(m, "dbg_downloadfw_pwr_state_cnt=%d\n", pdbgpriv->dbg_downloadfw_pwr_state_cnt);
2355
RTW_PRINT_SEL(m, "dbg_carddisable_error_cnt=%d\n", pdbgpriv->dbg_carddisable_error_cnt);
2356
RTW_PRINT_SEL(m, "dbg_fw_read_ps_state_fail_cnt=%d\n", pdbgpriv->dbg_fw_read_ps_state_fail_cnt);
2357
RTW_PRINT_SEL(m, "dbg_leave_ips_fail_cnt=%d\n", pdbgpriv->dbg_leave_ips_fail_cnt);
2358
RTW_PRINT_SEL(m, "dbg_leave_lps_fail_cnt=%d\n", pdbgpriv->dbg_leave_lps_fail_cnt);
2359
RTW_PRINT_SEL(m, "dbg_h2c_leave32k_fail_cnt=%d\n", pdbgpriv->dbg_h2c_leave32k_fail_cnt);
2360
RTW_PRINT_SEL(m, "dbg_diswow_dload_fw_fail_cnt=%d\n", pdbgpriv->dbg_diswow_dload_fw_fail_cnt);
2361
RTW_PRINT_SEL(m, "dbg_enwow_dload_fw_fail_cnt=%d\n", pdbgpriv->dbg_enwow_dload_fw_fail_cnt);
2362
RTW_PRINT_SEL(m, "dbg_ips_drvopen_fail_cnt=%d\n", pdbgpriv->dbg_ips_drvopen_fail_cnt);
2363
RTW_PRINT_SEL(m, "dbg_poll_fail_cnt=%d\n", pdbgpriv->dbg_poll_fail_cnt);
2364
RTW_PRINT_SEL(m, "dbg_rpwm_toogle_cnt=%d\n", pdbgpriv->dbg_rpwm_toogle_cnt);
2365
RTW_PRINT_SEL(m, "dbg_rpwm_timeout_fail_cnt=%d\n", pdbgpriv->dbg_rpwm_timeout_fail_cnt);
2366
RTW_PRINT_SEL(m, "dbg_sreset_cnt=%d\n", pdbgpriv->dbg_sreset_cnt);
2367
RTW_PRINT_SEL(m, "dbg_fw_mem_dl_error_cnt=%d\n", pdbgpriv->dbg_fw_mem_dl_error_cnt);
2368
2369
return 0;
2370
}
2371
ssize_t proc_set_ps_dbg_info(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
2372
{
2373
struct net_device *dev = data;
2374
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
2375
struct dvobj_priv *dvobj = adapter->dvobj;
2376
struct debug_priv *pdbgpriv = &dvobj->drv_dbg;
2377
char tmp[32];
2378
u8 ps_dbg_cmd_id;
2379
2380
if (count < 1)
2381
return -EFAULT;
2382
2383
if (count > sizeof(tmp)) {
2384
rtw_warn_on(1);
2385
return -EFAULT;
2386
}
2387
2388
if (buffer && !copy_from_user(tmp, buffer, count)) {
2389
2390
int num = sscanf(tmp, "%hhx", &ps_dbg_cmd_id);
2391
2392
if (num == 1 && ps_dbg_cmd_id == 1) /*Clean all*/
2393
_rtw_memset(pdbgpriv, 0, sizeof(struct debug_priv));
2394
2395
}
2396
2397
return count;
2398
}
2399
2400
2401
#ifdef CONFIG_DBG_COUNTER
2402
2403
int proc_get_rx_logs(struct seq_file *m, void *v)
2404
{
2405
struct net_device *dev = m->private;
2406
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
2407
struct rx_logs *rx_logs = &padapter->rx_logs;
2408
2409
RTW_PRINT_SEL(m,
2410
"intf_rx=%d\n"
2411
"intf_rx_err_recvframe=%d\n"
2412
"intf_rx_err_skb=%d\n"
2413
"intf_rx_report=%d\n"
2414
"core_rx=%d\n"
2415
"core_rx_pre=%d\n"
2416
"core_rx_pre_ver_err=%d\n"
2417
"core_rx_pre_mgmt=%d\n"
2418
"core_rx_pre_mgmt_err_80211w=%d\n"
2419
"core_rx_pre_mgmt_err=%d\n"
2420
"core_rx_pre_ctrl=%d\n"
2421
"core_rx_pre_ctrl_err=%d\n"
2422
"core_rx_pre_data=%d\n"
2423
"core_rx_pre_data_wapi_seq_err=%d\n"
2424
"core_rx_pre_data_wapi_key_err=%d\n"
2425
"core_rx_pre_data_handled=%d\n"
2426
"core_rx_pre_data_err=%d\n"
2427
"core_rx_pre_data_unknown=%d\n"
2428
"core_rx_pre_unknown=%d\n"
2429
"core_rx_enqueue=%d\n"
2430
"core_rx_dequeue=%d\n"
2431
"core_rx_post=%d\n"
2432
"core_rx_post_decrypt=%d\n"
2433
"core_rx_post_decrypt_wep=%d\n"
2434
"core_rx_post_decrypt_tkip=%d\n"
2435
"core_rx_post_decrypt_aes=%d\n"
2436
"core_rx_post_decrypt_wapi=%d\n"
2437
"core_rx_post_decrypt_hw=%d\n"
2438
"core_rx_post_decrypt_unknown=%d\n"
2439
"core_rx_post_decrypt_err=%d\n"
2440
"core_rx_post_defrag_err=%d\n"
2441
"core_rx_post_portctrl_err=%d\n"
2442
"core_rx_post_indicate=%d\n"
2443
"core_rx_post_indicate_in_oder=%d\n"
2444
"core_rx_post_indicate_reoder=%d\n"
2445
"core_rx_post_indicate_err=%d\n"
2446
"os_indicate=%d\n"
2447
"os_indicate_ap_mcast=%d\n"
2448
"os_indicate_ap_forward=%d\n"
2449
"os_indicate_ap_self=%d\n"
2450
"os_indicate_err=%d\n"
2451
"os_netif_ok=%d\n"
2452
"os_netif_err=%d\n",
2453
rx_logs->intf_rx,
2454
rx_logs->intf_rx_err_recvframe,
2455
rx_logs->intf_rx_err_skb,
2456
rx_logs->intf_rx_report,
2457
rx_logs->core_rx,
2458
rx_logs->core_rx_pre,
2459
rx_logs->core_rx_pre_ver_err,
2460
rx_logs->core_rx_pre_mgmt,
2461
rx_logs->core_rx_pre_mgmt_err_80211w,
2462
rx_logs->core_rx_pre_mgmt_err,
2463
rx_logs->core_rx_pre_ctrl,
2464
rx_logs->core_rx_pre_ctrl_err,
2465
rx_logs->core_rx_pre_data,
2466
rx_logs->core_rx_pre_data_wapi_seq_err,
2467
rx_logs->core_rx_pre_data_wapi_key_err,
2468
rx_logs->core_rx_pre_data_handled,
2469
rx_logs->core_rx_pre_data_err,
2470
rx_logs->core_rx_pre_data_unknown,
2471
rx_logs->core_rx_pre_unknown,
2472
rx_logs->core_rx_enqueue,
2473
rx_logs->core_rx_dequeue,
2474
rx_logs->core_rx_post,
2475
rx_logs->core_rx_post_decrypt,
2476
rx_logs->core_rx_post_decrypt_wep,
2477
rx_logs->core_rx_post_decrypt_tkip,
2478
rx_logs->core_rx_post_decrypt_aes,
2479
rx_logs->core_rx_post_decrypt_wapi,
2480
rx_logs->core_rx_post_decrypt_hw,
2481
rx_logs->core_rx_post_decrypt_unknown,
2482
rx_logs->core_rx_post_decrypt_err,
2483
rx_logs->core_rx_post_defrag_err,
2484
rx_logs->core_rx_post_portctrl_err,
2485
rx_logs->core_rx_post_indicate,
2486
rx_logs->core_rx_post_indicate_in_oder,
2487
rx_logs->core_rx_post_indicate_reoder,
2488
rx_logs->core_rx_post_indicate_err,
2489
rx_logs->os_indicate,
2490
rx_logs->os_indicate_ap_mcast,
2491
rx_logs->os_indicate_ap_forward,
2492
rx_logs->os_indicate_ap_self,
2493
rx_logs->os_indicate_err,
2494
rx_logs->os_netif_ok,
2495
rx_logs->os_netif_err
2496
);
2497
2498
return 0;
2499
}
2500
2501
int proc_get_tx_logs(struct seq_file *m, void *v)
2502
{
2503
struct net_device *dev = m->private;
2504
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
2505
struct tx_logs *tx_logs = &padapter->tx_logs;
2506
2507
RTW_PRINT_SEL(m,
2508
"os_tx=%d\n"
2509
"os_tx_err_up=%d\n"
2510
"os_tx_err_xmit=%d\n"
2511
"os_tx_m2u=%d\n"
2512
"os_tx_m2u_ignore_fw_linked=%d\n"
2513
"os_tx_m2u_ignore_self=%d\n"
2514
"os_tx_m2u_entry=%d\n"
2515
"os_tx_m2u_entry_err_xmit=%d\n"
2516
"os_tx_m2u_entry_err_skb=%d\n"
2517
"os_tx_m2u_stop=%d\n"
2518
"core_tx=%d\n"
2519
"core_tx_err_pxmitframe=%d\n"
2520
"core_tx_err_brtx=%d\n"
2521
"core_tx_upd_attrib=%d\n"
2522
"core_tx_upd_attrib_adhoc=%d\n"
2523
"core_tx_upd_attrib_sta=%d\n"
2524
"core_tx_upd_attrib_ap=%d\n"
2525
"core_tx_upd_attrib_unknown=%d\n"
2526
"core_tx_upd_attrib_dhcp=%d\n"
2527
"core_tx_upd_attrib_icmp=%d\n"
2528
"core_tx_upd_attrib_active=%d\n"
2529
"core_tx_upd_attrib_err_ucast_sta=%d\n"
2530
"core_tx_upd_attrib_err_ucast_ap_link=%d\n"
2531
"core_tx_upd_attrib_err_sta=%d\n"
2532
"core_tx_upd_attrib_err_link=%d\n"
2533
"core_tx_upd_attrib_err_sec=%d\n"
2534
"core_tx_ap_enqueue_warn_fwstate=%d\n"
2535
"core_tx_ap_enqueue_warn_sta=%d\n"
2536
"core_tx_ap_enqueue_warn_nosta=%d\n"
2537
"core_tx_ap_enqueue_warn_link=%d\n"
2538
"core_tx_ap_enqueue_warn_trigger=%d\n"
2539
"core_tx_ap_enqueue_mcast=%d\n"
2540
"core_tx_ap_enqueue_ucast=%d\n"
2541
"core_tx_ap_enqueue=%d\n"
2542
"intf_tx=%d\n"
2543
"intf_tx_pending_ac=%d\n"
2544
"intf_tx_pending_fw_under_survey=%d\n"
2545
"intf_tx_pending_fw_under_linking=%d\n"
2546
"intf_tx_pending_xmitbuf=%d\n"
2547
"intf_tx_enqueue=%d\n"
2548
"core_tx_enqueue=%d\n"
2549
"core_tx_enqueue_class=%d\n"
2550
"core_tx_enqueue_class_err_sta=%d\n"
2551
"core_tx_enqueue_class_err_nosta=%d\n"
2552
"core_tx_enqueue_class_err_fwlink=%d\n"
2553
"intf_tx_direct=%d\n"
2554
"intf_tx_direct_err_coalesce=%d\n"
2555
"intf_tx_dequeue=%d\n"
2556
"intf_tx_dequeue_err_coalesce=%d\n"
2557
"intf_tx_dump_xframe=%d\n"
2558
"intf_tx_dump_xframe_err_txdesc=%d\n"
2559
"intf_tx_dump_xframe_err_port=%d\n",
2560
tx_logs->os_tx,
2561
tx_logs->os_tx_err_up,
2562
tx_logs->os_tx_err_xmit,
2563
tx_logs->os_tx_m2u,
2564
tx_logs->os_tx_m2u_ignore_fw_linked,
2565
tx_logs->os_tx_m2u_ignore_self,
2566
tx_logs->os_tx_m2u_entry,
2567
tx_logs->os_tx_m2u_entry_err_xmit,
2568
tx_logs->os_tx_m2u_entry_err_skb,
2569
tx_logs->os_tx_m2u_stop,
2570
tx_logs->core_tx,
2571
tx_logs->core_tx_err_pxmitframe,
2572
tx_logs->core_tx_err_brtx,
2573
tx_logs->core_tx_upd_attrib,
2574
tx_logs->core_tx_upd_attrib_adhoc,
2575
tx_logs->core_tx_upd_attrib_sta,
2576
tx_logs->core_tx_upd_attrib_ap,
2577
tx_logs->core_tx_upd_attrib_unknown,
2578
tx_logs->core_tx_upd_attrib_dhcp,
2579
tx_logs->core_tx_upd_attrib_icmp,
2580
tx_logs->core_tx_upd_attrib_active,
2581
tx_logs->core_tx_upd_attrib_err_ucast_sta,
2582
tx_logs->core_tx_upd_attrib_err_ucast_ap_link,
2583
tx_logs->core_tx_upd_attrib_err_sta,
2584
tx_logs->core_tx_upd_attrib_err_link,
2585
tx_logs->core_tx_upd_attrib_err_sec,
2586
tx_logs->core_tx_ap_enqueue_warn_fwstate,
2587
tx_logs->core_tx_ap_enqueue_warn_sta,
2588
tx_logs->core_tx_ap_enqueue_warn_nosta,
2589
tx_logs->core_tx_ap_enqueue_warn_link,
2590
tx_logs->core_tx_ap_enqueue_warn_trigger,
2591
tx_logs->core_tx_ap_enqueue_mcast,
2592
tx_logs->core_tx_ap_enqueue_ucast,
2593
tx_logs->core_tx_ap_enqueue,
2594
tx_logs->intf_tx,
2595
tx_logs->intf_tx_pending_ac,
2596
tx_logs->intf_tx_pending_fw_under_survey,
2597
tx_logs->intf_tx_pending_fw_under_linking,
2598
tx_logs->intf_tx_pending_xmitbuf,
2599
tx_logs->intf_tx_enqueue,
2600
tx_logs->core_tx_enqueue,
2601
tx_logs->core_tx_enqueue_class,
2602
tx_logs->core_tx_enqueue_class_err_sta,
2603
tx_logs->core_tx_enqueue_class_err_nosta,
2604
tx_logs->core_tx_enqueue_class_err_fwlink,
2605
tx_logs->intf_tx_direct,
2606
tx_logs->intf_tx_direct_err_coalesce,
2607
tx_logs->intf_tx_dequeue,
2608
tx_logs->intf_tx_dequeue_err_coalesce,
2609
tx_logs->intf_tx_dump_xframe,
2610
tx_logs->intf_tx_dump_xframe_err_txdesc,
2611
tx_logs->intf_tx_dump_xframe_err_port
2612
);
2613
2614
return 0;
2615
}
2616
2617
int proc_get_int_logs(struct seq_file *m, void *v)
2618
{
2619
struct net_device *dev = m->private;
2620
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
2621
2622
RTW_PRINT_SEL(m,
2623
"all=%d\n"
2624
"err=%d\n"
2625
"tbdok=%d\n"
2626
"tbder=%d\n"
2627
"bcnderr=%d\n"
2628
"bcndma=%d\n"
2629
"bcndma_e=%d\n"
2630
"rx=%d\n"
2631
"rx_rdu=%d\n"
2632
"rx_fovw=%d\n"
2633
"txfovw=%d\n"
2634
"mgntok=%d\n"
2635
"highdok=%d\n"
2636
"bkdok=%d\n"
2637
"bedok=%d\n"
2638
"vidok=%d\n"
2639
"vodok=%d\n",
2640
padapter->int_logs.all,
2641
padapter->int_logs.err,
2642
padapter->int_logs.tbdok,
2643
padapter->int_logs.tbder,
2644
padapter->int_logs.bcnderr,
2645
padapter->int_logs.bcndma,
2646
padapter->int_logs.bcndma_e,
2647
padapter->int_logs.rx,
2648
padapter->int_logs.rx_rdu,
2649
padapter->int_logs.rx_fovw,
2650
padapter->int_logs.txfovw,
2651
padapter->int_logs.mgntok,
2652
padapter->int_logs.highdok,
2653
padapter->int_logs.bkdok,
2654
padapter->int_logs.bedok,
2655
padapter->int_logs.vidok,
2656
padapter->int_logs.vodok
2657
);
2658
2659
return 0;
2660
}
2661
2662
#endif /* CONFIG_DBG_COUNTER */
2663
2664
int proc_get_hw_status(struct seq_file *m, void *v)
2665
{
2666
struct net_device *dev = m->private;
2667
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
2668
struct dvobj_priv *dvobj = padapter->dvobj;
2669
struct debug_priv *pdbgpriv = &dvobj->drv_dbg;
2670
struct registry_priv *regsty = dvobj_to_regsty(dvobj);
2671
2672
if (regsty->check_hw_status == 0)
2673
RTW_PRINT_SEL(m, "RX FIFO full count: not check in watch dog\n");
2674
else if (pdbgpriv->dbg_rx_fifo_last_overflow == 1
2675
&& pdbgpriv->dbg_rx_fifo_curr_overflow == 1
2676
&& pdbgpriv->dbg_rx_fifo_diff_overflow == 1
2677
)
2678
RTW_PRINT_SEL(m, "RX FIFO full count: no implementation\n");
2679
else {
2680
RTW_PRINT_SEL(m, "RX FIFO full count: last_time=%llu, current_time=%llu, differential=%llu\n"
2681
, pdbgpriv->dbg_rx_fifo_last_overflow, pdbgpriv->dbg_rx_fifo_curr_overflow, pdbgpriv->dbg_rx_fifo_diff_overflow);
2682
}
2683
2684
return 0;
2685
}
2686
2687
ssize_t proc_set_hw_status(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
2688
{
2689
struct net_device *dev = data;
2690
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
2691
struct dvobj_priv *dvobj = padapter->dvobj;
2692
struct registry_priv *regsty = dvobj_to_regsty(dvobj);
2693
char tmp[32];
2694
u32 enable;
2695
2696
if (count < 1)
2697
return -EFAULT;
2698
2699
if (count > sizeof(tmp)) {
2700
rtw_warn_on(1);
2701
return -EFAULT;
2702
}
2703
2704
if (buffer && !copy_from_user(tmp, buffer, count)) {
2705
2706
int num = sscanf(tmp, "%d ", &enable);
2707
2708
if (num == 1 && regsty && enable <= 1) {
2709
regsty->check_hw_status = enable;
2710
RTW_INFO("check_hw_status=%d\n", regsty->check_hw_status);
2711
}
2712
}
2713
2714
return count;
2715
}
2716
2717
#ifdef CONFIG_HUAWEI_PROC
2718
int proc_get_huawei_trx_info(struct seq_file *sel, void *v)
2719
{
2720
struct net_device *dev = sel->private;
2721
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
2722
struct dm_struct *dm = adapter_to_phydm(padapter);
2723
struct sta_info *psta;
2724
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
2725
struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj);
2726
struct ra_sta_info *ra_info;
2727
u8 curr_tx_sgi = _FALSE;
2728
u8 curr_tx_rate = 0;
2729
u8 mac_id;
2730
#ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA
2731
u8 isCCKrate, rf_path;
2732
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter);
2733
struct rx_raw_rssi *psample_pkt_rssi = &padapter->recvpriv.raw_rssi_info;
2734
#endif
2735
2736
if (!dm->is_linked) {
2737
RTW_PRINT_SEL(sel, "NO link\n\n");
2738
return 0;
2739
}
2740
2741
/*============ tx info ============ */
2742
for (mac_id = 0; mac_id < macid_ctl->num; mac_id++) {
2743
if (rtw_macid_is_used(macid_ctl, mac_id) && !rtw_macid_is_bmc(macid_ctl, mac_id)) {
2744
psta = macid_ctl->sta[mac_id];
2745
if (!psta)
2746
continue;
2747
2748
RTW_PRINT_SEL(sel, "STA [" MAC_FMT "]\n", MAC_ARG(psta->cmn.mac_addr));
2749
2750
ra_info = &psta->cmn.ra_info;
2751
curr_tx_sgi = rtw_get_current_tx_sgi(padapter, psta);
2752
curr_tx_rate = rtw_get_current_tx_rate(padapter, psta);
2753
RTW_PRINT_SEL(sel, "curr_tx_rate : %s (%s)\n",
2754
HDATA_RATE(curr_tx_rate), (curr_tx_sgi) ? "S" : "L");
2755
RTW_PRINT_SEL(sel, "curr_tx_bw : %s\n", ch_width_str(ra_info->curr_tx_bw));
2756
}
2757
}
2758
2759
/*============ rx info ============ */
2760
RTW_PRINT_SEL(sel, "rx_rate : %s\n", HDATA_RATE(dm->rx_rate));
2761
#ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA
2762
isCCKrate = (psample_pkt_rssi->data_rate <= DESC_RATE11M) ? TRUE : FALSE;
2763
2764
for (rf_path = 0; rf_path < pHalData->NumTotalRFPath; rf_path++) {
2765
if (!isCCKrate)
2766
_RTW_PRINT_SEL(sel , "RF_PATH_%d : rx_ofdm_pwr:%d(dBm), rx_ofdm_snr:%d(dB)\n",
2767
rf_path, psample_pkt_rssi->ofdm_pwr[rf_path], psample_pkt_rssi->ofdm_snr[rf_path]);
2768
}
2769
#endif
2770
RTW_PRINT_SEL(sel, "\n");
2771
return 0;
2772
}
2773
#endif /* CONFIG_HUAWEI_PROC */
2774
2775
int proc_get_trx_info_debug(struct seq_file *m, void *v)
2776
{
2777
struct net_device *dev = m->private;
2778
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
2779
2780
/*============ tx info ============ */
2781
rtw_hal_get_def_var(padapter, HW_DEF_RA_INFO_DUMP, m);
2782
2783
/*============ rx info ============ */
2784
rtw_hal_set_odm_var(padapter, HAL_ODM_RX_INFO_DUMP, m, _FALSE);
2785
2786
return 0;
2787
}
2788
2789
int proc_get_rx_signal(struct seq_file *m, void *v)
2790
{
2791
struct net_device *dev = m->private;
2792
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
2793
2794
RTW_PRINT_SEL(m, "rssi:%d\n", padapter->recvpriv.rssi);
2795
#ifdef CONFIG_MP_INCLUDED
2796
if (padapter->registrypriv.mp_mode == 1) {
2797
struct dm_struct *odm = adapter_to_phydm(padapter);
2798
if (padapter->mppriv.antenna_rx == ANTENNA_A)
2799
RTW_PRINT_SEL(m, "Antenna: A\n");
2800
else if (padapter->mppriv.antenna_rx == ANTENNA_B)
2801
RTW_PRINT_SEL(m, "Antenna: B\n");
2802
else if (padapter->mppriv.antenna_rx == ANTENNA_C)
2803
RTW_PRINT_SEL(m, "Antenna: C\n");
2804
else if (padapter->mppriv.antenna_rx == ANTENNA_D)
2805
RTW_PRINT_SEL(m, "Antenna: D\n");
2806
else if (padapter->mppriv.antenna_rx == ANTENNA_AB)
2807
RTW_PRINT_SEL(m, "Antenna: AB\n");
2808
else if (padapter->mppriv.antenna_rx == ANTENNA_BC)
2809
RTW_PRINT_SEL(m, "Antenna: BC\n");
2810
else if (padapter->mppriv.antenna_rx == ANTENNA_CD)
2811
RTW_PRINT_SEL(m, "Antenna: CD\n");
2812
else
2813
RTW_PRINT_SEL(m, "Antenna: __\n");
2814
2815
RTW_PRINT_SEL(m, "rx_rate = %s\n", HDATA_RATE(odm->rx_rate));
2816
return 0;
2817
} else
2818
#endif
2819
{
2820
/* RTW_PRINT_SEL(m, "rxpwdb:%d\n", padapter->recvpriv.rxpwdb); */
2821
RTW_PRINT_SEL(m, "signal_strength:%u\n", padapter->recvpriv.signal_strength);
2822
RTW_PRINT_SEL(m, "signal_qual:%u\n", padapter->recvpriv.signal_qual);
2823
}
2824
#ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA
2825
rtw_odm_get_perpkt_rssi(m, padapter);
2826
rtw_get_raw_rssi_info(m, padapter);
2827
#endif
2828
return 0;
2829
}
2830
2831
ssize_t proc_set_rx_signal(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
2832
{
2833
struct net_device *dev = data;
2834
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
2835
char tmp[32];
2836
u32 is_signal_dbg, signal_strength;
2837
2838
if (count < 1)
2839
return -EFAULT;
2840
2841
if (count > sizeof(tmp)) {
2842
rtw_warn_on(1);
2843
return -EFAULT;
2844
}
2845
2846
if (buffer && !copy_from_user(tmp, buffer, count)) {
2847
2848
int num = sscanf(tmp, "%u %u", &is_signal_dbg, &signal_strength);
2849
2850
if (num < 1)
2851
return count;
2852
2853
is_signal_dbg = is_signal_dbg == 0 ? 0 : 1;
2854
2855
if (is_signal_dbg && num < 2)
2856
return count;
2857
2858
signal_strength = signal_strength > 100 ? 100 : signal_strength;
2859
2860
padapter->recvpriv.is_signal_dbg = is_signal_dbg;
2861
padapter->recvpriv.signal_strength_dbg = signal_strength;
2862
2863
if (is_signal_dbg)
2864
RTW_INFO("set %s %u\n", "DBG_SIGNAL_STRENGTH", signal_strength);
2865
else
2866
RTW_INFO("set %s\n", "HW_SIGNAL_STRENGTH");
2867
2868
}
2869
2870
return count;
2871
2872
}
2873
2874
int proc_get_mac_rptbuf(struct seq_file *m, void *v)
2875
{
2876
#ifdef CONFIG_RTL8814A
2877
struct net_device *dev = m->private;
2878
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
2879
u16 i;
2880
u16 mac_id;
2881
u32 shcut_addr = 0;
2882
u32 read_addr = 0;
2883
2884
RTW_PRINT_SEL(m, "TX ShortCut:\n");
2885
for (mac_id = 0; mac_id < 64; mac_id++) {
2886
rtw_write16(padapter, 0x140, 0x662 | ((mac_id & BIT5) >> 5));
2887
shcut_addr = 0x8000;
2888
shcut_addr = shcut_addr | ((mac_id & 0x1f) << 7);
2889
RTW_PRINT_SEL(m, "mac_id=%d, 0x140=%x =>\n", mac_id, 0x662 | ((mac_id & BIT5) >> 5));
2890
for (i = 0; i < 30; i++) {
2891
read_addr = 0;
2892
read_addr = shcut_addr | (i << 2);
2893
RTW_PRINT_SEL(m, "i=%02d: MAC_%04x= %08x ", i, read_addr, rtw_read32(padapter, read_addr));
2894
if (!((i + 1) % 4))
2895
RTW_PRINT_SEL(m, "\n");
2896
if (i == 29)
2897
RTW_PRINT_SEL(m, "\n");
2898
}
2899
}
2900
#endif /* CONFIG_RTL8814A */
2901
return 0;
2902
}
2903
2904
#ifdef CONFIG_80211N_HT
2905
2906
int proc_get_ht_enable(struct seq_file *m, void *v)
2907
{
2908
struct net_device *dev = m->private;
2909
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
2910
struct registry_priv *pregpriv = &padapter->registrypriv;
2911
2912
if (pregpriv)
2913
RTW_PRINT_SEL(m, "%d\n", pregpriv->ht_enable);
2914
2915
return 0;
2916
}
2917
2918
ssize_t proc_set_ht_enable(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
2919
{
2920
struct net_device *dev = data;
2921
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
2922
struct registry_priv *pregpriv = &padapter->registrypriv;
2923
char tmp[32];
2924
u32 mode;
2925
2926
if (count < 1)
2927
return -EFAULT;
2928
2929
if (count > sizeof(tmp)) {
2930
rtw_warn_on(1);
2931
return -EFAULT;
2932
}
2933
2934
if (buffer && !copy_from_user(tmp, buffer, count)) {
2935
2936
int num = sscanf(tmp, "%d ", &mode);
2937
2938
if ( num == 1 && pregpriv && mode < 2) {
2939
pregpriv->ht_enable = mode;
2940
RTW_INFO("ht_enable=%d\n", pregpriv->ht_enable);
2941
}
2942
}
2943
2944
return count;
2945
2946
}
2947
2948
int proc_get_bw_mode(struct seq_file *m, void *v)
2949
{
2950
struct net_device *dev = m->private;
2951
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
2952
struct registry_priv *pregpriv = &padapter->registrypriv;
2953
2954
if (pregpriv)
2955
RTW_PRINT_SEL(m, "0x%02x\n", pregpriv->bw_mode);
2956
2957
return 0;
2958
}
2959
2960
ssize_t proc_set_bw_mode(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
2961
{
2962
struct net_device *dev = data;
2963
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
2964
struct registry_priv *pregpriv = &padapter->registrypriv;
2965
char tmp[32];
2966
u32 mode;
2967
u8 bw_2g;
2968
u8 bw_5g;
2969
2970
if (count < 1)
2971
return -EFAULT;
2972
2973
if (count > sizeof(tmp)) {
2974
rtw_warn_on(1);
2975
return -EFAULT;
2976
}
2977
2978
if (buffer && !copy_from_user(tmp, buffer, count)) {
2979
2980
int num = sscanf(tmp, "%x ", &mode);
2981
bw_5g = mode >> 4;
2982
bw_2g = mode & 0x0f;
2983
2984
if (num == 1 && pregpriv && bw_2g <= 4 && bw_5g <= 4) {
2985
pregpriv->bw_mode = mode;
2986
printk("bw_mode=0x%x\n", mode);
2987
}
2988
}
2989
2990
return count;
2991
2992
}
2993
2994
int proc_get_ampdu_enable(struct seq_file *m, void *v)
2995
{
2996
struct net_device *dev = m->private;
2997
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
2998
struct registry_priv *pregpriv = &padapter->registrypriv;
2999
3000
if (pregpriv)
3001
RTW_PRINT_SEL(m, "%d\n", pregpriv->ampdu_enable);
3002
3003
return 0;
3004
}
3005
3006
ssize_t proc_set_ampdu_enable(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
3007
{
3008
struct net_device *dev = data;
3009
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3010
struct registry_priv *pregpriv = &padapter->registrypriv;
3011
char tmp[32];
3012
u32 mode;
3013
3014
if (count < 1)
3015
return -EFAULT;
3016
3017
if (count > sizeof(tmp)) {
3018
rtw_warn_on(1);
3019
return -EFAULT;
3020
}
3021
3022
if (buffer && !copy_from_user(tmp, buffer, count)) {
3023
3024
int num = sscanf(tmp, "%d ", &mode);
3025
3026
if (num == 1 && pregpriv && mode < 2) {
3027
pregpriv->ampdu_enable = mode;
3028
printk("ampdu_enable=%d\n", mode);
3029
}
3030
3031
}
3032
3033
return count;
3034
3035
}
3036
3037
3038
void dump_regsty_rx_ampdu_size_limit(void *sel, _adapter *adapter)
3039
{
3040
struct registry_priv *regsty = adapter_to_regsty(adapter);
3041
int i;
3042
3043
RTW_PRINT_SEL(sel, "%-3s %-3s %-3s %-3s %-4s\n"
3044
, "", "20M", "40M", "80M", "160M");
3045
for (i = 0; i < 4; i++)
3046
RTW_PRINT_SEL(sel, "%dSS %3u %3u %3u %4u\n", i + 1
3047
, regsty->rx_ampdu_sz_limit_by_nss_bw[i][0]
3048
, regsty->rx_ampdu_sz_limit_by_nss_bw[i][1]
3049
, regsty->rx_ampdu_sz_limit_by_nss_bw[i][2]
3050
, regsty->rx_ampdu_sz_limit_by_nss_bw[i][3]);
3051
}
3052
3053
int proc_get_rx_ampdu(struct seq_file *m, void *v)
3054
{
3055
struct net_device *dev = m->private;
3056
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3057
3058
_RTW_PRINT_SEL(m, "accept: ");
3059
if (padapter->fix_rx_ampdu_accept == RX_AMPDU_ACCEPT_INVALID)
3060
RTW_PRINT_SEL(m, "%u%s\n", rtw_rx_ampdu_is_accept(padapter), "(auto)");
3061
else
3062
RTW_PRINT_SEL(m, "%u%s\n", padapter->fix_rx_ampdu_accept, "(fixed)");
3063
3064
_RTW_PRINT_SEL(m, "size: ");
3065
if (padapter->fix_rx_ampdu_size == RX_AMPDU_SIZE_INVALID) {
3066
RTW_PRINT_SEL(m, "%u%s\n", rtw_rx_ampdu_size(padapter), "(auto) with conditional limit:");
3067
dump_regsty_rx_ampdu_size_limit(m, padapter);
3068
} else
3069
RTW_PRINT_SEL(m, "%u%s\n", padapter->fix_rx_ampdu_size, "(fixed)");
3070
RTW_PRINT_SEL(m, "\n");
3071
3072
RTW_PRINT_SEL(m, "%19s %17s\n", "fix_rx_ampdu_accept", "fix_rx_ampdu_size");
3073
3074
_RTW_PRINT_SEL(m, "%-19d %-17u\n"
3075
, padapter->fix_rx_ampdu_accept
3076
, padapter->fix_rx_ampdu_size);
3077
3078
return 0;
3079
}
3080
3081
ssize_t proc_set_rx_ampdu(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
3082
{
3083
struct net_device *dev = data;
3084
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3085
char tmp[32];
3086
u8 accept;
3087
u8 size;
3088
3089
if (count < 1)
3090
return -EFAULT;
3091
3092
if (count > sizeof(tmp)) {
3093
rtw_warn_on(1);
3094
return -EFAULT;
3095
}
3096
3097
if (buffer && !copy_from_user(tmp, buffer, count)) {
3098
3099
int num = sscanf(tmp, "%hhu %hhu", &accept, &size);
3100
3101
if (num >= 1)
3102
rtw_rx_ampdu_set_accept(padapter, accept, RX_AMPDU_DRV_FIXED);
3103
if (num >= 2)
3104
rtw_rx_ampdu_set_size(padapter, size, RX_AMPDU_DRV_FIXED);
3105
3106
rtw_rx_ampdu_apply(padapter);
3107
}
3108
3109
return count;
3110
}
3111
3112
int proc_get_rx_ampdu_factor(struct seq_file *m, void *v)
3113
{
3114
struct net_device *dev = m->private;
3115
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3116
3117
3118
if (padapter)
3119
RTW_PRINT_SEL(m, "rx ampdu factor = %x\n", padapter->driver_rx_ampdu_factor);
3120
3121
return 0;
3122
}
3123
3124
ssize_t proc_set_rx_ampdu_factor(struct file *file, const char __user *buffer
3125
, size_t count, loff_t *pos, void *data)
3126
{
3127
struct net_device *dev = data;
3128
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3129
char tmp[32];
3130
u32 factor;
3131
3132
if (count < 1)
3133
return -EFAULT;
3134
3135
if (count > sizeof(tmp)) {
3136
rtw_warn_on(1);
3137
return -EFAULT;
3138
}
3139
3140
if (buffer && !copy_from_user(tmp, buffer, count)) {
3141
3142
int num = sscanf(tmp, "%d ", &factor);
3143
3144
if (padapter && (num == 1)) {
3145
RTW_INFO("padapter->driver_rx_ampdu_factor = %x\n", factor);
3146
3147
if (factor > 0x03)
3148
padapter->driver_rx_ampdu_factor = 0xFF;
3149
else
3150
padapter->driver_rx_ampdu_factor = factor;
3151
}
3152
}
3153
3154
return count;
3155
}
3156
3157
int proc_get_tx_max_agg_num(struct seq_file *m, void *v)
3158
{
3159
struct net_device *dev = m->private;
3160
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3161
3162
3163
if (padapter)
3164
RTW_PRINT_SEL(m, "tx max AMPDU num = 0x%02x\n", padapter->driver_tx_max_agg_num);
3165
3166
return 0;
3167
}
3168
3169
ssize_t proc_set_tx_max_agg_num(struct file *file, const char __user *buffer
3170
, size_t count, loff_t *pos, void *data)
3171
{
3172
struct net_device *dev = data;
3173
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3174
char tmp[32];
3175
u8 agg_num;
3176
3177
if (count < 1)
3178
return -EFAULT;
3179
3180
if (count > sizeof(tmp)) {
3181
rtw_warn_on(1);
3182
return -EFAULT;
3183
}
3184
3185
if (buffer && !copy_from_user(tmp, buffer, count)) {
3186
3187
int num = sscanf(tmp, "%hhx ", &agg_num);
3188
3189
if (padapter && (num == 1)) {
3190
RTW_INFO("padapter->driver_tx_max_agg_num = 0x%02x\n", agg_num);
3191
3192
padapter->driver_tx_max_agg_num = agg_num;
3193
}
3194
}
3195
3196
return count;
3197
}
3198
3199
int proc_get_rx_ampdu_density(struct seq_file *m, void *v)
3200
{
3201
struct net_device *dev = m->private;
3202
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3203
3204
3205
if (padapter)
3206
RTW_PRINT_SEL(m, "rx ampdu densityg = %x\n", padapter->driver_rx_ampdu_spacing);
3207
3208
return 0;
3209
}
3210
3211
ssize_t proc_set_rx_ampdu_density(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
3212
{
3213
struct net_device *dev = data;
3214
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3215
char tmp[32];
3216
u32 density;
3217
3218
if (count < 1)
3219
return -EFAULT;
3220
3221
if (count > sizeof(tmp)) {
3222
rtw_warn_on(1);
3223
return -EFAULT;
3224
}
3225
3226
if (buffer && !copy_from_user(tmp, buffer, count)) {
3227
3228
int num = sscanf(tmp, "%d ", &density);
3229
3230
if (padapter && (num == 1)) {
3231
RTW_INFO("padapter->driver_rx_ampdu_spacing = %x\n", density);
3232
3233
if (density > 0x07)
3234
padapter->driver_rx_ampdu_spacing = 0xFF;
3235
else
3236
padapter->driver_rx_ampdu_spacing = density;
3237
}
3238
}
3239
3240
return count;
3241
}
3242
3243
int proc_get_tx_ampdu_density(struct seq_file *m, void *v)
3244
{
3245
struct net_device *dev = m->private;
3246
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3247
3248
3249
if (padapter)
3250
RTW_PRINT_SEL(m, "tx ampdu density = %x\n", padapter->driver_ampdu_spacing);
3251
3252
return 0;
3253
}
3254
3255
ssize_t proc_set_tx_ampdu_density(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
3256
{
3257
struct net_device *dev = data;
3258
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3259
char tmp[32];
3260
u32 density;
3261
3262
if (count < 1)
3263
return -EFAULT;
3264
3265
if (count > sizeof(tmp)) {
3266
rtw_warn_on(1);
3267
return -EFAULT;
3268
}
3269
3270
if (buffer && !copy_from_user(tmp, buffer, count)) {
3271
3272
int num = sscanf(tmp, "%d ", &density);
3273
3274
if (padapter && (num == 1)) {
3275
RTW_INFO("padapter->driver_ampdu_spacing = %x\n", density);
3276
3277
if (density > 0x07)
3278
padapter->driver_ampdu_spacing = 0xFF;
3279
else
3280
padapter->driver_ampdu_spacing = density;
3281
}
3282
}
3283
3284
return count;
3285
}
3286
3287
#ifdef CONFIG_TX_AMSDU
3288
int proc_get_tx_amsdu(struct seq_file *m, void *v)
3289
{
3290
struct net_device *dev = m->private;
3291
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3292
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
3293
3294
if (padapter)
3295
{
3296
RTW_PRINT_SEL(m, "tx amsdu = %d\n", padapter->tx_amsdu);
3297
RTW_PRINT_SEL(m, "amsdu set timer conut = %u\n", pxmitpriv->amsdu_debug_set_timer);
3298
RTW_PRINT_SEL(m, "amsdu time out count = %u\n", pxmitpriv->amsdu_debug_timeout);
3299
RTW_PRINT_SEL(m, "amsdu coalesce one count = %u\n", pxmitpriv->amsdu_debug_coalesce_one);
3300
RTW_PRINT_SEL(m, "amsdu coalesce two count = %u\n", pxmitpriv->amsdu_debug_coalesce_two);
3301
}
3302
3303
return 0;
3304
}
3305
3306
ssize_t proc_set_tx_amsdu(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
3307
{
3308
struct net_device *dev = data;
3309
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3310
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
3311
char tmp[32];
3312
u32 amsdu;
3313
3314
if (count < 1)
3315
return -EFAULT;
3316
3317
if (count > sizeof(tmp)) {
3318
rtw_warn_on(1);
3319
return -EFAULT;
3320
}
3321
3322
if (buffer && !copy_from_user(tmp, buffer, count)) {
3323
3324
int num = sscanf(tmp, "%d ", &amsdu);
3325
3326
if (padapter && (num == 1)) {
3327
RTW_INFO("padapter->tx_amsdu = %x\n", amsdu);
3328
3329
if (amsdu > 3)
3330
padapter->tx_amsdu = 0;
3331
else if(amsdu == 3)
3332
{
3333
pxmitpriv->amsdu_debug_set_timer = 0;
3334
pxmitpriv->amsdu_debug_timeout = 0;
3335
pxmitpriv->amsdu_debug_coalesce_one = 0;
3336
pxmitpriv->amsdu_debug_coalesce_two = 0;
3337
}
3338
else
3339
padapter->tx_amsdu = amsdu;
3340
}
3341
}
3342
3343
return count;
3344
}
3345
3346
int proc_get_tx_amsdu_rate(struct seq_file *m, void *v)
3347
{
3348
struct net_device *dev = m->private;
3349
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3350
3351
if (padapter)
3352
RTW_PRINT_SEL(m, "tx amsdu rate = %d Mbps\n", padapter->tx_amsdu_rate);
3353
3354
return 0;
3355
}
3356
3357
ssize_t proc_set_tx_amsdu_rate(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
3358
{
3359
struct net_device *dev = data;
3360
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3361
char tmp[32];
3362
u32 amsdu_rate;
3363
3364
if (count < 1)
3365
return -EFAULT;
3366
3367
if (count > sizeof(tmp)) {
3368
rtw_warn_on(1);
3369
return -EFAULT;
3370
}
3371
3372
if (buffer && !copy_from_user(tmp, buffer, count)) {
3373
3374
int num = sscanf(tmp, "%d ", &amsdu_rate);
3375
3376
if (padapter && (num == 1)) {
3377
RTW_INFO("padapter->tx_amsdu_rate = %x\n", amsdu_rate);
3378
padapter->tx_amsdu_rate = amsdu_rate;
3379
}
3380
}
3381
3382
return count;
3383
}
3384
#endif /* CONFIG_TX_AMSDU */
3385
#endif /* CONFIG_80211N_HT */
3386
3387
int proc_get_en_fwps(struct seq_file *m, void *v)
3388
{
3389
struct net_device *dev = m->private;
3390
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3391
struct registry_priv *pregpriv = &padapter->registrypriv;
3392
3393
if (pregpriv)
3394
RTW_PRINT_SEL(m, "check_fw_ps = %d , 1:enable get FW PS state , 0: disable get FW PS state\n"
3395
, pregpriv->check_fw_ps);
3396
3397
return 0;
3398
}
3399
3400
ssize_t proc_set_en_fwps(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
3401
{
3402
struct net_device *dev = data;
3403
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3404
struct registry_priv *pregpriv = &padapter->registrypriv;
3405
char tmp[32];
3406
u32 mode;
3407
3408
if (count < 1)
3409
return -EFAULT;
3410
3411
if (count > sizeof(tmp)) {
3412
rtw_warn_on(1);
3413
return -EFAULT;
3414
}
3415
3416
if (buffer && !copy_from_user(tmp, buffer, count)) {
3417
3418
int num = sscanf(tmp, "%d ", &mode);
3419
3420
if (num == 1 && pregpriv && mode < 2) {
3421
pregpriv->check_fw_ps = mode;
3422
RTW_INFO("pregpriv->check_fw_ps=%d\n", pregpriv->check_fw_ps);
3423
}
3424
3425
}
3426
3427
return count;
3428
}
3429
3430
/*
3431
int proc_get_two_path_rssi(struct seq_file *m, void *v)
3432
{
3433
struct net_device *dev = m->private;
3434
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3435
3436
if(padapter)
3437
RTW_PRINT_SEL(m, "%d %d\n",
3438
padapter->recvpriv.RxRssi[0], padapter->recvpriv.RxRssi[1]);
3439
3440
return 0;
3441
}
3442
*/
3443
#ifdef CONFIG_80211N_HT
3444
void rtw_dump_dft_phy_cap(void *sel, _adapter *adapter)
3445
{
3446
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
3447
struct ht_priv *phtpriv = &pmlmepriv->htpriv;
3448
#ifdef CONFIG_80211AC_VHT
3449
struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv;
3450
#endif
3451
3452
#ifdef CONFIG_80211AC_VHT
3453
RTW_PRINT_SEL(sel, "[DFT CAP] VHT STBC Tx : %s\n", (TEST_FLAG(pvhtpriv->stbc_cap, STBC_VHT_ENABLE_TX)) ? "V" : "X");
3454
RTW_PRINT_SEL(sel, "[DFT CAP] VHT STBC Rx : %s\n", (TEST_FLAG(pvhtpriv->stbc_cap, STBC_VHT_ENABLE_RX)) ? "V" : "X");
3455
#endif
3456
RTW_PRINT_SEL(sel, "[DFT CAP] HT STBC Tx : %s\n", (TEST_FLAG(phtpriv->stbc_cap, STBC_HT_ENABLE_TX)) ? "V" : "X");
3457
RTW_PRINT_SEL(sel, "[DFT CAP] HT STBC Rx : %s\n\n", (TEST_FLAG(phtpriv->stbc_cap, STBC_HT_ENABLE_RX)) ? "V" : "X");
3458
3459
#ifdef CONFIG_80211AC_VHT
3460
RTW_PRINT_SEL(sel, "[DFT CAP] VHT LDPC Tx : %s\n", (TEST_FLAG(pvhtpriv->ldpc_cap, LDPC_VHT_ENABLE_TX)) ? "V" : "X");
3461
RTW_PRINT_SEL(sel, "[DFT CAP] VHT LDPC Rx : %s\n", (TEST_FLAG(pvhtpriv->ldpc_cap, LDPC_VHT_ENABLE_RX)) ? "V" : "X");
3462
#endif
3463
RTW_PRINT_SEL(sel, "[DFT CAP] HT LDPC Tx : %s\n", (TEST_FLAG(phtpriv->ldpc_cap, LDPC_HT_ENABLE_TX)) ? "V" : "X");
3464
RTW_PRINT_SEL(sel, "[DFT CAP] HT LDPC Rx : %s\n\n", (TEST_FLAG(phtpriv->ldpc_cap, LDPC_HT_ENABLE_RX)) ? "V" : "X");
3465
3466
#ifdef CONFIG_BEAMFORMING
3467
#ifdef CONFIG_80211AC_VHT
3468
RTW_PRINT_SEL(sel, "[DFT CAP] VHT MU Bfer : %s\n", (TEST_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_MU_MIMO_AP_ENABLE)) ? "V" : "X");
3469
RTW_PRINT_SEL(sel, "[DFT CAP] VHT MU Bfee : %s\n", (TEST_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_MU_MIMO_STA_ENABLE)) ? "V" : "X");
3470
RTW_PRINT_SEL(sel, "[DFT CAP] VHT SU Bfer : %s\n", (TEST_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_BEAMFORMER_ENABLE)) ? "V" : "X");
3471
RTW_PRINT_SEL(sel, "[DFT CAP] VHT SU Bfee : %s\n", (TEST_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_BEAMFORMEE_ENABLE)) ? "V" : "X");
3472
#endif
3473
RTW_PRINT_SEL(sel, "[DFT CAP] HT Bfer : %s\n", (TEST_FLAG(phtpriv->beamform_cap, BEAMFORMING_HT_BEAMFORMER_ENABLE)) ? "V" : "X");
3474
RTW_PRINT_SEL(sel, "[DFT CAP] HT Bfee : %s\n", (TEST_FLAG(phtpriv->beamform_cap, BEAMFORMING_HT_BEAMFORMEE_ENABLE)) ? "V" : "X");
3475
#endif
3476
}
3477
3478
void rtw_get_dft_phy_cap(void *sel, _adapter *adapter)
3479
{
3480
RTW_PRINT_SEL(sel, "\n ======== PHY CAP protocol ========\n");
3481
rtw_ht_use_default_setting(adapter);
3482
#ifdef CONFIG_80211AC_VHT
3483
rtw_vht_use_default_setting(adapter);
3484
#endif
3485
#ifdef CONFIG_80211N_HT
3486
rtw_dump_dft_phy_cap(sel, adapter);
3487
#endif
3488
}
3489
3490
void rtw_dump_drv_phy_cap(void *sel, _adapter *adapter)
3491
{
3492
struct registry_priv *pregistry_priv = &adapter->registrypriv;
3493
3494
RTW_PRINT_SEL(sel, "\n ======== DRV's configuration ========\n");
3495
#if 0
3496
RTW_PRINT_SEL(sel, "[DRV CAP] TRx Capability : 0x%08x\n", phy_spec->trx_cap);
3497
RTW_PRINT_SEL(sel, "[DRV CAP] Tx Stream Num Index : %d\n", (phy_spec->trx_cap >> 24) & 0xFF); /*Tx Stream Num Index [31:24]*/
3498
RTW_PRINT_SEL(sel, "[DRV CAP] Rx Stream Num Index : %d\n", (phy_spec->trx_cap >> 16) & 0xFF); /*Rx Stream Num Index [23:16]*/
3499
RTW_PRINT_SEL(sel, "[DRV CAP] Tx Path Num Index : %d\n", (phy_spec->trx_cap >> 8) & 0xFF);/*Tx Path Num Index [15:8]*/
3500
RTW_PRINT_SEL(sel, "[DRV CAP] Rx Path Num Index : %d\n", (phy_spec->trx_cap & 0xFF));/*Rx Path Num Index [7:0]*/
3501
#endif
3502
#ifdef CONFIG_80211N_HT
3503
RTW_PRINT_SEL(sel, "[DRV CAP] STBC Capability : 0x%02x\n", pregistry_priv->stbc_cap);
3504
RTW_PRINT_SEL(sel, "[DRV CAP] VHT STBC Tx : %s\n", (TEST_FLAG(pregistry_priv->stbc_cap, BIT1)) ? "V" : "X"); /*BIT1: Enable VHT STBC Tx*/
3505
RTW_PRINT_SEL(sel, "[DRV CAP] VHT STBC Rx : %s\n", (TEST_FLAG(pregistry_priv->stbc_cap, BIT0)) ? "V" : "X"); /*BIT0: Enable VHT STBC Rx*/
3506
RTW_PRINT_SEL(sel, "[DRV CAP] HT STBC Tx : %s\n", (TEST_FLAG(pregistry_priv->stbc_cap, BIT5)) ? "V" : "X"); /*BIT5: Enable HT STBC Tx*/
3507
RTW_PRINT_SEL(sel, "[DRV CAP] HT STBC Rx : %s\n\n", (TEST_FLAG(pregistry_priv->stbc_cap, BIT4)) ? "V" : "X"); /*BIT4: Enable HT STBC Rx*/
3508
3509
RTW_PRINT_SEL(sel, "[DRV CAP] LDPC Capability : 0x%02x\n", pregistry_priv->ldpc_cap);
3510
RTW_PRINT_SEL(sel, "[DRV CAP] VHT LDPC Tx : %s\n", (TEST_FLAG(pregistry_priv->ldpc_cap, BIT1)) ? "V" : "X"); /*BIT1: Enable VHT LDPC Tx*/
3511
RTW_PRINT_SEL(sel, "[DRV CAP] VHT LDPC Rx : %s\n", (TEST_FLAG(pregistry_priv->ldpc_cap, BIT0)) ? "V" : "X"); /*BIT0: Enable VHT LDPC Rx*/
3512
RTW_PRINT_SEL(sel, "[DRV CAP] HT LDPC Tx : %s\n", (TEST_FLAG(pregistry_priv->ldpc_cap, BIT5)) ? "V" : "X"); /*BIT5: Enable HT LDPC Tx*/
3513
RTW_PRINT_SEL(sel, "[DRV CAP] HT LDPC Rx : %s\n\n", (TEST_FLAG(pregistry_priv->ldpc_cap, BIT4)) ? "V" : "X"); /*BIT4: Enable HT LDPC Rx*/
3514
#endif /* CONFIG_80211N_HT */
3515
#ifdef CONFIG_BEAMFORMING
3516
#if 0
3517
RTW_PRINT_SEL(sel, "[DRV CAP] TxBF parameter : 0x%08x\n", phy_spec->txbf_param);
3518
RTW_PRINT_SEL(sel, "[DRV CAP] VHT Sounding Dim : %d\n", (phy_spec->txbf_param >> 24) & 0xFF); /*VHT Sounding Dim [31:24]*/
3519
RTW_PRINT_SEL(sel, "[DRV CAP] VHT Steering Ant : %d\n", (phy_spec->txbf_param >> 16) & 0xFF); /*VHT Steering Ant [23:16]*/
3520
RTW_PRINT_SEL(sel, "[DRV CAP] HT Sounding Dim : %d\n", (phy_spec->txbf_param >> 8) & 0xFF); /*HT Sounding Dim [15:8]*/
3521
RTW_PRINT_SEL(sel, "[DRV CAP] HT Steering Ant : %d\n", phy_spec->txbf_param & 0xFF); /*HT Steering Ant [7:0]*/
3522
#endif
3523
3524
/*
3525
* BIT0: Enable VHT SU Beamformer
3526
* BIT1: Enable VHT SU Beamformee
3527
* BIT2: Enable VHT MU Beamformer, depend on VHT SU Beamformer
3528
* BIT3: Enable VHT MU Beamformee, depend on VHT SU Beamformee
3529
* BIT4: Enable HT Beamformer
3530
* BIT5: Enable HT Beamformee
3531
*/
3532
RTW_PRINT_SEL(sel, "[DRV CAP] TxBF Capability : 0x%02x\n", pregistry_priv->beamform_cap);
3533
RTW_PRINT_SEL(sel, "[DRV CAP] VHT MU Bfer : %s\n", (TEST_FLAG(pregistry_priv->beamform_cap, BIT2)) ? "V" : "X");
3534
RTW_PRINT_SEL(sel, "[DRV CAP] VHT MU Bfee : %s\n", (TEST_FLAG(pregistry_priv->beamform_cap, BIT3)) ? "V" : "X");
3535
RTW_PRINT_SEL(sel, "[DRV CAP] VHT SU Bfer : %s\n", (TEST_FLAG(pregistry_priv->beamform_cap, BIT0)) ? "V" : "X");
3536
RTW_PRINT_SEL(sel, "[DRV CAP] VHT SU Bfee : %s\n", (TEST_FLAG(pregistry_priv->beamform_cap, BIT1)) ? "V" : "X");
3537
RTW_PRINT_SEL(sel, "[DRV CAP] HT Bfer : %s\n", (TEST_FLAG(pregistry_priv->beamform_cap, BIT4)) ? "V" : "X");
3538
RTW_PRINT_SEL(sel, "[DRV CAP] HT Bfee : %s\n", (TEST_FLAG(pregistry_priv->beamform_cap, BIT5)) ? "V" : "X");
3539
3540
RTW_PRINT_SEL(sel, "[DRV CAP] Tx Bfer rf_num : %d\n", pregistry_priv->beamformer_rf_num);
3541
RTW_PRINT_SEL(sel, "[DRV CAP] Tx Bfee rf_num : %d\n", pregistry_priv->beamformee_rf_num);
3542
#endif
3543
}
3544
3545
int proc_get_stbc_cap(struct seq_file *m, void *v)
3546
{
3547
struct net_device *dev = m->private;
3548
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3549
struct registry_priv *pregpriv = &padapter->registrypriv;
3550
3551
if (pregpriv)
3552
RTW_PRINT_SEL(m, "0x%02x\n", pregpriv->stbc_cap);
3553
3554
return 0;
3555
}
3556
3557
ssize_t proc_set_stbc_cap(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
3558
{
3559
struct net_device *dev = data;
3560
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3561
struct registry_priv *pregpriv = &padapter->registrypriv;
3562
char tmp[32];
3563
u32 mode;
3564
3565
if (count < 1)
3566
return -EFAULT;
3567
3568
if (count > sizeof(tmp)) {
3569
rtw_warn_on(1);
3570
return -EFAULT;
3571
}
3572
3573
if (buffer && !copy_from_user(tmp, buffer, count)) {
3574
3575
int num = sscanf(tmp, "%d ", &mode);
3576
3577
if (num == 1 && pregpriv) {
3578
pregpriv->stbc_cap = mode;
3579
RTW_INFO("stbc_cap = 0x%02x\n", mode);
3580
}
3581
}
3582
3583
return count;
3584
}
3585
int proc_get_rx_stbc(struct seq_file *m, void *v)
3586
{
3587
struct net_device *dev = m->private;
3588
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3589
struct registry_priv *pregpriv = &padapter->registrypriv;
3590
3591
if (pregpriv)
3592
RTW_PRINT_SEL(m, "%d\n", pregpriv->rx_stbc);
3593
3594
return 0;
3595
}
3596
3597
ssize_t proc_set_rx_stbc(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
3598
{
3599
struct net_device *dev = data;
3600
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3601
struct registry_priv *pregpriv = &padapter->registrypriv;
3602
char tmp[32];
3603
u32 mode;
3604
3605
if (count < 1)
3606
return -EFAULT;
3607
3608
if (count > sizeof(tmp)) {
3609
rtw_warn_on(1);
3610
return -EFAULT;
3611
}
3612
3613
if (buffer && !copy_from_user(tmp, buffer, count)) {
3614
3615
int num = sscanf(tmp, "%d ", &mode);
3616
3617
if (num == 1 && pregpriv && (mode == 0 || mode == 1 || mode == 2 || mode == 3)) {
3618
pregpriv->rx_stbc = mode;
3619
printk("rx_stbc=%d\n", mode);
3620
}
3621
}
3622
3623
return count;
3624
3625
}
3626
int proc_get_ldpc_cap(struct seq_file *m, void *v)
3627
{
3628
struct net_device *dev = m->private;
3629
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3630
struct registry_priv *pregpriv = &padapter->registrypriv;
3631
3632
if (pregpriv)
3633
RTW_PRINT_SEL(m, "0x%02x\n", pregpriv->ldpc_cap);
3634
3635
return 0;
3636
}
3637
3638
ssize_t proc_set_ldpc_cap(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
3639
{
3640
struct net_device *dev = data;
3641
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3642
struct registry_priv *pregpriv = &padapter->registrypriv;
3643
char tmp[32];
3644
u32 mode;
3645
3646
if (count < 1)
3647
return -EFAULT;
3648
3649
if (count > sizeof(tmp)) {
3650
rtw_warn_on(1);
3651
return -EFAULT;
3652
}
3653
3654
if (buffer && !copy_from_user(tmp, buffer, count)) {
3655
3656
int num = sscanf(tmp, "%d ", &mode);
3657
3658
if (num == 1 && pregpriv) {
3659
pregpriv->ldpc_cap = mode;
3660
RTW_INFO("ldpc_cap = 0x%02x\n", mode);
3661
}
3662
}
3663
3664
return count;
3665
}
3666
#ifdef CONFIG_BEAMFORMING
3667
int proc_get_txbf_cap(struct seq_file *m, void *v)
3668
{
3669
struct net_device *dev = m->private;
3670
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3671
struct registry_priv *pregpriv = &padapter->registrypriv;
3672
3673
if (pregpriv)
3674
RTW_PRINT_SEL(m, "0x%02x\n", pregpriv->beamform_cap);
3675
3676
return 0;
3677
}
3678
3679
ssize_t proc_set_txbf_cap(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
3680
{
3681
struct net_device *dev = data;
3682
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3683
struct registry_priv *pregpriv = &padapter->registrypriv;
3684
char tmp[32];
3685
u32 mode;
3686
3687
if (count < 1)
3688
return -EFAULT;
3689
3690
if (count > sizeof(tmp)) {
3691
rtw_warn_on(1);
3692
return -EFAULT;
3693
}
3694
3695
if (buffer && !copy_from_user(tmp, buffer, count)) {
3696
3697
int num = sscanf(tmp, "%d ", &mode);
3698
3699
if (num == 1 && pregpriv) {
3700
pregpriv->beamform_cap = mode;
3701
RTW_INFO("beamform_cap = 0x%02x\n", mode);
3702
}
3703
}
3704
3705
return count;
3706
}
3707
#endif
3708
#endif /* CONFIG_80211N_HT */
3709
3710
/*int proc_get_rssi_disp(struct seq_file *m, void *v)
3711
{
3712
struct net_device *dev = m->private;
3713
return 0;
3714
}
3715
*/
3716
3717
/*ssize_t proc_set_rssi_disp(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
3718
{
3719
struct net_device *dev = data;
3720
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3721
char tmp[32];
3722
u32 enable=0;
3723
3724
if (count < 1)
3725
{
3726
RTW_INFO("argument size is less than 1\n");
3727
return -EFAULT;
3728
}
3729
3730
if (count > sizeof(tmp)) {
3731
rtw_warn_on(1);
3732
return -EFAULT;
3733
}
3734
3735
if (buffer && !copy_from_user(tmp, buffer, count)) {
3736
3737
int num = sscanf(tmp, "%x", &enable);
3738
3739
if (num != 1) {
3740
RTW_INFO("invalid set_rssi_disp parameter!\n");
3741
return count;
3742
}
3743
3744
if(enable)
3745
{
3746
RTW_INFO("Linked info Function Enable\n");
3747
padapter->bLinkInfoDump = enable ;
3748
}
3749
else
3750
{
3751
RTW_INFO("Linked info Function Disable\n");
3752
padapter->bLinkInfoDump = 0 ;
3753
}
3754
3755
}
3756
3757
return count;
3758
3759
}
3760
3761
*/
3762
#ifdef CONFIG_AP_MODE
3763
3764
int proc_get_all_sta_info(struct seq_file *m, void *v)
3765
{
3766
struct net_device *dev = m->private;
3767
_irqL irqL;
3768
struct sta_info *psta;
3769
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3770
struct sta_priv *pstapriv = &padapter->stapriv;
3771
int i;
3772
_list *plist, *phead;
3773
3774
RTW_MAP_DUMP_SEL(m, "sta_dz_bitmap=", pstapriv->sta_dz_bitmap, pstapriv->aid_bmp_len);
3775
RTW_MAP_DUMP_SEL(m, "tim_bitmap=", pstapriv->tim_bitmap, pstapriv->aid_bmp_len);
3776
3777
_enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
3778
3779
for (i = 0; i < NUM_STA; i++) {
3780
phead = &(pstapriv->sta_hash[i]);
3781
plist = get_next(phead);
3782
3783
while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
3784
psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
3785
3786
plist = get_next(plist);
3787
3788
/* if(extra_arg == psta->cmn.aid) */
3789
{
3790
RTW_PRINT_SEL(m, "==============================\n");
3791
RTW_PRINT_SEL(m, "sta's macaddr:" MAC_FMT "\n", MAC_ARG(psta->cmn.mac_addr));
3792
RTW_PRINT_SEL(m, "rtsen=%d, cts2slef=%d\n", psta->rtsen, psta->cts2self);
3793
RTW_PRINT_SEL(m, "state=0x%x, aid=%d, macid=%d, raid=%d\n",
3794
psta->state, psta->cmn.aid, psta->cmn.mac_id, psta->cmn.ra_info.rate_id);
3795
#ifdef CONFIG_RTS_FULL_BW
3796
if(psta->vendor_8812)
3797
RTW_PRINT_SEL(m,"Vendor Realtek 8812\n");
3798
#endif/*CONFIG_RTS_FULL_BW*/
3799
#ifdef CONFIG_80211N_HT
3800
RTW_PRINT_SEL(m, "qos_en=%d, ht_en=%d, init_rate=%d\n", psta->qos_option, psta->htpriv.ht_option, psta->init_rate);
3801
RTW_PRINT_SEL(m, "bwmode=%d, ch_offset=%d, sgi_20m=%d,sgi_40m=%d\n"
3802
, psta->cmn.bw_mode, psta->htpriv.ch_offset, psta->htpriv.sgi_20m, psta->htpriv.sgi_40m);
3803
RTW_PRINT_SEL(m, "ampdu_enable = %d\n", psta->htpriv.ampdu_enable);
3804
RTW_PRINT_SEL(m, "tx_amsdu_enable = %d\n", psta->htpriv.tx_amsdu_enable);
3805
RTW_PRINT_SEL(m, "agg_enable_bitmap=%x, candidate_tid_bitmap=%x\n", psta->htpriv.agg_enable_bitmap, psta->htpriv.candidate_tid_bitmap);
3806
#endif /* CONFIG_80211N_HT */
3807
#ifdef CONFIG_80211AC_VHT
3808
RTW_PRINT_SEL(m, "vht_en=%d, vht_sgi_80m=%d\n", psta->vhtpriv.vht_option, psta->vhtpriv.sgi_80m);
3809
RTW_PRINT_SEL(m, "vht_ldpc_cap=0x%x, vht_stbc_cap=0x%x, vht_beamform_cap=0x%x\n", psta->vhtpriv.ldpc_cap, psta->vhtpriv.stbc_cap, psta->vhtpriv.beamform_cap);
3810
RTW_PRINT_SEL(m, "vht_mcs_map=0x%x, vht_highest_rate=0x%x, vht_ampdu_len=%d\n", *(u16 *)psta->vhtpriv.vht_mcs_map, psta->vhtpriv.vht_highest_rate, psta->vhtpriv.ampdu_len);
3811
#endif
3812
RTW_PRINT_SEL(m, "sleepq_len=%d\n", psta->sleepq_len);
3813
RTW_PRINT_SEL(m, "sta_xmitpriv.vo_q_qcnt=%d\n", psta->sta_xmitpriv.vo_q.qcnt);
3814
RTW_PRINT_SEL(m, "sta_xmitpriv.vi_q_qcnt=%d\n", psta->sta_xmitpriv.vi_q.qcnt);
3815
RTW_PRINT_SEL(m, "sta_xmitpriv.be_q_qcnt=%d\n", psta->sta_xmitpriv.be_q.qcnt);
3816
RTW_PRINT_SEL(m, "sta_xmitpriv.bk_q_qcnt=%d\n", psta->sta_xmitpriv.bk_q.qcnt);
3817
3818
RTW_PRINT_SEL(m, "capability=0x%x\n", psta->capability);
3819
RTW_PRINT_SEL(m, "flags=0x%x\n", psta->flags);
3820
RTW_PRINT_SEL(m, "wpa_psk=0x%x\n", psta->wpa_psk);
3821
RTW_PRINT_SEL(m, "wpa2_group_cipher=0x%x\n", psta->wpa2_group_cipher);
3822
RTW_PRINT_SEL(m, "wpa2_pairwise_cipher=0x%x\n", psta->wpa2_pairwise_cipher);
3823
RTW_PRINT_SEL(m, "qos_info=0x%x\n", psta->qos_info);
3824
RTW_PRINT_SEL(m, "dot118021XPrivacy=0x%x\n", psta->dot118021XPrivacy);
3825
3826
sta_rx_reorder_ctl_dump(m, psta);
3827
3828
#ifdef CONFIG_TDLS
3829
RTW_PRINT_SEL(m, "tdls_sta_state=0x%08x\n", psta->tdls_sta_state);
3830
RTW_PRINT_SEL(m, "PeerKey_Lifetime=%d\n", psta->TDLS_PeerKey_Lifetime);
3831
#endif /* CONFIG_TDLS */
3832
RTW_PRINT_SEL(m, "rx_data_uc_pkts=%llu\n", sta_rx_data_uc_pkts(psta));
3833
RTW_PRINT_SEL(m, "rx_data_mc_pkts=%llu\n", psta->sta_stats.rx_data_mc_pkts);
3834
RTW_PRINT_SEL(m, "rx_data_bc_pkts=%llu\n", psta->sta_stats.rx_data_bc_pkts);
3835
RTW_PRINT_SEL(m, "rx_uc_bytes=%llu\n", sta_rx_uc_bytes(psta));
3836
RTW_PRINT_SEL(m, "rx_mc_bytes=%llu\n", psta->sta_stats.rx_mc_bytes);
3837
RTW_PRINT_SEL(m, "rx_bc_bytes=%llu\n", psta->sta_stats.rx_bc_bytes);
3838
if (psta->sta_stats.rx_tp_kbits >> 10)
3839
RTW_PRINT_SEL(m, "rx_tp =%d (Mbps)\n", psta->sta_stats.rx_tp_kbits >> 10);
3840
else
3841
RTW_PRINT_SEL(m, "rx_tp =%d (Kbps)\n", psta->sta_stats.rx_tp_kbits);
3842
3843
RTW_PRINT_SEL(m, "tx_data_pkts=%llu\n", psta->sta_stats.tx_pkts);
3844
RTW_PRINT_SEL(m, "tx_bytes=%llu\n", psta->sta_stats.tx_bytes);
3845
if (psta->sta_stats.tx_tp_kbits >> 10)
3846
RTW_PRINT_SEL(m, "tx_tp =%d (Mbps)\n", psta->sta_stats.tx_tp_kbits >> 10);
3847
else
3848
RTW_PRINT_SEL(m, "tx_tp =%d (Kbps)\n", psta->sta_stats.tx_tp_kbits);
3849
#ifdef CONFIG_RTW_80211K
3850
RTW_PRINT_SEL(m, "rm_en_cap="RM_CAP_FMT"\n", RM_CAP_ARG(psta->rm_en_cap));
3851
#endif
3852
dump_st_ctl(m, &psta->st_ctl);
3853
3854
if (STA_OP_WFD_MODE(psta))
3855
RTW_PRINT_SEL(m, "op_wfd_mode:0x%02x\n", STA_OP_WFD_MODE(psta));
3856
3857
RTW_PRINT_SEL(m, "==============================\n");
3858
}
3859
3860
}
3861
3862
}
3863
3864
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
3865
3866
return 0;
3867
}
3868
3869
#endif
3870
3871
#ifdef CONFIG_PREALLOC_RX_SKB_BUFFER
3872
int proc_get_rtkm_info(struct seq_file *m, void *v)
3873
{
3874
struct net_device *dev = m->private;
3875
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3876
struct recv_priv *precvpriv = &padapter->recvpriv;
3877
struct recv_buf *precvbuf;
3878
3879
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
3880
3881
RTW_PRINT_SEL(m, "============[RTKM Info]============\n");
3882
RTW_PRINT_SEL(m, "MAX_RTKM_NR_PREALLOC_RECV_SKB: %d\n", rtw_rtkm_get_nr_recv_skb());
3883
RTW_PRINT_SEL(m, "MAX_RTKM_RECVBUF_SZ: %d\n", rtw_rtkm_get_buff_size());
3884
3885
RTW_PRINT_SEL(m, "============[Driver Info]============\n");
3886
RTW_PRINT_SEL(m, "NR_PREALLOC_RECV_SKB: %d\n", NR_PREALLOC_RECV_SKB);
3887
RTW_PRINT_SEL(m, "MAX_RECVBUF_SZ: %d\n", precvbuf->alloc_sz);
3888
3889
return 0;
3890
}
3891
#endif /* CONFIG_PREALLOC_RX_SKB_BUFFER */
3892
3893
#ifdef DBG_MEMORY_LEAK
3894
#include <asm/atomic.h>
3895
extern atomic_t _malloc_cnt;;
3896
extern atomic_t _malloc_size;;
3897
3898
int proc_get_malloc_cnt(struct seq_file *m, void *v)
3899
{
3900
RTW_PRINT_SEL(m, "_malloc_cnt=%d\n", atomic_read(&_malloc_cnt));
3901
RTW_PRINT_SEL(m, "_malloc_size=%d\n", atomic_read(&_malloc_size));
3902
3903
return 0;
3904
}
3905
#endif /* DBG_MEMORY_LEAK */
3906
3907
#ifdef CONFIG_FIND_BEST_CHANNEL
3908
int proc_get_best_channel(struct seq_file *m, void *v)
3909
{
3910
struct net_device *dev = m->private;
3911
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3912
struct rf_ctl_t *rfctl = adapter_to_rfctl(padapter);
3913
u32 i, best_channel_24G = 1, best_channel_5G = 36, index_24G = 0, index_5G = 0;
3914
3915
for (i = 0; i < rfctl->max_chan_nums && rfctl->channel_set[i].ChannelNum != 0; i++) {
3916
if (rfctl->channel_set[i].ChannelNum == 1)
3917
index_24G = i;
3918
if (rfctl->channel_set[i].ChannelNum == 36)
3919
index_5G = i;
3920
}
3921
3922
for (i = 0; i < rfctl->max_chan_nums && rfctl->channel_set[i].ChannelNum != 0; i++) {
3923
/* 2.4G */
3924
if (rfctl->channel_set[i].ChannelNum == 6) {
3925
if (rfctl->channel_set[i].rx_count < rfctl->channel_set[index_24G].rx_count) {
3926
index_24G = i;
3927
best_channel_24G = rfctl->channel_set[i].ChannelNum;
3928
}
3929
}
3930
3931
/* 5G */
3932
if (rfctl->channel_set[i].ChannelNum >= 36
3933
&& rfctl->channel_set[i].ChannelNum < 140) {
3934
/* Find primary channel */
3935
if (((rfctl->channel_set[i].ChannelNum - 36) % 8 == 0)
3936
&& (rfctl->channel_set[i].rx_count < rfctl->channel_set[index_5G].rx_count)) {
3937
index_5G = i;
3938
best_channel_5G = rfctl->channel_set[i].ChannelNum;
3939
}
3940
}
3941
3942
if (rfctl->channel_set[i].ChannelNum >= 149
3943
&& rfctl->channel_set[i].ChannelNum < 165) {
3944
/* find primary channel */
3945
if (((rfctl->channel_set[i].ChannelNum - 149) % 8 == 0)
3946
&& (rfctl->channel_set[i].rx_count < rfctl->channel_set[index_5G].rx_count)) {
3947
index_5G = i;
3948
best_channel_5G = rfctl->channel_set[i].ChannelNum;
3949
}
3950
}
3951
#if 1 /* debug */
3952
RTW_PRINT_SEL(m, "The rx cnt of channel %3d = %d\n",
3953
rfctl->channel_set[i].ChannelNum, rfctl->channel_set[i].rx_count);
3954
#endif
3955
}
3956
3957
RTW_PRINT_SEL(m, "best_channel_5G = %d\n", best_channel_5G);
3958
RTW_PRINT_SEL(m, "best_channel_24G = %d\n", best_channel_24G);
3959
3960
return 0;
3961
}
3962
3963
ssize_t proc_set_best_channel(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
3964
{
3965
struct net_device *dev = data;
3966
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
3967
struct rf_ctl_t *rfctl = adapter_to_rfctl(padapter);
3968
char tmp[32];
3969
3970
if (count < 1)
3971
return -EFAULT;
3972
3973
if (count > sizeof(tmp)) {
3974
rtw_warn_on(1);
3975
return -EFAULT;
3976
}
3977
3978
if (buffer && !copy_from_user(tmp, buffer, count)) {
3979
int i;
3980
for (i = 0; i < rfctl->max_chan_nums && rfctl->channel_set[i].ChannelNum != 0; i++)
3981
rfctl->channel_set[i].rx_count = 0;
3982
3983
RTW_INFO("set %s\n", "Clean Best Channel Count");
3984
}
3985
3986
return count;
3987
}
3988
#endif /* CONFIG_FIND_BEST_CHANNEL */
3989
3990
#ifdef CONFIG_BT_COEXIST
3991
int proc_get_btcoex_dbg(struct seq_file *m, void *v)
3992
{
3993
struct net_device *dev = m->private;
3994
PADAPTER padapter;
3995
char buf[512] = {0};
3996
padapter = (PADAPTER)rtw_netdev_priv(dev);
3997
3998
rtw_btcoex_GetDBG(padapter, buf, 512);
3999
4000
_RTW_PRINT_SEL(m, "%s", buf);
4001
4002
return 0;
4003
}
4004
4005
ssize_t proc_set_btcoex_dbg(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
4006
{
4007
struct net_device *dev = data;
4008
PADAPTER padapter;
4009
u8 tmp[80] = {0};
4010
u32 module[2] = {0};
4011
u32 num;
4012
4013
padapter = (PADAPTER)rtw_netdev_priv(dev);
4014
4015
/* RTW_INFO("+" FUNC_ADPT_FMT "\n", FUNC_ADPT_ARG(padapter)); */
4016
4017
if (NULL == buffer) {
4018
RTW_INFO(FUNC_ADPT_FMT ": input buffer is NULL!\n",
4019
FUNC_ADPT_ARG(padapter));
4020
4021
return -EFAULT;
4022
}
4023
4024
if (count < 1) {
4025
RTW_INFO(FUNC_ADPT_FMT ": input length is 0!\n",
4026
FUNC_ADPT_ARG(padapter));
4027
4028
return -EFAULT;
4029
}
4030
4031
num = count;
4032
if (num > (sizeof(tmp) - 1))
4033
num = (sizeof(tmp) - 1);
4034
4035
if (copy_from_user(tmp, buffer, num)) {
4036
RTW_INFO(FUNC_ADPT_FMT ": copy buffer from user space FAIL!\n",
4037
FUNC_ADPT_ARG(padapter));
4038
4039
return -EFAULT;
4040
}
4041
4042
num = sscanf(tmp, "%x %x", module, module + 1);
4043
if (1 == num) {
4044
if (0 == module[0])
4045
_rtw_memset(module, 0, sizeof(module));
4046
else
4047
_rtw_memset(module, 0xFF, sizeof(module));
4048
} else if (2 != num) {
4049
RTW_INFO(FUNC_ADPT_FMT ": input(\"%s\") format incorrect!\n",
4050
FUNC_ADPT_ARG(padapter), tmp);
4051
4052
if (0 == num)
4053
return -EFAULT;
4054
}
4055
4056
RTW_INFO(FUNC_ADPT_FMT ": input 0x%08X 0x%08X\n",
4057
FUNC_ADPT_ARG(padapter), module[0], module[1]);
4058
rtw_btcoex_SetDBG(padapter, module);
4059
4060
return count;
4061
}
4062
4063
int proc_get_btcoex_info(struct seq_file *m, void *v)
4064
{
4065
struct net_device *dev = m->private;
4066
PADAPTER padapter;
4067
const u32 bufsize = 40 * 100;
4068
u8 *pbuf = NULL;
4069
4070
padapter = (PADAPTER)rtw_netdev_priv(dev);
4071
4072
pbuf = rtw_zmalloc(bufsize);
4073
if (NULL == pbuf)
4074
return -ENOMEM;
4075
4076
rtw_btcoex_DisplayBtCoexInfo(padapter, pbuf, bufsize);
4077
4078
_RTW_PRINT_SEL(m, "%s\n", pbuf);
4079
4080
rtw_mfree(pbuf, bufsize);
4081
4082
return 0;
4083
}
4084
4085
#ifdef CONFIG_RF4CE_COEXIST
4086
int proc_get_rf4ce_state(struct seq_file *m, void *v)
4087
{
4088
struct net_device *dev = m->private;
4089
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
4090
u8 state = 0, voice = 0;
4091
4092
state = rtw_btcoex_GetRf4ceLinkState(adapter);
4093
4094
RTW_PRINT_SEL(m, "RF4CE %s\n", state?"Connected":"Disconnect");
4095
4096
return 0;
4097
}
4098
4099
/* This interface is designed for user space application to inform RF4CE state
4100
* Initial define for DHC 1295 E387 project
4101
*
4102
* echo state voice > rf4ce_state
4103
* state
4104
* 0: RF4CE disconnected
4105
* 1: RF4CE connected
4106
*/
4107
ssize_t proc_set_rf4ce_state(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
4108
{
4109
struct net_device *dev = data;
4110
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
4111
char tmp[32];
4112
u8 state;
4113
4114
if (count < 1)
4115
return -EFAULT;
4116
4117
if (count > sizeof(tmp)) {
4118
rtw_warn_on(1);
4119
return -EFAULT;
4120
}
4121
4122
if (buffer && !copy_from_user(tmp, buffer, count)) {
4123
4124
int num = sscanf(tmp, "%hhx", &state);
4125
4126
if (num >= 1)
4127
rtw_btcoex_SetRf4ceLinkState(adapter, state);
4128
}
4129
4130
return count;
4131
}
4132
#endif /* CONFIG_RF4CE_COEXIST */
4133
#endif /* CONFIG_BT_COEXIST */
4134
4135
#if defined(DBG_CONFIG_ERROR_DETECT)
4136
int proc_get_sreset(struct seq_file *m, void *v)
4137
{
4138
struct net_device *dev = m->private;
4139
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
4140
struct dvobj_priv *psdpriv = padapter->dvobj;
4141
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
4142
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
4143
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
4144
4145
if (psrtpriv->dbg_sreset_ctrl == _TRUE) {
4146
RTW_PRINT_SEL(m, "self_dect_tx_cnt:%llu\n", psrtpriv->self_dect_tx_cnt);
4147
RTW_PRINT_SEL(m, "self_dect_rx_cnt:%llu\n", psrtpriv->self_dect_rx_cnt);
4148
RTW_PRINT_SEL(m, "self_dect_fw_cnt:%llu\n", psrtpriv->self_dect_fw_cnt);
4149
RTW_PRINT_SEL(m, "tx_dma_status_cnt:%llu\n", psrtpriv->tx_dma_status_cnt);
4150
RTW_PRINT_SEL(m, "rx_dma_status_cnt:%llu\n", psrtpriv->rx_dma_status_cnt);
4151
RTW_PRINT_SEL(m, "self_dect_case:%d\n", psrtpriv->self_dect_case);
4152
RTW_PRINT_SEL(m, "dbg_sreset_cnt:%d\n", pdbgpriv->dbg_sreset_cnt);
4153
}
4154
return 0;
4155
}
4156
4157
ssize_t proc_set_sreset(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
4158
{
4159
struct net_device *dev = data;
4160
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
4161
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
4162
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
4163
char tmp[32];
4164
s32 trigger_point;
4165
4166
if (count < 1)
4167
return -EFAULT;
4168
4169
if (count > sizeof(tmp)) {
4170
rtw_warn_on(1);
4171
return -EFAULT;
4172
}
4173
4174
if (buffer && !copy_from_user(tmp, buffer, count)) {
4175
4176
int num = sscanf(tmp, "%d", &trigger_point);
4177
4178
if (num < 1)
4179
return count;
4180
4181
if (trigger_point == SRESET_TGP_NULL)
4182
rtw_hal_sreset_reset(padapter);
4183
else if (trigger_point == SRESET_TGP_INFO)
4184
psrtpriv->dbg_sreset_ctrl = _TRUE;
4185
else
4186
sreset_set_trigger_point(padapter, trigger_point);
4187
}
4188
4189
return count;
4190
4191
}
4192
#endif /* DBG_CONFIG_ERROR_DETECT */
4193
4194
#ifdef CONFIG_PCI_HCI
4195
4196
ssize_t proc_set_pci_bridge_conf_space(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
4197
{
4198
struct net_device *dev = data;
4199
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
4200
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
4201
struct pci_dev *pdev = pdvobjpriv->ppcidev;
4202
struct pci_dev *bridge_pdev = pdev->bus->self;
4203
4204
char tmp[32] = { 0 };
4205
int num;
4206
4207
u32 reg = 0, value = 0;
4208
4209
if (count < 1)
4210
return -EFAULT;
4211
4212
if (count > sizeof(tmp)) {
4213
rtw_warn_on(1);
4214
return -EFAULT;
4215
}
4216
4217
if (buffer && !copy_from_user(tmp, buffer, count)) {
4218
4219
num = sscanf(tmp, "%x %x", &reg, &value);
4220
if (num != 2) {
4221
RTW_INFO("invalid parameter!\n");
4222
return count;
4223
}
4224
4225
if (reg >= 0x1000) {
4226
RTW_INFO("invalid register!\n");
4227
return count;
4228
}
4229
4230
if (value > 0xFF) {
4231
RTW_INFO("invalid value! Only one byte\n");
4232
return count;
4233
}
4234
4235
RTW_INFO(FUNC_ADPT_FMT ": register 0x%x value 0x%x\n",
4236
FUNC_ADPT_ARG(padapter), reg, value);
4237
4238
pci_write_config_byte(bridge_pdev, reg, value);
4239
}
4240
return count;
4241
}
4242
4243
4244
int proc_get_pci_bridge_conf_space(struct seq_file *m, void *v)
4245
{
4246
struct net_device *dev = m->private;
4247
_adapter *padapter = (_adapter *) rtw_netdev_priv(dev);
4248
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
4249
struct pci_dev *pdev = pdvobjpriv->ppcidev;
4250
struct pci_dev *bridge_pdev = pdev->bus->self;
4251
4252
u32 tmp[4] = { 0 };
4253
u32 i, j;
4254
4255
RTW_PRINT_SEL(m, "\n***** PCI Host Device Configuration Space*****\n\n");
4256
4257
for (i = 0; i < 0x1000; i += 0x10) {
4258
for (j = 0 ; j < 4 ; j++)
4259
pci_read_config_dword(bridge_pdev, i + j * 4, tmp+j);
4260
4261
RTW_PRINT_SEL(m, "%03x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
4262
i, tmp[0] & 0xFF, (tmp[0] >> 8) & 0xFF, (tmp[0] >> 16) & 0xFF, (tmp[0] >> 24) & 0xFF,
4263
tmp[1] & 0xFF, (tmp[1] >> 8) & 0xFF, (tmp[1] >> 16) & 0xFF, (tmp[1] >> 24) & 0xFF,
4264
tmp[2] & 0xFF, (tmp[2] >> 8) & 0xFF, (tmp[2] >> 16) & 0xFF, (tmp[2] >> 24) & 0xFF,
4265
tmp[3] & 0xFF, (tmp[3] >> 8) & 0xFF, (tmp[3] >> 16) & 0xFF, (tmp[3] >> 24) & 0xFF);
4266
}
4267
return 0;
4268
}
4269
4270
4271
ssize_t proc_set_pci_conf_space(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
4272
{
4273
struct net_device *dev = data;
4274
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
4275
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
4276
struct pci_dev *pdev = pdvobjpriv->ppcidev;
4277
4278
char tmp[32] = { 0 };
4279
int num;
4280
4281
u32 reg = 0, value = 0;
4282
4283
if (count < 1)
4284
return -EFAULT;
4285
4286
if (count > sizeof(tmp)) {
4287
rtw_warn_on(1);
4288
return -EFAULT;
4289
}
4290
4291
if (buffer && !copy_from_user(tmp, buffer, count)) {
4292
4293
num = sscanf(tmp, "%x %x", &reg, &value);
4294
4295
if (num != 2) {
4296
RTW_INFO("invalid parameter!\n");
4297
return count;
4298
}
4299
4300
4301
if (reg >= 0x1000) {
4302
RTW_INFO("invalid register!\n");
4303
return count;
4304
}
4305
4306
if (value > 0xFF) {
4307
RTW_INFO("invalid value! Only one byte\n");
4308
return count;
4309
}
4310
4311
RTW_INFO(FUNC_ADPT_FMT ": register 0x%x value 0x%x\n",
4312
FUNC_ADPT_ARG(padapter), reg, value);
4313
4314
pci_write_config_byte(pdev, reg, value);
4315
4316
4317
}
4318
return count;
4319
}
4320
4321
4322
int proc_get_pci_conf_space(struct seq_file *m, void *v)
4323
{
4324
struct net_device *dev = m->private;
4325
_adapter *padapter = (_adapter *) rtw_netdev_priv(dev);
4326
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
4327
struct pci_dev *pdev = pdvobjpriv->ppcidev;
4328
struct pci_dev *bridge_pdev = pdev->bus->self;
4329
4330
u32 tmp[4] = { 0 };
4331
u32 i, j;
4332
4333
RTW_PRINT_SEL(m, "\n***** PCI Device Configuration Space *****\n\n");
4334
4335
for (i = 0; i < 0x1000; i += 0x10) {
4336
for (j = 0 ; j < 4 ; j++)
4337
pci_read_config_dword(pdev, i + j * 4, tmp+j);
4338
4339
RTW_PRINT_SEL(m, "%03x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
4340
i, tmp[0] & 0xFF, (tmp[0] >> 8) & 0xFF, (tmp[0] >> 16) & 0xFF, (tmp[0] >> 24) & 0xFF,
4341
tmp[1] & 0xFF, (tmp[1] >> 8) & 0xFF, (tmp[1] >> 16) & 0xFF, (tmp[1] >> 24) & 0xFF,
4342
tmp[2] & 0xFF, (tmp[2] >> 8) & 0xFF, (tmp[2] >> 16) & 0xFF, (tmp[2] >> 24) & 0xFF,
4343
tmp[3] & 0xFF, (tmp[3] >> 8) & 0xFF, (tmp[3] >> 16) & 0xFF, (tmp[3] >> 24) & 0xFF);
4344
}
4345
4346
return 0;
4347
}
4348
4349
4350
int proc_get_pci_aspm(struct seq_file *m, void *v)
4351
{
4352
struct net_device *dev = m->private;
4353
_adapter *padapter = (_adapter *) rtw_netdev_priv(dev);
4354
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
4355
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
4356
struct pci_priv *pcipriv = &(pdvobjpriv->pcipriv);
4357
u8 tmp8 = 0;
4358
u16 tmp16 = 0;
4359
u32 tmp32 = 0;
4360
u8 l1_idle = 0;
4361
4362
4363
RTW_PRINT_SEL(m, "***** ASPM Capability *****\n");
4364
4365
pci_read_config_dword(pdvobjpriv->ppcidev, pcipriv->pciehdr_offset + PCI_EXP_LNKCAP, &tmp32);
4366
4367
RTW_PRINT_SEL(m, "CLK REQ: %s\n", (tmp32&PCI_EXP_LNKCAP_CLKPM) ? "Enable" : "Disable");
4368
RTW_PRINT_SEL(m, "ASPM L0s: %s\n", (tmp32&BIT10) ? "Enable" : "Disable");
4369
RTW_PRINT_SEL(m, "ASPM L1: %s\n", (tmp32&BIT11) ? "Enable" : "Disable");
4370
4371
tmp8 = rtw_hal_pci_l1off_capability(padapter);
4372
RTW_PRINT_SEL(m, "ASPM L1OFF: %s\n", tmp8 ? "Enable" : "Disable");
4373
4374
RTW_PRINT_SEL(m, "***** ASPM CTRL Reg *****\n");
4375
4376
pci_read_config_word(pdvobjpriv->ppcidev, pcipriv->pciehdr_offset + PCI_EXP_LNKCTL, &tmp16);
4377
4378
RTW_PRINT_SEL(m, "CLK REQ: %s\n", (tmp16&PCI_EXP_LNKCTL_CLKREQ_EN) ? "Enable" : "Disable");
4379
RTW_PRINT_SEL(m, "ASPM L0s: %s\n", (tmp16&BIT0) ? "Enable" : "Disable");
4380
RTW_PRINT_SEL(m, "ASPM L1: %s\n", (tmp16&BIT1) ? "Enable" : "Disable");
4381
4382
tmp8 = rtw_hal_pci_l1off_nic_support(padapter);
4383
RTW_PRINT_SEL(m, "ASPM L1OFF: %s\n", tmp8 ? "Enable" : "Disable");
4384
4385
RTW_PRINT_SEL(m, "***** ASPM Backdoor *****\n");
4386
4387
tmp8 = rtw_hal_pci_dbi_read(padapter, 0x719);
4388
RTW_PRINT_SEL(m, "CLK REQ: %s\n", (tmp8 & BIT4) ? "Enable" : "Disable");
4389
4390
tmp8 = rtw_hal_pci_dbi_read(padapter, 0x70f);
4391
l1_idle = tmp8 & 0x38;
4392
RTW_PRINT_SEL(m, "ASPM L0s: %s\n", (tmp8&BIT7) ? "Enable" : "Disable");
4393
4394
tmp8 = rtw_hal_pci_dbi_read(padapter, 0x719);
4395
RTW_PRINT_SEL(m, "ASPM L1: %s\n", (tmp8 & BIT3) ? "Enable" : "Disable");
4396
4397
tmp8 = rtw_hal_pci_dbi_read(padapter, 0x718);
4398
RTW_PRINT_SEL(m, "ASPM L1OFF: %s\n", (tmp8 & BIT5) ? "Enable" : "Disable");
4399
4400
RTW_PRINT_SEL(m, "********* MISC **********\n");
4401
RTW_PRINT_SEL(m, "ASPM L1 Idel Time: 0x%x\n", l1_idle>>3);
4402
RTW_PRINT_SEL(m, "*************************\n");
4403
4404
#ifdef CONFIG_PCI_DYNAMIC_ASPM
4405
RTW_PRINT_SEL(m, "Dynamic ASPM mode: %d (%s)\n", pcipriv->aspm_mode,
4406
pcipriv->aspm_mode == ASPM_MODE_PERF ? "Perf" :
4407
pcipriv->aspm_mode == ASPM_MODE_PS ? "PS" : "Und");
4408
#endif
4409
4410
return 0;
4411
}
4412
4413
int proc_get_rx_ring(struct seq_file *m, void *v)
4414
{
4415
_irqL irqL;
4416
struct net_device *dev = m->private;
4417
_adapter *padapter = (_adapter *) rtw_netdev_priv(dev);
4418
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
4419
struct recv_priv *precvpriv = &padapter->recvpriv;
4420
struct rtw_rx_ring *rx_ring = &precvpriv->rx_ring[RX_MPDU_QUEUE];
4421
int i, j;
4422
4423
RTW_PRINT_SEL(m, "rx ring (%p)\n", rx_ring);
4424
RTW_PRINT_SEL(m, " dma: 0x%08x\n", (int) rx_ring->dma);
4425
RTW_PRINT_SEL(m, " idx: %d\n", rx_ring->idx);
4426
4427
_enter_critical(&pdvobjpriv->irq_th_lock, &irqL);
4428
for (i = 0; i < precvpriv->rxringcount; i++) {
4429
#ifdef CONFIG_TRX_BD_ARCH
4430
struct rx_buf_desc *entry = &rx_ring->buf_desc[i];
4431
#else
4432
struct recv_stat *entry = &rx_ring->desc[i];
4433
#endif
4434
struct sk_buff *skb = rx_ring->rx_buf[i];
4435
4436
RTW_PRINT_SEL(m, " desc[%03d]: %p, rx_buf[%03d]: 0x%08x\n",
4437
i, entry, i, cpu_to_le32(*((dma_addr_t *)skb->cb)));
4438
4439
for (j = 0; j < sizeof(*entry) / 4; j++) {
4440
if ((j % 4) == 0)
4441
RTW_PRINT_SEL(m, " 0x%03x", j);
4442
4443
RTW_PRINT_SEL(m, " 0x%08x ", ((int *) entry)[j]);
4444
4445
if ((j % 4) == 3)
4446
RTW_PRINT_SEL(m, "\n");
4447
}
4448
}
4449
_exit_critical(&pdvobjpriv->irq_th_lock, &irqL);
4450
4451
return 0;
4452
}
4453
4454
int proc_get_tx_ring(struct seq_file *m, void *v)
4455
{
4456
_irqL irqL;
4457
struct net_device *dev = m->private;
4458
_adapter *padapter = (_adapter *) rtw_netdev_priv(dev);
4459
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
4460
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
4461
int i, j, k;
4462
4463
_enter_critical(&pdvobjpriv->irq_th_lock, &irqL);
4464
for (i = 0; i < PCI_MAX_TX_QUEUE_COUNT; i++) {
4465
struct rtw_tx_ring *tx_ring = &pxmitpriv->tx_ring[i];
4466
4467
RTW_PRINT_SEL(m, "tx ring[%d] (%p)\n", i, tx_ring);
4468
RTW_PRINT_SEL(m, " dma: 0x%08x\n", (int) tx_ring->dma);
4469
RTW_PRINT_SEL(m, " idx: %d\n", tx_ring->idx);
4470
RTW_PRINT_SEL(m, " entries: %d\n", tx_ring->entries);
4471
/* RTW_PRINT_SEL(m, " queue: %d\n", tx_ring->queue); */
4472
RTW_PRINT_SEL(m, " qlen: %d\n", tx_ring->qlen);
4473
4474
for (j = 0; j < pxmitpriv->txringcount[i]; j++) {
4475
#ifdef CONFIG_TRX_BD_ARCH
4476
struct tx_buf_desc *entry = &tx_ring->buf_desc[j];
4477
RTW_PRINT_SEL(m, " buf_desc[%03d]: %p\n", j, entry);
4478
#else
4479
struct tx_desc *entry = &tx_ring->desc[j];
4480
RTW_PRINT_SEL(m, " desc[%03d]: %p\n", j, entry);
4481
#endif
4482
4483
for (k = 0; k < sizeof(*entry) / 4; k++) {
4484
if ((k % 4) == 0)
4485
RTW_PRINT_SEL(m, " 0x%03x", k);
4486
4487
RTW_PRINT_SEL(m, " 0x%08x ", ((int *) entry)[k]);
4488
4489
if ((k % 4) == 3)
4490
RTW_PRINT_SEL(m, "\n");
4491
}
4492
}
4493
}
4494
_exit_critical(&pdvobjpriv->irq_th_lock, &irqL);
4495
4496
return 0;
4497
}
4498
4499
#ifdef DBG_TXBD_DESC_DUMP
4500
int proc_get_tx_ring_ext(struct seq_file *m, void *v)
4501
{
4502
_irqL irqL;
4503
struct net_device *dev = m->private;
4504
_adapter *padapter = (_adapter *) rtw_netdev_priv(dev);
4505
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
4506
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
4507
struct rtw_tx_desc_backup *pbuf;
4508
int i, j, k, idx;
4509
4510
RTW_PRINT_SEL(m, "<<<< tx ring ext dump settings >>>>\n");
4511
RTW_PRINT_SEL(m, " - backup frame num: %d\n", TX_BAK_FRMAE_CNT);
4512
RTW_PRINT_SEL(m, " - backup max. desc size: %d bytes\n", TX_BAK_DESC_LEN);
4513
RTW_PRINT_SEL(m, " - backup data size: %d bytes\n\n", TX_BAK_DATA_LEN);
4514
4515
if (!pxmitpriv->dump_txbd_desc) {
4516
RTW_PRINT_SEL(m, "Dump function is disabled.\n");
4517
return 0;
4518
}
4519
4520
_enter_critical(&pdvobjpriv->irq_th_lock, &irqL);
4521
for (i = 0; i < HW_QUEUE_ENTRY; i++) {
4522
struct rtw_tx_ring *tx_ring = &pxmitpriv->tx_ring[i];
4523
4524
idx = rtw_get_tx_desc_backup(padapter, i, &pbuf);
4525
4526
RTW_PRINT_SEL(m, "Tx ring[%d]", i);
4527
switch (i) {
4528
case 0:
4529
RTW_PRINT_SEL(m, " (VO)\n");
4530
break;
4531
case 1:
4532
RTW_PRINT_SEL(m, " (VI)\n");
4533
break;
4534
case 2:
4535
RTW_PRINT_SEL(m, " (BE)\n");
4536
break;
4537
case 3:
4538
RTW_PRINT_SEL(m, " (BK)\n");
4539
break;
4540
case 4:
4541
RTW_PRINT_SEL(m, " (BCN)\n");
4542
break;
4543
case 5:
4544
RTW_PRINT_SEL(m, " (MGT)\n");
4545
break;
4546
case 6:
4547
RTW_PRINT_SEL(m, " (HIGH)\n");
4548
break;
4549
case 7:
4550
RTW_PRINT_SEL(m, " (TXCMD)\n");
4551
break;
4552
default:
4553
RTW_PRINT_SEL(m, " (?)\n");
4554
break;
4555
}
4556
4557
RTW_PRINT_SEL(m, " Entries: %d\n", TX_BAK_FRMAE_CNT);
4558
RTW_PRINT_SEL(m, " Last idx: %d\n", idx);
4559
4560
for (j = 0; j < TX_BAK_FRMAE_CNT; j++) {
4561
RTW_PRINT_SEL(m, " desc[%03d]:\n", j);
4562
4563
for (k = 0; k < (pbuf->tx_desc_size) / 4; k++) {
4564
if ((k % 4) == 0)
4565
RTW_PRINT_SEL(m, " 0x%03x", k);
4566
4567
RTW_PRINT_SEL(m, " 0x%08x ", ((int *)pbuf->tx_bak_desc)[k]);
4568
4569
if ((k % 4) == 3)
4570
RTW_PRINT_SEL(m, "\n");
4571
}
4572
4573
#if 1 /* data dump */
4574
if (pbuf->tx_desc_size) {
4575
RTW_PRINT_SEL(m, " data[%03d]:\n", j);
4576
4577
for (k = 0; k < (TX_BAK_DATA_LEN) / 4; k++) {
4578
if ((k % 4) == 0)
4579
RTW_PRINT_SEL(m, " 0x%03x", k);
4580
4581
RTW_PRINT_SEL(m, " 0x%08x ", ((int *)pbuf->tx_bak_data_hdr)[k]);
4582
4583
if ((k % 4) == 3)
4584
RTW_PRINT_SEL(m, "\n");
4585
}
4586
RTW_PRINT_SEL(m, "\n");
4587
}
4588
#endif
4589
4590
RTW_PRINT_SEL(m, " R/W pointer: %d/%d\n", pbuf->tx_bak_rp, pbuf->tx_bak_wp);
4591
4592
pbuf = pbuf + 1;
4593
}
4594
RTW_PRINT_SEL(m, "\n");
4595
}
4596
_exit_critical(&pdvobjpriv->irq_th_lock, &irqL);
4597
4598
return 0;
4599
}
4600
4601
ssize_t proc_set_tx_ring_ext(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
4602
{
4603
_irqL irqL;
4604
struct net_device *dev = data;
4605
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
4606
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
4607
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
4608
char tmp[32];
4609
u32 reset = 0;
4610
u32 dump = 0;
4611
4612
if (count < 1)
4613
return -EFAULT;
4614
4615
if (count > sizeof(tmp)) {
4616
rtw_warn_on(1);
4617
return -EFAULT;
4618
}
4619
4620
if (buffer && !copy_from_user(tmp, buffer, count)) {
4621
4622
int num = sscanf(tmp, "%u %u", &dump, &reset);
4623
4624
if (num != 2) {
4625
RTW_INFO("invalid parameter!\n");
4626
return count;
4627
}
4628
4629
_enter_critical(&pdvobjpriv->irq_th_lock, &irqL);
4630
pxmitpriv->dump_txbd_desc = (BOOLEAN) dump;
4631
4632
if (reset == 1)
4633
rtw_tx_desc_backup_reset();
4634
4635
_exit_critical(&pdvobjpriv->irq_th_lock, &irqL);
4636
4637
}
4638
4639
return count;
4640
}
4641
4642
#endif
4643
4644
#endif
4645
4646
#ifdef CONFIG_WOWLAN
4647
int proc_get_pattern_info(struct seq_file *m, void *v)
4648
{
4649
struct net_device *dev = m->private;
4650
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
4651
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
4652
u8 val8;
4653
char str_1[128];
4654
char *p_str;
4655
int i = 0 , j = 0, k = 0;
4656
int len = 0, max_len = 0, total = 0;
4657
4658
p_str = str_1;
4659
max_len = sizeof(str_1);
4660
4661
total = pwrpriv->wowlan_pattern_idx;
4662
4663
rtw_set_default_pattern(padapter);
4664
4665
/*show pattern*/
4666
RTW_PRINT_SEL(m, "\n======[Pattern Info.]======\n");
4667
RTW_PRINT_SEL(m, "pattern number: %d\n", total);
4668
RTW_PRINT_SEL(m, "support default patterns: %c\n",
4669
(pwrpriv->default_patterns_en) ? 'Y' : 'N');
4670
4671
for (k = 0; k < total ; k++) {
4672
RTW_PRINT_SEL(m, "\npattern idx: %d\n", k);
4673
RTW_PRINT_SEL(m, "pattern content:\n");
4674
4675
p_str = str_1;
4676
max_len = sizeof(str_1);
4677
for (i = 0 ; i < MAX_WKFM_PATTERN_SIZE / 8 ; i++) {
4678
_rtw_memset(p_str, 0, max_len);
4679
len = 0;
4680
for (j = 0 ; j < 8 ; j++) {
4681
val8 = pwrpriv->patterns[k].content[i * 8 + j];
4682
len += snprintf(p_str + len, max_len - len,
4683
"%02x ", val8);
4684
}
4685
RTW_PRINT_SEL(m, "%s\n", p_str);
4686
}
4687
RTW_PRINT_SEL(m, "\npattern mask:\n");
4688
for (i = 0 ; i < MAX_WKFM_SIZE / 8 ; i++) {
4689
_rtw_memset(p_str, 0, max_len);
4690
len = 0;
4691
for (j = 0 ; j < 8 ; j++) {
4692
val8 = pwrpriv->patterns[k].mask[i * 8 + j];
4693
len += snprintf(p_str + len, max_len - len,
4694
"%02x ", val8);
4695
}
4696
RTW_PRINT_SEL(m, "%s\n", p_str);
4697
}
4698
4699
RTW_PRINT_SEL(m, "\npriv_pattern_len:\n");
4700
RTW_PRINT_SEL(m, "pattern_len: %d\n", pwrpriv->patterns[k].len);
4701
RTW_PRINT_SEL(m, "*****************\n");
4702
}
4703
4704
return 0;
4705
}
4706
4707
ssize_t proc_set_pattern_info(struct file *file, const char __user *buffer,
4708
size_t count, loff_t *pos, void *data)
4709
{
4710
struct net_device *dev = data;
4711
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
4712
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
4713
struct wowlan_ioctl_param poidparam;
4714
u8 tmp[MAX_WKFM_PATTERN_STR_LEN + 1] = {0};
4715
int ret = 0;
4716
u8 index = 0;
4717
4718
poidparam.subcode = 0;
4719
4720
if (count < 1)
4721
return -EFAULT;
4722
4723
if (count >= sizeof(tmp)) {
4724
RTW_ERR("%s: pattern string is too long, count=%zu\n",
4725
__func__, count);
4726
return -EFAULT;
4727
}
4728
4729
if (pwrpriv->wowlan_pattern_idx >= MAX_WKFM_CAM_NUM) {
4730
RTW_ERR("priv-pattern is full(idx: %d)\n",
4731
pwrpriv->wowlan_pattern_idx);
4732
RTW_ERR("please clean priv-pattern first\n");
4733
return -ENOMEM;
4734
}
4735
4736
if (buffer && !copy_from_user(tmp, buffer, count)) {
4737
if (strncmp(tmp, "clean", 5) == 0) {
4738
poidparam.subcode = WOWLAN_PATTERN_CLEAN;
4739
rtw_hal_set_hwreg(padapter,
4740
HW_VAR_WOWLAN, (u8 *)&poidparam);
4741
} else {
4742
index = pwrpriv->wowlan_pattern_idx;
4743
ret = rtw_wowlan_parser_pattern_cmd(tmp,
4744
pwrpriv->patterns[index].content,
4745
&pwrpriv->patterns[index].len,
4746
pwrpriv->patterns[index].mask);
4747
if (ret == _TRUE)
4748
pwrpriv->wowlan_pattern_idx++;
4749
}
4750
} else {
4751
rtw_warn_on(1);
4752
return -EFAULT;
4753
}
4754
4755
return count;
4756
}
4757
4758
int proc_get_wakeup_event(struct seq_file *m, void *v)
4759
{
4760
struct net_device *dev = m->private;
4761
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
4762
struct registry_priv *registry_par = &padapter->registrypriv;
4763
4764
RTW_PRINT_SEL(m, "wakeup event: %#02x\n", registry_par->wakeup_event);
4765
return 0;
4766
}
4767
4768
ssize_t proc_set_wakeup_event(struct file *file, const char __user *buffer,
4769
size_t count, loff_t *pos, void *data)
4770
{
4771
struct net_device *dev = data;
4772
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
4773
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter);
4774
struct registry_priv *registry_par = &padapter->registrypriv;
4775
u32 wakeup_event = 0;
4776
4777
u8 tmp[8] = {0};
4778
int num = 0;
4779
4780
if (count < 1)
4781
return -EFAULT;
4782
4783
if (count > sizeof(tmp)) {
4784
rtw_warn_on(1);
4785
return -EFAULT;
4786
}
4787
4788
if (buffer && !copy_from_user(tmp, buffer, count))
4789
num = sscanf(tmp, "%u", &wakeup_event);
4790
else
4791
return -EFAULT;
4792
4793
if (num == 1 && wakeup_event <= 0x07) {
4794
registry_par->wakeup_event = wakeup_event;
4795
4796
if (wakeup_event & BIT(1))
4797
pwrctrlpriv->default_patterns_en = _TRUE;
4798
else
4799
pwrctrlpriv->default_patterns_en = _FALSE;
4800
4801
rtw_wow_pattern_sw_reset(padapter);
4802
4803
RTW_INFO("%s: wakeup_event: %#2x, default pattern: %d\n",
4804
__func__, registry_par->wakeup_event,
4805
pwrctrlpriv->default_patterns_en);
4806
} else {
4807
return -EINVAL;
4808
}
4809
4810
return count;
4811
}
4812
4813
int proc_get_wakeup_reason(struct seq_file *m, void *v)
4814
{
4815
struct net_device *dev = m->private;
4816
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
4817
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
4818
u8 val = pwrpriv->wowlan_last_wake_reason;
4819
4820
RTW_PRINT_SEL(m, "last wake reason: %#02x\n", val);
4821
return 0;
4822
}
4823
#endif /*CONFIG_WOWLAN*/
4824
4825
#ifdef CONFIG_GPIO_WAKEUP
4826
int proc_get_wowlan_gpio_info(struct seq_file *m, void *v)
4827
{
4828
struct net_device *dev = m->private;
4829
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
4830
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
4831
u8 val = pwrpriv->is_high_active;
4832
4833
RTW_PRINT_SEL(m, "wakeup_gpio_idx: %d\n", WAKEUP_GPIO_IDX);
4834
RTW_PRINT_SEL(m, "high_active: %d\n", val);
4835
4836
return 0;
4837
}
4838
4839
ssize_t proc_set_wowlan_gpio_info(struct file *file, const char __user *buffer,
4840
size_t count, loff_t *pos, void *data)
4841
{
4842
struct net_device *dev = data;
4843
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
4844
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
4845
char tmp[32] = {0};
4846
int num = 0;
4847
u32 is_high_active = 0;
4848
u8 val8 = 0;
4849
4850
if (count < 1)
4851
return -EFAULT;
4852
4853
if (count > sizeof(tmp)) {
4854
rtw_warn_on(1);
4855
return -EFAULT;
4856
}
4857
4858
if (buffer && !copy_from_user(tmp, buffer, count)) {
4859
4860
num = sscanf(tmp, "%u", &is_high_active);
4861
4862
if (num != 1) {
4863
RTW_INFO("Invalid format\n");
4864
return count;
4865
}
4866
4867
is_high_active = is_high_active == 0 ? 0 : 1;
4868
4869
pwrpriv->is_high_active = is_high_active;
4870
4871
rtw_ps_deny(padapter, PS_DENY_IOCTL);
4872
LeaveAllPowerSaveModeDirect(padapter);
4873
4874
#ifdef CONFIG_WAKEUP_GPIO_INPUT_MODE
4875
if (pwrpriv->is_high_active == 0)
4876
rtw_hal_set_input_gpio(padapter, WAKEUP_GPIO_IDX);
4877
else
4878
rtw_hal_set_output_gpio(padapter, WAKEUP_GPIO_IDX, 0);
4879
#else
4880
val8 = (pwrpriv->is_high_active == 0) ? 1 : 0;
4881
rtw_hal_switch_gpio_wl_ctrl(padapter, WAKEUP_GPIO_IDX, _TRUE);
4882
rtw_hal_set_output_gpio(padapter, WAKEUP_GPIO_IDX, val8);
4883
#endif
4884
rtw_ps_deny_cancel(padapter, PS_DENY_IOCTL);
4885
4886
RTW_INFO("set %s %d\n", "gpio_high_active",
4887
pwrpriv->is_high_active);
4888
RTW_INFO("%s: set GPIO_%d %d as default.\n",
4889
__func__, WAKEUP_GPIO_IDX, val8);
4890
}
4891
4892
return count;
4893
}
4894
#endif /* CONFIG_GPIO_WAKEUP */
4895
4896
#ifdef CONFIG_P2P_WOWLAN
4897
int proc_get_p2p_wowlan_info(struct seq_file *m, void *v)
4898
{
4899
struct net_device *dev = m->private;
4900
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
4901
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
4902
struct p2p_wowlan_info peerinfo = pwdinfo->p2p_wow_info;
4903
if (_TRUE == peerinfo.is_trigger) {
4904
RTW_PRINT_SEL(m, "is_trigger: TRUE\n");
4905
switch (peerinfo.wowlan_recv_frame_type) {
4906
case P2P_WOWLAN_RECV_NEGO_REQ:
4907
RTW_PRINT_SEL(m, "Frame Type: Nego Request\n");
4908
break;
4909
case P2P_WOWLAN_RECV_INVITE_REQ:
4910
RTW_PRINT_SEL(m, "Frame Type: Invitation Request\n");
4911
break;
4912
case P2P_WOWLAN_RECV_PROVISION_REQ:
4913
RTW_PRINT_SEL(m, "Frame Type: Provision Request\n");
4914
break;
4915
default:
4916
break;
4917
}
4918
RTW_PRINT_SEL(m, "Peer Addr: "MAC_FMT"\n", MAC_ARG(peerinfo.wowlan_peer_addr));
4919
RTW_PRINT_SEL(m, "Peer WPS Config: %x\n", peerinfo.wowlan_peer_wpsconfig);
4920
RTW_PRINT_SEL(m, "Persistent Group: %d\n", peerinfo.wowlan_peer_is_persistent);
4921
RTW_PRINT_SEL(m, "Intivation Type: %d\n", peerinfo.wowlan_peer_invitation_type);
4922
} else
4923
RTW_PRINT_SEL(m, "is_trigger: False\n");
4924
return 0;
4925
}
4926
#endif /* CONFIG_P2P_WOWLAN */
4927
#ifdef CONFIG_BCN_CNT_CONFIRM_HDL
4928
int proc_get_new_bcn_max(struct seq_file *m, void *v)
4929
{
4930
extern int new_bcn_max;
4931
4932
RTW_PRINT_SEL(m, "%d", new_bcn_max);
4933
return 0;
4934
}
4935
4936
ssize_t proc_set_new_bcn_max(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
4937
{
4938
char tmp[32];
4939
extern int new_bcn_max;
4940
4941
if (count < 1)
4942
return -EFAULT;
4943
4944
if (count > sizeof(tmp)) {
4945
rtw_warn_on(1);
4946
return -EFAULT;
4947
}
4948
4949
if (buffer && !copy_from_user(tmp, buffer, count))
4950
sscanf(tmp, "%d ", &new_bcn_max);
4951
4952
return count;
4953
}
4954
#endif
4955
#ifdef CONFIG_POWER_SAVING
4956
int proc_get_ps_info(struct seq_file *m, void *v)
4957
{
4958
struct net_device *dev = m->private;
4959
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
4960
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
4961
u8 ips_mode = pwrpriv->ips_mode_req;
4962
u8 lps_mode = pwrpriv->power_mgnt;
4963
u8 lps_level = pwrpriv->lps_level;
4964
#ifdef CONFIG_LPS_1T1R
4965
u8 lps_1t1r = pwrpriv->lps_1t1r;
4966
#endif
4967
#ifdef CONFIG_WOWLAN
4968
u8 wow_lps_mode = pwrpriv->wowlan_power_mgmt;
4969
u8 wow_lps_level = pwrpriv->wowlan_lps_level;
4970
#ifdef CONFIG_LPS_1T1R
4971
u8 wow_lps_1t1r = pwrpriv->wowlan_lps_1t1r;
4972
#endif
4973
#endif /* CONFIG_WOWLAN */
4974
char *str = "";
4975
4976
RTW_PRINT_SEL(m, "======Power Saving Info:======\n");
4977
RTW_PRINT_SEL(m, "*IPS:\n");
4978
4979
if (ips_mode == IPS_NORMAL) {
4980
#ifdef CONFIG_FWLPS_IN_IPS
4981
str = "FW_LPS_IN_IPS";
4982
#else
4983
str = "Card Disable";
4984
#endif
4985
} else if (ips_mode == IPS_NONE)
4986
str = "NO IPS";
4987
else if (ips_mode == IPS_LEVEL_2)
4988
str = "IPS_LEVEL_2";
4989
else
4990
str = "invalid ips_mode";
4991
4992
RTW_PRINT_SEL(m, " IPS mode: %s\n", str);
4993
RTW_PRINT_SEL(m, " IPS enter count:%d, IPS leave count:%d\n",
4994
pwrpriv->ips_enter_cnts, pwrpriv->ips_leave_cnts);
4995
RTW_PRINT_SEL(m, "------------------------------\n");
4996
RTW_PRINT_SEL(m, "*LPS:\n");
4997
4998
if (lps_mode == PS_MODE_ACTIVE)
4999
str = "NO LPS";
5000
else if (lps_mode == PS_MODE_MIN)
5001
str = "MIN";
5002
else if (lps_mode == PS_MODE_MAX)
5003
str = "MAX";
5004
else if (lps_mode == PS_MODE_DTIM)
5005
str = "DTIM";
5006
else
5007
sprintf(str, "%d", lps_mode);
5008
5009
RTW_PRINT_SEL(m, " LPS mode: %s\n", str);
5010
5011
if (pwrpriv->dtim != 0)
5012
RTW_PRINT_SEL(m, " DTIM: %d\n", pwrpriv->dtim);
5013
RTW_PRINT_SEL(m, " LPS enter count:%d, LPS leave count:%d\n",
5014
pwrpriv->lps_enter_cnts, pwrpriv->lps_leave_cnts);
5015
5016
if (lps_level == LPS_LCLK)
5017
str = "LPS_LCLK";
5018
else if (lps_level == LPS_PG)
5019
str = "LPS_PG";
5020
else
5021
str = "LPS_NORMAL";
5022
RTW_PRINT_SEL(m, " LPS level: %s\n", str);
5023
5024
#ifdef CONFIG_LPS_1T1R
5025
RTW_PRINT_SEL(m, " LPS 1T1R: %d\n", lps_1t1r);
5026
#endif
5027
5028
#ifdef CONFIG_WOWLAN
5029
RTW_PRINT_SEL(m, "------------------------------\n");
5030
RTW_PRINT_SEL(m, "*WOW LPS:\n");
5031
5032
if (wow_lps_mode == PS_MODE_ACTIVE)
5033
str = "NO LPS";
5034
else if (wow_lps_mode == PS_MODE_MIN)
5035
str = "MIN";
5036
else if (wow_lps_mode == PS_MODE_MAX)
5037
str = "MAX";
5038
else if (wow_lps_mode == PS_MODE_DTIM)
5039
str = "DTIM";
5040
else
5041
sprintf(str, "%d", wow_lps_mode);
5042
5043
RTW_PRINT_SEL(m, " WOW LPS mode: %s\n", str);
5044
5045
if (wow_lps_level == LPS_LCLK)
5046
str = "LPS_LCLK";
5047
else if (wow_lps_level == LPS_PG)
5048
str = "LPS_PG";
5049
else
5050
str = "LPS_NORMAL";
5051
RTW_PRINT_SEL(m, " WOW LPS level: %s\n", str);
5052
5053
#ifdef CONFIG_LPS_1T1R
5054
RTW_PRINT_SEL(m, " WOW LPS 1T1R: %d\n", wow_lps_1t1r);
5055
#endif
5056
#endif /* CONFIG_WOWLAN */
5057
5058
RTW_PRINT_SEL(m, "=============================\n");
5059
return 0;
5060
}
5061
5062
ssize_t proc_set_ps_info(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
5063
{
5064
struct net_device *dev = data;
5065
struct _ADAPTER *adapter = (_adapter *)rtw_netdev_priv(dev);
5066
char tmp[8];
5067
int num = 0;
5068
int mode = 0;
5069
int en = 0;
5070
5071
if (count > sizeof(tmp)) {
5072
rtw_warn_on(1);
5073
return -EFAULT;
5074
}
5075
5076
if (!buffer || copy_from_user(tmp, buffer, count))
5077
goto exit;
5078
5079
num = sscanf(tmp, "%d %d", &mode, &en);
5080
if (num > 2) {
5081
RTW_ERR("%s: invalid parameter!\n", __FUNCTION__);
5082
goto exit;
5083
}
5084
5085
if (num == 1 && mode == 0) {
5086
/* back to original LPS/IPS Mode */
5087
RTW_INFO("%s: back to original LPS/IPS Mode\n", __FUNCTION__);
5088
5089
rtw_pm_set_lps(adapter, adapter->registrypriv.power_mgnt);
5090
5091
rtw_pm_set_ips(adapter, adapter->registrypriv.ips_mode);
5092
5093
#ifdef CONFIG_WOWLAN
5094
RTW_INFO("%s: back to original WOW LPS Mode\n", __FUNCTION__);
5095
5096
rtw_pm_set_wow_lps(adapter, adapter->registrypriv.wow_power_mgnt);
5097
#endif /* CONFIG_WOWLAN */
5098
5099
goto exit;
5100
}
5101
5102
if (mode == 1) {
5103
/* LPS */
5104
RTW_INFO("%s: LPS: %s, en=%d\n", __FUNCTION__, (en == 0) ? "disable":"enable", en);
5105
if (rtw_pm_set_lps(adapter, en) != 0 )
5106
RTW_ERR("%s: invalid parameter, mode=%d, level=%d\n", __FUNCTION__, mode, en);
5107
5108
} else if (mode == 2) {
5109
/* IPS */
5110
RTW_INFO("%s: IPS: %s, en=%d\n", __FUNCTION__, (en == 0) ? "disable":"enable", en);
5111
if (rtw_pm_set_ips(adapter, en) != 0 )
5112
RTW_ERR("%s: invalid parameter, mode=%d, level=%d\n", __FUNCTION__, mode, en);
5113
}
5114
#ifdef CONFIG_WOWLAN
5115
else if (mode == 3) {
5116
/* WOW LPS */
5117
RTW_INFO("%s: WOW LPS: %s, en=%d\n", __FUNCTION__, (en == 0) ? "disable":"enable", en);
5118
if (rtw_pm_set_wow_lps(adapter, en) != 0 )
5119
RTW_ERR("%s: invalid parameter, mode=%d, level=%d\n", __FUNCTION__, mode, en);
5120
}
5121
#endif /* CONFIG_WOWLAN */
5122
else
5123
RTW_ERR("%s: invalid parameter, mode = %d!\n", __FUNCTION__, mode);
5124
5125
exit:
5126
return count;
5127
}
5128
5129
#ifdef CONFIG_WMMPS_STA
5130
int proc_get_wmmps_info(struct seq_file *m, void *v)
5131
{
5132
struct net_device *dev = m->private;
5133
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
5134
struct registry_priv *pregpriv = &padapter->registrypriv;
5135
char *uapsd_max_sp_str="";
5136
5137
if (pregpriv){
5138
switch(pregpriv->uapsd_max_sp_len) {
5139
case 0:
5140
uapsd_max_sp_str = "NO_LIMIT";
5141
break;
5142
case 1:
5143
uapsd_max_sp_str = "TWO_MSDU";
5144
break;
5145
case 2:
5146
uapsd_max_sp_str = "FOUR_MSDU";
5147
break;
5148
case 3:
5149
uapsd_max_sp_str = "SIX_MSDU";
5150
break;
5151
default:
5152
uapsd_max_sp_str = "UNSPECIFIED";
5153
break;
5154
}
5155
5156
RTW_PRINT_SEL(m, "====== WMMPS_STA Info:======\n");
5157
RTW_PRINT_SEL(m, "uapsd_max_sp_len=0x%02x (%s)\n", pregpriv->uapsd_max_sp_len, uapsd_max_sp_str);
5158
RTW_PRINT_SEL(m, "uapsd_ac_enable=0x%02x\n", pregpriv->uapsd_ac_enable);
5159
RTW_PRINT_SEL(m, "BIT0 - AC_VO UAPSD: %s\n", (pregpriv->uapsd_ac_enable & DRV_CFG_UAPSD_VO) ? "Enabled" : "Disabled");
5160
RTW_PRINT_SEL(m, "BIT1 - AC_VI UAPSD: %s\n", (pregpriv->uapsd_ac_enable & DRV_CFG_UAPSD_VI) ? "Enabled" : "Disabled");
5161
RTW_PRINT_SEL(m, "BIT2 - AC_BK UAPSD: %s\n", (pregpriv->uapsd_ac_enable & DRV_CFG_UAPSD_BK) ? "Enabled" : "Disabled");
5162
RTW_PRINT_SEL(m, "BIT3 - AC_BE UAPSD: %s\n", (pregpriv->uapsd_ac_enable & DRV_CFG_UAPSD_BE) ? "Enabled" : "Disabled");
5163
RTW_PRINT_SEL(m, "============================\n");
5164
}
5165
5166
return 0;
5167
}
5168
5169
ssize_t proc_set_wmmps_info(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
5170
{
5171
struct net_device *dev = data;
5172
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
5173
struct registry_priv *pregpriv = &padapter->registrypriv;
5174
char tmp[32];
5175
u8 uapsd_ac_setting;
5176
u8 uapsd_max_sp_len_setting;
5177
5178
if (count < 1)
5179
return -EFAULT;
5180
5181
if (count > sizeof(tmp)) {
5182
rtw_warn_on(1);
5183
return -EFAULT;
5184
}
5185
5186
if (buffer && !copy_from_user(tmp, buffer, count)) {
5187
5188
int num = sscanf(tmp, "%hhu %hhx", &uapsd_max_sp_len_setting, &uapsd_ac_setting);
5189
5190
if (pregpriv) {
5191
if (num >= 1) {
5192
pregpriv->uapsd_max_sp_len = uapsd_max_sp_len_setting;
5193
RTW_INFO("uapsd_max_sp_len = %d\n", pregpriv->uapsd_max_sp_len);
5194
}
5195
5196
if (num >= 2) {
5197
pregpriv->uapsd_ac_enable = uapsd_ac_setting;
5198
RTW_INFO("uapsd_ac_enable = 0x%02x\n", pregpriv->uapsd_ac_enable);
5199
}
5200
}
5201
}
5202
5203
return count;
5204
}
5205
#endif /* CONFIG_WMMPS_STA */
5206
#endif /* CONFIG_POWER_SAVING */
5207
5208
#ifdef CONFIG_TDLS
5209
int proc_get_tdls_enable(struct seq_file *m, void *v)
5210
{
5211
struct net_device *dev = m->private;
5212
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
5213
struct registry_priv *pregpriv = &padapter->registrypriv;
5214
5215
if (pregpriv)
5216
RTW_PRINT_SEL(m, "TDLS is %s !\n", (rtw_is_tdls_enabled(padapter) == _TRUE) ? "enabled" : "disabled");
5217
5218
return 0;
5219
}
5220
5221
ssize_t proc_set_tdls_enable(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
5222
{
5223
struct net_device *dev = data;
5224
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
5225
struct registry_priv *pregpriv = &padapter->registrypriv;
5226
char tmp[32];
5227
u32 en_tdls = 0;
5228
5229
if (count < 1)
5230
return -EFAULT;
5231
5232
if (count > sizeof(tmp)) {
5233
rtw_warn_on(1);
5234
return -EFAULT;
5235
}
5236
5237
if (buffer && !copy_from_user(tmp, buffer, count)) {
5238
5239
int num = sscanf(tmp, "%d ", &en_tdls);
5240
5241
if (num == 1 && pregpriv) {
5242
if (en_tdls > 0)
5243
rtw_enable_tdls_func(padapter);
5244
else
5245
rtw_disable_tdls_func(padapter, _TRUE);
5246
}
5247
}
5248
5249
return count;
5250
}
5251
5252
static int proc_tdls_display_tdls_function_info(struct seq_file *m)
5253
{
5254
struct net_device *dev = m->private;
5255
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
5256
struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
5257
u8 SpaceBtwnItemAndValue = TDLS_DBG_INFO_SPACE_BTWN_ITEM_AND_VALUE;
5258
u8 SpaceBtwnItemAndValueTmp = 0;
5259
BOOLEAN FirstMatchFound = _FALSE;
5260
int j = 0;
5261
5262
RTW_PRINT_SEL(m, "============[TDLS Function Info]============\n");
5263
RTW_PRINT_SEL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS Enable", (rtw_is_tdls_enabled(padapter) == _TRUE) ? "_TRUE" : "_FALSE");
5264
RTW_PRINT_SEL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS Driver Setup", (ptdlsinfo->driver_setup == _TRUE) ? "_TRUE" : "_FALSE");
5265
RTW_PRINT_SEL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS Prohibited", (ptdlsinfo->ap_prohibited == _TRUE) ? "_TRUE" : "_FALSE");
5266
RTW_PRINT_SEL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS Channel Switch Prohibited", (ptdlsinfo->ch_switch_prohibited == _TRUE) ? "_TRUE" : "_FALSE");
5267
RTW_PRINT_SEL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS Link Established", (ptdlsinfo->link_established == _TRUE) ? "_TRUE" : "_FALSE");
5268
RTW_PRINT_SEL(m, "%-*s = %d/%d\n", SpaceBtwnItemAndValue, "TDLS STA Num (Linked/Allowed)", ptdlsinfo->sta_cnt, MAX_ALLOWED_TDLS_STA_NUM);
5269
RTW_PRINT_SEL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS Allowed STA Num Reached", (ptdlsinfo->sta_maximum == _TRUE) ? "_TRUE" : "_FALSE");
5270
5271
#ifdef CONFIG_TDLS_CH_SW
5272
RTW_PRINT_SEL(m, "%-*s =", SpaceBtwnItemAndValue, "TDLS CH SW State");
5273
if (ptdlsinfo->chsw_info.ch_sw_state == TDLS_STATE_NONE)
5274
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_STATE_NONE");
5275
else {
5276
for (j = 0; j < 32; j++) {
5277
if (ptdlsinfo->chsw_info.ch_sw_state & BIT(j)) {
5278
if (FirstMatchFound == _FALSE) {
5279
SpaceBtwnItemAndValueTmp = 1;
5280
FirstMatchFound = _TRUE;
5281
} else
5282
SpaceBtwnItemAndValueTmp = SpaceBtwnItemAndValue + 3;
5283
switch (BIT(j)) {
5284
case TDLS_INITIATOR_STATE:
5285
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_INITIATOR_STATE");
5286
break;
5287
case TDLS_RESPONDER_STATE:
5288
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_RESPONDER_STATE");
5289
break;
5290
case TDLS_LINKED_STATE:
5291
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_LINKED_STATE");
5292
break;
5293
case TDLS_WAIT_PTR_STATE:
5294
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_WAIT_PTR_STATE");
5295
break;
5296
case TDLS_ALIVE_STATE:
5297
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_ALIVE_STATE");
5298
break;
5299
case TDLS_CH_SWITCH_ON_STATE:
5300
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_CH_SWITCH_ON_STATE");
5301
break;
5302
case TDLS_PEER_AT_OFF_STATE:
5303
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_PEER_AT_OFF_STATE");
5304
break;
5305
case TDLS_CH_SW_INITIATOR_STATE:
5306
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_CH_SW_INITIATOR_STATE");
5307
break;
5308
case TDLS_WAIT_CH_RSP_STATE:
5309
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValue, " ", "TDLS_WAIT_CH_RSP_STATE");
5310
break;
5311
default:
5312
RTW_PRINT_SEL(m, "%-*sBIT(%d)\n", SpaceBtwnItemAndValueTmp, " ", j);
5313
break;
5314
}
5315
}
5316
}
5317
}
5318
5319
RTW_PRINT_SEL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS CH SW On", (ATOMIC_READ(&ptdlsinfo->chsw_info.chsw_on) == _TRUE) ? "_TRUE" : "_FALSE");
5320
RTW_PRINT_SEL(m, "%-*s = %d\n", SpaceBtwnItemAndValue, "TDLS CH SW Off-Channel Num", ptdlsinfo->chsw_info.off_ch_num);
5321
RTW_PRINT_SEL(m, "%-*s = %d\n", SpaceBtwnItemAndValue, "TDLS CH SW Channel Offset", ptdlsinfo->chsw_info.ch_offset);
5322
RTW_PRINT_SEL(m, "%-*s = %d\n", SpaceBtwnItemAndValue, "TDLS CH SW Current Time", ptdlsinfo->chsw_info.cur_time);
5323
RTW_PRINT_SEL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS CH SW Delay Switch Back", (ptdlsinfo->chsw_info.delay_switch_back == _TRUE) ? "_TRUE" : "_FALSE");
5324
RTW_PRINT_SEL(m, "%-*s = %d\n", SpaceBtwnItemAndValue, "TDLS CH SW Dump Back", ptdlsinfo->chsw_info.dump_stack);
5325
#endif
5326
5327
RTW_PRINT_SEL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS Device Discovered", (ptdlsinfo->dev_discovered == _TRUE) ? "_TRUE" : "_FALSE");
5328
5329
return 0;
5330
}
5331
5332
static int proc_tdls_display_network_info(struct seq_file *m)
5333
{
5334
struct net_device *dev = m->private;
5335
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
5336
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
5337
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
5338
struct wlan_network *cur_network = &(pmlmepriv->cur_network);
5339
int i = 0;
5340
u8 SpaceBtwnItemAndValue = TDLS_DBG_INFO_SPACE_BTWN_ITEM_AND_VALUE;
5341
5342
/* Display the linked AP/GO info */
5343
RTW_PRINT_SEL(m, "============[Associated AP/GO Info]============\n");
5344
5345
if ((pmlmepriv->fw_state & WIFI_STATION_STATE) && (pmlmepriv->fw_state & _FW_LINKED)) {
5346
RTW_PRINT_SEL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "BSSID", cur_network->network.Ssid.Ssid);
5347
RTW_PRINT_SEL(m, "%-*s = "MAC_FMT"\n", SpaceBtwnItemAndValue, "Mac Address", MAC_ARG(cur_network->network.MacAddress));
5348
5349
RTW_PRINT_SEL(m, "%-*s = ", SpaceBtwnItemAndValue, "Wireless Mode");
5350
for (i = 0; i < 8; i++) {
5351
if (pmlmeext->cur_wireless_mode & BIT(i)) {
5352
switch (BIT(i)) {
5353
case WIRELESS_11B:
5354
RTW_PRINT_SEL(m, "%4s", "11B ");
5355
break;
5356
case WIRELESS_11G:
5357
RTW_PRINT_SEL(m, "%4s", "11G ");
5358
break;
5359
case WIRELESS_11A:
5360
RTW_PRINT_SEL(m, "%4s", "11A ");
5361
break;
5362
case WIRELESS_11_24N:
5363
RTW_PRINT_SEL(m, "%7s", "11_24N ");
5364
break;
5365
case WIRELESS_11_5N:
5366
RTW_PRINT_SEL(m, "%6s", "11_5N ");
5367
break;
5368
case WIRELESS_AUTO:
5369
RTW_PRINT_SEL(m, "%5s", "AUTO ");
5370
break;
5371
case WIRELESS_11AC:
5372
RTW_PRINT_SEL(m, "%5s", "11AC ");
5373
break;
5374
}
5375
}
5376
}
5377
RTW_PRINT_SEL(m, "\n");
5378
5379
RTW_PRINT_SEL(m, "%-*s = ", SpaceBtwnItemAndValue, "Privacy");
5380
switch (padapter->securitypriv.dot11PrivacyAlgrthm) {
5381
case _NO_PRIVACY_:
5382
RTW_PRINT_SEL(m, "%s\n", "NO PRIVACY");
5383
break;
5384
case _WEP40_:
5385
RTW_PRINT_SEL(m, "%s\n", "WEP 40");
5386
break;
5387
case _TKIP_:
5388
RTW_PRINT_SEL(m, "%s\n", "TKIP");
5389
break;
5390
case _TKIP_WTMIC_:
5391
RTW_PRINT_SEL(m, "%s\n", "TKIP WTMIC");
5392
break;
5393
case _AES_:
5394
RTW_PRINT_SEL(m, "%s\n", "AES");
5395
break;
5396
case _WEP104_:
5397
RTW_PRINT_SEL(m, "%s\n", "WEP 104");
5398
break;
5399
case _WEP_WPA_MIXED_:
5400
RTW_PRINT_SEL(m, "%s\n", "WEP/WPA Mixed");
5401
break;
5402
case _SMS4_:
5403
RTW_PRINT_SEL(m, "%s\n", "SMS4");
5404
break;
5405
#ifdef CONFIG_IEEE80211W
5406
case _BIP_:
5407
RTW_PRINT_SEL(m, "%s\n", "BIP");
5408
break;
5409
#endif /* CONFIG_IEEE80211W */
5410
}
5411
5412
RTW_PRINT_SEL(m, "%-*s = %d\n", SpaceBtwnItemAndValue, "Channel", pmlmeext->cur_channel);
5413
RTW_PRINT_SEL(m, "%-*s = ", SpaceBtwnItemAndValue, "Channel Offset");
5414
switch (pmlmeext->cur_ch_offset) {
5415
case HAL_PRIME_CHNL_OFFSET_DONT_CARE:
5416
RTW_PRINT_SEL(m, "%s\n", "N/A");
5417
break;
5418
case HAL_PRIME_CHNL_OFFSET_LOWER:
5419
RTW_PRINT_SEL(m, "%s\n", "Lower");
5420
break;
5421
case HAL_PRIME_CHNL_OFFSET_UPPER:
5422
RTW_PRINT_SEL(m, "%s\n", "Upper");
5423
break;
5424
}
5425
5426
RTW_PRINT_SEL(m, "%-*s = ", SpaceBtwnItemAndValue, "Bandwidth Mode");
5427
switch (pmlmeext->cur_bwmode) {
5428
case CHANNEL_WIDTH_20:
5429
RTW_PRINT_SEL(m, "%s\n", "20MHz");
5430
break;
5431
case CHANNEL_WIDTH_40:
5432
RTW_PRINT_SEL(m, "%s\n", "40MHz");
5433
break;
5434
case CHANNEL_WIDTH_80:
5435
RTW_PRINT_SEL(m, "%s\n", "80MHz");
5436
break;
5437
case CHANNEL_WIDTH_160:
5438
RTW_PRINT_SEL(m, "%s\n", "160MHz");
5439
break;
5440
case CHANNEL_WIDTH_80_80:
5441
RTW_PRINT_SEL(m, "%s\n", "80MHz + 80MHz");
5442
break;
5443
}
5444
} else
5445
RTW_PRINT_SEL(m, "No association with AP/GO exists!\n");
5446
5447
return 0;
5448
}
5449
5450
static int proc_tdls_display_tdls_sta_info(struct seq_file *m)
5451
{
5452
struct net_device *dev = m->private;
5453
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
5454
struct sta_priv *pstapriv = &padapter->stapriv;
5455
struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
5456
struct sta_info *psta;
5457
int i = 0, j = 0;
5458
_irqL irqL;
5459
_list *plist, *phead;
5460
u8 SpaceBtwnItemAndValue = TDLS_DBG_INFO_SPACE_BTWN_ITEM_AND_VALUE;
5461
u8 SpaceBtwnItemAndValueTmp = 0;
5462
u8 NumOfTdlsStaToShow = 0;
5463
BOOLEAN FirstMatchFound = _FALSE;
5464
5465
/* Search for TDLS sta info to display */
5466
_enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
5467
for (i = 0; i < NUM_STA; i++) {
5468
phead = &(pstapriv->sta_hash[i]);
5469
plist = get_next(phead);
5470
while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
5471
psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
5472
plist = get_next(plist);
5473
if (psta->tdls_sta_state != TDLS_STATE_NONE) {
5474
/* We got one TDLS sta info to show */
5475
RTW_PRINT_SEL(m, "============[TDLS Peer STA Info: STA %d]============\n", ++NumOfTdlsStaToShow);
5476
RTW_PRINT_SEL(m, "%-*s = "MAC_FMT"\n", SpaceBtwnItemAndValue, "Mac Address", MAC_ARG(psta->cmn.mac_addr));
5477
RTW_PRINT_SEL(m, "%-*s =", SpaceBtwnItemAndValue, "TDLS STA State");
5478
SpaceBtwnItemAndValueTmp = 0;
5479
FirstMatchFound = _FALSE;
5480
for (j = 0; j < 32; j++) {
5481
if (psta->tdls_sta_state & BIT(j)) {
5482
if (FirstMatchFound == _FALSE) {
5483
SpaceBtwnItemAndValueTmp = 1;
5484
FirstMatchFound = _TRUE;
5485
} else
5486
SpaceBtwnItemAndValueTmp = SpaceBtwnItemAndValue + 3;
5487
switch (BIT(j)) {
5488
case TDLS_INITIATOR_STATE:
5489
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_INITIATOR_STATE");
5490
break;
5491
case TDLS_RESPONDER_STATE:
5492
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_RESPONDER_STATE");
5493
break;
5494
case TDLS_LINKED_STATE:
5495
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_LINKED_STATE");
5496
break;
5497
case TDLS_WAIT_PTR_STATE:
5498
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_WAIT_PTR_STATE");
5499
break;
5500
case TDLS_ALIVE_STATE:
5501
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_ALIVE_STATE");
5502
break;
5503
case TDLS_CH_SWITCH_ON_STATE:
5504
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_CH_SWITCH_ON_STATE");
5505
break;
5506
case TDLS_PEER_AT_OFF_STATE:
5507
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_PEER_AT_OFF_STATE");
5508
break;
5509
case TDLS_CH_SW_INITIATOR_STATE:
5510
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_CH_SW_INITIATOR_STATE");
5511
break;
5512
case TDLS_WAIT_CH_RSP_STATE:
5513
RTW_PRINT_SEL(m, "%-*s%s\n", SpaceBtwnItemAndValue, " ", "TDLS_WAIT_CH_RSP_STATE");
5514
break;
5515
default:
5516
RTW_PRINT_SEL(m, "%-*sBIT(%d)\n", SpaceBtwnItemAndValueTmp, " ", j);
5517
break;
5518
}
5519
}
5520
}
5521
5522
RTW_PRINT_SEL(m, "%-*s = ", SpaceBtwnItemAndValue, "Wireless Mode");
5523
for (j = 0; j < 8; j++) {
5524
if (psta->wireless_mode & BIT(j)) {
5525
switch (BIT(j)) {
5526
case WIRELESS_11B:
5527
RTW_PRINT_SEL(m, "%4s", "11B ");
5528
break;
5529
case WIRELESS_11G:
5530
RTW_PRINT_SEL(m, "%4s", "11G ");
5531
break;
5532
case WIRELESS_11A:
5533
RTW_PRINT_SEL(m, "%4s", "11A ");
5534
break;
5535
case WIRELESS_11_24N:
5536
RTW_PRINT_SEL(m, "%7s", "11_24N ");
5537
break;
5538
case WIRELESS_11_5N:
5539
RTW_PRINT_SEL(m, "%6s", "11_5N ");
5540
break;
5541
case WIRELESS_AUTO:
5542
RTW_PRINT_SEL(m, "%5s", "AUTO ");
5543
break;
5544
case WIRELESS_11AC:
5545
RTW_PRINT_SEL(m, "%5s", "11AC ");
5546
break;
5547
}
5548
}
5549
}
5550
RTW_PRINT_SEL(m, "\n");
5551
5552
RTW_PRINT_SEL(m, "%-*s = ", SpaceBtwnItemAndValue, "Bandwidth Mode");
5553
switch (psta->cmn.bw_mode) {
5554
case CHANNEL_WIDTH_20:
5555
RTW_PRINT_SEL(m, "%s\n", "20MHz");
5556
break;
5557
case CHANNEL_WIDTH_40:
5558
RTW_PRINT_SEL(m, "%s\n", "40MHz");
5559
break;
5560
case CHANNEL_WIDTH_80:
5561
RTW_PRINT_SEL(m, "%s\n", "80MHz");
5562
break;
5563
case CHANNEL_WIDTH_160:
5564
RTW_PRINT_SEL(m, "%s\n", "160MHz");
5565
break;
5566
case CHANNEL_WIDTH_80_80:
5567
RTW_PRINT_SEL(m, "%s\n", "80MHz + 80MHz");
5568
break;
5569
case CHANNEL_WIDTH_5:
5570
RTW_PRINT_SEL(m, "%s\n", "5MHz");
5571
break;
5572
case CHANNEL_WIDTH_10:
5573
RTW_PRINT_SEL(m, "%s\n", "10MHz");
5574
break;
5575
default:
5576
RTW_PRINT_SEL(m, "(%d)%s\n", psta->cmn.bw_mode, "invalid");
5577
break;
5578
}
5579
5580
RTW_PRINT_SEL(m, "%-*s = ", SpaceBtwnItemAndValue, "Privacy");
5581
switch (psta->dot118021XPrivacy) {
5582
case _NO_PRIVACY_:
5583
RTW_PRINT_SEL(m, "%s\n", "NO PRIVACY");
5584
break;
5585
case _WEP40_:
5586
RTW_PRINT_SEL(m, "%s\n", "WEP 40");
5587
break;
5588
case _TKIP_:
5589
RTW_PRINT_SEL(m, "%s\n", "TKIP");
5590
break;
5591
case _TKIP_WTMIC_:
5592
RTW_PRINT_SEL(m, "%s\n", "TKIP WTMIC");
5593
break;
5594
case _AES_:
5595
RTW_PRINT_SEL(m, "%s\n", "AES");
5596
break;
5597
case _WEP104_:
5598
RTW_PRINT_SEL(m, "%s\n", "WEP 104");
5599
break;
5600
case _WEP_WPA_MIXED_:
5601
RTW_PRINT_SEL(m, "%s\n", "WEP/WPA Mixed");
5602
break;
5603
case _SMS4_:
5604
RTW_PRINT_SEL(m, "%s\n", "SMS4");
5605
break;
5606
#ifdef CONFIG_IEEE80211W
5607
case _BIP_:
5608
RTW_PRINT_SEL(m, "%s\n", "BIP");
5609
break;
5610
#endif /* CONFIG_IEEE80211W */
5611
}
5612
5613
RTW_PRINT_SEL(m, "%-*s = %d sec/%d sec\n", SpaceBtwnItemAndValue, "TPK Lifetime (Current/Expire)", psta->TPK_count, psta->TDLS_PeerKey_Lifetime);
5614
RTW_PRINT_SEL(m, "%-*s = %llu\n", SpaceBtwnItemAndValue, "Tx Packets Over Direct Link", psta->sta_stats.tx_pkts);
5615
RTW_PRINT_SEL(m, "%-*s = %llu\n", SpaceBtwnItemAndValue, "Rx Packets Over Direct Link", psta->sta_stats.rx_data_pkts);
5616
}
5617
}
5618
}
5619
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
5620
if (NumOfTdlsStaToShow == 0) {
5621
RTW_PRINT_SEL(m, "============[TDLS Peer STA Info]============\n");
5622
RTW_PRINT_SEL(m, "No TDLS direct link exists!\n");
5623
}
5624
5625
return 0;
5626
}
5627
5628
int proc_get_tdls_info(struct seq_file *m, void *v)
5629
{
5630
struct net_device *dev = m->private;
5631
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
5632
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
5633
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
5634
struct wlan_network *cur_network = &(pmlmepriv->cur_network);
5635
struct sta_priv *pstapriv = &padapter->stapriv;
5636
struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
5637
struct sta_info *psta;
5638
int i = 0, j = 0;
5639
_irqL irqL;
5640
_list *plist, *phead;
5641
u8 SpaceBtwnItemAndValue = 41;
5642
u8 SpaceBtwnItemAndValueTmp = 0;
5643
u8 NumOfTdlsStaToShow = 0;
5644
BOOLEAN FirstMatchFound = _FALSE;
5645
5646
if (hal_chk_wl_func(padapter, WL_FUNC_TDLS) == _FALSE) {
5647
RTW_PRINT_SEL(m, "No tdls info can be shown since hal doesn't support tdls\n");
5648
return 0;
5649
}
5650
5651
proc_tdls_display_tdls_function_info(m);
5652
proc_tdls_display_network_info(m);
5653
proc_tdls_display_tdls_sta_info(m);
5654
5655
return 0;
5656
}
5657
#endif
5658
5659
int proc_get_monitor(struct seq_file *m, void *v)
5660
{
5661
struct net_device *dev = m->private;
5662
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
5663
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
5664
5665
if (WIFI_MONITOR_STATE == get_fwstate(pmlmepriv)) {
5666
RTW_PRINT_SEL(m, "Monitor mode : Enable\n");
5667
5668
RTW_PRINT_SEL(m, "ch=%d, ch_offset=%d, bw=%d\n",
5669
rtw_get_oper_ch(padapter), rtw_get_oper_choffset(padapter), rtw_get_oper_bw(padapter));
5670
} else
5671
RTW_PRINT_SEL(m, "Monitor mode : Disable\n");
5672
5673
return 0;
5674
}
5675
5676
ssize_t proc_set_monitor(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
5677
{
5678
char tmp[32];
5679
struct net_device *dev = data;
5680
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
5681
u8 target_chan, target_offset, target_bw;
5682
5683
if (count < 3) {
5684
RTW_INFO("argument size is less than 3\n");
5685
return -EFAULT;
5686
}
5687
5688
if (count > sizeof(tmp)) {
5689
rtw_warn_on(1);
5690
return -EFAULT;
5691
}
5692
5693
if (buffer && !copy_from_user(tmp, buffer, count)) {
5694
int num = sscanf(tmp, "%hhu %hhu %hhu", &target_chan, &target_offset, &target_bw);
5695
5696
if (num != 3) {
5697
RTW_INFO("invalid write_reg parameter!\n");
5698
return count;
5699
}
5700
5701
padapter->mlmeextpriv.cur_channel = target_chan;
5702
set_channel_bwmode(padapter, target_chan, target_offset, target_bw);
5703
}
5704
5705
return count;
5706
}
5707
#ifdef DBG_XMIT_BLOCK
5708
int proc_get_xmit_block(struct seq_file *m, void *v)
5709
{
5710
struct net_device *dev = m->private;
5711
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
5712
5713
dump_xmit_block(m, padapter);
5714
5715
return 0;
5716
}
5717
5718
ssize_t proc_set_xmit_block(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
5719
{
5720
struct net_device *dev = data;
5721
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
5722
char tmp[32];
5723
u8 xb_mode, xb_reason;
5724
5725
if (count < 1)
5726
return -EFAULT;
5727
5728
if (count > sizeof(tmp)) {
5729
rtw_warn_on(1);
5730
return -EFAULT;
5731
}
5732
5733
if (buffer && !copy_from_user(tmp, buffer, count)) {
5734
5735
int num = sscanf(tmp, "%hhx %hhx", &xb_mode, &xb_reason);
5736
5737
if (num != 2) {
5738
RTW_INFO("invalid parameter!\n");
5739
return count;
5740
}
5741
5742
if (xb_mode == 0)/*set*/
5743
rtw_set_xmit_block(padapter, xb_reason);
5744
else if (xb_mode == 1)/*clear*/
5745
rtw_clr_xmit_block(padapter, xb_reason);
5746
else
5747
RTW_INFO("invalid parameter!\n");
5748
}
5749
5750
return count;
5751
}
5752
#endif
5753
5754
#include <hal_data.h>
5755
int proc_get_efuse_map(struct seq_file *m, void *v)
5756
{
5757
struct net_device *dev = m->private;
5758
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
5759
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter);
5760
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter);
5761
PEFUSE_HAL pEfuseHal = &pHalData->EfuseHal;
5762
int i, j;
5763
u8 ips_mode = IPS_NUM;
5764
u16 mapLen;
5765
5766
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, _FALSE);
5767
if (mapLen > EFUSE_MAX_MAP_LEN)
5768
mapLen = EFUSE_MAX_MAP_LEN;
5769
5770
ips_mode = pwrctrlpriv->ips_mode;
5771
rtw_pm_set_ips(padapter, IPS_NONE);
5772
5773
if (pHalData->efuse_file_status == EFUSE_FILE_LOADED) {
5774
RTW_PRINT_SEL(m, "File eFuse Map loaded! file path:%s\nDriver eFuse Map From File\n", EFUSE_MAP_PATH);
5775
if (pHalData->bautoload_fail_flag)
5776
RTW_PRINT_SEL(m, "File Autoload fail!!!\n");
5777
} else if (pHalData->efuse_file_status == EFUSE_FILE_FAILED) {
5778
RTW_PRINT_SEL(m, "Open File eFuse Map Fail ! file path:%s\nDriver eFuse Map From Default\n", EFUSE_MAP_PATH);
5779
if (pHalData->bautoload_fail_flag)
5780
RTW_PRINT_SEL(m, "HW Autoload fail!!!\n");
5781
} else {
5782
RTW_PRINT_SEL(m, "Driver eFuse Map From HW\n");
5783
if (pHalData->bautoload_fail_flag)
5784
RTW_PRINT_SEL(m, "HW Autoload fail!!!\n");
5785
}
5786
for (i = 0; i < mapLen; i += 16) {
5787
RTW_PRINT_SEL(m, "0x%02x\t", i);
5788
for (j = 0; j < 8; j++)
5789
RTW_PRINT_SEL(m, "%02X ", pHalData->efuse_eeprom_data[i + j]);
5790
RTW_PRINT_SEL(m, "\t");
5791
for (; j < 16; j++)
5792
RTW_PRINT_SEL(m, "%02X ", pHalData->efuse_eeprom_data[i + j]);
5793
RTW_PRINT_SEL(m, "\n");
5794
}
5795
5796
if (rtw_efuse_map_read(padapter, 0, mapLen, pEfuseHal->fakeEfuseInitMap) == _FAIL) {
5797
RTW_PRINT_SEL(m, "WARN - Read Realmap Failed\n");
5798
return 0;
5799
}
5800
5801
RTW_PRINT_SEL(m, "\n");
5802
RTW_PRINT_SEL(m, "HW eFuse Map\n");
5803
for (i = 0; i < mapLen; i += 16) {
5804
RTW_PRINT_SEL(m, "0x%02x\t", i);
5805
for (j = 0; j < 8; j++)
5806
RTW_PRINT_SEL(m, "%02X ", pEfuseHal->fakeEfuseInitMap[i + j]);
5807
RTW_PRINT_SEL(m, "\t");
5808
for (; j < 16; j++)
5809
RTW_PRINT_SEL(m, "%02X ", pEfuseHal->fakeEfuseInitMap[i + j]);
5810
RTW_PRINT_SEL(m, "\n");
5811
}
5812
5813
rtw_pm_set_ips(padapter, ips_mode);
5814
5815
return 0;
5816
}
5817
5818
ssize_t proc_set_efuse_map(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
5819
{
5820
#if 0
5821
char tmp[256] = {0};
5822
u32 addr, cnts;
5823
u8 efuse_data;
5824
5825
int jj, kk;
5826
5827
struct net_device *dev = data;
5828
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
5829
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter);
5830
u8 ips_mode = IPS_NUM;
5831
5832
if (count < 3) {
5833
RTW_INFO("argument size is less than 3\n");
5834
return -EFAULT;
5835
}
5836
5837
if (count > sizeof(tmp)) {
5838
rtw_warn_on(1);
5839
return -EFAULT;
5840
}
5841
5842
if (buffer && !copy_from_user(tmp, buffer, count)) {
5843
5844
int num = sscanf(tmp, "%x %d %x", &addr, &cnts, &efuse_data);
5845
5846
if (num != 3) {
5847
RTW_INFO("invalid write_reg parameter!\n");
5848
return count;
5849
}
5850
}
5851
ips_mode = pwrctrlpriv->ips_mode;
5852
rtw_pm_set_ips(padapter, IPS_NONE);
5853
if (rtw_efuse_map_write(padapter, addr, cnts, &efuse_data) == _FAIL)
5854
RTW_INFO("WARN - rtw_efuse_map_write error!!\n");
5855
rtw_pm_set_ips(padapter, ips_mode);
5856
#endif
5857
return count;
5858
}
5859
5860
#ifdef CONFIG_IEEE80211W
5861
ssize_t proc_set_tx_sa_query(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
5862
{
5863
struct net_device *dev = data;
5864
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
5865
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
5866
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
5867
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
5868
struct sta_priv *pstapriv = &padapter->stapriv;
5869
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
5870
struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj);
5871
struct sta_info *psta;
5872
_list *plist, *phead;
5873
_irqL irqL;
5874
char tmp[16];
5875
u8 mac_addr[NUM_STA][ETH_ALEN];
5876
u32 key_type;
5877
u8 index;
5878
5879
if (count > 2) {
5880
RTW_INFO("argument size is more than 2\n");
5881
return -EFAULT;
5882
}
5883
5884
if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
5885
5886
int num = sscanf(tmp, "%x", &key_type);
5887
5888
if (num != 1) {
5889
RTW_INFO("invalid read_reg parameter!\n");
5890
return count;
5891
}
5892
RTW_INFO("0: set sa query request , key_type=%d\n", key_type);
5893
}
5894
5895
if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE)
5896
&& (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) && SEC_IS_BIP_KEY_INSTALLED(&padapter->securitypriv) == _TRUE) {
5897
RTW_INFO("STA:"MAC_FMT"\n", MAC_ARG(get_my_bssid(&(pmlmeinfo->network))));
5898
/* TX unicast sa_query to AP */
5899
issue_action_SA_Query(padapter, get_my_bssid(&(pmlmeinfo->network)), 0, 0, (u8)key_type);
5900
} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE && SEC_IS_BIP_KEY_INSTALLED(&padapter->securitypriv) == _TRUE) {
5901
/* TX unicast sa_query to every client STA */
5902
_enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
5903
for (index = 0; index < NUM_STA; index++) {
5904
psta = NULL;
5905
5906
phead = &(pstapriv->sta_hash[index]);
5907
plist = get_next(phead);
5908
5909
while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
5910
psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
5911
plist = get_next(plist);
5912
_rtw_memcpy(&mac_addr[psta->cmn.mac_id][0], psta->cmn.mac_addr, ETH_ALEN);
5913
}
5914
}
5915
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
5916
5917
for (index = 0; index < macid_ctl->num && index < NUM_STA; index++) {
5918
if (rtw_macid_is_used(macid_ctl, index) && !rtw_macid_is_bmc(macid_ctl, index)) {
5919
if (!_rtw_memcmp(get_my_bssid(&(pmlmeinfo->network)), &mac_addr[index][0], ETH_ALEN)
5920
&& !IS_MCAST(&mac_addr[index][0])) {
5921
issue_action_SA_Query(padapter, &mac_addr[index][0], 0, 0, (u8)key_type);
5922
RTW_INFO("STA[%u]:"MAC_FMT"\n", index , MAC_ARG(&mac_addr[index][0]));
5923
}
5924
}
5925
}
5926
}
5927
5928
return count;
5929
}
5930
5931
int proc_get_tx_sa_query(struct seq_file *m, void *v)
5932
{
5933
struct net_device *dev = m->private;
5934
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
5935
5936
RTW_PRINT_SEL(m, "%s\n", __func__);
5937
return 0;
5938
}
5939
5940
ssize_t proc_set_tx_deauth(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
5941
{
5942
struct net_device *dev = data;
5943
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
5944
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
5945
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
5946
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
5947
struct sta_priv *pstapriv = &padapter->stapriv;
5948
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
5949
struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj);
5950
struct sta_info *psta;
5951
_list *plist, *phead;
5952
_irqL irqL;
5953
char tmp[16];
5954
u8 mac_addr[NUM_STA][ETH_ALEN];
5955
u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
5956
u32 key_type;
5957
u8 index;
5958
5959
5960
if (count > 2) {
5961
RTW_INFO("argument size is more than 2\n");
5962
return -EFAULT;
5963
}
5964
5965
if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
5966
5967
int num = sscanf(tmp, "%x", &key_type);
5968
5969
if (num != 1) {
5970
RTW_INFO("invalid read_reg parameter!\n");
5971
return count;
5972
}
5973
RTW_INFO("key_type=%d\n", key_type);
5974
}
5975
if (key_type < 0 || key_type > 4)
5976
return count;
5977
5978
if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE)
5979
&& (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)) {
5980
if (key_type == 3) /* key_type 3 only for AP mode */
5981
return count;
5982
/* TX unicast deauth to AP */
5983
issue_deauth_11w(padapter, get_my_bssid(&(pmlmeinfo->network)), 0, (u8)key_type);
5984
} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) {
5985
u8 updated = _FALSE;
5986
5987
if (key_type == 3)
5988
issue_deauth_11w(padapter, bc_addr, 0, IEEE80211W_RIGHT_KEY);
5989
5990
/* TX unicast deauth to every client STA */
5991
_enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
5992
for (index = 0; index < NUM_STA; index++) {
5993
psta = NULL;
5994
5995
phead = &(pstapriv->sta_hash[index]);
5996
plist = get_next(phead);
5997
5998
while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
5999
psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
6000
plist = get_next(plist);
6001
_rtw_memcpy(&mac_addr[psta->cmn.mac_id][0], psta->cmn.mac_addr, ETH_ALEN);
6002
}
6003
}
6004
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
6005
6006
for (index = 0; index < macid_ctl->num && index < NUM_STA; index++) {
6007
if (rtw_macid_is_used(macid_ctl, index) && !rtw_macid_is_bmc(macid_ctl, index)) {
6008
if (!_rtw_memcmp(get_my_bssid(&(pmlmeinfo->network)), &mac_addr[index][0], ETH_ALEN)) {
6009
if (key_type != 3)
6010
issue_deauth_11w(padapter, &mac_addr[index][0], 0, (u8)key_type);
6011
6012
psta = rtw_get_stainfo(pstapriv, &mac_addr[index][0]);
6013
if (psta && key_type != IEEE80211W_WRONG_KEY && key_type != IEEE80211W_NO_KEY) {
6014
_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
6015
if (rtw_is_list_empty(&psta->asoc_list) == _FALSE) {
6016
rtw_list_delete(&psta->asoc_list);
6017
pstapriv->asoc_list_cnt--;
6018
updated |= ap_free_sta(padapter, psta, _FALSE, WLAN_REASON_PREV_AUTH_NOT_VALID, _TRUE);
6019
6020
}
6021
_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
6022
}
6023
6024
RTW_INFO("STA[%u]:"MAC_FMT"\n", index , MAC_ARG(&mac_addr[index][0]));
6025
}
6026
}
6027
}
6028
6029
associated_clients_update(padapter, updated, STA_INFO_UPDATE_ALL);
6030
}
6031
6032
return count;
6033
}
6034
6035
int proc_get_tx_deauth(struct seq_file *m, void *v)
6036
{
6037
struct net_device *dev = m->private;
6038
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6039
6040
RTW_PRINT_SEL(m, "%s\n", __func__);
6041
return 0;
6042
}
6043
6044
ssize_t proc_set_tx_auth(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6045
{
6046
struct net_device *dev = data;
6047
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6048
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
6049
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
6050
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
6051
struct sta_priv *pstapriv = &padapter->stapriv;
6052
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
6053
struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj);
6054
struct sta_info *psta;
6055
_list *plist, *phead;
6056
_irqL irqL;
6057
char tmp[16];
6058
u8 mac_addr[NUM_STA][ETH_ALEN];
6059
u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
6060
u32 tx_auth;
6061
u8 index;
6062
6063
6064
if (count > 2) {
6065
RTW_INFO("argument size is more than 2\n");
6066
return -EFAULT;
6067
}
6068
6069
if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
6070
6071
int num = sscanf(tmp, "%x", &tx_auth);
6072
6073
if (num != 1) {
6074
RTW_INFO("invalid read_reg parameter!\n");
6075
return count;
6076
}
6077
RTW_INFO("1: setnd auth, 2: send assoc request. tx_auth=%d\n", tx_auth);
6078
}
6079
6080
if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE)
6081
&& (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)) {
6082
if (tx_auth == 1) {
6083
/* TX unicast auth to AP */
6084
issue_auth(padapter, NULL, 0);
6085
} else if (tx_auth == 2) {
6086
/* TX unicast auth to AP */
6087
issue_assocreq(padapter);
6088
}
6089
}
6090
6091
return count;
6092
}
6093
6094
int proc_get_tx_auth(struct seq_file *m, void *v)
6095
{
6096
struct net_device *dev = m->private;
6097
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6098
6099
RTW_PRINT_SEL(m, "%s\n", __func__);
6100
return 0;
6101
}
6102
#endif /* CONFIG_IEEE80211W */
6103
6104
#ifdef CONFIG_CUSTOMER01_SMART_ANTENNA
6105
static u32 phase_idx;
6106
int proc_get_pathb_phase(struct seq_file *m, void *v)
6107
{
6108
struct net_device *dev = m->private;
6109
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6110
6111
RTW_PRINT_SEL(m, "PathB phase index =%d\n", phase_idx);
6112
return 0;
6113
}
6114
6115
ssize_t proc_set_pathb_phase(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6116
{
6117
struct net_device *dev = data;
6118
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6119
char tmp[255];
6120
int num;
6121
u32 tmp_idx;
6122
6123
if (NULL == buffer) {
6124
RTW_INFO(FUNC_ADPT_FMT ": input buffer is NULL!\n", FUNC_ADPT_ARG(padapter));
6125
return -EFAULT;
6126
}
6127
6128
if (count < 1) {
6129
RTW_INFO(FUNC_ADPT_FMT ": input length is 0!\n", FUNC_ADPT_ARG(padapter));
6130
return -EFAULT;
6131
}
6132
6133
if (buffer && !copy_from_user(tmp, buffer, count)) {
6134
num = sscanf(tmp, "%u", &tmp_idx);
6135
if ((tmp_idx < 0) || (tmp_idx > 11)) {
6136
RTW_INFO(FUNC_ADPT_FMT "Invalid input value\n", FUNC_ADPT_ARG(padapter));
6137
return count;
6138
}
6139
phase_idx = tmp_idx;
6140
rtw_hal_set_pathb_phase(padapter, phase_idx);
6141
}
6142
return count;
6143
}
6144
#endif
6145
6146
#ifdef CONFIG_MCC_MODE
6147
int proc_get_mcc_info(struct seq_file *m, void *v)
6148
{
6149
struct net_device *dev = m->private;
6150
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
6151
6152
dump_adapters_status(m, adapter_to_dvobj(adapter));
6153
rtw_hal_dump_mcc_info(m, adapter_to_dvobj(adapter));
6154
return 0;
6155
}
6156
6157
int proc_get_mcc_policy_table(struct seq_file *m, void *v)
6158
{
6159
struct net_device *dev = m->private;
6160
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
6161
6162
rtw_hal_dump_mcc_policy_table(m);
6163
return 0;
6164
}
6165
6166
ssize_t proc_set_mcc_enable(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6167
{
6168
struct net_device *dev = data;
6169
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6170
char tmp[255];
6171
u32 en_mcc = 0;
6172
6173
if (NULL == buffer) {
6174
RTW_INFO(FUNC_ADPT_FMT ": input buffer is NULL!\n", FUNC_ADPT_ARG(padapter));
6175
return -EFAULT;
6176
}
6177
6178
if (count < 1) {
6179
RTW_INFO(FUNC_ADPT_FMT ": input length is 0!\n", FUNC_ADPT_ARG(padapter));
6180
return -EFAULT;
6181
}
6182
6183
if (count > sizeof(tmp)) {
6184
RTW_INFO(FUNC_ADPT_FMT ": input length is too large\n", FUNC_ADPT_ARG(padapter));
6185
rtw_warn_on(1);
6186
return -EFAULT;
6187
}
6188
6189
if (buffer && !copy_from_user(tmp, buffer, count)) {
6190
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
6191
_adapter *iface = NULL;
6192
u8 i = 0;
6193
int num = sscanf(tmp, "%u", &en_mcc);
6194
6195
if (num < 1) {
6196
RTW_INFO(FUNC_ADPT_FMT ": input parameters < 1\n", FUNC_ADPT_ARG(padapter));
6197
return -EINVAL;
6198
}
6199
6200
RTW_INFO("%s: en_mcc = %d\n", __func__, en_mcc);
6201
6202
for (i = 0; i < dvobj->iface_nums; i++) {
6203
iface = dvobj->padapters[i];
6204
if (!iface)
6205
continue;
6206
iface->registrypriv.en_mcc = en_mcc;
6207
}
6208
}
6209
6210
return count;
6211
}
6212
6213
ssize_t proc_set_mcc_duration(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6214
{
6215
struct net_device *dev = data;
6216
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6217
char tmp[255];
6218
u32 enable_runtime_duration = 0, mcc_duration = 0, type = 0;
6219
6220
if (NULL == buffer) {
6221
RTW_INFO(FUNC_ADPT_FMT ": input buffer is NULL!\n", FUNC_ADPT_ARG(padapter));
6222
return -EFAULT;
6223
}
6224
6225
if (count < 1) {
6226
RTW_INFO(FUNC_ADPT_FMT ": input length is 0!\n", FUNC_ADPT_ARG(padapter));
6227
return -EFAULT;
6228
}
6229
6230
if (count > sizeof(tmp)) {
6231
RTW_INFO(FUNC_ADPT_FMT ": input length is too large\n", FUNC_ADPT_ARG(padapter));
6232
rtw_warn_on(1);
6233
return -EFAULT;
6234
}
6235
6236
if (buffer && !copy_from_user(tmp, buffer, count)) {
6237
int num = sscanf(tmp, "%u %u %u", &enable_runtime_duration, &type, &mcc_duration);
6238
6239
if (num < 1) {
6240
RTW_INFO(FUNC_ADPT_FMT ": input parameters < 1\n", FUNC_ADPT_ARG(padapter));
6241
return -EINVAL;
6242
}
6243
6244
if (num > 3) {
6245
RTW_INFO(FUNC_ADPT_FMT ": input parameters > 2\n", FUNC_ADPT_ARG(padapter));
6246
return -EINVAL;
6247
}
6248
6249
if (num == 2) {
6250
RTW_INFO(FUNC_ADPT_FMT ": input parameters > 2\n", FUNC_ADPT_ARG(padapter));
6251
return -EINVAL;
6252
}
6253
6254
if (num >= 1) {
6255
SET_MCC_RUNTIME_DURATION(padapter, enable_runtime_duration);
6256
RTW_INFO("runtime duration:%s\n", enable_runtime_duration ? "enable":"disable");
6257
}
6258
6259
if (num == 3) {
6260
RTW_INFO("type:%d, mcc duration:%d\n", type, mcc_duration);
6261
rtw_set_mcc_duration_cmd(padapter, type, mcc_duration);
6262
}
6263
}
6264
6265
return count;
6266
}
6267
6268
#ifdef CONFIG_MCC_PHYDM_OFFLOAD
6269
ssize_t proc_set_mcc_phydm_offload_enable(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6270
{
6271
struct net_device *dev = data;
6272
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6273
char tmp[255];
6274
u32 mcc_phydm_enable = 0;
6275
6276
if (NULL == buffer) {
6277
RTW_INFO(FUNC_ADPT_FMT ": input buffer is NULL!\n", FUNC_ADPT_ARG(padapter));
6278
return -EFAULT;
6279
}
6280
6281
if (count < 1) {
6282
RTW_INFO(FUNC_ADPT_FMT ": input length is 0!\n", FUNC_ADPT_ARG(padapter));
6283
return -EFAULT;
6284
}
6285
6286
if (count > sizeof(tmp)) {
6287
RTW_INFO(FUNC_ADPT_FMT ": input length is too large\n", FUNC_ADPT_ARG(padapter));
6288
rtw_warn_on(1);
6289
return -EFAULT;
6290
}
6291
6292
if (buffer && !copy_from_user(tmp, buffer, count)) {
6293
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
6294
u8 i = 0;
6295
int num = sscanf(tmp, "%u", &mcc_phydm_enable);
6296
6297
if (num < 1) {
6298
RTW_INFO(FUNC_ADPT_FMT ": input parameters < 1\n", FUNC_ADPT_ARG(padapter));
6299
return -EINVAL;
6300
}
6301
6302
RTW_INFO("%s: mcc phydm enable = %d\n", __func__, mcc_phydm_enable);
6303
rtw_set_mcc_phydm_offload_enable_cmd(padapter, mcc_phydm_enable, _TRUE);
6304
}
6305
6306
return count;
6307
}
6308
#endif
6309
6310
ssize_t proc_set_mcc_single_tx_criteria(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6311
{
6312
struct net_device *dev = data;
6313
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6314
char tmp[255];
6315
u32 mcc_single_tx_criteria = 0;
6316
6317
if (NULL == buffer) {
6318
RTW_INFO(FUNC_ADPT_FMT ": input buffer is NULL!\n", FUNC_ADPT_ARG(padapter));
6319
return -EFAULT;
6320
}
6321
6322
if (count < 1) {
6323
RTW_INFO(FUNC_ADPT_FMT ": input length is 0!\n", FUNC_ADPT_ARG(padapter));
6324
return -EFAULT;
6325
}
6326
6327
if (count > sizeof(tmp)) {
6328
RTW_INFO(FUNC_ADPT_FMT ": input length is too large\n", FUNC_ADPT_ARG(padapter));
6329
rtw_warn_on(1);
6330
return -EFAULT;
6331
}
6332
6333
if (buffer && !copy_from_user(tmp, buffer, count)) {
6334
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
6335
_adapter *iface = NULL;
6336
u8 i = 0;
6337
int num = sscanf(tmp, "%u", &mcc_single_tx_criteria);
6338
6339
if (num < 1) {
6340
RTW_INFO(FUNC_ADPT_FMT ": input parameters < 1\n", FUNC_ADPT_ARG(padapter));
6341
return -EINVAL;
6342
}
6343
6344
RTW_INFO("%s: mcc_single_tx_criteria = %d\n", __func__, mcc_single_tx_criteria);
6345
6346
for (i = 0; i < dvobj->iface_nums; i++) {
6347
iface = dvobj->padapters[i];
6348
if (!iface)
6349
continue;
6350
iface->registrypriv.rtw_mcc_single_tx_cri = mcc_single_tx_criteria;
6351
}
6352
6353
6354
}
6355
6356
return count;
6357
}
6358
6359
6360
ssize_t proc_set_mcc_ap_bw20_target_tp(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6361
{
6362
struct net_device *dev = data;
6363
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6364
char tmp[255];
6365
u32 mcc_ap_bw20_target_tp = 0;
6366
6367
if (NULL == buffer) {
6368
RTW_INFO(FUNC_ADPT_FMT ": input buffer is NULL!\n", FUNC_ADPT_ARG(padapter));
6369
return -EFAULT;
6370
}
6371
6372
if (count < 1) {
6373
RTW_INFO(FUNC_ADPT_FMT ": input length is 0!\n", FUNC_ADPT_ARG(padapter));
6374
return -EFAULT;
6375
}
6376
6377
if (count > sizeof(tmp)) {
6378
RTW_INFO(FUNC_ADPT_FMT ": input length is too large\n", FUNC_ADPT_ARG(padapter));
6379
rtw_warn_on(1);
6380
return -EFAULT;
6381
}
6382
6383
if (buffer && !copy_from_user(tmp, buffer, count)) {
6384
int num = sscanf(tmp, "%u", &mcc_ap_bw20_target_tp);
6385
6386
if (num < 1) {
6387
RTW_INFO(FUNC_ADPT_FMT ": input parameters < 1\n", FUNC_ADPT_ARG(padapter));
6388
return -EINVAL;
6389
}
6390
6391
RTW_INFO("%s: mcc_ap_bw20_target_tp = %d\n", __func__, mcc_ap_bw20_target_tp);
6392
6393
padapter->registrypriv.rtw_mcc_ap_bw20_target_tx_tp = mcc_ap_bw20_target_tp;
6394
6395
6396
}
6397
6398
return count;
6399
}
6400
6401
ssize_t proc_set_mcc_ap_bw40_target_tp(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6402
{
6403
struct net_device *dev = data;
6404
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6405
char tmp[255];
6406
u32 mcc_ap_bw40_target_tp = 0;
6407
6408
if (NULL == buffer) {
6409
RTW_INFO(FUNC_ADPT_FMT ": input buffer is NULL!\n", FUNC_ADPT_ARG(padapter));
6410
return -EFAULT;
6411
}
6412
6413
if (count < 1) {
6414
RTW_INFO(FUNC_ADPT_FMT ": input length is 0!\n", FUNC_ADPT_ARG(padapter));
6415
return -EFAULT;
6416
}
6417
6418
if (count > sizeof(tmp)) {
6419
RTW_INFO(FUNC_ADPT_FMT ": input length is too large\n", FUNC_ADPT_ARG(padapter));
6420
rtw_warn_on(1);
6421
return -EFAULT;
6422
}
6423
6424
if (buffer && !copy_from_user(tmp, buffer, count)) {
6425
int num = sscanf(tmp, "%u", &mcc_ap_bw40_target_tp);
6426
6427
if (num < 1) {
6428
RTW_INFO(FUNC_ADPT_FMT ": input parameters < 1\n", FUNC_ADPT_ARG(padapter));
6429
return -EINVAL;
6430
}
6431
6432
RTW_INFO("%s: mcc_ap_bw40_target_tp = %d\n", __func__, mcc_ap_bw40_target_tp);
6433
6434
padapter->registrypriv.rtw_mcc_ap_bw40_target_tx_tp = mcc_ap_bw40_target_tp;
6435
6436
6437
}
6438
6439
return count;
6440
}
6441
6442
ssize_t proc_set_mcc_ap_bw80_target_tp(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6443
{
6444
struct net_device *dev = data;
6445
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6446
char tmp[255];
6447
u32 mcc_ap_bw80_target_tp = 0;
6448
6449
if (NULL == buffer) {
6450
RTW_INFO(FUNC_ADPT_FMT ": input buffer is NULL!\n", FUNC_ADPT_ARG(padapter));
6451
return -EFAULT;
6452
}
6453
6454
if (count < 1) {
6455
RTW_INFO(FUNC_ADPT_FMT ": input length is 0!\n", FUNC_ADPT_ARG(padapter));
6456
return -EFAULT;
6457
}
6458
6459
if (count > sizeof(tmp)) {
6460
RTW_INFO(FUNC_ADPT_FMT ": input length is too large\n", FUNC_ADPT_ARG(padapter));
6461
rtw_warn_on(1);
6462
return -EFAULT;
6463
}
6464
6465
if (buffer && !copy_from_user(tmp, buffer, count)) {
6466
int num = sscanf(tmp, "%u", &mcc_ap_bw80_target_tp);
6467
6468
if (num < 1) {
6469
RTW_INFO(FUNC_ADPT_FMT ": input parameters < 1\n", FUNC_ADPT_ARG(padapter));
6470
return -EINVAL;
6471
}
6472
6473
RTW_INFO("%s: mcc_ap_bw80_target_tp = %d\n", __func__, mcc_ap_bw80_target_tp);
6474
6475
padapter->registrypriv.rtw_mcc_ap_bw80_target_tx_tp = mcc_ap_bw80_target_tp;
6476
6477
6478
}
6479
6480
return count;
6481
}
6482
6483
ssize_t proc_set_mcc_sta_bw20_target_tp(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6484
{
6485
struct net_device *dev = data;
6486
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6487
char tmp[255];
6488
u32 mcc_sta_bw20_target_tp = 0;
6489
6490
if (NULL == buffer) {
6491
RTW_INFO(FUNC_ADPT_FMT ": input buffer is NULL!\n", FUNC_ADPT_ARG(padapter));
6492
return -EFAULT;
6493
}
6494
6495
if (count < 1) {
6496
RTW_INFO(FUNC_ADPT_FMT ": input length is 0!\n", FUNC_ADPT_ARG(padapter));
6497
return -EFAULT;
6498
}
6499
6500
if (count > sizeof(tmp)) {
6501
RTW_INFO(FUNC_ADPT_FMT ": input length is too large\n", FUNC_ADPT_ARG(padapter));
6502
rtw_warn_on(1);
6503
return -EFAULT;
6504
}
6505
6506
if (buffer && !copy_from_user(tmp, buffer, count)) {
6507
int num = sscanf(tmp, "%u", &mcc_sta_bw20_target_tp);
6508
6509
if (num < 1) {
6510
RTW_INFO(FUNC_ADPT_FMT ": input parameters < 1\n", FUNC_ADPT_ARG(padapter));
6511
return -EINVAL;
6512
}
6513
6514
RTW_INFO("%s: mcc_sta_bw20_target_tp = %d\n", __func__, mcc_sta_bw20_target_tp);
6515
6516
padapter->registrypriv.rtw_mcc_sta_bw20_target_tx_tp = mcc_sta_bw20_target_tp;
6517
6518
6519
}
6520
6521
return count;
6522
}
6523
6524
ssize_t proc_set_mcc_sta_bw40_target_tp(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6525
{
6526
struct net_device *dev = data;
6527
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6528
char tmp[255];
6529
u32 mcc_sta_bw40_target_tp = 0;
6530
6531
if (NULL == buffer) {
6532
RTW_INFO(FUNC_ADPT_FMT ": input buffer is NULL!\n", FUNC_ADPT_ARG(padapter));
6533
return -EFAULT;
6534
}
6535
6536
if (count < 1) {
6537
RTW_INFO(FUNC_ADPT_FMT ": input length is 0!\n", FUNC_ADPT_ARG(padapter));
6538
return -EFAULT;
6539
}
6540
6541
if (count > sizeof(tmp)) {
6542
RTW_INFO(FUNC_ADPT_FMT ": input length is too large\n", FUNC_ADPT_ARG(padapter));
6543
rtw_warn_on(1);
6544
return -EFAULT;
6545
}
6546
6547
if (buffer && !copy_from_user(tmp, buffer, count)) {
6548
int num = sscanf(tmp, "%u", &mcc_sta_bw40_target_tp);
6549
6550
if (num < 1) {
6551
RTW_INFO(FUNC_ADPT_FMT ": input parameters < 1\n", FUNC_ADPT_ARG(padapter));
6552
return -EINVAL;
6553
}
6554
6555
RTW_INFO("%s: mcc_sta_bw40_target_tp = %d\n", __func__, mcc_sta_bw40_target_tp);
6556
6557
padapter->registrypriv.rtw_mcc_sta_bw40_target_tx_tp = mcc_sta_bw40_target_tp;
6558
6559
6560
}
6561
6562
return count;
6563
}
6564
6565
ssize_t proc_set_mcc_sta_bw80_target_tp(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6566
{
6567
struct net_device *dev = data;
6568
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6569
char tmp[255];
6570
u32 mcc_sta_bw80_target_tp = 0;
6571
6572
if (NULL == buffer) {
6573
RTW_INFO(FUNC_ADPT_FMT ": input buffer is NULL!\n", FUNC_ADPT_ARG(padapter));
6574
return -EFAULT;
6575
}
6576
6577
if (count < 1) {
6578
RTW_INFO(FUNC_ADPT_FMT ": input length is 0!\n", FUNC_ADPT_ARG(padapter));
6579
return -EFAULT;
6580
}
6581
6582
if (count > sizeof(tmp)) {
6583
RTW_INFO(FUNC_ADPT_FMT ": input length is too large\n", FUNC_ADPT_ARG(padapter));
6584
rtw_warn_on(1);
6585
return -EFAULT;
6586
}
6587
6588
if (buffer && !copy_from_user(tmp, buffer, count)) {
6589
int num = sscanf(tmp, "%u", &mcc_sta_bw80_target_tp);
6590
6591
if (num < 1) {
6592
RTW_INFO(FUNC_ADPT_FMT ": input parameters < 1\n", FUNC_ADPT_ARG(padapter));
6593
return -EINVAL;
6594
}
6595
6596
RTW_INFO("%s: mcc_sta_bw80_target_tp = %d\n", __func__, mcc_sta_bw80_target_tp);
6597
6598
padapter->registrypriv.rtw_mcc_sta_bw80_target_tx_tp = mcc_sta_bw80_target_tp;
6599
6600
6601
}
6602
6603
return count;
6604
}
6605
#endif /* CONFIG_MCC_MODE */
6606
6607
int proc_get_ack_timeout(struct seq_file *m, void *v)
6608
{
6609
struct net_device *dev = m->private;
6610
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6611
u8 ack_timeout_val;
6612
#ifdef CONFIG_RTL8821C
6613
u8 ack_timeout_val_cck;
6614
#endif
6615
6616
ack_timeout_val = rtw_read8(padapter, REG_ACKTO);
6617
6618
#ifdef CONFIG_RTL8821C
6619
ack_timeout_val_cck = rtw_read8(padapter, REG_ACKTO_CCK_8821C);
6620
RTW_PRINT_SEL(m, "Current CCK packet ACK Timeout = %d us (0x%x).\n", ack_timeout_val_cck, ack_timeout_val_cck);
6621
RTW_PRINT_SEL(m, "Current non-CCK packet ACK Timeout = %d us (0x%x).\n", ack_timeout_val, ack_timeout_val);
6622
#else
6623
RTW_PRINT_SEL(m, "Current ACK Timeout = %d us (0x%x).\n", ack_timeout_val, ack_timeout_val);
6624
#endif
6625
6626
return 0;
6627
}
6628
6629
ssize_t proc_set_ack_timeout(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6630
{
6631
struct net_device *dev = data;
6632
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6633
char tmp[32];
6634
u32 ack_timeout_ms, ack_timeout_ms_cck;
6635
6636
if (count > sizeof(tmp)) {
6637
rtw_warn_on(1);
6638
return -EFAULT;
6639
}
6640
6641
if (buffer && !copy_from_user(tmp, buffer, count)) {
6642
int num = sscanf(tmp, "%u %u", &ack_timeout_ms, &ack_timeout_ms_cck);
6643
6644
#ifdef CONFIG_RTL8821C
6645
if (num < 2) {
6646
RTW_INFO(FUNC_ADPT_FMT ": input parameters < 2\n", FUNC_ADPT_ARG(padapter));
6647
return -EINVAL;
6648
}
6649
#else
6650
if (num < 1) {
6651
RTW_INFO(FUNC_ADPT_FMT ": input parameters < 1\n", FUNC_ADPT_ARG(padapter));
6652
return -EINVAL;
6653
}
6654
#endif
6655
/* This register sets the Ack time out value after Tx unicast packet. It is in units of us. */
6656
rtw_write8(padapter, REG_ACKTO, (u8)ack_timeout_ms);
6657
6658
#ifdef CONFIG_RTL8821C
6659
/* This register sets the Ack time out value after Tx unicast CCK packet. It is in units of us. */
6660
rtw_write8(padapter, REG_ACKTO_CCK_8821C, (u8)ack_timeout_ms_cck);
6661
RTW_INFO("Set CCK packet ACK Timeout to %d us.\n", ack_timeout_ms_cck);
6662
RTW_INFO("Set non-CCK packet ACK Timeout to %d us.\n", ack_timeout_ms);
6663
#else
6664
RTW_INFO("Set ACK Timeout to %d us.\n", ack_timeout_ms);
6665
#endif
6666
}
6667
6668
return count;
6669
}
6670
6671
ssize_t proc_set_fw_offload(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6672
{
6673
struct net_device *dev = data;
6674
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
6675
_adapter *pri_adapter = GET_PRIMARY_ADAPTER(adapter);
6676
HAL_DATA_TYPE *hal = GET_HAL_DATA(adapter);
6677
char tmp[32];
6678
u32 iqk_offload_enable = 0, ch_switch_offload_enable = 0;
6679
6680
if (buffer == NULL) {
6681
RTW_INFO("input buffer is NULL!\n");
6682
return -EFAULT;
6683
}
6684
6685
if (count < 1) {
6686
RTW_INFO("input length is 0!\n");
6687
return -EFAULT;
6688
}
6689
6690
if (count > sizeof(tmp)) {
6691
RTW_INFO("input length is too large\n");
6692
rtw_warn_on(1);
6693
return -EFAULT;
6694
}
6695
6696
if (buffer && !copy_from_user(tmp, buffer, count)) {
6697
int num = sscanf(tmp, "%d %d", &iqk_offload_enable, &ch_switch_offload_enable);
6698
6699
if (num < 2) {
6700
RTW_INFO("input parameters < 1\n");
6701
return -EINVAL;
6702
}
6703
6704
if (hal->RegIQKFWOffload != iqk_offload_enable) {
6705
hal->RegIQKFWOffload = iqk_offload_enable;
6706
rtw_run_in_thread_cmd(pri_adapter, ((void *)(rtw_hal_update_iqk_fw_offload_cap)), pri_adapter);
6707
}
6708
6709
if (hal->ch_switch_offload != ch_switch_offload_enable)
6710
hal->ch_switch_offload = ch_switch_offload_enable;
6711
}
6712
6713
return count;
6714
}
6715
6716
int proc_get_fw_offload(struct seq_file *m, void *v)
6717
{
6718
struct net_device *dev = m->private;
6719
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
6720
HAL_DATA_TYPE *hal = GET_HAL_DATA(adapter);
6721
6722
6723
RTW_PRINT_SEL(m, "IQK FW offload:%s\n", hal->RegIQKFWOffload?"enable":"disable");
6724
RTW_PRINT_SEL(m, "Channel switch FW offload:%s\n", hal->ch_switch_offload?"enable":"disable");
6725
return 0;
6726
}
6727
#ifdef CONFIG_FW_HANDLE_TXBCN
6728
extern void rtw_hal_set_fw_ap_bcn_offload_cmd(_adapter *adapter, bool fw_bcn_en, u8 tbtt_rpt_map);
6729
ssize_t proc_set_fw_tbtt_rpt(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6730
{
6731
struct net_device *dev = data;
6732
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
6733
char tmp[32];
6734
u32 fw_tbtt_rpt, fw_bcn_offload;
6735
6736
6737
if (buffer == NULL) {
6738
RTW_INFO("input buffer is NULL!\n");
6739
return -EFAULT;
6740
}
6741
6742
if (count < 1) {
6743
RTW_INFO("input length is 0!\n");
6744
return -EFAULT;
6745
}
6746
6747
if (count > sizeof(tmp)) {
6748
RTW_INFO("input length is too large\n");
6749
rtw_warn_on(1);
6750
return -EFAULT;
6751
}
6752
6753
if (buffer && !copy_from_user(tmp, buffer, count)) {
6754
int num = sscanf(tmp, "%d %x",&fw_bcn_offload, &fw_tbtt_rpt);
6755
6756
if (num < 2) {
6757
RTW_INFO("input parameters < 2\n");
6758
return -EINVAL;
6759
}
6760
rtw_hal_set_fw_ap_bcn_offload_cmd(adapter, fw_bcn_offload, fw_tbtt_rpt);
6761
}
6762
6763
return count;
6764
}
6765
6766
int proc_get_fw_tbtt_rpt(struct seq_file *m, void *v)
6767
{
6768
struct net_device *dev = m->private;
6769
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
6770
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
6771
6772
RTW_PRINT_SEL(m, "FW BCN offload:%s\n", dvobj->fw_bcn_offload ? "enable" : "disable");
6773
RTW_PRINT_SEL(m, "FW TBTT RPT:%x\n", dvobj->vap_tbtt_rpt_map);
6774
return 0;
6775
}
6776
6777
#endif
6778
6779
#ifdef CONFIG_CTRL_TXSS_BY_TP
6780
ssize_t proc_set_txss_tp(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6781
{
6782
struct net_device *dev = data;
6783
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
6784
struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
6785
6786
char tmp[32];
6787
u32 enable = 0;
6788
u32 txss_tx_tp = 0;
6789
int txss_chk_cnt = 0;
6790
6791
if (buffer == NULL) {
6792
RTW_INFO("input buffer is NULL!\n");
6793
return -EFAULT;
6794
}
6795
6796
if (count < 1) {
6797
RTW_INFO("input length is 0!\n");
6798
return -EFAULT;
6799
}
6800
6801
if (count > sizeof(tmp)) {
6802
RTW_INFO("input length is too large\n");
6803
rtw_warn_on(1);
6804
return -EFAULT;
6805
}
6806
6807
if (buffer && !copy_from_user(tmp, buffer, count)) {
6808
int num = sscanf(tmp, "%u %u %d",
6809
&enable, &txss_tx_tp, &txss_chk_cnt);
6810
6811
if (num < 1) {
6812
RTW_INFO("input parameters < 1\n");
6813
return -EINVAL;
6814
}
6815
pmlmeext->txss_ctrl_en = enable;
6816
6817
if (txss_tx_tp)
6818
pmlmeext->txss_tp_th = txss_tx_tp;
6819
if (txss_chk_cnt)
6820
pmlmeext->txss_tp_chk_cnt = txss_chk_cnt;
6821
6822
RTW_INFO("%s txss_ctl_en :%s , txss_tp_th:%d, tp_chk_cnt:%d\n",
6823
__func__, pmlmeext->txss_tp_th ? "Y" : "N",
6824
pmlmeext->txss_tp_th, pmlmeext->txss_tp_chk_cnt);
6825
6826
}
6827
6828
return count;
6829
}
6830
6831
int proc_get_txss_tp(struct seq_file *m, void *v)
6832
{
6833
struct net_device *dev = m->private;
6834
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
6835
struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
6836
6837
RTW_PRINT_SEL(m, "TXSS Control - %s\n", pmlmeext->txss_ctrl_en ? "enable" : "disable");
6838
RTW_PRINT_SEL(m, "TXSS Tx TP TH - %d\n", pmlmeext->txss_tp_th);
6839
RTW_PRINT_SEL(m, "TXSS check cnt - %d\n", pmlmeext->txss_tp_chk_cnt);
6840
6841
return 0;
6842
}
6843
#ifdef DBG_CTRL_TXSS
6844
ssize_t proc_set_txss_ctrl(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6845
{
6846
struct net_device *dev = data;
6847
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
6848
struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
6849
6850
char tmp[32];
6851
u32 tx_1ss = 0;
6852
6853
if (buffer == NULL) {
6854
RTW_INFO("input buffer is NULL!\n");
6855
return -EFAULT;
6856
}
6857
6858
if (count < 1) {
6859
RTW_INFO("input length is 0!\n");
6860
return -EFAULT;
6861
}
6862
6863
if (count > sizeof(tmp)) {
6864
RTW_INFO("input length is too large\n");
6865
rtw_warn_on(1);
6866
return -EFAULT;
6867
}
6868
6869
if (buffer && !copy_from_user(tmp, buffer, count)) {
6870
int num = sscanf(tmp, "%u", &tx_1ss);
6871
6872
if (num < 1) {
6873
RTW_INFO("input parameters < 1\n");
6874
return -EINVAL;
6875
}
6876
6877
pmlmeext->txss_ctrl_en = _FALSE;
6878
6879
dbg_ctrl_txss(adapter, tx_1ss);
6880
6881
RTW_INFO("%s set tx to 1ss :%s\n", __func__, tx_1ss ? "Y" : "N");
6882
}
6883
6884
return count;
6885
}
6886
6887
int proc_get_txss_ctrl(struct seq_file *m, void *v)
6888
{
6889
struct net_device *dev = m->private;
6890
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
6891
struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
6892
6893
RTW_PRINT_SEL(m, "TXSS 1ss - %s\n", pmlmeext->txss_1ss ? "Y" : "N");
6894
6895
return 0;
6896
}
6897
#endif
6898
#endif
6899
6900
#ifdef CONFIG_DBG_RF_CAL
6901
int proc_get_iqk_info(struct seq_file *m, void *v)
6902
{
6903
struct net_device *dev = m->private;
6904
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6905
6906
return 0;
6907
}
6908
6909
ssize_t proc_set_iqk(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6910
{
6911
struct net_device *dev = data;
6912
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6913
char tmp[32];
6914
u32 recovery, clear, segment;
6915
6916
if (count < 1)
6917
return -EFAULT;
6918
6919
if (count > sizeof(tmp)) {
6920
rtw_warn_on(1);
6921
return -EFAULT;
6922
}
6923
6924
if (buffer && !copy_from_user(tmp, buffer, count)) {
6925
6926
int num = sscanf(tmp, "%d %d %d", &recovery, &clear, &segment);
6927
6928
if (num != 3) {
6929
RTW_INFO("Invalid format\n");
6930
return count;
6931
}
6932
6933
rtw_hal_iqk_test(padapter, recovery, clear, segment);
6934
}
6935
6936
return count;
6937
6938
}
6939
6940
int proc_get_lck_info(struct seq_file *m, void *v)
6941
{
6942
struct net_device *dev = m->private;
6943
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6944
6945
return 0;
6946
}
6947
6948
ssize_t proc_set_lck(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6949
{
6950
struct net_device *dev = data;
6951
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
6952
char tmp[32];
6953
u32 trigger;
6954
6955
if (count < 1)
6956
return -EFAULT;
6957
6958
if (count > sizeof(tmp)) {
6959
rtw_warn_on(1);
6960
return -EFAULT;
6961
}
6962
6963
if (buffer && !copy_from_user(tmp, buffer, count)) {
6964
6965
int num = sscanf(tmp, "%d", &trigger);
6966
6967
if (num != 1) {
6968
RTW_INFO("Invalid format\n");
6969
return count;
6970
}
6971
6972
rtw_hal_lck_test(padapter);
6973
}
6974
6975
return count;
6976
}
6977
#endif /* CONFIG_DBG_RF_CAL */
6978
6979
#ifdef CONFIG_LPS_CHK_BY_TP
6980
ssize_t proc_set_lps_chk_tp(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
6981
{
6982
struct net_device *dev = data;
6983
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
6984
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(adapter);
6985
char tmp[32];
6986
u32 enable = 0;
6987
u32 lps_tx_tp = 0, lps_rx_tp = 0, lps_bi_tp = 0;
6988
int lps_chk_cnt_th = 0;
6989
u32 lps_tx_pkts = 0, lps_rx_pkts = 0;
6990
6991
if (buffer == NULL) {
6992
RTW_INFO("input buffer is NULL!\n");
6993
return -EFAULT;
6994
}
6995
6996
if (count < 1) {
6997
RTW_INFO("input length is 0!\n");
6998
return -EFAULT;
6999
}
7000
7001
if (count > sizeof(tmp)) {
7002
RTW_INFO("input length is too large\n");
7003
rtw_warn_on(1);
7004
return -EFAULT;
7005
}
7006
7007
if (buffer && !copy_from_user(tmp, buffer, count)) {
7008
int num = sscanf(tmp, "%u %u %u %u %d %u %u",
7009
&enable, &lps_tx_tp, &lps_rx_tp, &lps_bi_tp,
7010
&lps_chk_cnt_th, &lps_tx_pkts, &lps_rx_pkts);
7011
7012
if (num < 1) {
7013
RTW_INFO("input parameters < 1\n");
7014
return -EINVAL;
7015
}
7016
pwrpriv->lps_chk_by_tp = enable;
7017
7018
if (lps_tx_tp) {
7019
pwrpriv->lps_tx_tp_th = lps_tx_tp;
7020
pwrpriv->lps_rx_tp_th = lps_tx_tp;
7021
pwrpriv->lps_bi_tp_th = lps_tx_tp;
7022
}
7023
if (lps_rx_tp)
7024
pwrpriv->lps_rx_tp_th = lps_rx_tp;
7025
if (lps_bi_tp)
7026
pwrpriv->lps_bi_tp_th = lps_bi_tp;
7027
7028
if (lps_chk_cnt_th)
7029
pwrpriv->lps_chk_cnt_th = lps_chk_cnt_th;
7030
7031
if (lps_tx_pkts)
7032
pwrpriv->lps_tx_pkts = lps_tx_pkts;
7033
7034
if (lps_rx_pkts)
7035
pwrpriv->lps_rx_pkts = lps_rx_pkts;
7036
7037
RTW_INFO("%s lps_chk_by_tp:%s , lps_tx_tp_th:%d, lps_tx_tp_th:%d, lps_bi_tp:%d\n",
7038
__func__, pwrpriv->lps_chk_by_tp ? "Y" : "N",
7039
pwrpriv->lps_tx_tp_th, pwrpriv->lps_tx_tp_th, pwrpriv->lps_bi_tp_th);
7040
RTW_INFO("%s lps_chk_cnt_th:%d , lps_tx_pkts:%d, lps_rx_pkts:%d\n",
7041
__func__, pwrpriv->lps_chk_cnt_th, pwrpriv->lps_tx_pkts, pwrpriv->lps_rx_pkts);
7042
}
7043
7044
return count;
7045
}
7046
7047
int proc_get_lps_chk_tp(struct seq_file *m, void *v)
7048
{
7049
struct net_device *dev = m->private;
7050
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
7051
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(adapter);
7052
7053
RTW_PRINT_SEL(m, "LPS chk by tp - %s\n", pwrpriv->lps_chk_by_tp ? "enable" : "disable");
7054
RTW_PRINT_SEL(m, "LPS Tx TP TH - %d(Mbps)\n", pwrpriv->lps_tx_tp_th);
7055
RTW_PRINT_SEL(m, "LPS Rx TP TH - %d(Mbps)\n", pwrpriv->lps_rx_tp_th);
7056
RTW_PRINT_SEL(m, "LPS BI TP TH - %d(Mbps)\n", pwrpriv->lps_bi_tp_th);
7057
7058
RTW_PRINT_SEL(m, "LPS CHK CNT - %d\n", pwrpriv->lps_chk_cnt_th);
7059
RTW_PRINT_SEL(m, "LPS Tx PKTs - %d\n", pwrpriv->lps_tx_pkts);
7060
RTW_PRINT_SEL(m, "LPS Rx PKTs - %d\n", pwrpriv->lps_rx_pkts);
7061
return 0;
7062
}
7063
#endif /*CONFIG_LPS_CHK_BY_TP*/
7064
#ifdef CONFIG_SUPPORT_STATIC_SMPS
7065
ssize_t proc_set_smps(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
7066
{
7067
struct net_device *dev = data;
7068
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
7069
struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
7070
char tmp[32];
7071
u32 enable = 0;
7072
u32 smps_en, smps_tx_tp = 0, smps_rx_tp = 0;
7073
u32 smps_test = 0, smps_test_en = 0;
7074
7075
if (buffer == NULL) {
7076
RTW_INFO("input buffer is NULL!\n");
7077
return -EFAULT;
7078
}
7079
7080
if (count < 1) {
7081
RTW_INFO("input length is 0!\n");
7082
return -EFAULT;
7083
}
7084
7085
if (count > sizeof(tmp)) {
7086
RTW_INFO("input length is too large\n");
7087
rtw_warn_on(1);
7088
return -EFAULT;
7089
}
7090
7091
if (buffer && !copy_from_user(tmp, buffer, count)) {
7092
int num = sscanf(tmp, "%u %u %u %u %u", &smps_en, &smps_tx_tp, &smps_rx_tp,
7093
&smps_test, &smps_test_en);
7094
7095
if (num < 1) {
7096
RTW_INFO("input parameters < 1\n");
7097
return -EINVAL;
7098
}
7099
7100
pmlmeext->ssmps_en = smps_en;
7101
if (smps_tx_tp) {
7102
pmlmeext->ssmps_tx_tp_th= smps_tx_tp;
7103
pmlmeext->ssmps_rx_tp_th= smps_tx_tp;
7104
}
7105
if (smps_rx_tp)
7106
pmlmeext->ssmps_rx_tp_th = smps_rx_tp;
7107
7108
#ifdef DBG_STATIC_SMPS
7109
if (num > 3) {
7110
pmlmeext->ssmps_test = smps_test;
7111
pmlmeext->ssmps_test_en = smps_test_en;
7112
}
7113
#endif
7114
RTW_INFO("SM PS : %s tx_tp_th:%d, rx_tp_th:%d\n",
7115
(smps_en) ? "Enable" : "Disable",
7116
pmlmeext->ssmps_tx_tp_th,
7117
pmlmeext->ssmps_rx_tp_th);
7118
#ifdef DBG_STATIC_SMPS
7119
RTW_INFO("SM PS : %s ssmps_test_en:%d\n",
7120
(smps_test) ? "Enable" : "Disable",
7121
pmlmeext->ssmps_test_en);
7122
#endif
7123
}
7124
7125
return count;
7126
}
7127
7128
int proc_get_smps(struct seq_file *m, void *v)
7129
{
7130
struct net_device *dev = m->private;
7131
_adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
7132
struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
7133
7134
RTW_PRINT_SEL(m, "Static SMPS %s\n", pmlmeext->ssmps_en ? "enable" : "disable");
7135
RTW_PRINT_SEL(m, "Tx TP TH %d\n", pmlmeext->ssmps_tx_tp_th);
7136
RTW_PRINT_SEL(m, "Rx TP TH %d\n", pmlmeext->ssmps_rx_tp_th);
7137
#ifdef DBG_STATIC_SMPS
7138
RTW_PRINT_SEL(m, "test %d, test_en:%d\n", pmlmeext->ssmps_test, pmlmeext->ssmps_test_en);
7139
#endif
7140
return 0;
7141
}
7142
#endif /*CONFIG_SUPPORT_STATIC_SMPS*/
7143
7144
#endif /* CONFIG_PROC_DEBUG */
7145
#define RTW_BUFDUMP_BSIZE 16
7146
#if 1
7147
inline void RTW_BUF_DUMP_SEL(uint _loglevel, void *sel, u8 *_titlestring,
7148
bool _idx_show, const u8 *_hexdata, int _hexdatalen)
7149
{
7150
#ifdef CONFIG_RTW_DEBUG
7151
int __i;
7152
u8 *ptr = (u8 *)_hexdata;
7153
7154
if (_loglevel <= rtw_drv_log_level) {
7155
if (_titlestring) {
7156
if (sel == RTW_DBGDUMP)
7157
RTW_PRINT("");
7158
_RTW_PRINT_SEL(sel, "%s", _titlestring);
7159
if (_hexdatalen >= RTW_BUFDUMP_BSIZE)
7160
_RTW_PRINT_SEL(sel, "\n");
7161
}
7162
7163
for (__i = 0; __i < _hexdatalen; __i++) {
7164
if (((__i % RTW_BUFDUMP_BSIZE) == 0) && (_hexdatalen >= RTW_BUFDUMP_BSIZE)) {
7165
if (sel == RTW_DBGDUMP)
7166
RTW_PRINT("");
7167
if (_idx_show)
7168
_RTW_PRINT_SEL(sel, "0x%03X: ", __i);
7169
}
7170
_RTW_PRINT_SEL(sel, "%02X%s", ptr[__i], (((__i + 1) % 4) == 0) ? " " : " ");
7171
if ((__i + 1 < _hexdatalen) && ((__i + 1) % RTW_BUFDUMP_BSIZE) == 0)
7172
_RTW_PRINT_SEL(sel, "\n");
7173
}
7174
_RTW_PRINT_SEL(sel, "\n");
7175
}
7176
#endif
7177
}
7178
#else
7179
inline void _RTW_STR_DUMP_SEL(void *sel, char *str_out)
7180
{
7181
if (sel == RTW_DBGDUMP)
7182
_dbgdump("%s\n", str_out);
7183
#if defined(_seqdump)
7184
else
7185
_seqdump(sel, "%s\n", str_out);
7186
#endif /*_seqdump*/
7187
}
7188
inline void RTW_BUF_DUMP_SEL(uint _loglevel, void *sel, u8 *_titlestring,
7189
bool _idx_show, u8 *_hexdata, int _hexdatalen)
7190
{
7191
int __i, len;
7192
int __j, idx;
7193
int block_num, remain_byte;
7194
char str_out[128] = {'\0'};
7195
char str_val[32] = {'\0'};
7196
char *p = NULL;
7197
u8 *ptr = (u8 *)_hexdata;
7198
7199
if (_loglevel <= rtw_drv_log_level) {
7200
/*dump title*/
7201
p = &str_out[0];
7202
if (_titlestring) {
7203
if (sel == RTW_DBGDUMP) {
7204
len = snprintf(str_val, sizeof(str_val), "%s", DRIVER_PREFIX);
7205
strncpy(p, str_val, len);
7206
p += len;
7207
}
7208
len = snprintf(str_val, sizeof(str_val), "%s", _titlestring);
7209
strncpy(p, str_val, len);
7210
p += len;
7211
}
7212
if (p != &str_out[0]) {
7213
_RTW_STR_DUMP_SEL(sel, str_out);
7214
_rtw_memset(&str_out, '\0', sizeof(str_out));
7215
}
7216
7217
/*dump buffer*/
7218
block_num = _hexdatalen / RTW_BUFDUMP_BSIZE;
7219
remain_byte = _hexdatalen % RTW_BUFDUMP_BSIZE;
7220
for (__i = 0; __i < block_num; __i++) {
7221
p = &str_out[0];
7222
if (sel == RTW_DBGDUMP) {
7223
len = snprintf(str_val, sizeof(str_val), "%s", DRIVER_PREFIX);
7224
strncpy(p, str_val, len);
7225
p += len;
7226
}
7227
if (_idx_show) {
7228
len = snprintf(str_val, sizeof(str_val), "0x%03X: ", __i * RTW_BUFDUMP_BSIZE);
7229
strncpy(p, str_val, len);
7230
p += len;
7231
}
7232
for (__j =0; __j < RTW_BUFDUMP_BSIZE; __j++) {
7233
idx = __i * RTW_BUFDUMP_BSIZE + __j;
7234
len = snprintf(str_val, sizeof(str_val), "%02X%s", ptr[idx], (((__j + 1) % 4) == 0) ? " " : " ");
7235
strncpy(p, str_val, len);
7236
p += len;
7237
}
7238
_RTW_STR_DUMP_SEL(sel, str_out);
7239
_rtw_memset(&str_out, '\0', sizeof(str_out));
7240
}
7241
7242
p = &str_out[0];
7243
if ((sel == RTW_DBGDUMP) && remain_byte) {
7244
len = snprintf(str_val, sizeof(str_val), "%s", DRIVER_PREFIX);
7245
strncpy(p, str_val, len);
7246
p += len;
7247
}
7248
if (_idx_show && remain_byte) {
7249
len = snprintf(str_val, sizeof(str_val), "0x%03X: ", block_num * RTW_BUFDUMP_BSIZE);
7250
strncpy(p, str_val, len);
7251
p += len;
7252
}
7253
for (__i = 0; __i < remain_byte; __i++) {
7254
idx = block_num * RTW_BUFDUMP_BSIZE + __i;
7255
len = snprintf(str_val, sizeof(str_val), "%02X%s", ptr[idx], (((__i + 1) % 4) == 0) ? " " : " ");
7256
strncpy(p, str_val, len);
7257
p += len;
7258
}
7259
_RTW_STR_DUMP_SEL(sel, str_out);
7260
}
7261
}
7262
7263
#endif
7264
7265