Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
debug.c File Reference
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/seq_file.h>
#include <linux/vmalloc.h>
#include "carl9170.h"
#include "cmd.h"

Go to the source code of this file.

Data Structures

struct  carl9170_debugfs_fops
 

Macros

#define ADD(buf, off, max, fmt, args...)   off += snprintf(&buf[off], max - off, fmt, ##args);
 
#define __DEBUGFS_DECLARE_FILE(name, _read, _write, _read_bufsize, _attr, _dstate)
 
#define DEBUGFS_DECLARE_FILE(name, _read, _write, _read_bufsize, _attr)
 
#define DEBUGFS_DECLARE_RO_FILE(name, _read_bufsize)
 
#define DEBUGFS_DECLARE_WO_FILE(name)
 
#define DEBUGFS_DECLARE_RW_FILE(name, _read_bufsize)
 
#define __DEBUGFS_DECLARE_RW_FILE(name, _read_bufsize, _dstate)
 
#define DEBUGFS_READONLY_FILE(name, _read_bufsize, fmt, value...)
 
#define BM_STR_OFF(offset)
 
#define DEBUGFS_QUEUE_DUMP(q, qi)
 
#define UPDATE_COUNTER(ar, name)
 
#define TALLY_SUM_UP(ar, name)
 
#define DEBUGFS_HW_TALLY_FILE(name, f)
 
#define DEBUGFS_HW_REG_FILE(name, f)
 
#define DEBUGFS_ADD(name)
 

Functions

 DEBUGFS_DECLARE_RO_FILE (mem_usage, 512)
 
 DEBUGFS_DECLARE_RO_FILE (qos_stat, 512)
 
 DEBUGFS_DECLARE_RO_FILE (ampdu_state, 8000)
 
 DEBUGFS_DECLARE_RO_FILE (sta_psm, 160)
 
 DEBUGFS_DECLARE_RO_FILE (tx_stuck, 180)
 
 DEBUGFS_DECLARE_RO_FILE (phy_noise, 180)
 
 DEBUGFS_DECLARE_RO_FILE (vif_dump, 8000)
 
 DEBUGFS_DECLARE_RW_FILE (hw_ioread32, CARL9170_DEBUG_RING_SIZE *40)
 
 __DEBUGFS_DECLARE_RW_FILE (bug, 400, CARL9170_STOPPED)
 
 DEBUGFS_DECLARE_RW_FILE (erp, 80)
 
 DEBUGFS_DECLARE_WO_FILE (hw_iowrite32)
 
 DEBUGFS_HW_TALLY_FILE (hw_tx_tally,"u")
 
 DEBUGFS_HW_TALLY_FILE (hw_rx_tally,"u")
 
 DEBUGFS_HW_TALLY_FILE (hw_phy_errors,"u")
 
 DEBUGFS_HW_REG_FILE (hw_wlan_queue,".8x")
 
 DEBUGFS_HW_REG_FILE (hw_pta_queue,".8x")
 
 DEBUGFS_HW_REG_FILE (hw_ampdu_info,".8x")
 
 DEBUGFS_QUEUE_DUMP (tx_status, 0)
 
 DEBUGFS_QUEUE_DUMP (tx_status, 1)
 
 DEBUGFS_QUEUE_DUMP (tx_status, 2)
 
 DEBUGFS_QUEUE_DUMP (tx_status, 3)
 
 DEBUGFS_QUEUE_DUMP (tx_pending, 0)
 
 DEBUGFS_QUEUE_DUMP (tx_pending, 1)
 
 DEBUGFS_QUEUE_DUMP (tx_pending, 2)
 
 DEBUGFS_QUEUE_DUMP (tx_pending, 3)
 
 DEBUGFS_READONLY_FILE (usb_tx_anch_urbs, 20,"%d", atomic_read(&ar->tx_anch_urbs))
 
 DEBUGFS_READONLY_FILE (usb_rx_anch_urbs, 20,"%d", atomic_read(&ar->rx_anch_urbs))
 
 DEBUGFS_READONLY_FILE (usb_rx_work_urbs, 20,"%d", atomic_read(&ar->rx_work_urbs))
 
 DEBUGFS_READONLY_FILE (usb_rx_pool_urbs, 20,"%d", atomic_read(&ar->rx_pool_urbs))
 
 DEBUGFS_READONLY_FILE (tx_total_queued, 20,"%d", atomic_read(&ar->tx_total_queued))
 
 DEBUGFS_READONLY_FILE (tx_ampdu_scheduler, 20,"%d", atomic_read(&ar->tx_ampdu_scheduler))
 
 DEBUGFS_READONLY_FILE (tx_total_pending, 20,"%d", atomic_read(&ar->tx_total_pending))
 
 DEBUGFS_READONLY_FILE (tx_ampdu_list_len, 20,"%d", ar->tx_ampdu_list_len)
 
 DEBUGFS_READONLY_FILE (tx_ampdu_upload, 20,"%d", atomic_read(&ar->tx_ampdu_upload))
 
 DEBUGFS_READONLY_FILE (tx_janitor_last_run, 64,"last run:%d ms ago", jiffies_to_msecs(jiffies-ar->tx_janitor_last_run))
 
 DEBUGFS_READONLY_FILE (tx_dropped, 20,"%d", ar->tx_dropped)
 
 DEBUGFS_READONLY_FILE (rx_dropped, 20,"%d", ar->rx_dropped)
 
 DEBUGFS_READONLY_FILE (sniffer_enabled, 20,"%d", ar->sniffer_enabled)
 
 DEBUGFS_READONLY_FILE (rx_software_decryption, 20,"%d", ar->rx_software_decryption)
 
 DEBUGFS_READONLY_FILE (ampdu_factor, 20,"%d", ar->current_factor)
 
 DEBUGFS_READONLY_FILE (ampdu_density, 20,"%d", ar->current_density)
 
 DEBUGFS_READONLY_FILE (beacon_int, 20,"%d TU", ar->global_beacon_int)
 
 DEBUGFS_READONLY_FILE (pretbtt, 20,"%d TU", ar->global_pretbtt)
 
