1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * mac80211 debugfs for wireless PHYs 4 * 5 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2013-2014 Intel Mobile Communications GmbH 7 * Copyright (C) 2018 - 2019, 2021-2025 Intel Corporation 8 */ 9 10 #include <linux/debugfs.h> 11 #include <linux/rtnetlink.h> 12 #include <linux/vmalloc.h> 13 #include "ieee80211_i.h" 14 #include "driver-ops.h" 15 #include "rate.h" 16 #include "debugfs.h" 17 18 #define DEBUGFS_FORMAT_BUFFER_SIZE 100 19 20 int mac80211_format_buffer(char __user *userbuf, size_t count, 21 loff_t *ppos, char *fmt, ...) 22 { 23 va_list args; 24 char buf[DEBUGFS_FORMAT_BUFFER_SIZE]; 25 int res; 26 27 va_start(args, fmt); 28 res = vscnprintf(buf, sizeof(buf), fmt, args); 29 va_end(args); 30 31 return simple_read_from_buffer(userbuf, count, ppos, buf, res); 32 } 33 34 #define DEBUGFS_READONLY_FILE_FN(name, fmt, value...) \ 35 static ssize_t name## _read(struct file *file, char __user *userbuf, \ 36 size_t count, loff_t *ppos) \ 37 { \ 38 struct ieee80211_local *local = file->private_data; \ 39 \ 40 return mac80211_format_buffer(userbuf, count, ppos, \ 41 fmt "\n", ##value); \ 42 } 43 44 #define DEBUGFS_READONLY_FILE_OPS(name) \ 45 static const struct debugfs_short_fops name## _ops = { \ 46 .read = name## _read, \ 47 .llseek = generic_file_llseek, \ 48 }; 49 50 #define DEBUGFS_READONLY_FILE(name, fmt, value...) \ 51 DEBUGFS_READONLY_FILE_FN(name, fmt, value) \ 52 DEBUGFS_READONLY_FILE_OPS(name) 53 54 #define DEBUGFS_ADD(name) \ 55 debugfs_create_file(#name, 0400, phyd, local, &name## _ops) 56 57 #define DEBUGFS_ADD_MODE(name, mode) \ 58 debugfs_create_file(#name, mode, phyd, local, &name## _ops); 59 60 61 DEBUGFS_READONLY_FILE(hw_conf, "%x", 62 local->hw.conf.flags); 63 DEBUGFS_READONLY_FILE(user_power, "%d", 64 local->user_power_level); 65 DEBUGFS_READONLY_FILE(power, "%d", 66 local->hw.conf.power_level); 67 DEBUGFS_READONLY_FILE(total_ps_buffered, "%d", 68 local->total_ps_buffered); 69 DEBUGFS_READONLY_FILE(wep_iv, "%#08x", 70 local->wep_iv & 0xffffff); 71 DEBUGFS_READONLY_FILE(rate_ctrl_alg, "%s", 72 local->rate_ctrl ? local->rate_ctrl->ops->name : "hw/driver"); 73 74 static ssize_t aqm_read(struct file *file, 75 char __user *user_buf, 76 size_t count, 77 loff_t *ppos) 78 { 79 struct ieee80211_local *local = file->private_data; 80 struct fq *fq = &local->fq; 81 char buf[200]; 82 int len = 0; 83 84 spin_lock_bh(&local->fq.lock); 85 86 len = scnprintf(buf, sizeof(buf), 87 "access name value\n" 88 "R fq_flows_cnt %u\n" 89 "R fq_backlog %u\n" 90 "R fq_overlimit %u\n" 91 "R fq_overmemory %u\n" 92 "R fq_collisions %u\n" 93 "R fq_memory_usage %u\n" 94 "RW fq_memory_limit %u\n" 95 "RW fq_limit %u\n" 96 "RW fq_quantum %u\n", 97 fq->flows_cnt, 98 fq->backlog, 99 fq->overmemory, 100 fq->overlimit, 101 fq->collisions, 102 fq->memory_usage, 103 fq->memory_limit, 104 fq->limit, 105 fq->quantum); 106 107 spin_unlock_bh(&local->fq.lock); 108 109 return simple_read_from_buffer(user_buf, count, ppos, 110 buf, len); 111 } 112 113 static ssize_t aqm_write(struct file *file, 114 const char __user *user_buf, 115 size_t count, 116 loff_t *ppos) 117 { 118 struct ieee80211_local *local = file->private_data; 119 char buf[100]; 120 121 if (count >= sizeof(buf)) 122 return -EINVAL; 123 124 if (copy_from_user(buf, user_buf, count)) 125 return -EFAULT; 126 127 if (count && buf[count - 1] == '\n') 128 buf[count - 1] = '\0'; 129 else 130 buf[count] = '\0'; 131 132 if (sscanf(buf, "fq_limit %u", &local->fq.limit) == 1) 133 return count; 134 else if (sscanf(buf, "fq_memory_limit %u", &local->fq.memory_limit) == 1) 135 return count; 136 else if (sscanf(buf, "fq_quantum %u", &local->fq.quantum) == 1) 137 return count; 138 139 return -EINVAL; 140 } 141 142 static const struct debugfs_short_fops aqm_ops = { 143 .write = aqm_write, 144 .read = aqm_read, 145 .llseek = default_llseek, 146 }; 147 148 static ssize_t airtime_flags_read(struct file *file, 149 char __user *user_buf, 150 size_t count, loff_t *ppos) 151 { 152 struct ieee80211_local *local = file->private_data; 153 char buf[128] = {}, *pos, *end; 154 155 pos = buf; 156 end = pos + sizeof(buf) - 1; 157 158 if (local->airtime_flags & AIRTIME_USE_TX) 159 pos += scnprintf(pos, end - pos, "AIRTIME_TX\t(%lx)\n", 160 AIRTIME_USE_TX); 161 if (local->airtime_flags & AIRTIME_USE_RX) 162 pos += scnprintf(pos, end - pos, "AIRTIME_RX\t(%lx)\n", 163 AIRTIME_USE_RX); 164 165 return simple_read_from_buffer(user_buf, count, ppos, buf, 166 strlen(buf)); 167 } 168 169 static ssize_t airtime_flags_write(struct file *file, 170 const char __user *user_buf, 171 size_t count, loff_t *ppos) 172 { 173 struct ieee80211_local *local = file->private_data; 174 int ret; 175 176 ret = kstrtou16_from_user(user_buf, count, 0, &local->airtime_flags); 177 return ret ? : count; 178 } 179 180 static const struct debugfs_short_fops airtime_flags_ops = { 181 .write = airtime_flags_write, 182 .read = airtime_flags_read, 183 .llseek = default_llseek, 184 }; 185 186 static ssize_t aql_pending_read(struct file *file, 187 char __user *user_buf, 188 size_t count, loff_t *ppos) 189 { 190 struct ieee80211_local *local = file->private_data; 191 char buf[400]; 192 int len = 0; 193 194 len = scnprintf(buf, sizeof(buf), 195 "AC AQL pending\n" 196 "VO %u us\n" 197 "VI %u us\n" 198 "BE %u us\n" 199 "BK %u us\n" 200 "MC %u us\n" 201 "total %u us\n", 202 atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_VO]), 203 atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_VI]), 204 atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_BE]), 205 atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_BK]), 206 atomic_read(&local->aql_mc_pending_airtime), 207 atomic_read(&local->aql_total_pending_airtime)); 208 return simple_read_from_buffer(user_buf, count, ppos, 209 buf, len); 210 } 211 212 static const struct debugfs_short_fops aql_pending_ops = { 213 .read = aql_pending_read, 214 .llseek = default_llseek, 215 }; 216 217 static ssize_t aql_txq_limit_read(struct file *file, 218 char __user *user_buf, 219 size_t count, 220 loff_t *ppos) 221 { 222 struct ieee80211_local *local = file->private_data; 223 char buf[400]; 224 int len = 0; 225 226 len = scnprintf(buf, sizeof(buf), 227 "AC AQL limit low AQL limit high\n" 228 "VO %u %u\n" 229 "VI %u %u\n" 230 "BE %u %u\n" 231 "BK %u %u\n" 232 "MC %u\n", 233 local->aql_txq_limit_low[IEEE80211_AC_VO], 234 local->aql_txq_limit_high[IEEE80211_AC_VO], 235 local->aql_txq_limit_low[IEEE80211_AC_VI], 236 local->aql_txq_limit_high[IEEE80211_AC_VI], 237 local->aql_txq_limit_low[IEEE80211_AC_BE], 238 local->aql_txq_limit_high[IEEE80211_AC_BE], 239 local->aql_txq_limit_low[IEEE80211_AC_BK], 240 local->aql_txq_limit_high[IEEE80211_AC_BK], 241 local->aql_txq_limit_mc); 242 return simple_read_from_buffer(user_buf, count, ppos, 243 buf, len); 244 } 245 246 static ssize_t aql_txq_limit_write(struct file *file, 247 const char __user *user_buf, 248 size_t count, 249 loff_t *ppos) 250 { 251 struct ieee80211_local *local = file->private_data; 252 char buf[100]; 253 u32 ac, q_limit_low, q_limit_high, q_limit_low_old, q_limit_high_old; 254 struct sta_info *sta; 255 256 if (count >= sizeof(buf)) 257 return -EINVAL; 258 259 if (copy_from_user(buf, user_buf, count)) 260 return -EFAULT; 261 262 if (count && buf[count - 1] == '\n') 263 buf[count - 1] = '\0'; 264 else 265 buf[count] = '\0'; 266 267 if (sscanf(buf, "mcast %u", &q_limit_low) == 1) { 268 local->aql_txq_limit_mc = q_limit_low; 269 return count; 270 } 271 272 if (sscanf(buf, "%u %u %u", &ac, &q_limit_low, &q_limit_high) != 3) 273 return -EINVAL; 274 275 if (ac >= IEEE80211_NUM_ACS) 276 return -EINVAL; 277 278 q_limit_low_old = local->aql_txq_limit_low[ac]; 279 q_limit_high_old = local->aql_txq_limit_high[ac]; 280 281 guard(wiphy)(local->hw.wiphy); 282 283 local->aql_txq_limit_low[ac] = q_limit_low; 284 local->aql_txq_limit_high[ac] = q_limit_high; 285 286 list_for_each_entry(sta, &local->sta_list, list) { 287 /* If a sta has customized queue limits, keep it */ 288 if (sta->airtime[ac].aql_limit_low == q_limit_low_old && 289 sta->airtime[ac].aql_limit_high == q_limit_high_old) { 290 sta->airtime[ac].aql_limit_low = q_limit_low; 291 sta->airtime[ac].aql_limit_high = q_limit_high; 292 } 293 } 294 295 return count; 296 } 297 298 static const struct debugfs_short_fops aql_txq_limit_ops = { 299 .write = aql_txq_limit_write, 300 .read = aql_txq_limit_read, 301 .llseek = default_llseek, 302 }; 303 304 static ssize_t aql_enable_read(struct file *file, char __user *user_buf, 305 size_t count, loff_t *ppos) 306 { 307 char buf[3]; 308 int len; 309 310 len = scnprintf(buf, sizeof(buf), "%d\n", 311 !static_key_false(&aql_disable.key)); 312 313 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 314 } 315 316 static ssize_t aql_enable_write(struct file *file, const char __user *user_buf, 317 size_t count, loff_t *ppos) 318 { 319 bool val; 320 int ret; 321 322 ret = kstrtobool_from_user(user_buf, count, &val); 323 if (unlikely(ret)) 324 return ret; 325 326 if (val) 327 static_branch_disable(&aql_disable); 328 else 329 static_branch_enable(&aql_disable); 330 331 return count; 332 } 333 334 static const struct debugfs_short_fops aql_enable_ops = { 335 .write = aql_enable_write, 336 .read = aql_enable_read, 337 .llseek = default_llseek, 338 }; 339 340 static ssize_t force_tx_status_read(struct file *file, 341 char __user *user_buf, 342 size_t count, 343 loff_t *ppos) 344 { 345 struct ieee80211_local *local = file->private_data; 346 char buf[3]; 347 int len = 0; 348 349 len = scnprintf(buf, sizeof(buf), "%d\n", (int)local->force_tx_status); 350 351 return simple_read_from_buffer(user_buf, count, ppos, 352 buf, len); 353 } 354 355 static ssize_t force_tx_status_write(struct file *file, 356 const char __user *user_buf, 357 size_t count, 358 loff_t *ppos) 359 { 360 struct ieee80211_local *local = file->private_data; 361 bool val; 362 int ret; 363 364 ret = kstrtobool_from_user(user_buf, count, &val); 365 if (unlikely(ret)) 366 return ret; 367 368 local->force_tx_status = val; 369 return count; 370 } 371 372 static const struct debugfs_short_fops force_tx_status_ops = { 373 .write = force_tx_status_write, 374 .read = force_tx_status_read, 375 .llseek = default_llseek, 376 }; 377 378 #ifdef CONFIG_PM 379 static ssize_t reset_write(struct file *file, const char __user *user_buf, 380 size_t count, loff_t *ppos) 381 { 382 struct ieee80211_local *local = file->private_data; 383 int ret; 384 385 rtnl_lock(); 386 wiphy_lock(local->hw.wiphy); 387 __ieee80211_suspend(&local->hw, NULL); 388 ret = __ieee80211_resume(&local->hw); 389 wiphy_unlock(local->hw.wiphy); 390 391 if (ret) 392 cfg80211_shutdown_all_interfaces(local->hw.wiphy); 393 394 rtnl_unlock(); 395 396 return count; 397 } 398 399 static const struct debugfs_short_fops reset_ops = { 400 .write = reset_write, 401 .llseek = noop_llseek, 402 }; 403 #endif 404 405 static const char *hw_flag_names[] = { 406 #define FLAG(F) [IEEE80211_HW_##F] = #F 407 FLAG(HAS_RATE_CONTROL), 408 FLAG(RX_INCLUDES_FCS), 409 FLAG(HOST_BROADCAST_PS_BUFFERING), 410 FLAG(SIGNAL_UNSPEC), 411 FLAG(SIGNAL_DBM), 412 FLAG(NEED_DTIM_BEFORE_ASSOC), 413 FLAG(SPECTRUM_MGMT), 414 FLAG(AMPDU_AGGREGATION), 415 FLAG(SUPPORTS_PS), 416 FLAG(PS_NULLFUNC_STACK), 417 FLAG(SUPPORTS_DYNAMIC_PS), 418 FLAG(MFP_CAPABLE), 419 FLAG(WANT_MONITOR_VIF), 420 FLAG(NO_VIRTUAL_MONITOR), 421 FLAG(NO_AUTO_VIF), 422 FLAG(SW_CRYPTO_CONTROL), 423 FLAG(SUPPORT_FAST_XMIT), 424 FLAG(REPORTS_TX_ACK_STATUS), 425 FLAG(CONNECTION_MONITOR), 426 FLAG(QUEUE_CONTROL), 427 FLAG(SUPPORTS_PER_STA_GTK), 428 FLAG(AP_LINK_PS), 429 FLAG(TX_AMPDU_SETUP_IN_HW), 430 FLAG(SUPPORTS_RC_TABLE), 431 FLAG(P2P_DEV_ADDR_FOR_INTF), 432 FLAG(TIMING_BEACON_ONLY), 433 FLAG(SUPPORTS_HT_CCK_RATES), 434 FLAG(CHANCTX_STA_CSA), 435 FLAG(SUPPORTS_CLONED_SKBS), 436 FLAG(SINGLE_SCAN_ON_ALL_BANDS), 437 FLAG(TDLS_WIDER_BW), 438 FLAG(SUPPORTS_AMSDU_IN_AMPDU), 439 FLAG(BEACON_TX_STATUS), 440 FLAG(NEEDS_UNIQUE_STA_ADDR), 441 FLAG(SUPPORTS_REORDERING_BUFFER), 442 FLAG(USES_RSS), 443 FLAG(TX_AMSDU), 444 FLAG(TX_FRAG_LIST), 445 FLAG(REPORTS_LOW_ACK), 446 FLAG(SUPPORTS_TX_FRAG), 447 FLAG(SUPPORTS_TDLS_BUFFER_STA), 448 FLAG(DOESNT_SUPPORT_QOS_NDP), 449 FLAG(BUFF_MMPDU_TXQ), 450 FLAG(SUPPORTS_VHT_EXT_NSS_BW), 451 FLAG(STA_MMPDU_TXQ), 452 FLAG(TX_STATUS_NO_AMPDU_LEN), 453 FLAG(SUPPORTS_MULTI_BSSID), 454 FLAG(SUPPORTS_ONLY_HE_MULTI_BSSID), 455 FLAG(AMPDU_KEYBORDER_SUPPORT), 456 FLAG(SUPPORTS_TX_ENCAP_OFFLOAD), 457 FLAG(SUPPORTS_RX_DECAP_OFFLOAD), 458 FLAG(SUPPORTS_CONC_MON_RX_DECAP), 459 FLAG(DETECTS_COLOR_COLLISION), 460 FLAG(MLO_MCAST_MULTI_LINK_TX), 461 FLAG(DISALLOW_PUNCTURING), 462 FLAG(HANDLES_QUIET_CSA), 463 FLAG(STRICT), 464 FLAG(SUPPORTS_NDP_BLOCKACK), 465 #undef FLAG 466 }; 467 468 static ssize_t hwflags_read(struct file *file, char __user *user_buf, 469 size_t count, loff_t *ppos) 470 { 471 struct ieee80211_local *local = file->private_data; 472 size_t bufsz = 30 * NUM_IEEE80211_HW_FLAGS; 473 char *buf = kzalloc(bufsz, GFP_KERNEL); 474 char *pos = buf, *end = buf + bufsz - 1; 475 ssize_t rv; 476 int i; 477 478 if (!buf) 479 return -ENOMEM; 480 481 /* fail compilation if somebody adds or removes 482 * a flag without updating the name array above 483 */ 484 BUILD_BUG_ON(ARRAY_SIZE(hw_flag_names) != NUM_IEEE80211_HW_FLAGS); 485 486 for (i = 0; i < NUM_IEEE80211_HW_FLAGS; i++) { 487 if (test_bit(i, local->hw.flags)) 488 pos += scnprintf(pos, end - pos, "%s\n", 489 hw_flag_names[i]); 490 } 491 492 rv = simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); 493 kfree(buf); 494 return rv; 495 } 496 497 static ssize_t hwflags_write(struct file *file, const char __user *user_buf, 498 size_t count, loff_t *ppos) 499 { 500 struct ieee80211_local *local = file->private_data; 501 char buf[100]; 502 int val; 503 504 if (count >= sizeof(buf)) 505 return -EINVAL; 506 507 if (copy_from_user(buf, user_buf, count)) 508 return -EFAULT; 509 510 if (count && buf[count - 1] == '\n') 511 buf[count - 1] = '\0'; 512 else 513 buf[count] = '\0'; 514 515 if (sscanf(buf, "strict=%d", &val) == 1) { 516 switch (val) { 517 case 0: 518 ieee80211_hw_set(&local->hw, STRICT); 519 return count; 520 case 1: 521 __clear_bit(IEEE80211_HW_STRICT, local->hw.flags); 522 return count; 523 default: 524 return -EINVAL; 525 } 526 } 527 528 return -EINVAL; 529 } 530 531 static const struct file_operations hwflags_ops = { 532 .open = simple_open, 533 .read = hwflags_read, 534 .write = hwflags_write, 535 }; 536 537 static ssize_t misc_read(struct file *file, char __user *user_buf, 538 size_t count, loff_t *ppos) 539 { 540 struct ieee80211_local *local = file->private_data; 541 /* Max len of each line is 16 characters, plus 9 for 'pending:\n' */ 542 size_t bufsz = IEEE80211_MAX_QUEUES * 16 + 9; 543 char *buf; 544 char *pos, *end; 545 ssize_t rv; 546 int i; 547 int ln; 548 549 buf = kzalloc(bufsz, GFP_KERNEL); 550 if (!buf) 551 return -ENOMEM; 552 553 pos = buf; 554 end = buf + bufsz - 1; 555 556 pos += scnprintf(pos, end - pos, "pending:\n"); 557 558 for (i = 0; i < IEEE80211_MAX_QUEUES; i++) { 559 ln = skb_queue_len(&local->pending[i]); 560 pos += scnprintf(pos, end - pos, "[%i] %d\n", 561 i, ln); 562 } 563 564 rv = simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); 565 kfree(buf); 566 return rv; 567 } 568 569 static ssize_t queues_read(struct file *file, char __user *user_buf, 570 size_t count, loff_t *ppos) 571 { 572 struct ieee80211_local *local = file->private_data; 573 unsigned long flags; 574 char buf[IEEE80211_MAX_QUEUES * 20]; 575 int q, res = 0; 576 577 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); 578 for (q = 0; q < local->hw.queues; q++) 579 res += sprintf(buf + res, "%02d: %#.8lx/%d\n", q, 580 local->queue_stop_reasons[q], 581 skb_queue_len(&local->pending[q])); 582 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); 583 584 return simple_read_from_buffer(user_buf, count, ppos, buf, res); 585 } 586 587 DEBUGFS_READONLY_FILE_OPS(queues); 588 DEBUGFS_READONLY_FILE_OPS(misc); 589 590 /* statistics stuff */ 591 592 static ssize_t format_devstat_counter(struct ieee80211_local *local, 593 char __user *userbuf, 594 size_t count, loff_t *ppos, 595 int (*printvalue)(struct ieee80211_low_level_stats *stats, char *buf, 596 int buflen)) 597 { 598 struct ieee80211_low_level_stats stats; 599 char buf[20]; 600 int res; 601 602 wiphy_lock(local->hw.wiphy); 603 res = drv_get_stats(local, &stats); 604 wiphy_unlock(local->hw.wiphy); 605 if (res) 606 return res; 607 res = printvalue(&stats, buf, sizeof(buf)); 608 return simple_read_from_buffer(userbuf, count, ppos, buf, res); 609 } 610 611 #define DEBUGFS_DEVSTATS_FILE(name) \ 612 static int print_devstats_##name(struct ieee80211_low_level_stats *stats,\ 613 char *buf, int buflen) \ 614 { \ 615 return scnprintf(buf, buflen, "%u\n", stats->name); \ 616 } \ 617 static ssize_t stats_ ##name## _read(struct file *file, \ 618 char __user *userbuf, \ 619 size_t count, loff_t *ppos) \ 620 { \ 621 return format_devstat_counter(file->private_data, \ 622 userbuf, \ 623 count, \ 624 ppos, \ 625 print_devstats_##name); \ 626 } \ 627 \ 628 static const struct debugfs_short_fops stats_ ##name## _ops = { \ 629 .read = stats_ ##name## _read, \ 630 .llseek = generic_file_llseek, \ 631 }; 632 633 #ifdef CONFIG_MAC80211_DEBUG_COUNTERS 634 #define DEBUGFS_STATS_ADD(name) \ 635 debugfs_create_u32(#name, 0400, statsd, &local->name); 636 #endif 637 #define DEBUGFS_DEVSTATS_ADD(name) \ 638 debugfs_create_file(#name, 0400, statsd, local, &stats_ ##name## _ops); 639 640 DEBUGFS_DEVSTATS_FILE(dot11ACKFailureCount); 641 DEBUGFS_DEVSTATS_FILE(dot11RTSFailureCount); 642 DEBUGFS_DEVSTATS_FILE(dot11FCSErrorCount); 643 DEBUGFS_DEVSTATS_FILE(dot11RTSSuccessCount); 644 645 void debugfs_hw_add(struct ieee80211_local *local) 646 { 647 struct dentry *phyd = local->hw.wiphy->debugfsdir; 648 struct dentry *statsd; 649 650 if (!phyd) 651 return; 652 653 local->debugfs.keys = debugfs_create_dir("keys", phyd); 654 655 DEBUGFS_ADD(total_ps_buffered); 656 DEBUGFS_ADD(wep_iv); 657 DEBUGFS_ADD(rate_ctrl_alg); 658 DEBUGFS_ADD(queues); 659 DEBUGFS_ADD(misc); 660 #ifdef CONFIG_PM 661 DEBUGFS_ADD_MODE(reset, 0200); 662 #endif 663 DEBUGFS_ADD_MODE(hwflags, 0600); 664 DEBUGFS_ADD(user_power); 665 DEBUGFS_ADD(power); 666 DEBUGFS_ADD(hw_conf); 667 DEBUGFS_ADD_MODE(force_tx_status, 0600); 668 DEBUGFS_ADD_MODE(aql_enable, 0600); 669 DEBUGFS_ADD(aql_pending); 670 DEBUGFS_ADD_MODE(aqm, 0600); 671 672 DEBUGFS_ADD_MODE(airtime_flags, 0600); 673 674 DEBUGFS_ADD(aql_txq_limit); 675 debugfs_create_u32("aql_threshold", 0600, 676 phyd, &local->aql_threshold); 677 678 statsd = debugfs_create_dir("statistics", phyd); 679 680 #ifdef CONFIG_MAC80211_DEBUG_COUNTERS 681 DEBUGFS_STATS_ADD(dot11TransmittedFragmentCount); 682 DEBUGFS_STATS_ADD(dot11MulticastTransmittedFrameCount); 683 DEBUGFS_STATS_ADD(dot11FailedCount); 684 DEBUGFS_STATS_ADD(dot11RetryCount); 685 DEBUGFS_STATS_ADD(dot11MultipleRetryCount); 686 DEBUGFS_STATS_ADD(dot11FrameDuplicateCount); 687 DEBUGFS_STATS_ADD(dot11ReceivedFragmentCount); 688 DEBUGFS_STATS_ADD(dot11MulticastReceivedFrameCount); 689 DEBUGFS_STATS_ADD(dot11TransmittedFrameCount); 690 DEBUGFS_STATS_ADD(tx_handlers_queued); 691 DEBUGFS_STATS_ADD(tx_handlers_drop_wep); 692 DEBUGFS_STATS_ADD(tx_handlers_drop_not_assoc); 693 DEBUGFS_STATS_ADD(tx_handlers_drop_unauth_port); 694 DEBUGFS_STATS_ADD(rx_handlers_drop); 695 DEBUGFS_STATS_ADD(rx_handlers_queued); 696 DEBUGFS_STATS_ADD(rx_handlers_drop_nullfunc); 697 DEBUGFS_STATS_ADD(rx_handlers_drop_defrag); 698 DEBUGFS_STATS_ADD(tx_expand_skb_head); 699 DEBUGFS_STATS_ADD(tx_expand_skb_head_cloned); 700 DEBUGFS_STATS_ADD(rx_expand_skb_head_defrag); 701 DEBUGFS_STATS_ADD(rx_handlers_fragments); 702 DEBUGFS_STATS_ADD(tx_status_drop); 703 #endif 704 DEBUGFS_DEVSTATS_ADD(dot11ACKFailureCount); 705 DEBUGFS_DEVSTATS_ADD(dot11RTSFailureCount); 706 DEBUGFS_DEVSTATS_ADD(dot11FCSErrorCount); 707 DEBUGFS_DEVSTATS_ADD(dot11RTSSuccessCount); 708 } 709