2014-05-11 08:04:31 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2008-2011 Atheros Communications Inc.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
|
|
|
struct ath_hw *ah = file->private_data;
|
|
|
|
u32 len = 0, size = 6000;
|
|
|
|
char *buf;
|
|
|
|
size_t retval;
|
|
|
|
|
|
|
|
buf = kzalloc(size, GFP_KERNEL);
|
|
|
|
if (buf == NULL)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
len = ah->eep_ops->dump_eeprom(ah, false, buf, len, size);
|
|
|
|
|
|
|
|
retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
|
|
|
kfree(buf);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct file_operations fops_modal_eeprom = {
|
|
|
|
.read = read_file_modal_eeprom,
|
|
|
|
.open = simple_open,
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
.llseek = default_llseek,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void ath9k_cmn_debug_modal_eeprom(struct dentry *debugfs_phy,
|
|
|
|
struct ath_hw *ah)
|
|
|
|
{
|
|
|
|
debugfs_create_file("modal_eeprom", S_IRUSR, debugfs_phy, ah,
|
|
|
|
&fops_modal_eeprom);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(ath9k_cmn_debug_modal_eeprom);
|
2014-05-11 08:04:33 +00:00
|
|
|
|
|
|
|
static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
|
|
|
struct ath_hw *ah = file->private_data;
|
|
|
|
u32 len = 0, size = 1500;
|
|
|
|
ssize_t retval = 0;
|
|
|
|
char *buf;
|
|
|
|
|
|
|
|
buf = kzalloc(size, GFP_KERNEL);
|
|
|
|
if (!buf)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
len = ah->eep_ops->dump_eeprom(ah, true, buf, len, size);
|
|
|
|
|
|
|
|
retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
|
|
|
kfree(buf);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct file_operations fops_base_eeprom = {
|
|
|
|
.read = read_file_base_eeprom,
|
|
|
|
.open = simple_open,
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
.llseek = default_llseek,
|
|
|
|
};
|
|
|
|
|
|
|
|
void ath9k_cmn_debug_base_eeprom(struct dentry *debugfs_phy,
|
|
|
|
struct ath_hw *ah)
|
|
|
|
{
|
|
|
|
debugfs_create_file("base_eeprom", S_IRUSR, debugfs_phy, ah,
|
|
|
|
&fops_base_eeprom);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(ath9k_cmn_debug_base_eeprom);
|
2014-05-11 08:04:36 +00:00
|
|
|
|
|
|
|
void ath9k_cmn_debug_stat_rx(struct ath_rx_stats *rxstats,
|
|
|
|
struct ath_rx_status *rs)
|
|
|
|
{
|
|
|
|
#define RX_PHY_ERR_INC(c) rxstats->phy_err_stats[c]++
|
|
|
|
#define RX_CMN_STAT_INC(c) (rxstats->c++)
|
|
|
|
|
|
|
|
RX_CMN_STAT_INC(rx_pkts_all);
|
|
|
|
rxstats->rx_bytes_all += rs->rs_datalen;
|
|
|
|
|
|
|
|
if (rs->rs_status & ATH9K_RXERR_CRC)
|
|
|
|
RX_CMN_STAT_INC(crc_err);
|
|
|
|
if (rs->rs_status & ATH9K_RXERR_DECRYPT)
|
|
|
|
RX_CMN_STAT_INC(decrypt_crc_err);
|
|
|
|
if (rs->rs_status & ATH9K_RXERR_MIC)
|
|
|
|
RX_CMN_STAT_INC(mic_err);
|
|
|
|
if (rs->rs_status & ATH9K_RX_DELIM_CRC_PRE)
|
|
|
|
RX_CMN_STAT_INC(pre_delim_crc_err);
|
|
|
|
if (rs->rs_status & ATH9K_RX_DELIM_CRC_POST)
|
|
|
|
RX_CMN_STAT_INC(post_delim_crc_err);
|
|
|
|
if (rs->rs_status & ATH9K_RX_DECRYPT_BUSY)
|
|
|
|
RX_CMN_STAT_INC(decrypt_busy_err);
|
|
|
|
|
|
|
|
if (rs->rs_status & ATH9K_RXERR_PHY) {
|
|
|
|
RX_CMN_STAT_INC(phy_err);
|
|
|
|
if (rs->rs_phyerr < ATH9K_PHYERR_MAX)
|
|
|
|
RX_PHY_ERR_INC(rs->rs_phyerr);
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef RX_CMN_STAT_INC
|
|
|
|
#undef RX_PHY_ERR_INC
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(ath9k_cmn_debug_stat_rx);
|