2011-02-22 02:27:26 +07:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* GPL LICENSE SUMMARY
|
|
|
|
*
|
|
|
|
* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of version 2 of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
|
|
|
|
* USA
|
|
|
|
*
|
|
|
|
* The full GNU General Public License is included in this distribution
|
|
|
|
* in the file called LICENSE.GPL.
|
|
|
|
*
|
|
|
|
* Contact Information:
|
|
|
|
* Intel Linux Wireless <ilw@linux.intel.com>
|
|
|
|
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
|
|
|
*****************************************************************************/
|
|
|
|
#include <linux/ieee80211.h>
|
|
|
|
#include <net/mac80211.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "iwl-dev.h"
|
|
|
|
#include "iwl-debug.h"
|
|
|
|
#include "iwl-core.h"
|
|
|
|
#include "iwl-io.h"
|
|
|
|
|
|
|
|
/* create and remove of files */
|
|
|
|
#define DEBUGFS_ADD_FILE(name, parent, mode) do { \
|
2011-10-24 21:49:25 +07:00
|
|
|
if (!debugfs_create_file(#name, mode, parent, il, \
|
2011-10-24 20:41:30 +07:00
|
|
|
&il_dbgfs_##name##_ops)) \
|
2011-02-22 02:27:26 +07:00
|
|
|
goto err; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define DEBUGFS_ADD_BOOL(name, parent, ptr) do { \
|
|
|
|
struct dentry *__tmp; \
|
|
|
|
__tmp = debugfs_create_bool(#name, S_IWUSR | S_IRUSR, \
|
|
|
|
parent, ptr); \
|
|
|
|
if (IS_ERR(__tmp) || !__tmp) \
|
|
|
|
goto err; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define DEBUGFS_ADD_X32(name, parent, ptr) do { \
|
|
|
|
struct dentry *__tmp; \
|
|
|
|
__tmp = debugfs_create_x32(#name, S_IWUSR | S_IRUSR, \
|
|
|
|
parent, ptr); \
|
|
|
|
if (IS_ERR(__tmp) || !__tmp) \
|
|
|
|
goto err; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
/* file operation */
|
|
|
|
#define DEBUGFS_READ_FUNC(name) \
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_##name##_read(struct file *file, \
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf, \
|
|
|
|
size_t count, loff_t *ppos);
|
|
|
|
|
|
|
|
#define DEBUGFS_WRITE_FUNC(name) \
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_##name##_write(struct file *file, \
|
2011-02-22 02:27:26 +07:00
|
|
|
const char __user *user_buf, \
|
|
|
|
size_t count, loff_t *ppos);
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2011-10-24 20:41:30 +07:00
|
|
|
il_dbgfs_open_file_generic(struct inode *inode, struct file *file)
|
2011-02-22 02:27:26 +07:00
|
|
|
{
|
|
|
|
file->private_data = inode->i_private;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define DEBUGFS_READ_FILE_OPS(name) \
|
|
|
|
DEBUGFS_READ_FUNC(name); \
|
2011-10-24 20:41:30 +07:00
|
|
|
static const struct file_operations il_dbgfs_##name##_ops = { \
|
|
|
|
.read = il_dbgfs_##name##_read, \
|
|
|
|
.open = il_dbgfs_open_file_generic, \
|
2011-02-22 02:27:26 +07:00
|
|
|
.llseek = generic_file_llseek, \
|
|
|
|
};
|
|
|
|
|
|
|
|
#define DEBUGFS_WRITE_FILE_OPS(name) \
|
|
|
|
DEBUGFS_WRITE_FUNC(name); \
|
2011-10-24 20:41:30 +07:00
|
|
|
static const struct file_operations il_dbgfs_##name##_ops = { \
|
|
|
|
.write = il_dbgfs_##name##_write, \
|
|
|
|
.open = il_dbgfs_open_file_generic, \
|
2011-02-22 02:27:26 +07:00
|
|
|
.llseek = generic_file_llseek, \
|
|
|
|
};
|
|
|
|
|
|
|
|
#define DEBUGFS_READ_WRITE_FILE_OPS(name) \
|
|
|
|
DEBUGFS_READ_FUNC(name); \
|
|
|
|
DEBUGFS_WRITE_FUNC(name); \
|
2011-10-24 20:41:30 +07:00
|
|
|
static const struct file_operations il_dbgfs_##name##_ops = { \
|
|
|
|
.write = il_dbgfs_##name##_write, \
|
|
|
|
.read = il_dbgfs_##name##_read, \
|
|
|
|
.open = il_dbgfs_open_file_generic, \
|
2011-02-22 02:27:26 +07:00
|
|
|
.llseek = generic_file_llseek, \
|
|
|
|
};
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_tx_statistics_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos) {
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
char *buf;
|
|
|
|
int pos = 0;
|
|
|
|
|
|
|
|
int cnt;
|
|
|
|
ssize_t ret;
|
|
|
|
const size_t bufsz = 100 +
|
|
|
|
sizeof(char) * 50 * (MANAGEMENT_MAX + CONTROL_MAX);
|
|
|
|
buf = kzalloc(bufsz, GFP_KERNEL);
|
|
|
|
if (!buf)
|
|
|
|
return -ENOMEM;
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "Management:\n");
|
|
|
|
for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) {
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"\t%25s\t\t: %u\n",
|
2011-10-24 20:41:30 +07:00
|
|
|
il_get_mgmt_string(cnt),
|
2011-10-24 21:49:25 +07:00
|
|
|
il->tx_stats.mgmt[cnt]);
|
2011-02-22 02:27:26 +07:00
|
|
|
}
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "Control\n");
|
|
|
|
for (cnt = 0; cnt < CONTROL_MAX; cnt++) {
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"\t%25s\t\t: %u\n",
|
2011-10-24 20:41:30 +07:00
|
|
|
il_get_ctrl_string(cnt),
|
2011-10-24 21:49:25 +07:00
|
|
|
il->tx_stats.ctrl[cnt]);
|
2011-02-22 02:27:26 +07:00
|
|
|
}
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "Data:\n");
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->tx_stats.data_cnt);
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->tx_stats.data_bytes);
|
2011-02-22 02:27:26 +07:00
|
|
|
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
kfree(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t
|
2011-10-24 20:41:30 +07:00
|
|
|
il_dbgfs_clear_traffic_statistics_write(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
const char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
u32 clear_flag;
|
|
|
|
char buf[8];
|
|
|
|
int buf_size;
|
|
|
|
|
|
|
|
memset(buf, 0, sizeof(buf));
|
|
|
|
buf_size = min(count, sizeof(buf) - 1);
|
|
|
|
if (copy_from_user(buf, user_buf, buf_size))
|
|
|
|
return -EFAULT;
|
|
|
|
if (sscanf(buf, "%x", &clear_flag) != 1)
|
|
|
|
return -EFAULT;
|
2011-10-24 21:49:25 +07:00
|
|
|
il_clear_traffic_stats(il);
|
2011-02-22 02:27:26 +07:00
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_rx_statistics_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos) {
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
char *buf;
|
|
|
|
int pos = 0;
|
|
|
|
int cnt;
|
|
|
|
ssize_t ret;
|
|
|
|
const size_t bufsz = 100 +
|
|
|
|
sizeof(char) * 50 * (MANAGEMENT_MAX + CONTROL_MAX);
|
|
|
|
buf = kzalloc(bufsz, GFP_KERNEL);
|
|
|
|
if (!buf)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "Management:\n");
|
|
|
|
for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) {
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"\t%25s\t\t: %u\n",
|
2011-10-24 20:41:30 +07:00
|
|
|
il_get_mgmt_string(cnt),
|
2011-10-24 21:49:25 +07:00
|
|
|
il->rx_stats.mgmt[cnt]);
|
2011-02-22 02:27:26 +07:00
|
|
|
}
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "Control:\n");
|
|
|
|
for (cnt = 0; cnt < CONTROL_MAX; cnt++) {
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"\t%25s\t\t: %u\n",
|
2011-10-24 20:41:30 +07:00
|
|
|
il_get_ctrl_string(cnt),
|
2011-10-24 21:49:25 +07:00
|
|
|
il->rx_stats.ctrl[cnt]);
|
2011-02-22 02:27:26 +07:00
|
|
|
}
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "Data:\n");
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->rx_stats.data_cnt);
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->rx_stats.data_bytes);
|
2011-02-22 02:27:26 +07:00
|
|
|
|
|
|
|
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
kfree(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define BYTE1_MASK 0x000000ff;
|
|
|
|
#define BYTE2_MASK 0x0000ffff;
|
|
|
|
#define BYTE3_MASK 0x00ffffff;
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_sram_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
|
|
|
u32 val;
|
|
|
|
char *buf;
|
|
|
|
ssize_t ret;
|
|
|
|
int i;
|
|
|
|
int pos = 0;
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
size_t bufsz;
|
|
|
|
|
|
|
|
/* default is to dump the entire data segment */
|
2011-10-24 21:49:25 +07:00
|
|
|
if (!il->dbgfs_sram_offset && !il->dbgfs_sram_len) {
|
|
|
|
il->dbgfs_sram_offset = 0x800000;
|
|
|
|
if (il->ucode_type == UCODE_INIT)
|
|
|
|
il->dbgfs_sram_len = il->ucode_init_data.len;
|
2011-02-22 02:27:26 +07:00
|
|
|
else
|
2011-10-24 21:49:25 +07:00
|
|
|
il->dbgfs_sram_len = il->ucode_data.len;
|
2011-02-22 02:27:26 +07:00
|
|
|
}
|
2011-10-24 21:49:25 +07:00
|
|
|
bufsz = 30 + il->dbgfs_sram_len * sizeof(char) * 10;
|
2011-02-22 02:27:26 +07:00
|
|
|
buf = kmalloc(bufsz, GFP_KERNEL);
|
|
|
|
if (!buf)
|
|
|
|
return -ENOMEM;
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "sram_len: 0x%x\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->dbgfs_sram_len);
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "sram_offset: 0x%x\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->dbgfs_sram_offset);
|
|
|
|
for (i = il->dbgfs_sram_len; i > 0; i -= 4) {
|
|
|
|
val = il_read_targ_mem(il, il->dbgfs_sram_offset + \
|
|
|
|
il->dbgfs_sram_len - i);
|
2011-02-22 02:27:26 +07:00
|
|
|
if (i < 4) {
|
|
|
|
switch (i) {
|
|
|
|
case 1:
|
|
|
|
val &= BYTE1_MASK;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
val &= BYTE2_MASK;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
val &= BYTE3_MASK;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!(i % 16))
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "\n");
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "0x%08x ", val);
|
|
|
|
}
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "\n");
|
|
|
|
|
|
|
|
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
kfree(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_sram_write(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
const char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
char buf[64];
|
|
|
|
int buf_size;
|
|
|
|
u32 offset, len;
|
|
|
|
|
|
|
|
memset(buf, 0, sizeof(buf));
|
|
|
|
buf_size = min(count, sizeof(buf) - 1);
|
|
|
|
if (copy_from_user(buf, user_buf, buf_size))
|
|
|
|
return -EFAULT;
|
|
|
|
|
|
|
|
if (sscanf(buf, "%x,%x", &offset, &len) == 2) {
|
2011-10-24 21:49:25 +07:00
|
|
|
il->dbgfs_sram_offset = offset;
|
|
|
|
il->dbgfs_sram_len = len;
|
2011-02-22 02:27:26 +07:00
|
|
|
} else {
|
2011-10-24 21:49:25 +07:00
|
|
|
il->dbgfs_sram_offset = 0;
|
|
|
|
il->dbgfs_sram_len = 0;
|
2011-02-22 02:27:26 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t
|
2011-10-24 20:41:30 +07:00
|
|
|
il_dbgfs_stations_read(struct file *file, char __user *user_buf,
|
2011-02-22 02:27:26 +07:00
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-10-24 20:41:30 +07:00
|
|
|
struct il_station_entry *station;
|
2011-10-24 21:49:25 +07:00
|
|
|
int max_sta = il->hw_params.max_stations;
|
2011-02-22 02:27:26 +07:00
|
|
|
char *buf;
|
|
|
|
int i, j, pos = 0;
|
|
|
|
ssize_t ret;
|
|
|
|
/* Add 30 for initial string */
|
2011-10-24 21:49:25 +07:00
|
|
|
const size_t bufsz = 30 + sizeof(char) * 500 * (il->num_stations);
|
2011-02-22 02:27:26 +07:00
|
|
|
|
|
|
|
buf = kmalloc(bufsz, GFP_KERNEL);
|
|
|
|
if (!buf)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "num of stations: %d\n\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->num_stations);
|
2011-02-22 02:27:26 +07:00
|
|
|
|
|
|
|
for (i = 0; i < max_sta; i++) {
|
2011-10-24 21:49:25 +07:00
|
|
|
station = &il->stations[i];
|
2011-02-22 02:27:26 +07:00
|
|
|
if (!station->used)
|
|
|
|
continue;
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"station %d - addr: %pM, flags: %#x\n",
|
|
|
|
i, station->sta.sta.addr,
|
|
|
|
station->sta.station_flags_msk);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"TID\tseq_num\ttxq_id\tframes\ttfds\t");
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"start_idx\tbitmap\t\t\trate_n_flags\n");
|
|
|
|
|
|
|
|
for (j = 0; j < MAX_TID_COUNT; j++) {
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"%d:\t%#x\t%#x\t%u\t%u\t%u\t\t%#.16llx\t%#x",
|
|
|
|
j, station->tid[j].seq_number,
|
|
|
|
station->tid[j].agg.txq_id,
|
|
|
|
station->tid[j].agg.frame_count,
|
|
|
|
station->tid[j].tfds_in_queue,
|
|
|
|
station->tid[j].agg.start_idx,
|
|
|
|
station->tid[j].agg.bitmap,
|
|
|
|
station->tid[j].agg.rate_n_flags);
|
|
|
|
|
|
|
|
if (station->tid[j].agg.wait_for_ba)
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
" - waitforba");
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
kfree(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_nvm_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count,
|
|
|
|
loff_t *ppos)
|
|
|
|
{
|
|
|
|
ssize_t ret;
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
int pos = 0, ofs = 0, buf_size = 0;
|
|
|
|
const u8 *ptr;
|
|
|
|
char *buf;
|
|
|
|
u16 eeprom_ver;
|
2011-10-24 21:49:25 +07:00
|
|
|
size_t eeprom_len = il->cfg->base_params->eeprom_size;
|
2011-02-22 02:27:26 +07:00
|
|
|
buf_size = 4 * eeprom_len + 256;
|
|
|
|
|
|
|
|
if (eeprom_len % 16) {
|
2011-08-19 03:07:57 +07:00
|
|
|
IL_ERR("NVM size is not multiple of 16.\n");
|
2011-02-22 02:27:26 +07:00
|
|
|
return -ENODATA;
|
|
|
|
}
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
ptr = il->eeprom;
|
2011-02-22 02:27:26 +07:00
|
|
|
if (!ptr) {
|
2011-08-19 03:07:57 +07:00
|
|
|
IL_ERR("Invalid EEPROM memory\n");
|
2011-02-22 02:27:26 +07:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 4 characters for byte 0xYY */
|
|
|
|
buf = kzalloc(buf_size, GFP_KERNEL);
|
|
|
|
if (!buf) {
|
2011-08-19 03:07:57 +07:00
|
|
|
IL_ERR("Can not allocate Buffer\n");
|
2011-02-22 02:27:26 +07:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2011-10-24 21:49:25 +07:00
|
|
|
eeprom_ver = il_eeprom_query16(il, EEPROM_VERSION);
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, buf_size - pos, "EEPROM "
|
|
|
|
"version: 0x%x\n", eeprom_ver);
|
|
|
|
for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) {
|
|
|
|
pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs);
|
|
|
|
hex_dump_to_buffer(ptr + ofs, 16 , 16, 2, buf + pos,
|
|
|
|
buf_size - pos, 0);
|
|
|
|
pos += strlen(buf + pos);
|
|
|
|
if (buf_size - pos > 0)
|
|
|
|
buf[pos++] = '\n';
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
kfree(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t
|
2011-10-24 20:41:30 +07:00
|
|
|
il_dbgfs_channels_read(struct file *file, char __user *user_buf,
|
2011-02-22 02:27:26 +07:00
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
struct ieee80211_channel *channels = NULL;
|
|
|
|
const struct ieee80211_supported_band *supp_band = NULL;
|
|
|
|
int pos = 0, i, bufsz = PAGE_SIZE;
|
|
|
|
char *buf;
|
|
|
|
ssize_t ret;
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
if (!test_bit(STATUS_GEO_CONFIGURED, &il->status))
|
2011-02-22 02:27:26 +07:00
|
|
|
return -EAGAIN;
|
|
|
|
|
|
|
|
buf = kzalloc(bufsz, GFP_KERNEL);
|
|
|
|
if (!buf) {
|
2011-08-19 03:07:57 +07:00
|
|
|
IL_ERR("Can not allocate Buffer\n");
|
2011-02-22 02:27:26 +07:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
supp_band = il_get_hw_mode(il, IEEE80211_BAND_2GHZ);
|
2011-02-22 02:27:26 +07:00
|
|
|
if (supp_band) {
|
|
|
|
channels = supp_band->channels;
|
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"Displaying %d channels in 2.4GHz band 802.11bg):\n",
|
|
|
|
supp_band->n_channels);
|
|
|
|
|
|
|
|
for (i = 0; i < supp_band->n_channels; i++)
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"%d: %ddBm: BSS%s%s, %s.\n",
|
|
|
|
channels[i].hw_value,
|
|
|
|
channels[i].max_power,
|
|
|
|
channels[i].flags & IEEE80211_CHAN_RADAR ?
|
|
|
|
" (IEEE 802.11h required)" : "",
|
|
|
|
((channels[i].flags & IEEE80211_CHAN_NO_IBSS)
|
|
|
|
|| (channels[i].flags &
|
|
|
|
IEEE80211_CHAN_RADAR)) ? "" :
|
|
|
|
", IBSS",
|
|
|
|
channels[i].flags &
|
|
|
|
IEEE80211_CHAN_PASSIVE_SCAN ?
|
|
|
|
"passive only" : "active/passive");
|
|
|
|
}
|
2011-10-24 21:49:25 +07:00
|
|
|
supp_band = il_get_hw_mode(il, IEEE80211_BAND_5GHZ);
|
2011-02-22 02:27:26 +07:00
|
|
|
if (supp_band) {
|
|
|
|
channels = supp_band->channels;
|
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"Displaying %d channels in 5.2GHz band (802.11a)\n",
|
|
|
|
supp_band->n_channels);
|
|
|
|
|
|
|
|
for (i = 0; i < supp_band->n_channels; i++)
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"%d: %ddBm: BSS%s%s, %s.\n",
|
|
|
|
channels[i].hw_value,
|
|
|
|
channels[i].max_power,
|
|
|
|
channels[i].flags & IEEE80211_CHAN_RADAR ?
|
|
|
|
" (IEEE 802.11h required)" : "",
|
|
|
|
((channels[i].flags & IEEE80211_CHAN_NO_IBSS)
|
|
|
|
|| (channels[i].flags &
|
|
|
|
IEEE80211_CHAN_RADAR)) ? "" :
|
|
|
|
", IBSS",
|
|
|
|
channels[i].flags &
|
|
|
|
IEEE80211_CHAN_PASSIVE_SCAN ?
|
|
|
|
"passive only" : "active/passive");
|
|
|
|
}
|
|
|
|
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
kfree(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_status_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos) {
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
char buf[512];
|
|
|
|
int pos = 0;
|
|
|
|
const size_t bufsz = sizeof(buf);
|
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
test_bit(STATUS_HCMD_ACTIVE, &il->status));
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INT_ENABLED:\t %d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
test_bit(STATUS_INT_ENABLED, &il->status));
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
test_bit(STATUS_RF_KILL_HW, &il->status));
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_CT_KILL:\t\t %d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
test_bit(STATUS_CT_KILL, &il->status));
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INIT:\t\t %d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
test_bit(STATUS_INIT, &il->status));
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
test_bit(STATUS_ALIVE, &il->status));
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
test_bit(STATUS_READY, &il->status));
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_TEMPERATURE:\t %d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
test_bit(STATUS_TEMPERATURE, &il->status));
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_GEO_CONFIGURED:\t %d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
test_bit(STATUS_GEO_CONFIGURED, &il->status));
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
test_bit(STATUS_EXIT_PENDING, &il->status));
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
test_bit(STATUS_STATISTICS, &il->status));
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCANNING:\t %d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
test_bit(STATUS_SCANNING, &il->status));
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_ABORTING:\t %d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
test_bit(STATUS_SCAN_ABORTING, &il->status));
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_HW:\t\t %d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
test_bit(STATUS_SCAN_HW, &il->status));
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_POWER_PMI:\t %d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
test_bit(STATUS_POWER_PMI, &il->status));
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_FW_ERROR:\t %d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
test_bit(STATUS_FW_ERROR, &il->status));
|
2011-02-22 02:27:26 +07:00
|
|
|
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_interrupt_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos) {
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
int pos = 0;
|
|
|
|
int cnt = 0;
|
|
|
|
char *buf;
|
|
|
|
int bufsz = 24 * 64; /* 24 items * 64 char per item */
|
|
|
|
ssize_t ret;
|
|
|
|
|
|
|
|
buf = kzalloc(bufsz, GFP_KERNEL);
|
|
|
|
if (!buf) {
|
2011-08-19 03:07:57 +07:00
|
|
|
IL_ERR("Can not allocate Buffer\n");
|
2011-02-22 02:27:26 +07:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"Interrupt Statistics Report:\n");
|
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "HW Error:\t\t\t %u\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->isr_stats.hw);
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "SW Error:\t\t\t %u\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->isr_stats.sw);
|
|
|
|
if (il->isr_stats.sw || il->isr_stats.hw) {
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"\tLast Restarting Code: 0x%X\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->isr_stats.err_code);
|
2011-02-22 02:27:26 +07:00
|
|
|
}
|
2011-11-15 17:25:42 +07:00
|
|
|
#ifdef CONFIG_IWLEGACY_DEBUG
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "Frame transmitted:\t\t %u\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->isr_stats.sch);
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "Alive interrupt:\t\t %u\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->isr_stats.alive);
|
2011-02-22 02:27:26 +07:00
|
|
|
#endif
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"HW RF KILL switch toggled:\t %u\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->isr_stats.rfkill);
|
2011-02-22 02:27:26 +07:00
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "CT KILL:\t\t\t %u\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->isr_stats.ctkill);
|
2011-02-22 02:27:26 +07:00
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "Wakeup Interrupt:\t\t %u\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->isr_stats.wakeup);
|
2011-02-22 02:27:26 +07:00
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"Rx command responses:\t\t %u\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->isr_stats.rx);
|
2011-02-22 02:27:26 +07:00
|
|
|
for (cnt = 0; cnt < REPLY_MAX; cnt++) {
|
2011-10-24 21:49:25 +07:00
|
|
|
if (il->isr_stats.rx_handlers[cnt] > 0)
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"\tRx handler[%36s]:\t\t %u\n",
|
2011-10-24 20:41:30 +07:00
|
|
|
il_get_cmd_string(cnt),
|
2011-10-24 21:49:25 +07:00
|
|
|
il->isr_stats.rx_handlers[cnt]);
|
2011-02-22 02:27:26 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "Tx/FH interrupt:\t\t %u\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->isr_stats.tx);
|
2011-02-22 02:27:26 +07:00
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "Unexpected INTA:\t\t %u\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->isr_stats.unhandled);
|
2011-02-22 02:27:26 +07:00
|
|
|
|
|
|
|
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
kfree(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_interrupt_write(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
const char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
char buf[8];
|
|
|
|
int buf_size;
|
|
|
|
u32 reset_flag;
|
|
|
|
|
|
|
|
memset(buf, 0, sizeof(buf));
|
|
|
|
buf_size = min(count, sizeof(buf) - 1);
|
|
|
|
if (copy_from_user(buf, user_buf, buf_size))
|
|
|
|
return -EFAULT;
|
|
|
|
if (sscanf(buf, "%x", &reset_flag) != 1)
|
|
|
|
return -EFAULT;
|
|
|
|
if (reset_flag == 0)
|
2011-10-24 21:49:25 +07:00
|
|
|
il_clear_isr_stats(il);
|
2011-02-22 02:27:26 +07:00
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t
|
2011-10-24 20:41:30 +07:00
|
|
|
il_dbgfs_qos_read(struct file *file, char __user *user_buf,
|
2011-02-22 02:27:26 +07:00
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-10-24 20:41:30 +07:00
|
|
|
struct il_rxon_context *ctx;
|
2011-02-22 02:27:26 +07:00
|
|
|
int pos = 0, i;
|
2011-10-24 20:41:30 +07:00
|
|
|
char buf[256 * NUM_IL_RXON_CTX];
|
2011-02-22 02:27:26 +07:00
|
|
|
const size_t bufsz = sizeof(buf);
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
for_each_context(il, ctx) {
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "context %d:\n",
|
|
|
|
ctx->ctxid);
|
|
|
|
for (i = 0; i < AC_NUM; i++) {
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"\tcw_min\tcw_max\taifsn\ttxop\n");
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"AC[%d]\t%u\t%u\t%u\t%u\n", i,
|
|
|
|
ctx->qos_data.def_qos_parm.ac[i].cw_min,
|
|
|
|
ctx->qos_data.def_qos_parm.ac[i].cw_max,
|
|
|
|
ctx->qos_data.def_qos_parm.ac[i].aifsn,
|
|
|
|
ctx->qos_data.def_qos_parm.ac[i].edca_txop);
|
|
|
|
}
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "\n");
|
|
|
|
}
|
|
|
|
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_disable_ht40_write(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
const char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
char buf[8];
|
|
|
|
int buf_size;
|
|
|
|
int ht40;
|
|
|
|
|
|
|
|
memset(buf, 0, sizeof(buf));
|
|
|
|
buf_size = min(count, sizeof(buf) - 1);
|
|
|
|
if (copy_from_user(buf, user_buf, buf_size))
|
|
|
|
return -EFAULT;
|
|
|
|
if (sscanf(buf, "%d", &ht40) != 1)
|
|
|
|
return -EFAULT;
|
2011-10-24 21:49:25 +07:00
|
|
|
if (!il_is_any_associated(il))
|
|
|
|
il->disable_ht40 = ht40 ? true : false;
|
2011-02-22 02:27:26 +07:00
|
|
|
else {
|
2011-08-19 03:07:57 +07:00
|
|
|
IL_ERR("Sta associated with AP - "
|
2011-02-22 02:27:26 +07:00
|
|
|
"Change to 40MHz channel support is not allowed\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_disable_ht40_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
char buf[100];
|
|
|
|
int pos = 0;
|
|
|
|
const size_t bufsz = sizeof(buf);
|
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"11n 40MHz Mode: %s\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->disable_ht40 ? "Disabled" : "Enabled");
|
2011-02-22 02:27:26 +07:00
|
|
|
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUGFS_READ_WRITE_FILE_OPS(sram);
|
|
|
|
DEBUGFS_READ_FILE_OPS(nvm);
|
|
|
|
DEBUGFS_READ_FILE_OPS(stations);
|
|
|
|
DEBUGFS_READ_FILE_OPS(channels);
|
|
|
|
DEBUGFS_READ_FILE_OPS(status);
|
|
|
|
DEBUGFS_READ_WRITE_FILE_OPS(interrupt);
|
|
|
|
DEBUGFS_READ_FILE_OPS(qos);
|
|
|
|
DEBUGFS_READ_WRITE_FILE_OPS(disable_ht40);
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_traffic_log_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
int pos = 0, ofs = 0;
|
|
|
|
int cnt = 0, entry;
|
2011-10-24 20:41:30 +07:00
|
|
|
struct il_tx_queue *txq;
|
|
|
|
struct il_queue *q;
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_rx_queue *rxq = &il->rxq;
|
2011-02-22 02:27:26 +07:00
|
|
|
char *buf;
|
2011-10-24 20:41:30 +07:00
|
|
|
int bufsz = ((IL_TRAFFIC_ENTRIES * IL_TRAFFIC_ENTRY_SIZE * 64) * 2) +
|
2011-10-24 21:49:25 +07:00
|
|
|
(il->cfg->base_params->num_of_queues * 32 * 8) + 400;
|
2011-02-22 02:27:26 +07:00
|
|
|
const u8 *ptr;
|
|
|
|
ssize_t ret;
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
if (!il->txq) {
|
2011-08-19 03:07:57 +07:00
|
|
|
IL_ERR("txq not ready\n");
|
2011-02-22 02:27:26 +07:00
|
|
|
return -EAGAIN;
|
|
|
|
}
|
|
|
|
buf = kzalloc(bufsz, GFP_KERNEL);
|
|
|
|
if (!buf) {
|
2011-08-19 03:07:57 +07:00
|
|
|
IL_ERR("Can not allocate buffer\n");
|
2011-02-22 02:27:26 +07:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "Tx Queue\n");
|
2011-10-24 21:49:25 +07:00
|
|
|
for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) {
|
|
|
|
txq = &il->txq[cnt];
|
2011-02-22 02:27:26 +07:00
|
|
|
q = &txq->q;
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"q[%d]: read_ptr: %u, write_ptr: %u\n",
|
|
|
|
cnt, q->read_ptr, q->write_ptr);
|
|
|
|
}
|
2011-08-16 19:17:04 +07:00
|
|
|
if (il->tx_traffic && (il_debug_level & IL_DL_TX)) {
|
2011-10-24 21:49:25 +07:00
|
|
|
ptr = il->tx_traffic;
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
2011-10-24 21:49:25 +07:00
|
|
|
"Tx Traffic idx: %u\n", il->tx_traffic_idx);
|
2011-10-24 20:41:30 +07:00
|
|
|
for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) {
|
|
|
|
for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16;
|
2011-02-22 02:27:26 +07:00
|
|
|
entry++, ofs += 16) {
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"0x%.4x ", ofs);
|
|
|
|
hex_dump_to_buffer(ptr + ofs, 16, 16, 2,
|
|
|
|
buf + pos, bufsz - pos, 0);
|
|
|
|
pos += strlen(buf + pos);
|
|
|
|
if (bufsz - pos > 0)
|
|
|
|
buf[pos++] = '\n';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "Rx Queue\n");
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"read: %u, write: %u\n",
|
|
|
|
rxq->read, rxq->write);
|
|
|
|
|
2011-08-16 19:17:04 +07:00
|
|
|
if (il->rx_traffic && (il_debug_level & IL_DL_RX)) {
|
2011-10-24 21:49:25 +07:00
|
|
|
ptr = il->rx_traffic;
|
2011-02-22 02:27:26 +07:00
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
2011-10-24 21:49:25 +07:00
|
|
|
"Rx Traffic idx: %u\n", il->rx_traffic_idx);
|
2011-10-24 20:41:30 +07:00
|
|
|
for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) {
|
|
|
|
for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16;
|
2011-02-22 02:27:26 +07:00
|
|
|
entry++, ofs += 16) {
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"0x%.4x ", ofs);
|
|
|
|
hex_dump_to_buffer(ptr + ofs, 16, 16, 2,
|
|
|
|
buf + pos, bufsz - pos, 0);
|
|
|
|
pos += strlen(buf + pos);
|
|
|
|
if (bufsz - pos > 0)
|
|
|
|
buf[pos++] = '\n';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
kfree(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_traffic_log_write(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
const char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
char buf[8];
|
|
|
|
int buf_size;
|
|
|
|
int traffic_log;
|
|
|
|
|
|
|
|
memset(buf, 0, sizeof(buf));
|
|
|
|
buf_size = min(count, sizeof(buf) - 1);
|
|
|
|
if (copy_from_user(buf, user_buf, buf_size))
|
|
|
|
return -EFAULT;
|
|
|
|
if (sscanf(buf, "%d", &traffic_log) != 1)
|
|
|
|
return -EFAULT;
|
|
|
|
if (traffic_log == 0)
|
2011-10-24 21:49:25 +07:00
|
|
|
il_reset_traffic_log(il);
|
2011-02-22 02:27:26 +07:00
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_tx_queue_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos) {
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-10-24 20:41:30 +07:00
|
|
|
struct il_tx_queue *txq;
|
|
|
|
struct il_queue *q;
|
2011-02-22 02:27:26 +07:00
|
|
|
char *buf;
|
|
|
|
int pos = 0;
|
|
|
|
int cnt;
|
|
|
|
int ret;
|
|
|
|
const size_t bufsz = sizeof(char) * 64 *
|
2011-10-24 21:49:25 +07:00
|
|
|
il->cfg->base_params->num_of_queues;
|
2011-02-22 02:27:26 +07:00
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
if (!il->txq) {
|
2011-08-19 03:07:57 +07:00
|
|
|
IL_ERR("txq not ready\n");
|
2011-02-22 02:27:26 +07:00
|
|
|
return -EAGAIN;
|
|
|
|
}
|
|
|
|
buf = kzalloc(bufsz, GFP_KERNEL);
|
|
|
|
if (!buf)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) {
|
|
|
|
txq = &il->txq[cnt];
|
2011-02-22 02:27:26 +07:00
|
|
|
q = &txq->q;
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"hwq %.2d: read=%u write=%u stop=%d"
|
|
|
|
" swq_id=%#.2x (ac %d/hwq %d)\n",
|
|
|
|
cnt, q->read_ptr, q->write_ptr,
|
2011-10-24 21:49:25 +07:00
|
|
|
!!test_bit(cnt, il->queue_stopped),
|
2011-02-22 02:27:26 +07:00
|
|
|
txq->swq_id, txq->swq_id & 3,
|
|
|
|
(txq->swq_id >> 2) & 0x1f);
|
|
|
|
if (cnt >= 4)
|
|
|
|
continue;
|
|
|
|
/* for the ACs, display the stop count too */
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
" stop-count: %d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
atomic_read(&il->queue_stop_count[cnt]));
|
2011-02-22 02:27:26 +07:00
|
|
|
}
|
|
|
|
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
kfree(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_rx_queue_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos) {
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
|
|
|
struct il_rx_queue *rxq = &il->rxq;
|
2011-02-22 02:27:26 +07:00
|
|
|
char buf[256];
|
|
|
|
int pos = 0;
|
|
|
|
const size_t bufsz = sizeof(buf);
|
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "read: %u\n",
|
|
|
|
rxq->read);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "write: %u\n",
|
|
|
|
rxq->write);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "free_count: %u\n",
|
|
|
|
rxq->free_count);
|
|
|
|
if (rxq->rb_stts) {
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "closed_rb_num: %u\n",
|
|
|
|
le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF);
|
|
|
|
} else {
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"closed_rb_num: Not Allocated\n");
|
|
|
|
}
|
|
|
|
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_ucode_rx_stats_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
|
|
|
return il->cfg->ops->lib->debugfs_ops.rx_stats_read(file,
|
2011-02-22 02:27:26 +07:00
|
|
|
user_buf, count, ppos);
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_ucode_tx_stats_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
|
|
|
return il->cfg->ops->lib->debugfs_ops.tx_stats_read(file,
|
2011-02-22 02:27:26 +07:00
|
|
|
user_buf, count, ppos);
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_ucode_general_stats_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
|
|
|
return il->cfg->ops->lib->debugfs_ops.general_stats_read(file,
|
2011-02-22 02:27:26 +07:00
|
|
|
user_buf, count, ppos);
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_sensitivity_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos) {
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
int pos = 0;
|
|
|
|
int cnt = 0;
|
|
|
|
char *buf;
|
2011-10-24 20:41:30 +07:00
|
|
|
int bufsz = sizeof(struct il_sensitivity_data) * 4 + 100;
|
2011-02-22 02:27:26 +07:00
|
|
|
ssize_t ret;
|
2011-10-24 20:41:30 +07:00
|
|
|
struct il_sensitivity_data *data;
|
2011-02-22 02:27:26 +07:00
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
data = &il->sensitivity_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
buf = kzalloc(bufsz, GFP_KERNEL);
|
|
|
|
if (!buf) {
|
2011-08-19 03:07:57 +07:00
|
|
|
IL_ERR("Can not allocate Buffer\n");
|
2011-02-22 02:27:26 +07:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm:\t\t\t %u\n",
|
|
|
|
data->auto_corr_ofdm);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"auto_corr_ofdm_mrc:\t\t %u\n",
|
|
|
|
data->auto_corr_ofdm_mrc);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm_x1:\t\t %u\n",
|
|
|
|
data->auto_corr_ofdm_x1);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"auto_corr_ofdm_mrc_x1:\t\t %u\n",
|
|
|
|
data->auto_corr_ofdm_mrc_x1);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_cck:\t\t\t %u\n",
|
|
|
|
data->auto_corr_cck);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_cck_mrc:\t\t %u\n",
|
|
|
|
data->auto_corr_cck_mrc);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"last_bad_plcp_cnt_ofdm:\t\t %u\n",
|
|
|
|
data->last_bad_plcp_cnt_ofdm);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "last_fa_cnt_ofdm:\t\t %u\n",
|
|
|
|
data->last_fa_cnt_ofdm);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"last_bad_plcp_cnt_cck:\t\t %u\n",
|
|
|
|
data->last_bad_plcp_cnt_cck);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "last_fa_cnt_cck:\t\t %u\n",
|
|
|
|
data->last_fa_cnt_cck);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "nrg_curr_state:\t\t\t %u\n",
|
|
|
|
data->nrg_curr_state);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "nrg_prev_state:\t\t\t %u\n",
|
|
|
|
data->nrg_prev_state);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "nrg_value:\t\t\t");
|
|
|
|
for (cnt = 0; cnt < 10; cnt++) {
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, " %u",
|
|
|
|
data->nrg_value[cnt]);
|
|
|
|
}
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "\n");
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_rssi:\t\t");
|
|
|
|
for (cnt = 0; cnt < NRG_NUM_PREV_STAT_L; cnt++) {
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, " %u",
|
|
|
|
data->nrg_silence_rssi[cnt]);
|
|
|
|
}
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "\n");
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_ref:\t\t %u\n",
|
|
|
|
data->nrg_silence_ref);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "nrg_energy_idx:\t\t\t %u\n",
|
|
|
|
data->nrg_energy_idx);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_idx:\t\t %u\n",
|
|
|
|
data->nrg_silence_idx);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "nrg_th_cck:\t\t\t %u\n",
|
|
|
|
data->nrg_th_cck);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"nrg_auto_corr_silence_diff:\t %u\n",
|
|
|
|
data->nrg_auto_corr_silence_diff);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "num_in_cck_no_fa:\t\t %u\n",
|
|
|
|
data->num_in_cck_no_fa);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "nrg_th_ofdm:\t\t\t %u\n",
|
|
|
|
data->nrg_th_ofdm);
|
|
|
|
|
|
|
|
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
kfree(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_chain_noise_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos) {
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
int pos = 0;
|
|
|
|
int cnt = 0;
|
|
|
|
char *buf;
|
2011-10-24 20:41:30 +07:00
|
|
|
int bufsz = sizeof(struct il_chain_noise_data) * 4 + 100;
|
2011-02-22 02:27:26 +07:00
|
|
|
ssize_t ret;
|
2011-10-24 20:41:30 +07:00
|
|
|
struct il_chain_noise_data *data;
|
2011-02-22 02:27:26 +07:00
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
data = &il->chain_noise_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
buf = kzalloc(bufsz, GFP_KERNEL);
|
|
|
|
if (!buf) {
|
2011-08-19 03:07:57 +07:00
|
|
|
IL_ERR("Can not allocate Buffer\n");
|
2011-02-22 02:27:26 +07:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "active_chains:\t\t\t %u\n",
|
|
|
|
data->active_chains);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_a:\t\t\t %u\n",
|
|
|
|
data->chain_noise_a);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_b:\t\t\t %u\n",
|
|
|
|
data->chain_noise_b);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_c:\t\t\t %u\n",
|
|
|
|
data->chain_noise_c);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_a:\t\t\t %u\n",
|
|
|
|
data->chain_signal_a);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_b:\t\t\t %u\n",
|
|
|
|
data->chain_signal_b);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_c:\t\t\t %u\n",
|
|
|
|
data->chain_signal_c);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "beacon_count:\t\t\t %u\n",
|
|
|
|
data->beacon_count);
|
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "disconn_array:\t\t\t");
|
|
|
|
for (cnt = 0; cnt < NUM_RX_CHAINS; cnt++) {
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, " %u",
|
|
|
|
data->disconn_array[cnt]);
|
|
|
|
}
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "\n");
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "delta_gain_code:\t\t");
|
|
|
|
for (cnt = 0; cnt < NUM_RX_CHAINS; cnt++) {
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, " %u",
|
|
|
|
data->delta_gain_code[cnt]);
|
|
|
|
}
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "\n");
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "radio_write:\t\t\t %u\n",
|
|
|
|
data->radio_write);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "state:\t\t\t\t %u\n",
|
|
|
|
data->state);
|
|
|
|
|
|
|
|
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
kfree(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_power_save_status_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
char buf[60];
|
|
|
|
int pos = 0;
|
|
|
|
const size_t bufsz = sizeof(buf);
|
|
|
|
u32 pwrsave_status;
|
|
|
|
|
2011-08-24 20:14:03 +07:00
|
|
|
pwrsave_status = _il_rd(il, CSR_GP_CNTRL) &
|
2011-02-22 02:27:26 +07:00
|
|
|
CSR_GP_REG_POWER_SAVE_STATUS_MSK;
|
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: ");
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "%s\n",
|
|
|
|
(pwrsave_status == CSR_GP_REG_NO_POWER_SAVE) ? "none" :
|
|
|
|
(pwrsave_status == CSR_GP_REG_MAC_POWER_SAVE) ? "MAC" :
|
|
|
|
(pwrsave_status == CSR_GP_REG_PHY_POWER_SAVE) ? "PHY" :
|
|
|
|
"error");
|
|
|
|
|
|
|
|
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_clear_ucode_statistics_write(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
const char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
char buf[8];
|
|
|
|
int buf_size;
|
|
|
|
int clear;
|
|
|
|
|
|
|
|
memset(buf, 0, sizeof(buf));
|
|
|
|
buf_size = min(count, sizeof(buf) - 1);
|
|
|
|
if (copy_from_user(buf, user_buf, buf_size))
|
|
|
|
return -EFAULT;
|
|
|
|
if (sscanf(buf, "%d", &clear) != 1)
|
|
|
|
return -EFAULT;
|
|
|
|
|
|
|
|
/* make request to uCode to retrieve statistics information */
|
2011-10-24 21:49:25 +07:00
|
|
|
mutex_lock(&il->mutex);
|
|
|
|
il_send_statistics_request(il, CMD_SYNC, true);
|
|
|
|
mutex_unlock(&il->mutex);
|
2011-02-22 02:27:26 +07:00
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_rxon_flags_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos) {
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
int len = 0;
|
|
|
|
char buf[20];
|
|
|
|
|
|
|
|
len = sprintf(buf, "0x%04X\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
le32_to_cpu(il->contexts[IL_RXON_CTX_BSS].active.flags));
|
2011-02-22 02:27:26 +07:00
|
|
|
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_rxon_filter_flags_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos) {
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
int len = 0;
|
|
|
|
char buf[20];
|
|
|
|
|
|
|
|
len = sprintf(buf, "0x%04X\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
le32_to_cpu(il->contexts[IL_RXON_CTX_BSS].active.filter_flags));
|
2011-02-22 02:27:26 +07:00
|
|
|
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_fh_reg_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
char *buf;
|
|
|
|
int pos = 0;
|
|
|
|
ssize_t ret = -EFAULT;
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
if (il->cfg->ops->lib->dump_fh) {
|
|
|
|
ret = pos = il->cfg->ops->lib->dump_fh(il, &buf, true);
|
2011-02-22 02:27:26 +07:00
|
|
|
if (buf) {
|
|
|
|
ret = simple_read_from_buffer(user_buf,
|
|
|
|
count, ppos, buf, pos);
|
|
|
|
kfree(buf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_missed_beacon_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos) {
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
int pos = 0;
|
|
|
|
char buf[12];
|
|
|
|
const size_t bufsz = sizeof(buf);
|
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos, "%d\n",
|
2011-10-24 21:49:25 +07:00
|
|
|
il->missed_beacon_threshold);
|
2011-02-22 02:27:26 +07:00
|
|
|
|
|
|
|
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_missed_beacon_write(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
const char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
char buf[8];
|
|
|
|
int buf_size;
|
|
|
|
int missed;
|
|
|
|
|
|
|
|
memset(buf, 0, sizeof(buf));
|
|
|
|
buf_size = min(count, sizeof(buf) - 1);
|
|
|
|
if (copy_from_user(buf, user_buf, buf_size))
|
|
|
|
return -EFAULT;
|
|
|
|
if (sscanf(buf, "%d", &missed) != 1)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
if (missed < IL_MISSED_BEACON_THRESHOLD_MIN ||
|
|
|
|
missed > IL_MISSED_BEACON_THRESHOLD_MAX)
|
2011-10-24 21:49:25 +07:00
|
|
|
il->missed_beacon_threshold =
|
2011-10-24 20:41:30 +07:00
|
|
|
IL_MISSED_BEACON_THRESHOLD_DEF;
|
2011-02-22 02:27:26 +07:00
|
|
|
else
|
2011-10-24 21:49:25 +07:00
|
|
|
il->missed_beacon_threshold = missed;
|
2011-02-22 02:27:26 +07:00
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_force_reset_read(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos) {
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-06-08 20:28:26 +07:00
|
|
|
int pos = 0;
|
2011-02-22 02:27:26 +07:00
|
|
|
char buf[300];
|
|
|
|
const size_t bufsz = sizeof(buf);
|
2011-10-24 20:41:30 +07:00
|
|
|
struct il_force_reset *force_reset;
|
2011-02-22 02:27:26 +07:00
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
force_reset = &il->force_reset;
|
2011-06-08 20:28:26 +07:00
|
|
|
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"\tnumber of reset request: %d\n",
|
|
|
|
force_reset->reset_request_count);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"\tnumber of reset request success: %d\n",
|
|
|
|
force_reset->reset_success_count);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"\tnumber of reset request reject: %d\n",
|
|
|
|
force_reset->reset_reject_count);
|
|
|
|
pos += scnprintf(buf + pos, bufsz - pos,
|
|
|
|
"\treset duration: %lu\n",
|
|
|
|
force_reset->reset_duration);
|
|
|
|
|
2011-02-22 02:27:26 +07:00
|
|
|
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_force_reset_write(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
const char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos) {
|
|
|
|
|
2011-06-08 20:28:26 +07:00
|
|
|
int ret;
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
ret = il_force_reset(il, true);
|
2011-06-08 20:28:26 +07:00
|
|
|
|
2011-02-22 02:27:26 +07:00
|
|
|
return ret ? ret : count;
|
|
|
|
}
|
|
|
|
|
2011-10-24 20:41:30 +07:00
|
|
|
static ssize_t il_dbgfs_wd_timeout_write(struct file *file,
|
2011-02-22 02:27:26 +07:00
|
|
|
const char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos) {
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
struct il_priv *il = file->private_data;
|
2011-02-22 02:27:26 +07:00
|
|
|
char buf[8];
|
|
|
|
int buf_size;
|
|
|
|
int timeout;
|
|
|
|
|
|
|
|
memset(buf, 0, sizeof(buf));
|
|
|
|
buf_size = min(count, sizeof(buf) - 1);
|
|
|
|
if (copy_from_user(buf, user_buf, buf_size))
|
|
|
|
return -EFAULT;
|
|
|
|
if (sscanf(buf, "%d", &timeout) != 1)
|
|
|
|
return -EINVAL;
|
2011-10-24 20:41:30 +07:00
|
|
|
if (timeout < 0 || timeout > IL_MAX_WD_TIMEOUT)
|
|
|
|
timeout = IL_DEF_WD_TIMEOUT;
|
2011-02-22 02:27:26 +07:00
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
il->cfg->base_params->wd_timeout = timeout;
|
|
|
|
il_setup_watchdog(il);
|
2011-02-22 02:27:26 +07:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUGFS_READ_FILE_OPS(rx_statistics);
|
|
|
|
DEBUGFS_READ_FILE_OPS(tx_statistics);
|
|
|
|
DEBUGFS_READ_WRITE_FILE_OPS(traffic_log);
|
|
|
|
DEBUGFS_READ_FILE_OPS(rx_queue);
|
|
|
|
DEBUGFS_READ_FILE_OPS(tx_queue);
|
|
|
|
DEBUGFS_READ_FILE_OPS(ucode_rx_stats);
|
|
|
|
DEBUGFS_READ_FILE_OPS(ucode_tx_stats);
|
|
|
|
DEBUGFS_READ_FILE_OPS(ucode_general_stats);
|
|
|
|
DEBUGFS_READ_FILE_OPS(sensitivity);
|
|
|
|
DEBUGFS_READ_FILE_OPS(chain_noise);
|
|
|
|
DEBUGFS_READ_FILE_OPS(power_save_status);
|
|
|
|
DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics);
|
|
|
|
DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics);
|
|
|
|
DEBUGFS_READ_FILE_OPS(fh_reg);
|
|
|
|
DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon);
|
|
|
|
DEBUGFS_READ_WRITE_FILE_OPS(force_reset);
|
|
|
|
DEBUGFS_READ_FILE_OPS(rxon_flags);
|
|
|
|
DEBUGFS_READ_FILE_OPS(rxon_filter_flags);
|
|
|
|
DEBUGFS_WRITE_FILE_OPS(wd_timeout);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create the debugfs files and directories
|
|
|
|
*
|
|
|
|
*/
|
2011-10-24 21:49:25 +07:00
|
|
|
int il_dbgfs_register(struct il_priv *il, const char *name)
|
2011-02-22 02:27:26 +07:00
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
struct dentry *phyd = il->hw->wiphy->debugfsdir;
|
2011-02-22 02:27:26 +07:00
|
|
|
struct dentry *dir_drv, *dir_data, *dir_rf, *dir_debug;
|
|
|
|
|
|
|
|
dir_drv = debugfs_create_dir(name, phyd);
|
|
|
|
if (!dir_drv)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
il->debugfs_dir = dir_drv;
|
2011-02-22 02:27:26 +07:00
|
|
|
|
|
|
|
dir_data = debugfs_create_dir("data", dir_drv);
|
|
|
|
if (!dir_data)
|
|
|
|
goto err;
|
|
|
|
dir_rf = debugfs_create_dir("rf", dir_drv);
|
|
|
|
if (!dir_rf)
|
|
|
|
goto err;
|
|
|
|
dir_debug = debugfs_create_dir("debug", dir_drv);
|
|
|
|
if (!dir_debug)
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
DEBUGFS_ADD_FILE(nvm, dir_data, S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(sram, dir_data, S_IWUSR | S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(stations, dir_data, S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(channels, dir_data, S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(status, dir_data, S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(interrupt, dir_data, S_IWUSR | S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(qos, dir_data, S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(rx_statistics, dir_debug, S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(tx_statistics, dir_debug, S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(traffic_log, dir_debug, S_IWUSR | S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(rx_queue, dir_debug, S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(tx_queue, dir_debug, S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR);
|
|
|
|
DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR);
|
|
|
|
DEBUGFS_ADD_FILE(fh_reg, dir_debug, S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR);
|
|
|
|
DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR);
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
if (il->cfg->base_params->sensitivity_calib_by_driver)
|
2011-02-22 02:27:26 +07:00
|
|
|
DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR);
|
2011-10-24 21:49:25 +07:00
|
|
|
if (il->cfg->base_params->chain_noise_calib_by_driver)
|
2011-02-22 02:27:26 +07:00
|
|
|
DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR);
|
|
|
|
DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR);
|
|
|
|
DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR);
|
|
|
|
DEBUGFS_ADD_FILE(wd_timeout, dir_debug, S_IWUSR);
|
2011-10-24 21:49:25 +07:00
|
|
|
if (il->cfg->base_params->sensitivity_calib_by_driver)
|
2011-02-22 02:27:26 +07:00
|
|
|
DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf,
|
2011-10-24 21:49:25 +07:00
|
|
|
&il->disable_sens_cal);
|
|
|
|
if (il->cfg->base_params->chain_noise_calib_by_driver)
|
2011-02-22 02:27:26 +07:00
|
|
|
DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf,
|
2011-10-24 21:49:25 +07:00
|
|
|
&il->disable_chain_noise_cal);
|
2011-02-22 02:27:26 +07:00
|
|
|
DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf,
|
2011-10-24 21:49:25 +07:00
|
|
|
&il->disable_tx_power_cal);
|
2011-02-22 02:27:26 +07:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
err:
|
2011-08-19 03:07:57 +07:00
|
|
|
IL_ERR("Can't create the debugfs directory\n");
|
2011-10-24 21:49:25 +07:00
|
|
|
il_dbgfs_unregister(il);
|
2011-02-22 02:27:26 +07:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2011-10-24 20:41:30 +07:00
|
|
|
EXPORT_SYMBOL(il_dbgfs_register);
|
2011-02-22 02:27:26 +07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove the debugfs files and directories
|
|
|
|
*
|
|
|
|
*/
|
2011-10-24 21:49:25 +07:00
|
|
|
void il_dbgfs_unregister(struct il_priv *il)
|
2011-02-22 02:27:26 +07:00
|
|
|
{
|
2011-10-24 21:49:25 +07:00
|
|
|
if (!il->debugfs_dir)
|
2011-02-22 02:27:26 +07:00
|
|
|
return;
|
|
|
|
|
2011-10-24 21:49:25 +07:00
|
|
|
debugfs_remove_recursive(il->debugfs_dir);
|
|
|
|
il->debugfs_dir = NULL;
|
2011-02-22 02:27:26 +07:00
|
|
|
}
|
2011-10-24 20:41:30 +07:00
|
|
|
EXPORT_SYMBOL(il_dbgfs_unregister);
|