void carl9170_debugfs_register (struct ar9170 *ar)
 
void carl9170_debugfs_unregister (struct ar9170 *ar)
 

Macro Definition Documentation

#define __DEBUGFS_DECLARE_FILE (   name,
  _read,
  _write,
  _read_bufsize,
  _attr,
  _dstate 
)
Value:
static const struct carl9170_debugfs_fops carl_debugfs_##name ##_ops = {\
.read_bufsize = _read_bufsize, \
.read = _read, \
.write = _write, \
.attr = _attr, \
.req_dev_state = _dstate, \
.fops = { \
.open = simple_open, \
.read = carl9170_debugfs_read, \
.write = carl9170_debugfs_write, \
.owner = THIS_MODULE \
}, \
}

Definition at line 167 of file debug.c.

#define __DEBUGFS_DECLARE_RW_FILE (   name,
  _read_bufsize,
  _dstate 
)
Value:
__DEBUGFS_DECLARE_FILE(name, carl9170_debugfs_##name ##_read, \
carl9170_debugfs_##name ##_write, \
_read_bufsize, S_IRUSR | S_IWUSR, _dstate)

Definition at line 200 of file debug.c.

#define ADD (   buf,
  off,
  max,
  fmt,
  args... 
)    off += snprintf(&buf[off], max - off, fmt, ##args);

Definition at line 48 of file debug.c.

#define BM_STR_OFF (   offset)
Value:
((CARL9170_BAW_BITS - (offset) - 1) / 4 + \
(CARL9170_BAW_BITS - (offset) - 1) / 32 + 1)
#define DEBUGFS_ADD (   name)
Value:
debugfs_create_file(#name, carl_debugfs_##name ##_ops.attr, \
ar->debug_dir, ar, \
&carl_debugfs_##name ## _ops.fops);
#define DEBUGFS_DECLARE_FILE (   name,
  _read,
  _write,
  _read_bufsize,
  _attr 
)
Value:
__DEBUGFS_DECLARE_FILE(name, _read, _write, _read_bufsize, \
_attr, CARL9170_STARTED) \

Definition at line 183 of file debug.c.

#define DEBUGFS_DECLARE_RO_FILE (   name,
  _read_bufsize 
)
Value:
DEBUGFS_DECLARE_FILE(name, carl9170_debugfs_##name ##_read, \
NULL, _read_bufsize, S_IRUSR)

Definition at line 187 of file debug.c.

#define DEBUGFS_DECLARE_RW_FILE (   name,
  _read_bufsize 
)
Value:
DEBUGFS_DECLARE_FILE(name, carl9170_debugfs_##name ##_read, \
carl9170_debugfs_##name ##_write, \
_read_bufsize, S_IRUSR | S_IWUSR)

Definition at line 195 of file debug.c.

#define DEBUGFS_DECLARE_WO_FILE (   name)
Value:
DEBUGFS_DECLARE_FILE(name, NULL, carl9170_debugfs_##name ##_write,\
0, S_IWUSR)

Definition at line 191 of file debug.c.

