Lines Matching +full:3 +full:- +full:d

25  *    Copyright (c) 2008-2009 Atheros Communications, Inc.
48 off += scnprintf(&buf[off], max - off, fmt, ##args)
74 ar = file->private_data; in carl9170_debugfs_read()
77 return -ENODEV; in carl9170_debugfs_read()
81 if (!dfops->read) in carl9170_debugfs_read()
82 return -ENOSYS; in carl9170_debugfs_read()
84 if (dfops->read_bufsize) { in carl9170_debugfs_read()
85 buf = vmalloc(dfops->read_bufsize); in carl9170_debugfs_read()
87 return -ENOMEM; in carl9170_debugfs_read()
90 mutex_lock(&ar->mutex); in carl9170_debugfs_read()
91 if (!CHK_DEV_STATE(ar, dfops->req_dev_state)) { in carl9170_debugfs_read()
92 err = -ENODEV; in carl9170_debugfs_read()
97 res_buf = dfops->read(ar, buf, dfops->read_bufsize, &ret); in carl9170_debugfs_read()
105 WARN_ON_ONCE(dfops->read_bufsize && (res_buf != buf)); in carl9170_debugfs_read()
109 mutex_unlock(&ar->mutex); in carl9170_debugfs_read()
125 return -E2BIG; in carl9170_debugfs_write()
127 ar = file->private_data; in carl9170_debugfs_write()
130 return -ENODEV; in carl9170_debugfs_write()
134 if (!dfops->write) in carl9170_debugfs_write()
135 return -ENOSYS; in carl9170_debugfs_write()
139 return -ENOMEM; in carl9170_debugfs_write()
142 err = -EFAULT; in carl9170_debugfs_write()
146 if (mutex_trylock(&ar->mutex) == 0) { in carl9170_debugfs_write()
147 err = -EAGAIN; in carl9170_debugfs_write()
151 if (!CHK_DEV_STATE(ar, dfops->req_dev_state)) { in carl9170_debugfs_write()
152 err = -ENODEV; in carl9170_debugfs_write()
156 err = dfops->write(ar, buf, count); in carl9170_debugfs_write()
161 mutex_unlock(&ar->mutex); in carl9170_debugfs_write()
219 spin_lock_bh(&ar->mem_lock); in carl9170_debugfs_mem_usage_read()
222 ar->fw.mem_blocks, ar->mem_bitmap); in carl9170_debugfs_mem_usage_read()
224 ADD(buf, *len, bufsize, "cookies: used:%3d / total:%3d, allocs:%d\n", in carl9170_debugfs_mem_usage_read()
225 bitmap_weight(ar->mem_bitmap, ar->fw.mem_blocks), in carl9170_debugfs_mem_usage_read()
226 ar->fw.mem_blocks, atomic_read(&ar->mem_allocs)); in carl9170_debugfs_mem_usage_read()
228 ADD(buf, *len, bufsize, "memory: free:%3d (%3d KiB) / total:%3d KiB)\n", in carl9170_debugfs_mem_usage_read()
229 atomic_read(&ar->mem_free_blocks), in carl9170_debugfs_mem_usage_read()
230 (atomic_read(&ar->mem_free_blocks) * ar->fw.mem_block_size) / 1024, in carl9170_debugfs_mem_usage_read()
231 (ar->fw.mem_blocks * ar->fw.mem_block_size) / 1024); in carl9170_debugfs_mem_usage_read()
233 spin_unlock_bh(&ar->mem_lock); in carl9170_debugfs_mem_usage_read()
248 spin_lock_bh(&ar->tx_stats_lock); in carl9170_debugfs_qos_stat_read()
251 "[ %3d/%3d %3d/%3d " in carl9170_debugfs_qos_stat_read()
252 " %3d/%3d %3d/%3d ]\n\n", in carl9170_debugfs_qos_stat_read()
253 ar->tx_stats[0].len, ar->tx_stats[0].limit, in carl9170_debugfs_qos_stat_read()
254 ar->tx_stats[1].len, ar->tx_stats[1].limit, in carl9170_debugfs_qos_stat_read()
255 ar->tx_stats[2].len, ar->tx_stats[2].limit, in carl9170_debugfs_qos_stat_read()
256 ar->tx_stats[3].len, ar->tx_stats[3].limit); in carl9170_debugfs_qos_stat_read()
260 "[%10d %10d %10d %10d ]\n\n", in carl9170_debugfs_qos_stat_read()
261 ar->tx_stats[0].count, ar->tx_stats[1].count, in carl9170_debugfs_qos_stat_read()
262 ar->tx_stats[2].count, ar->tx_stats[3].count); in carl9170_debugfs_qos_stat_read()
264 spin_unlock_bh(&ar->tx_stats_lock); in carl9170_debugfs_qos_stat_read()
268 "[ %3d/%3d %3d/%3d " in carl9170_debugfs_qos_stat_read()
269 " %3d/%3d %3d/%3d ]\n\n", in carl9170_debugfs_qos_stat_read()
270 skb_queue_len(&ar->tx_pending[0]), in carl9170_debugfs_qos_stat_read()
271 skb_queue_len(&ar->tx_status[0]), in carl9170_debugfs_qos_stat_read()
272 skb_queue_len(&ar->tx_pending[1]), in carl9170_debugfs_qos_stat_read()
273 skb_queue_len(&ar->tx_status[1]), in carl9170_debugfs_qos_stat_read()
274 skb_queue_len(&ar->tx_pending[2]), in carl9170_debugfs_qos_stat_read()
275 skb_queue_len(&ar->tx_status[2]), in carl9170_debugfs_qos_stat_read()
276 skb_queue_len(&ar->tx_pending[3]), in carl9170_debugfs_qos_stat_read()
277 skb_queue_len(&ar->tx_status[3])); in carl9170_debugfs_qos_stat_read()
287 struct _carl9170_tx_superframe *txc = (void *) skb->data; in carl9170_debugfs_format_frame()
289 struct carl9170_tx_info *arinfo = (void *) txinfo->rate_driver_data; in carl9170_debugfs_format_frame()
290 struct ieee80211_hdr *hdr = (void *) txc->frame_data; in carl9170_debugfs_format_frame()
292 ADD(buf, *off, bufsize, "%s %p, c:%2x, DA:%pM, sq:%4d, mc:%.4x, " in carl9170_debugfs_format_frame()
293 "pc:%.8x, to:%d ms\n", prefix, skb, txc->s.cookie, in carl9170_debugfs_format_frame()
295 le16_to_cpu(txc->f.mac_control), le32_to_cpu(txc->f.phy_control), in carl9170_debugfs_format_frame()
296 jiffies_to_msecs(jiffies - arinfo->timeout)); in carl9170_debugfs_format_frame()
309 list_for_each_entry_rcu(iter, &ar->tx_ampdu_list, list) { in carl9170_debugfs_ampdu_state_read()
311 spin_lock_bh(&iter->lock); in carl9170_debugfs_ampdu_state_read()
312 ADD(buf, *len, bufsize, "Entry: #%2d TID:%1d, BSN:%4d, " in carl9170_debugfs_ampdu_state_read()
313 "SNX:%4d, HSN:%4d, BAW:%2d, state:%1d, toggles:%d\n", in carl9170_debugfs_ampdu_state_read()
314 cnt, iter->tid, iter->bsn, iter->snx, iter->hsn, in carl9170_debugfs_ampdu_state_read()
315 iter->max, iter->state, iter->counter); in carl9170_debugfs_ampdu_state_read()
318 CARL9170_BAW_BITS, iter->bitmap); in carl9170_debugfs_ampdu_state_read()
321 ((CARL9170_BAW_BITS - (offset) - 1) / 4 + \ in carl9170_debugfs_ampdu_state_read()
322 (CARL9170_BAW_BITS - (offset) - 1) / 32 + 1) in carl9170_debugfs_ampdu_state_read()
327 offset = BM_STR_OFF(SEQ_DIFF(iter->snx, iter->bsn)); in carl9170_debugfs_ampdu_state_read()
330 offset = BM_STR_OFF(((int)iter->hsn - (int)iter->bsn) % in carl9170_debugfs_ampdu_state_read()
334 ADD(buf, *len, bufsize, "\tPre-Aggregation reorder buffer: " in carl9170_debugfs_ampdu_state_read()
335 " currently queued:%d\n", skb_queue_len(&iter->queue)); in carl9170_debugfs_ampdu_state_read()
338 skb_queue_walk(&iter->queue, skb) { in carl9170_debugfs_ampdu_state_read()
341 snprintf(prefix, sizeof(prefix), "\t\t%3d :", fc); in carl9170_debugfs_ampdu_state_read()
347 spin_unlock_bh(&iter->lock); in carl9170_debugfs_ampdu_state_read()
363 spin_lock_bh(&queue->lock); in carl9170_debugfs_queue_dump()
365 snprintf(prefix, sizeof(prefix), "%3d :", fc); in carl9170_debugfs_queue_dump()
370 spin_unlock_bh(&queue->lock); in carl9170_debugfs_queue_dump()
377 carl9170_debugfs_queue_dump(ar, buf, len, bufsize, &ar->q[qi]); \
385 ADD(buf, *len, bufsize, "psm state: %s\n", (ar->ps.off_override ? in carl9170_debugfs_sta_psm_read()
386 "FORCE CAM" : (ar->ps.state ? "PSM" : "CAM"))); in carl9170_debugfs_sta_psm_read()
388 ADD(buf, *len, bufsize, "sleep duration: %d ms.\n", ar->ps.sleep_ms); in carl9170_debugfs_sta_psm_read()
389 ADD(buf, *len, bufsize, "last power-state transition: %d ms ago.\n", in carl9170_debugfs_sta_psm_read()
390 jiffies_to_msecs(jiffies - ar->ps.last_action)); in carl9170_debugfs_sta_psm_read()
391 ADD(buf, *len, bufsize, "last CAM->PSM transition: %d ms ago.\n", in carl9170_debugfs_sta_psm_read()
392 jiffies_to_msecs(jiffies - ar->ps.last_slept)); in carl9170_debugfs_sta_psm_read()
403 for (i = 0; i < ar->hw->queues; i++) { in carl9170_debugfs_tx_stuck_read()
404 ADD(buf, *len, bufsize, "TX queue [%d]: %10d max:%10d ms.\n", in carl9170_debugfs_tx_stuck_read()
405 i, ieee80211_queue_stopped(ar->hw, i) ? in carl9170_debugfs_tx_stuck_read()
406 jiffies_to_msecs(jiffies - ar->queue_stop_timeout[i]) : 0, in carl9170_debugfs_tx_stuck_read()
407 jiffies_to_msecs(ar->max_queue_stop_timeout[i])); in carl9170_debugfs_tx_stuck_read()
409 ar->max_queue_stop_timeout[i] = 0; in carl9170_debugfs_tx_stuck_read()
427 ADD(buf, *len, bufsize, "Chain 0: %10d dBm, ext. chan.:%10d dBm\n", in carl9170_debugfs_phy_noise_read()
428 ar->noise[0], ar->noise[2]); in carl9170_debugfs_phy_noise_read()
429 ADD(buf, *len, bufsize, "Chain 2: %10d dBm, ext. chan.:%10d dBm\n", in carl9170_debugfs_phy_noise_read()
430 ar->noise[1], ar->noise[3]); in carl9170_debugfs_phy_noise_read()
442 ADD(buf, *len, bufsize, "registered VIFs:%d \\ %d\n", in carl9170_debugfs_vif_dump_read()
443 ar->vifs, ar->fw.vif_num); in carl9170_debugfs_vif_dump_read()
446 ar->fw.vif_num, &ar->vif_bitmap); in carl9170_debugfs_vif_dump_read()
449 list_for_each_entry_rcu(iter, &ar->vif_list, list) { in carl9170_debugfs_vif_dump_read()
451 ADD(buf, *len, bufsize, "\t%d = [%s VIF, id:%d, type:%x " in carl9170_debugfs_vif_dump_read()
453 "Master" : " Slave"), iter->id, vif->type, vif->addr, in carl9170_debugfs_vif_dump_read()
454 iter->enable_beacon ? "beaconing " : ""); in carl9170_debugfs_vif_dump_read()
465 unsigned int __i, __err = -ENODEV; \
469 ar->debug.stats.name##_counter[__i] = 0; \
474 __tmp, ar->debug.stats.name##_counter); \
481 ar->debug.stats.name##_sum[__i] += \
482 ar->debug.stats.name##_counter[__i]; \
508 name##_regs[i].nreg, ar->debug.stats.name ##_sum[i],\
509 ar->debug.stats.name ##_counter[i]); \
537 ar->debug.stats.name##_counter[i]); \
554 return -E2BIG; in carl9170_debugfs_hw_ioread32_write()
556 res = sscanf(buf, "0x%X %d", &reg, &n); in carl9170_debugfs_hw_ioread32_write()
558 err = -EINVAL; in carl9170_debugfs_hw_ioread32_write()
566 err = -EMSGSIZE; in carl9170_debugfs_hw_ioread32_write()
571 err = -EADDRNOTAVAIL; in carl9170_debugfs_hw_ioread32_write()
575 if (reg & 3) { in carl9170_debugfs_hw_ioread32_write()
576 err = -EINVAL; in carl9170_debugfs_hw_ioread32_write()
585 ar->debug.ring[ar->debug.ring_tail].reg = reg + (i << 2); in carl9170_debugfs_hw_ioread32_write()
586 ar->debug.ring[ar->debug.ring_tail].value = tmp; in carl9170_debugfs_hw_ioread32_write()
587 ar->debug.ring_tail++; in carl9170_debugfs_hw_ioread32_write()
588 ar->debug.ring_tail %= CARL9170_DEBUG_RING_SIZE; in carl9170_debugfs_hw_ioread32_write()
600 while (ar->debug.ring_head != ar->debug.ring_tail) { in carl9170_debugfs_hw_ioread32_read()
602 ar->debug.ring[ar->debug.ring_head].reg, in carl9170_debugfs_hw_ioread32_read()
603 ar->debug.ring[ar->debug.ring_head].value); in carl9170_debugfs_hw_ioread32_read()
605 ar->debug.ring_head++; in carl9170_debugfs_hw_ioread32_read()
606 ar->debug.ring_head %= CARL9170_DEBUG_RING_SIZE; in carl9170_debugfs_hw_ioread32_read()
611 ar->debug.ring_head = ar->debug.ring_tail; in carl9170_debugfs_hw_ioread32_read()
622 return -EINVAL; in carl9170_debugfs_bug_write()
626 ar->needs_full_reset = true; in carl9170_debugfs_bug_write()
631 err = -EAGAIN; in carl9170_debugfs_bug_write()
635 ar->needs_full_reset = false; in carl9170_debugfs_bug_write()
646 err = carl9170_set_channel(ar, ar->hw->conf.chandef.chan, in carl9170_debugfs_bug_write()
647 cfg80211_get_chandef_type(&ar->hw->conf.chandef)); in carl9170_debugfs_bug_write()
654 return -EINVAL; in carl9170_debugfs_bug_write()
668 ADD(buf, *ret, bufsize, "firmware restarts:%d, last reason:%d\n", in carl9170_debugfs_bug_read()
669 ar->restart_counter, ar->last_reason); in carl9170_debugfs_bug_read()
670 ADD(buf, *ret, bufsize, "phy reinit errors:%d (%d)\n", in carl9170_debugfs_bug_read()
671 ar->total_chan_fail, ar->chan_fail); in carl9170_debugfs_bug_read()
672 ADD(buf, *ret, bufsize, "reported firmware errors:%d\n", in carl9170_debugfs_bug_read()
673 ar->fw.err_counter); in carl9170_debugfs_bug_read()
674 ADD(buf, *ret, bufsize, "reported firmware BUGs:%d\n", in carl9170_debugfs_bug_read()
675 ar->fw.bug_counter); in carl9170_debugfs_bug_read()
676 ADD(buf, *ret, bufsize, "pending restart requests:%d\n", in carl9170_debugfs_bug_read()
677 atomic_read(&ar->pending_restarts)); in carl9170_debugfs_bug_read()
694 ADD(buf, *ret, bufsize, "ERP Setting: (%d) -> %s\n", ar->erp_mode, in carl9170_debugfs_erp_read()
695 erp_modes[ar->erp_mode]); in carl9170_debugfs_erp_read()
705 return -EINVAL; in carl9170_debugfs_erp_write()
707 res = sscanf(buf, "%d", &val); in carl9170_debugfs_erp_write()
709 return -EINVAL; in carl9170_debugfs_erp_write()
713 return -EINVAL; in carl9170_debugfs_erp_write()
715 ar->erp_mode = val; in carl9170_debugfs_erp_write()
731 return -E2BIG; in carl9170_debugfs_hw_iowrite32_write()
735 err = -EINVAL; in carl9170_debugfs_hw_iowrite32_write()
740 err = -EADDRNOTAVAIL; in carl9170_debugfs_hw_iowrite32_write()
744 if (reg & 3) { in carl9170_debugfs_hw_iowrite32_write()
745 err = -EINVAL; in carl9170_debugfs_hw_iowrite32_write()
767 DEBUGFS_QUEUE_DUMP(tx_status, 3);
771 DEBUGFS_QUEUE_DUMP(tx_pending, 3);
772 DEBUGFS_READONLY_FILE(usb_tx_anch_urbs, 20, "%d",
773 atomic_read(&ar->tx_anch_urbs));
774 DEBUGFS_READONLY_FILE(usb_rx_anch_urbs, 20, "%d",
775 atomic_read(&ar->rx_anch_urbs));
776 DEBUGFS_READONLY_FILE(usb_rx_work_urbs, 20, "%d",
777 atomic_read(&ar->rx_work_urbs));
778 DEBUGFS_READONLY_FILE(usb_rx_pool_urbs, 20, "%d",
779 atomic_read(&ar->rx_pool_urbs));
781 DEBUGFS_READONLY_FILE(tx_total_queued, 20, "%d",
782 atomic_read(&ar->tx_total_queued));
783 DEBUGFS_READONLY_FILE(tx_ampdu_scheduler, 20, "%d",
784 atomic_read(&ar->tx_ampdu_scheduler));
786 DEBUGFS_READONLY_FILE(tx_total_pending, 20, "%d",
787 atomic_read(&ar->tx_total_pending));
789 DEBUGFS_READONLY_FILE(tx_ampdu_list_len, 20, "%d",
790 ar->tx_ampdu_list_len);
792 DEBUGFS_READONLY_FILE(tx_ampdu_upload, 20, "%d",
793 atomic_read(&ar->tx_ampdu_upload));
795 DEBUGFS_READONLY_FILE(tx_janitor_last_run, 64, "last run:%d ms ago",
796 jiffies_to_msecs(jiffies - ar->tx_janitor_last_run));
798 DEBUGFS_READONLY_FILE(tx_dropped, 20, "%d", ar->tx_dropped);
800 DEBUGFS_READONLY_FILE(rx_dropped, 20, "%d", ar->rx_dropped);
802 DEBUGFS_READONLY_FILE(sniffer_enabled, 20, "%d", ar->sniffer_enabled);
803 DEBUGFS_READONLY_FILE(rx_software_decryption, 20, "%d",
804 ar->rx_software_decryption);
805 DEBUGFS_READONLY_FILE(ampdu_factor, 20, "%d",
806 ar->current_factor);
807 DEBUGFS_READONLY_FILE(ampdu_density, 20, "%d",
808 ar->current_density);
810 DEBUGFS_READONLY_FILE(beacon_int, 20, "%d TU", ar->global_beacon_int);
811 DEBUGFS_READONLY_FILE(pretbtt, 20, "%d TU", ar->global_pretbtt);
815 ar->debug_dir = debugfs_create_dir(KBUILD_MODNAME, in carl9170_debugfs_register()
816 ar->hw->wiphy->debugfsdir); in carl9170_debugfs_register()
820 ar->debug_dir, ar, \ in carl9170_debugfs_register()
885 debugfs_remove_recursive(ar->debug_dir); in carl9170_debugfs_unregister()