#define DEBUGFS_HW_REG_FILE (   name,
  f 
)
Value:
static char *carl9170_debugfs_##name ## _read(struct ar9170 *ar, \
char *dum, size_t bufsize, ssize_t *ret) \
{ \
char *buf; \
int i, max_len, err; \
\
max_len = ARRAY_SIZE(name##_regs) * 80; \
buf = vmalloc(max_len); \
if (!buf) \
return NULL; \
\
err = UPDATE_COUNTER(ar, name); \
if (err) { \
*ret = err; \
return buf; \
} \
for (i = 0; i < ARRAY_SIZE(name##_regs); i++) { \
ADD(buf, *ret, max_len, "%22s = %" f "\n", \
name##_regs[i].nreg, \
ar->debug.stats.name##_counter[i]); \
} \
\
return buf; \
} \
DEBUGFS_DECLARE_RO_FILE(name, 0);

Definition at line 527 of file debug.c.

#define DEBUGFS_HW_TALLY_FILE (   name,
  f 
)
Value:
static char *carl9170_debugfs_##name ## _read(struct ar9170 *ar, \
char *dum, size_t bufsize, ssize_t *ret) \
{ \
char *buf; \
int i, max_len, err; \
\
max_len = ARRAY_SIZE(name##_regs) * 80; \
buf = vmalloc(max_len); \
if (!buf) \
return NULL; \
\
err = UPDATE_COUNTER(ar, name); \
if (err) { \
*ret = err; \
return buf; \
} \
for (i = 0; i < ARRAY_SIZE(name##_regs); i++) { \
ADD(buf, *ret, max_len, "%22s = %" f "[+%" f "]\n", \
name##_regs[i].nreg, ar->debug.stats.name ##_sum[i],\
ar->debug.stats.name ##_counter[i]); \
} \
\
return buf; \
} \
DEBUGFS_DECLARE_RO_FILE(name, 0);

Definition at line 497 of file debug.c.

#define DEBUGFS_QUEUE_DUMP (   q,
  qi 
)
Value:
static char *carl9170_debugfs_##q ##_##qi ##_read(struct ar9170 *ar, \
char *buf, size_t bufsize, ssize_t *len) \
{ \
carl9170_debugfs_queue_dump(ar, buf, len, bufsize, &ar->q[qi]); \
return buf; \
} \
DEBUGFS_DECLARE_RO_FILE(q##_##qi, 8000);

Definition at line 380 of file debug.c.

#define DEBUGFS_READONLY_FILE (   name,
  _read_bufsize,
  fmt,
  value... 
)
Value:
static char *carl9170_debugfs_ ##name ## _read(struct ar9170 *ar, \
char *buf, size_t buf_size,\
ssize_t *len) \
{ \
ADD(buf, *len, buf_size, fmt "\n", ##value); \
return buf; \
} \
DEBUGFS_DECLARE_RO_FILE(name, _read_bufsize)

Definition at line 205 of file debug.c.

#define TALLY_SUM_UP (   ar,
  name 
)
Value:
do { \
unsigned int __i; \
for (__i = 0; __i < ARRAY_SIZE(name##_regs); __i++) { \
ar->debug.stats.name##_sum[__i] += \
ar->debug.stats.name##_counter[__i]; \
} \
} while (0)

Definition at line 488 of file debug.c.

#define UPDATE_COUNTER (   ar,
  name 
)
Value:
({ \
u32 __tmp[ARRAY_SIZE(name##_regs)]; \
unsigned int __i, __err = -ENODEV; \
for (__i = 0; __i < ARRAY_SIZE(name##_regs); __i++) { \
__tmp[__i] = name##_regs[__i].reg; \
ar->debug.stats.name##_counter[__i] = 0; \
} \
__err = carl9170_read_mreg(ar, ARRAY_SIZE(name##_regs), \
__tmp, ar->debug.stats.name##_counter); \
(__err); })

Definition at line 474 of file debug.c.

Function Documentation

__DEBUGFS_DECLARE_RW_FILE ( bug  ,
400  ,
CARL9170_STOPPED   
)
void carl9170_debugfs_register ( struct ar9170 ar)

Definition at line 824 of file debug.c.

void carl9170_debugfs_unregister ( struct ar9170 ar)

Definition at line 894 of file debug.c.

DEBUGFS_DECLARE_RO_FILE ( mem_usage  ,
512   
)
DEBUGFS_DECLARE_RO_FILE ( qos_stat  ,
512   
)
DEBUGFS_DECLARE_RO_FILE ( ampdu_state  ,
8000   
)
DEBUGFS_DECLARE_RO_FILE ( sta_psm  ,
160   
)
DEBUGFS_DECLARE_RO_FILE ( tx_stuck  ,
180   
)
DEBUGFS_DECLARE_RO_FILE ( phy_noise  ,
180   
)
DEBUGFS_DECLARE_RO_FILE ( vif_dump  ,
8000   
)
DEBUGFS_DECLARE_RW_FILE ( hw_ioread32  ,
CARL9170_DEBUG_RING_SIZE 40 
)
DEBUGFS_DECLARE_RW_FILE ( erp  ,
80   
)
DEBUGFS_DECLARE_WO_FILE ( hw_iowrite32  )
DEBUGFS_HW_REG_FILE ( hw_wlan_queue  ,
".8x"   
)
DEBUGFS_HW_REG_FILE ( hw_pta_queue  ,
".8x"   
)
DEBUGFS_HW_REG_FILE ( hw_ampdu_info  ,
".8x"   
)
DEBUGFS_HW_TALLY_FILE ( hw_tx_tally  ,
"u"   
)
DEBUGFS_HW_TALLY_FILE ( hw_rx_tally  ,
"u"   
)
DEBUGFS_HW_TALLY_FILE ( hw_phy_errors  ,
"u"   
)
DEBUGFS_QUEUE_DUMP ( tx_status  ,
 
)
DEBUGFS_QUEUE_DUMP ( tx_status  ,
 
)
DEBUGFS_QUEUE_DUMP ( tx_status  ,
 
)
DEBUGFS_QUEUE_DUMP ( tx_status  ,
 
)
DEBUGFS_QUEUE_DUMP ( tx_pending  ,
 
)
DEBUGFS_QUEUE_DUMP ( tx_pending  ,
 
)
DEBUGFS_QUEUE_DUMP ( tx_pending  ,
 
)
DEBUGFS_QUEUE_DUMP ( tx_pending  ,
 
)
DEBUGFS_READONLY_FILE ( usb_tx_anch_urbs  ,
20  ,
"%d"  ,
atomic_read &->  tx_anch_urbs 
)
DEBUGFS_READONLY_FILE ( usb_rx_anch_urbs  ,
20  ,
"%d"  ,
atomic_read &->  rx_anch_urbs 
)
DEBUGFS_READONLY_FILE ( usb_rx_work_urbs  ,
20  ,
"%d"  ,
atomic_read &->  rx_work_urbs 
)
DEBUGFS_READONLY_FILE ( usb_rx_pool_urbs  ,
20  ,
"%d"  ,
atomic_read &->  rx_pool_urbs 
)
DEBUGFS_READONLY_FILE ( tx_total_queued  ,
20  ,
"%d"  ,
atomic_read &->  tx_total_queued 
)
DEBUGFS_READONLY_FILE ( tx_ampdu_scheduler  ,
20  ,
"%d"  ,
atomic_read &->  tx_ampdu_scheduler 
)
DEBUGFS_READONLY_FILE ( tx_total_pending  ,
20  ,
"%d"  ,
atomic_read &->  tx_total_pending 
)
DEBUGFS_READONLY_FILE ( tx_ampdu_list_len  ,
20  ,
"%d"  ,
ar->  tx_ampdu_list_len 
)
DEBUGFS_READONLY_FILE ( tx_ampdu_upload  ,
20  ,
"%d"  ,
atomic_read &->  tx_ampdu_upload 
)
DEBUGFS_READONLY_FILE ( tx_janitor_last_run  ,
64  ,
"last run:%d ms ago"  ,
jiffies_to_msecs(jiffies-ar->tx_janitor_last_run)   
)
DEBUGFS_READONLY_FILE ( tx_dropped  ,
20  ,
"%d"  ,
ar->  tx_dropped 
)
DEBUGFS_READONLY_FILE ( rx_dropped  ,
20  ,
"%d"  ,
ar->  rx_dropped 
)
DEBUGFS_READONLY_FILE ( sniffer_enabled  ,
20  ,
"%d"  ,
ar->  sniffer_enabled 
)
DEBUGFS_READONLY_FILE ( rx_software_decryption  ,
20  ,
"%d"  ,
ar->  rx_software_decryption 
)
DEBUGFS_READONLY_FILE ( ampdu_factor  ,
20  ,
"%d"  ,
ar->  current_factor 
)
DEBUGFS_READONLY_FILE ( ampdu_density  ,
20  ,
"%d"  ,
ar->  current_density 
)
DEBUGFS_READONLY_FILE ( beacon_int  ,
20  ,
"%d TU"  ,
ar->  global_beacon_int 
)
DEBUGFS_READONLY_FILE ( pretbtt  ,
20  ,
"%d TU"  ,
ar->  global_pretbtt 
)