ath9k & ath9k_htc: remove some debugfs code dups
cover ath9k & ath9k_htc: remove some debugfs code dups
some debugfs related parts in this drivers are identical or almost identical. This patch set remove most obvious parts.
Module sizes before patch set:ath9k_htc 81196
ath9k 125783ath9k_common 8185
Module sizes after patch set:ath9k_htc 63361
ath9k 121433ath9k_common 13145
Oleksij Rempel (10):
ath9k-common: create common-debug and move modal_eeprom to cmn
ath9k_htc: use ath9k_cmn_debug_modal_eeprom
ath9k: move base_eeprom debug code to ath9k_cmn_debug_base_eeprom
ath9k_htc: use ath9k_cmn_debug_base_eeprom
ath9k: reorder or remove some includes
ath9k & ath9k_htc: move ath_rx_stats to cmn
ath9k: move recv to ath9k_cmn_debug_recv
ath9k_htc: use ath9k_cmn_debug_recv
ath9k: move phy_err to ath9k_cmn_debug_phy_err
ath9k_htc: use ath9k_cmn_debug_phy_err
drivers/net/wireless/ath/ath9k/Makefile | 3 +- drivers/net/wireless/ath/ath9k/ath9k.h | 2 +- drivers/net/wireless/ath/ath9k/common-debug.c | 253 +++++++++++ drivers/net/wireless/ath/ath9k/common-debug.h | 72 ++++ drivers/net/wireless/ath/ath9k/common.h | 1 + drivers/net/wireless/ath/ath9k/debug.c | 214 +--------- drivers/net/wireless/ath/ath9k/debug.h | 44 -- drivers/net/wireless/ath/ath9k/htc.h | 17 +- drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 555 ++----------------------- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 3 +- drivers/net/wireless/ath/ath9k/hw.c | 1 - 11 files changed, 377 insertions(+), 788 deletions(-) create mode 100644 drivers/net/wireless/ath/ath9k/common-debug.c create mode 100644 drivers/net/wireless/ath/ath9k/common-debug.h
Signature · 1 line
1.9.1
PATCH 1/10 ath9k-common: create common-debug and move modal_eeprom to cmn
--- drivers/net/wireless/ath/ath9k/Makefile | 3 +- drivers/net/wireless/ath/ath9k/common-debug.c | 53 +++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/common-debug.h | 18 +++++++++ drivers/net/wireless/ath/ath9k/common.h | 1 + drivers/net/wireless/ath/ath9k/debug.c | 33 ++--------------- 5 files changed, 77 insertions(+), 31 deletions(-) create mode 100644 drivers/net/wireless/ath/ath9k/common-debug.c create mode 100644 drivers/net/wireless/ath/ath9k/common-debug.h
drivers/net/wireless/ath/ath9k/Makefile +2 -1
@@ -53,7 +53,8 @@ obj-$(CONFIG_ATH9K_HW) += ath9k_hw.o obj-$(CONFIG_ATH9K_COMMON) += ath9k_common.o ath9k_common-y:= common.o \ common-init.o \ - common-beacon.o + common-beacon.o \ + common-debug.o ath9k_htc-y += htc_hst.o \ hif_usb.o \
drivers/net/wireless/ath/ath9k/common-debug.c new file +53 -0
53 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/common-debug.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* 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. +*/ + +void ath9k_cmn_debug_modal_eeprom (struct dentry *debugfs_phy, +struct ath_hw *ah);
drivers/net/wireless/ath/ath9k/common.h +1 -0
@@ -23,6 +23,7 @@#include "common-init.h" #include "common-beacon.h" +#include "common-debug.h" /* Common header for Atheros 802.11n base driver cores */
drivers/net/wireless/ath/ath9k/debug.c +3 -30
@@ -1296,34 +1296,6 @@ static const struct file_operations fops_base_eeprom = { .llseek = default_llseek, }; -static ssize_t read_file_modal_eeprom (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos) -{ -struct ath_softc *sc = file->private_data; -struct ath_hw *ah = sc->sc_ah; -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, -}; -#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT static ssize_t read_file_btcoex (struct file *file,char __user *user_buf,size_t count,loff_t *ppos)
@@ -1549,8 +1521,9 @@ int ath9k_init_debug(struct ath_hw *ah) &fops_dump_nfcal);debugfs_create_file ("base_eeprom" ,S_IRUSR , sc->debug.debugfs_phy, sc, &fops_base_eeprom); -debugfs_create_file ("modal_eeprom" ,S_IRUSR , sc->debug.debugfs_phy, sc, - &fops_modal_eeprom); + +ath9k_cmn_debug_modal_eeprom (sc->debug.debugfs_phy, sc->sc_ah); +debugfs_create_u32 ("gpio_mask" ,S_IRUSR |S_IWUSR , sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR,
Signature · 1 line
1.9.1
PATCH 2/10 ath9k_htc: use ath9k_cmn_debug_modal_eeprom
In reply to Oleksij Rempel--- drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 286 +------------------------ 1 file changed, 2 insertions(+), 284 deletions(-)
drivers/net/wireless/ath/ath9k/htc_drv_debug.c +2 -284
@@ -621,288 +621,6 @@ static const struct file_operations fops_base_eeprom = { .llseek = default_llseek, }; -static ssize_t read_4k_modal_eeprom (struct file *file, -char __user *user_buf, -size_t count,loff_t *ppos) -{ -#define PR_EEP (_s, _val) \ - do { \ - len += scnprintf(buf + len, size - len, "%20s : %10d\n",\ - _s, (_val)); \ - } while (0) - -struct ath9k_htc_priv *priv = file->private_data; -struct modal_eep_4k_header *pModal = &priv->ah->eeprom.map4k.modalHeader; -unsigned int len =0 , size =2048 ; -ssize_t retval =0 ; -char *buf; - - buf =kzalloc (size,GFP_KERNEL ); -if (buf ==NULL ) -return -ENOMEM ; - -PR_EEP ("Chain0 Ant. Control" , pModal->antCtrlChain[0 ]); -PR_EEP ("Ant. Common Control" , pModal->antCtrlCommon); -PR_EEP ("Chain0 Ant. Gain" , pModal->antennaGainCh[0 ]); -PR_EEP ("Switch Settle" , pModal->switchSettling); -PR_EEP ("Chain0 TxRxAtten" , pModal->txRxAttenCh[0 ]); -PR_EEP ("Chain0 RxTxMargin" , pModal->rxTxMarginCh[0 ]); -PR_EEP ("ADC Desired size" , pModal->adcDesiredSize); -PR_EEP ("PGA Desired size" , pModal->pgaDesiredSize); -PR_EEP ("Chain0 xlna Gain" , pModal->xlnaGainCh[0 ]); -PR_EEP ("txEndToXpaOff" , pModal->txEndToXpaOff); -PR_EEP ("txEndToRxOn" , pModal->txEndToRxOn); -PR_EEP ("txFrameToXpaOn" , pModal->txFrameToXpaOn); -PR_EEP ("CCA Threshold)" , pModal->thresh62); -PR_EEP ("Chain0 NF Threshold" , pModal->noiseFloorThreshCh[0 ]); -PR_EEP ("xpdGain" , pModal->xpdGain); -PR_EEP ("External PD" , pModal->xpd); -PR_EEP ("Chain0 I Coefficient" , pModal->iqCalICh[0 ]); -PR_EEP ("Chain0 Q Coefficient" , pModal->iqCalQCh[0 ]); -PR_EEP ("pdGainOverlap" , pModal->pdGainOverlap); -PR_EEP ("O/D Bias Version" , pModal->version); -PR_EEP ("CCK OutputBias" , pModal->ob_0); -PR_EEP ("BPSK OutputBias" , pModal->ob_1); -PR_EEP ("QPSK OutputBias" , pModal->ob_2); -PR_EEP ("16QAM OutputBias" , pModal->ob_3); -PR_EEP ("64QAM OutputBias" , pModal->ob_4); -PR_EEP ("CCK Driver1_Bias" , pModal->db1_0); -PR_EEP ("BPSK Driver1_Bias" , pModal->db1_1); -PR_EEP ("QPSK Driver1_Bias" , pModal->db1_2); -PR_EEP ("16QAM Driver1_Bias" , pModal->db1_3); -PR_EEP ("64QAM Driver1_Bias" , pModal->db1_4); -PR_EEP ("CCK Driver2_Bias" , pModal->db2_0); -PR_EEP ("BPSK Driver2_Bias" , pModal->db2_1); -PR_EEP ("QPSK Driver2_Bias" , pModal->db2_2); -PR_EEP ("16QAM Driver2_Bias" , pModal->db2_3); -PR_EEP ("64QAM Driver2_Bias" , pModal->db2_4); -PR_EEP ("xPA Bias Level" , pModal->xpaBiasLvl); -PR_EEP ("txFrameToDataStart" , pModal->txFrameToDataStart); -PR_EEP ("txFrameToPaOn" , pModal->txFrameToPaOn); -PR_EEP ("HT40 Power Inc." , pModal->ht40PowerIncForPdadc); -PR_EEP ("Chain0 bswAtten" , pModal->bswAtten[0 ]); -PR_EEP ("Chain0 bswMargin" , pModal->bswMargin[0 ]); -PR_EEP ("HT40 Switch Settle" , pModal->swSettleHt40); -PR_EEP ("Chain0 xatten2Db" , pModal->xatten2Db[0 ]); -PR_EEP ("Chain0 xatten2Margin" , pModal->xatten2Margin[0 ]); -PR_EEP ("Ant. Diversity ctl1" , pModal->antdiv_ctl1); -PR_EEP ("Ant. Diversity ctl2" , pModal->antdiv_ctl2); -PR_EEP ("TX Diversity" , pModal->tx_diversity); - -if (len > size) - len = size; - - retval =simple_read_from_buffer (user_buf, count, ppos, buf, len); -kfree (buf); - -return retval; - -#undef PR_EEP -} - -static ssize_t read_def_modal_eeprom (struct file *file, -char __user *user_buf, -size_t count,loff_t *ppos) -{ -#define PR_EEP (_s, _val) \ - do { \ - if (pBase->opCapFlags & AR5416_OPFLAGS_11G) { \ - pModal = &priv->ah->eeprom.def.modalHeader[1]; \ - len += scnprintf(buf + len, size - len, "%20s : %8d%7s", \ - _s, (_val), "|"); \ - } \ - if (pBase->opCapFlags & AR5416_OPFLAGS_11A) { \ - pModal = &priv->ah->eeprom.def.modalHeader[0]; \ - len += scnprintf(buf + len, size - len, "%9d\n",\ - (_val)); \ - } \ - } while (0) - -struct ath9k_htc_priv *priv = file->private_data; -struct base_eep_header *pBase = &priv->ah->eeprom.def.baseEepHeader; -struct modal_eep_header *pModal =NULL ; -unsigned int len =0 , size =3500 ; -ssize_t retval =0 ; -char *buf; - - buf =kzalloc (size,GFP_KERNEL ); -if (buf ==NULL ) -return -ENOMEM ; - - len +=scnprintf (buf + len, size - len, -"%31s %15s\n" ,"2G" ,"5G" ); - len +=scnprintf (buf + len, size - len, -"%32s %16s\n" ,"====" ,"====\n" ); - -PR_EEP ("Chain0 Ant. Control" , pModal->antCtrlChain[0 ]); -PR_EEP ("Chain1 Ant. Control" , pModal->antCtrlChain[1 ]); -PR_EEP ("Chain2 Ant. Control" , pModal->antCtrlChain[2 ]); -PR_EEP ("Ant. Common Control" , pModal->antCtrlCommon); -PR_EEP ("Chain0 Ant. Gain" , pModal->antennaGainCh[0 ]); -PR_EEP ("Chain1 Ant. Gain" , pModal->antennaGainCh[1 ]); -PR_EEP ("Chain2 Ant. Gain" , pModal->antennaGainCh[2 ]); -PR_EEP ("Switch Settle" , pModal->switchSettling); -PR_EEP ("Chain0 TxRxAtten" , pModal->txRxAttenCh[0 ]); -PR_EEP ("Chain1 TxRxAtten" , pModal->txRxAttenCh[1 ]); -PR_EEP ("Chain2 TxRxAtten" , pModal->txRxAttenCh[2 ]); -PR_EEP ("Chain0 RxTxMargin" , pModal->rxTxMarginCh[0 ]); -PR_EEP ("Chain1 RxTxMargin" , pModal->rxTxMarginCh[1 ]); -PR_EEP ("Chain2 RxTxMargin" , pModal->rxTxMarginCh[2 ]); -PR_EEP ("ADC Desired size" , pModal->adcDesiredSize); -PR_EEP ("PGA Desired size" , pModal->pgaDesiredSize); -PR_EEP ("Chain0 xlna Gain" , pModal->xlnaGainCh[0 ]); -PR_EEP ("Chain1 xlna Gain" , pModal->xlnaGainCh[1 ]); -PR_EEP ("Chain2 xlna Gain" , pModal->xlnaGainCh[2 ]); -PR_EEP ("txEndToXpaOff" , pModal->txEndToXpaOff); -PR_EEP ("txEndToRxOn" , pModal->txEndToRxOn); -PR_EEP ("txFrameToXpaOn" , pModal->txFrameToXpaOn); -PR_EEP ("CCA Threshold)" , pModal->thresh62); -PR_EEP ("Chain0 NF Threshold" , pModal->noiseFloorThreshCh[0 ]); -PR_EEP ("Chain1 NF Threshold" , pModal->noiseFloorThreshCh[1 ]); -PR_EEP ("Chain2 NF Threshold" , pModal->noiseFloorThreshCh[2 ]); -PR_EEP ("xpdGain" , pModal->xpdGain); -PR_EEP ("External PD" , pModal->xpd); -PR_EEP ("Chain0 I Coefficient" , pModal->iqCalICh[0 ]); -PR_EEP ("Chain1 I Coefficient" , pModal->iqCalICh[1 ]); -PR_EEP ("Chain2 I Coefficient" , pModal->iqCalICh[2 ]); -PR_EEP ("Chain0 Q Coefficient" , pModal->iqCalQCh[0 ]); -PR_EEP ("Chain1 Q Coefficient" , pModal->iqCalQCh[1 ]); -PR_EEP ("Chain2 Q Coefficient" , pModal->iqCalQCh[2 ]); -PR_EEP ("pdGainOverlap" , pModal->pdGainOverlap); -PR_EEP ("Chain0 OutputBias" , pModal->ob); -PR_EEP ("Chain0 DriverBias" , pModal->db); -PR_EEP ("xPA Bias Level" , pModal->xpaBiasLvl); -PR_EEP ("2chain pwr decrease" , pModal->pwrDecreaseFor2Chain); -PR_EEP ("3chain pwr decrease" , pModal->pwrDecreaseFor3Chain); -PR_EEP ("txFrameToDataStart" , pModal->txFrameToDataStart); -PR_EEP ("txFrameToPaOn" , pModal->txFrameToPaOn); -PR_EEP ("HT40 Power Inc." , pModal->ht40PowerIncForPdadc); -PR_EEP ("Chain0 bswAtten" , pModal->bswAtten[0 ]); -PR_EEP ("Chain1 bswAtten" , pModal->bswAtten[1 ]); -PR_EEP ("Chain2 bswAtten" , pModal->bswAtten[2 ]); -PR_EEP ("Chain0 bswMargin" , pModal->bswMargin[0 ]); -PR_EEP ("Chain1 bswMargin" , pModal->bswMargin[1 ]); -PR_EEP ("Chain2 bswMargin" , pModal->bswMargin[2 ]); -PR_EEP ("HT40 Switch Settle" , pModal->swSettleHt40); -PR_EEP ("Chain0 xatten2Db" , pModal->xatten2Db[0 ]); -PR_EEP ("Chain1 xatten2Db" , pModal->xatten2Db[1 ]); -PR_EEP ("Chain2 xatten2Db" , pModal->xatten2Db[2 ]); -PR_EEP ("Chain0 xatten2Margin" , pModal->xatten2Margin[0 ]); -PR_EEP ("Chain1 xatten2Margin" , pModal->xatten2Margin[1 ]); -PR_EEP ("Chain2 xatten2Margin" , pModal->xatten2Margin[2 ]); -PR_EEP ("Chain1 OutputBias" , pModal->ob_ch1); -PR_EEP ("Chain1 DriverBias" , pModal->db_ch1); -PR_EEP ("LNA Control" , pModal->lna_ctl); -PR_EEP ("XPA Bias Freq0" , pModal->xpaBiasLvlFreq[0 ]); -PR_EEP ("XPA Bias Freq1" , pModal->xpaBiasLvlFreq[1 ]); -PR_EEP ("XPA Bias Freq2" , pModal->xpaBiasLvlFreq[2 ]); - -if (len > size) - len = size; - - retval =simple_read_from_buffer (user_buf, count, ppos, buf, len); -kfree (buf); - -return retval; - -#undef PR_EEP -} - -static ssize_t read_9287_modal_eeprom (struct file *file, -char __user *user_buf, -size_t count,loff_t *ppos) -{ -#define PR_EEP (_s, _val) \ - do { \ - len += scnprintf(buf + len, size - len, "%20s : %10d\n",\ - _s, (_val)); \ - } while (0) - -struct ath9k_htc_priv *priv = file->private_data; -struct modal_eep_ar9287_header *pModal = &priv->ah->eeprom.map9287.modalHeader; -unsigned int len =0 , size =3000 ; -ssize_t retval =0 ; -char *buf; - - buf =kzalloc (size,GFP_KERNEL ); -if (buf ==NULL ) -return -ENOMEM ; - -PR_EEP ("Chain0 Ant. Control" , pModal->antCtrlChain[0 ]); -PR_EEP ("Chain1 Ant. Control" , pModal->antCtrlChain[1 ]); -PR_EEP ("Ant. Common Control" , pModal->antCtrlCommon); -PR_EEP ("Chain0 Ant. Gain" , pModal->antennaGainCh[0 ]); -PR_EEP ("Chain1 Ant. Gain" , pModal->antennaGainCh[1 ]); -PR_EEP ("Switch Settle" , pModal->switchSettling); -PR_EEP ("Chain0 TxRxAtten" , pModal->txRxAttenCh[0 ]); -PR_EEP ("Chain1 TxRxAtten" , pModal->txRxAttenCh[1 ]); -PR_EEP ("Chain0 RxTxMargin" , pModal->rxTxMarginCh[0 ]); -PR_EEP ("Chain1 RxTxMargin" , pModal->rxTxMarginCh[1 ]); -PR_EEP ("ADC Desired size" , pModal->adcDesiredSize); -PR_EEP ("txEndToXpaOff" , pModal->txEndToXpaOff); -PR_EEP ("txEndToRxOn" , pModal->txEndToRxOn); -PR_EEP ("txFrameToXpaOn" , pModal->txFrameToXpaOn); -PR_EEP ("CCA Threshold)" , pModal->thresh62); -PR_EEP ("Chain0 NF Threshold" , pModal->noiseFloorThreshCh[0 ]); -PR_EEP ("Chain1 NF Threshold" , pModal->noiseFloorThreshCh[1 ]); -PR_EEP ("xpdGain" , pModal->xpdGain); -PR_EEP ("External PD" , pModal->xpd); -PR_EEP ("Chain0 I Coefficient" , pModal->iqCalICh[0 ]); -PR_EEP ("Chain1 I Coefficient" , pModal->iqCalICh[1 ]); -PR_EEP ("Chain0 Q Coefficient" , pModal->iqCalQCh[0 ]); -PR_EEP ("Chain1 Q Coefficient" , pModal->iqCalQCh[1 ]); -PR_EEP ("pdGainOverlap" , pModal->pdGainOverlap); -PR_EEP ("xPA Bias Level" , pModal->xpaBiasLvl); -PR_EEP ("txFrameToDataStart" , pModal->txFrameToDataStart); -PR_EEP ("txFrameToPaOn" , pModal->txFrameToPaOn); -PR_EEP ("HT40 Power Inc." , pModal->ht40PowerIncForPdadc); -PR_EEP ("Chain0 bswAtten" , pModal->bswAtten[0 ]); -PR_EEP ("Chain1 bswAtten" , pModal->bswAtten[1 ]); -PR_EEP ("Chain0 bswMargin" , pModal->bswMargin[0 ]); -PR_EEP ("Chain1 bswMargin" , pModal->bswMargin[1 ]); -PR_EEP ("HT40 Switch Settle" , pModal->swSettleHt40); -PR_EEP ("AR92x7 Version" , pModal->version); -PR_EEP ("DriverBias1" , pModal->db1); -PR_EEP ("DriverBias2" , pModal->db1); -PR_EEP ("CCK OutputBias" , pModal->ob_cck); -PR_EEP ("PSK OutputBias" , pModal->ob_psk); -PR_EEP ("QAM OutputBias" , pModal->ob_qam); -PR_EEP ("PAL_OFF OutputBias" , pModal->ob_pal_off); - -if (len > size) - len = size; - - retval =simple_read_from_buffer (user_buf, count, ppos, buf, len); -kfree (buf); - -return retval; - -#undef PR_EEP -} - -static ssize_t read_file_modal_eeprom (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos) -{ -struct ath9k_htc_priv *priv = file->private_data; - -if (AR_SREV_9271 (priv->ah)) -return read_4k_modal_eeprom (file, user_buf, count, ppos); -else if (priv->ah->hw_version.usbdev ==AR9280_USB ) -return read_def_modal_eeprom (file, user_buf, count, ppos); -else if (priv->ah->hw_version.usbdev ==AR9287_USB ) -return read_9287_modal_eeprom (file, user_buf, count, ppos); - -return 0 ; -} - -static const struct file_operations fops_modal_eeprom = { - .read = read_file_modal_eeprom, - .open = simple_open, - .owner =THIS_MODULE , - .llseek = default_llseek, -}; - -/* Ethtool support for get-stats */ #define AMKSTR (nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO"static const char ath9k_htc_gstrings_stats[][ETH_GSTRING_LEN ] = {
@@ -1011,8 +729,8 @@ int ath9k_htc_init_debug(struct ath_hw *ah) priv, &fops_debug);debugfs_create_file ("base_eeprom" ,S_IRUSR , priv->debug.debugfs_phy, priv, &fops_base_eeprom); -debugfs_create_file ("modal_eeprom" ,S_IRUSR , priv->debug.debugfs_phy, - priv, &fops_modal_eeprom); + +ath9k_cmn_debug_modal_eeprom (priv->debug.debugfs_phy, priv->ah);return 0 ; }
Signature · 1 line
1.9.1
PATCH 3/10 ath9k: move base_eeprom debug code to ath9k_cmn_debug_base_eeprom
In reply to Oleksij Rempel--- drivers/net/wireless/ath/ath9k/common-debug.c | 35 +++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/common-debug.h | 2 ++ drivers/net/wireless/ath/ath9k/debug.c | 31 +----------------------- 3 files changed, 38 insertions(+), 30 deletions(-)
drivers/net/wireless/ath/ath9k/common-debug.c +35 -0
@@ -51,3 +51,38 @@ void ath9k_cmn_debug_modal_eeprom(struct dentry *debugfs_phy, &fops_modal_eeprom); }EXPORT_SYMBOL (ath9k_cmn_debug_modal_eeprom); + +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);
drivers/net/wireless/ath/ath9k/common-debug.h +2 -0
@@ -16,3 +16,5 @@void ath9k_cmn_debug_modal_eeprom (struct dentry *debugfs_phy,struct ath_hw *ah); +void ath9k_cmn_debug_base_eeprom (struct dentry *debugfs_phy, +struct ath_hw *ah);
drivers/net/wireless/ath/ath9k/debug.c +1 -30
@@ -1268,34 +1268,6 @@ static const struct file_operations fops_dump_nfcal = { .llseek = default_llseek, }; -static ssize_t read_file_base_eeprom (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos) -{ -struct ath_softc *sc = file->private_data; -struct ath_hw *ah = sc->sc_ah; -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, -}; -#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT static ssize_t read_file_btcoex (struct file *file,char __user *user_buf,size_t count,loff_t *ppos)
@@ -1519,9 +1491,8 @@ int ath9k_init_debug(struct ath_hw *ah) &fops_regdump);debugfs_create_file ("dump_nfcal" ,S_IRUSR , sc->debug.debugfs_phy, sc, &fops_dump_nfcal); -debugfs_create_file ("base_eeprom" ,S_IRUSR , sc->debug.debugfs_phy, sc, - &fops_base_eeprom); +ath9k_cmn_debug_base_eeprom (sc->debug.debugfs_phy, sc->sc_ah);ath9k_cmn_debug_modal_eeprom (sc->debug.debugfs_phy, sc->sc_ah); debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR,
Signature · 1 line
1.9.1
PATCH 4/10 ath9k_htc: use ath9k_cmn_debug_base_eeprom
In reply to Oleksij Rempel--- drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 138 +------------------------ 1 file changed, 1 insertion(+), 137 deletions(-)
drivers/net/wireless/ath/ath9k/htc_drv_debug.c +1 -137
@@ -486,141 +486,6 @@ static const struct file_operations fops_debug = { .llseek = default_llseek, }; -static ssize_t read_file_base_eeprom (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos) -{ -struct ath9k_htc_priv *priv = file->private_data; -struct ath_common *common =ath9k_hw_common (priv->ah); -struct base_eep_header *pBase =NULL ; -unsigned int len =0 , size =1500 ; -ssize_t retval =0 ; -char *buf; - - pBase =ath9k_htc_get_eeprom_base (priv); - -if (pBase ==NULL ) { -ath_err (common,"Unknown EEPROM type\n" ); -return 0 ; - } - - buf =kzalloc (size,GFP_KERNEL ); -if (buf ==NULL ) -return -ENOMEM ; - - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" ,"Major Version" , - pBase->version >>12 ); - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" ,"Minor Version" , - pBase->version &0xFFF ); - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" ,"Checksum" , - pBase->checksum); - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" ,"Length" , - pBase->length); - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" ,"RegDomain1" , - pBase->regDmn[0 ]); - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" ,"RegDomain2" , - pBase->regDmn[1 ]); - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" , -"TX Mask" , pBase->txMask); - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" , -"RX Mask" , pBase->rxMask); - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" , -"Allow 5GHz" , - !!(pBase->opCapFlags &AR5416_OPFLAGS_11A )); - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" , -"Allow 2GHz" , - !!(pBase->opCapFlags &AR5416_OPFLAGS_11G )); - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" , -"Disable 2GHz HT20" , - !!(pBase->opCapFlags &AR5416_OPFLAGS_N_2G_HT20 )); - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" , -"Disable 2GHz HT40" , - !!(pBase->opCapFlags &AR5416_OPFLAGS_N_2G_HT40 )); - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" , -"Disable 5Ghz HT20" , - !!(pBase->opCapFlags &AR5416_OPFLAGS_N_5G_HT20 )); - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" , -"Disable 5Ghz HT40" , - !!(pBase->opCapFlags &AR5416_OPFLAGS_N_5G_HT40 )); - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" , -"Big Endian" , - !!(pBase->eepMisc &0x01 )); - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" , -"Cal Bin Major Ver" , - (pBase->binBuildNumber >>24 ) &0xFF ); - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" , -"Cal Bin Minor Ver" , - (pBase->binBuildNumber >>16 ) &0xFF ); - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" , -"Cal Bin Build" , - (pBase->binBuildNumber >>8 ) &0xFF ); - -/* -* UB91 specific data. -*/ -if (AR_SREV_9271 (priv->ah)) { -struct base_eep_header_4k *pBase4k = - &priv->ah->eeprom.map4k.baseEepHeader; - - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" , -"TX Gain type" , - pBase4k->txGainType); - } - -/* -* UB95 specific data. -*/ -if (priv->ah->hw_version.usbdev ==AR9287_USB ) { -struct base_eep_ar9287_header *pBase9287 = - &priv->ah->eeprom.map9287.baseEepHeader; - - len +=scnprintf (buf + len, size - len, -"%20s : %10ddB\n" , -"Power Table Offset" , - pBase9287->pwrTableOffset); - - len +=scnprintf (buf + len, size - len, -"%20s : %10d\n" , -"OpenLoop Power Ctrl" , - pBase9287->openLoopPwrCntl); - } - - len +=scnprintf (buf + len, size - len,"%20s : %pM\n" ,"MacAddress" , - pBase->macAddr); -if (len > size) - 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, -}; -/* Ethtool support for get-stats */ #define AMKSTR (nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO"static const char ath9k_htc_gstrings_stats[][ETH_GSTRING_LEN ] = {
@@ -727,9 +592,8 @@ int ath9k_htc_init_debug(struct ath_hw *ah) priv, &fops_queue);debugfs_create_file ("debug" ,S_IRUSR |S_IWUSR , priv->debug.debugfs_phy, priv, &fops_debug); -debugfs_create_file ("base_eeprom" ,S_IRUSR , priv->debug.debugfs_phy, - priv, &fops_base_eeprom); +ath9k_cmn_debug_base_eeprom (priv->debug.debugfs_phy, priv->ah);ath9k_cmn_debug_modal_eeprom (priv->debug.debugfs_phy, priv->ah);return 0 ;
Signature · 1 line
1.9.1
PATCH 5/10 ath9k: reorder or remove some includes
In reply to Oleksij Rempelto fix compile errors
--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 +- drivers/net/wireless/ath/ath9k/hw.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -1
@@ -23,8 +23,8 @@#include <linux/leds.h> #include <linux/completion.h> -#include "debug.h" #include "common.h" +#include "debug.h" #include "mci.h" #include "dfs.h" #include "spectral.h"
drivers/net/wireless/ath/ath9k/hw.c +0 -1
@@ -26,7 +26,6 @@#include "ar9003_mac.h" #include "ar9003_mci.h" #include "ar9003_phy.h" -#include "debug.h" #include "ath9k.h" static bool ath9k_hw_set_reset_reg (struct ath_hw *ah,u32 type);
Signature · 1 line
1.9.1
PATCH 6/10 ath9k & ath9k_htc: move ath_rx_stats to cmn
In reply to Oleksij Rempeland use it. This move need changes in both drivers.
--- drivers/net/wireless/ath/ath9k/common-debug.c | 33 ++++++++++ drivers/net/wireless/ath/ath9k/common-debug.h | 48 ++++++++++++++ drivers/net/wireless/ath/ath9k/debug.c | 26 +------- drivers/net/wireless/ath/ath9k/debug.h | 44 ------------- drivers/net/wireless/ath/ath9k/htc.h | 17 ++--- drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 88 +++++++------------------- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 3 +- 7 files changed, 111 insertions(+), 148 deletions(-)
drivers/net/wireless/ath/ath9k/common-debug.c +33 -0
@@ -86,3 +86,36 @@ void ath9k_cmn_debug_base_eeprom(struct dentry *debugfs_phy, &fops_base_eeprom); }EXPORT_SYMBOL (ath9k_cmn_debug_base_eeprom); + +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);
drivers/net/wireless/ath/ath9k/common-debug.h +48 -0
55 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/debug.c +1 -25
@@ -998,31 +998,7 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf,void ath_debug_stat_rx (struct ath_softc *sc,struct ath_rx_status *rs) { -#define RX_PHY_ERR_INC (c) sc->debug.stats.rxstats.phy_err_stats[c]++ - -RX_STAT_INC (rx_pkts_all); - sc->debug.stats.rxstats.rx_bytes_all += rs->rs_datalen; - -if (rs->rs_status &ATH9K_RXERR_CRC ) -RX_STAT_INC (crc_err); -if (rs->rs_status &ATH9K_RXERR_DECRYPT ) -RX_STAT_INC (decrypt_crc_err); -if (rs->rs_status &ATH9K_RXERR_MIC ) -RX_STAT_INC (mic_err); -if (rs->rs_status &ATH9K_RX_DELIM_CRC_PRE ) -RX_STAT_INC (pre_delim_crc_err); -if (rs->rs_status &ATH9K_RX_DELIM_CRC_POST ) -RX_STAT_INC (post_delim_crc_err); -if (rs->rs_status &ATH9K_RX_DECRYPT_BUSY ) -RX_STAT_INC (decrypt_busy_err); - -if (rs->rs_status &ATH9K_RXERR_PHY ) { -RX_STAT_INC (phy_err); -if (rs->rs_phyerr <ATH9K_PHYERR_MAX ) -RX_PHY_ERR_INC (rs->rs_phyerr); - } - -#undef RX_PHY_ERR_INC +ath9k_cmn_debug_stat_rx (&sc->debug.stats.rxstats, rs); }static const struct file_operations fops_recv = {
drivers/net/wireless/ath/ath9k/debug.h +0 -44
50 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/htc.h +5 -12
@@ -325,14 +325,14 @@ static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(struct sk_buff *skb)#define TX_STAT_INC (c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++)#define TX_STAT_ADD (c, a) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) -#define RX_STAT_INC (c) (hif_dev->htc_handle->drv_priv->debug.rx_stats.c++) -#define RX_STAT_ADD (c, a) (hif_dev->htc_handle->drv_priv->debug.rx_stats.c += a) +#define RX_STAT_INC (c) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c++) +#define RX_STAT_ADD (c, a) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c += a)#define CAB_STAT_INC priv->debug.tx_stats.cab_queued++#define TX_QSTAT_INC (q) (priv->debug.tx_stats.queue_stats[q]++)void ath9k_htc_err_stat_rx (struct ath9k_htc_priv *priv, -struct ath_htc_rx_status *rxs); +struct ath_rx_status *rs);struct ath_tx_stats {u32 buf_queued;
@@ -345,25 +345,18 @@ struct ath_tx_stats {u32 queue_stats[IEEE80211_NUM_ACS ]; }; -struct ath_rx_stats { +struct ath_skbrx_stats {u32 skb_allocated;u32 skb_completed;u32 skb_completed_bytes;u32 skb_dropped; -u32 err_crc; -u32 err_decrypt_crc; -u32 err_mic; -u32 err_pre_delim; -u32 err_post_delim; -u32 err_decrypt_busy; -u32 err_phy; -u32 err_phy_stats[ATH9K_PHYERR_MAX ]; };struct ath9k_debug {struct dentry *debugfs_phy;struct ath_tx_stats tx_stats;struct ath_rx_stats rx_stats; +struct ath_skbrx_stats skbrx_stats; }; void ath9k_htc_get_et_strings(struct ieee80211_hw *hw,
drivers/net/wireless/ath/ath9k/htc_drv_debug.c +23 -65
126 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +1 -2
@@ -996,8 +996,6 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, goto rx_next; } -ath9k_htc_err_stat_rx (priv, rxstatus); -/* Get the RX status information */ memset (rx_status,0 ,sizeof (struct ieee80211_rx_status ));
@@ -1005,6 +1003,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,/* Copy everything from ath_htc_rx_status (HTC_RX_FRAME_HEADER). * After this, we can drop this part of skb. */ rx_status_htc_to_ath (&rx_stats, rxstatus); +ath9k_htc_err_stat_rx (priv, &rx_stats); rx_status->mactime =be64_to_cpu (rxstatus->rs_tstamp);skb_pull (skb,HTC_RX_FRAME_HEADER_SIZE );
Signature · 1 line
1.9.1
PATCH 7/10 ath9k: move recv to ath9k_cmn_debug_recv
In reply to Oleksij Rempel--- drivers/net/wireless/ath/ath9k/common-debug.c | 63 +++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/common-debug.h | 2 + drivers/net/wireless/ath/ath9k/debug.c | 60 ++----------------------- 3 files changed, 68 insertions(+), 57 deletions(-)
drivers/net/wireless/ath/ath9k/common-debug.c +63 -0
@@ -119,3 +119,66 @@ void ath9k_cmn_debug_stat_rx(struct ath_rx_stats *rxstats,#undef RX_PHY_ERR_INC }EXPORT_SYMBOL (ath9k_cmn_debug_stat_rx); + +static ssize_t read_file_recv (struct file *file,char __user *user_buf, +size_t count,loff_t *ppos) +{ +#define RXS_ERR (s, e) \ + do { \ + len += scnprintf(buf + len, size - len, \ + "%18s : %10u\n", s, \ + rxstats->e); \ + } while (0) + +struct ath_rx_stats *rxstats = file->private_data; +char *buf; +unsigned int len =0 , size =1600 ; +ssize_t retval =0 ; + + buf =kzalloc (size,GFP_KERNEL ); +if (buf ==NULL ) +return -ENOMEM ; + +RXS_ERR ("PKTS-ALL" , rx_pkts_all); +RXS_ERR ("BYTES-ALL" , rx_bytes_all); +RXS_ERR ("BEACONS" , rx_beacons); +RXS_ERR ("FRAGS" , rx_frags); +RXS_ERR ("SPECTRAL" , rx_spectral); + +RXS_ERR ("CRC ERR" , crc_err); +RXS_ERR ("DECRYPT CRC ERR" , decrypt_crc_err); +RXS_ERR ("PHY ERR" , phy_err); +RXS_ERR ("MIC ERR" , mic_err); +RXS_ERR ("PRE-DELIM CRC ERR" , pre_delim_crc_err); +RXS_ERR ("POST-DELIM CRC ERR" , post_delim_crc_err); +RXS_ERR ("DECRYPT BUSY ERR" , decrypt_busy_err); +RXS_ERR ("LENGTH-ERR" , rx_len_err); +RXS_ERR ("OOM-ERR" , rx_oom_err); +RXS_ERR ("RATE-ERR" , rx_rate_err); +RXS_ERR ("TOO-MANY-FRAGS" , rx_too_many_frags_err); + +if (len > size) + len = size; + + retval =simple_read_from_buffer (user_buf, count, ppos, buf, len); +kfree (buf); + +return retval; + +#undef RXS_ERR +} + +static const struct file_operations fops_recv = { + .read = read_file_recv, + .open = simple_open, + .owner =THIS_MODULE , + .llseek = default_llseek, +}; + +void ath9k_cmn_debug_recv (struct dentry *debugfs_phy, +struct ath_rx_stats *rxstats) +{ +debugfs_create_file ("recv" ,S_IRUSR , debugfs_phy, rxstats, + &fops_recv); +} +EXPORT_SYMBOL (ath9k_cmn_debug_recv);
drivers/net/wireless/ath/ath9k/common-debug.h +2 -0
@@ -66,3 +66,5 @@ void ath9k_cmn_debug_base_eeprom(struct dentry *debugfs_phy, struct ath_hw *ah);void ath9k_cmn_debug_stat_rx (struct ath_rx_stats *rxstats,struct ath_rx_status *rs); +void ath9k_cmn_debug_recv (struct dentry *debugfs_phy, +struct ath_rx_stats *rxstats);
drivers/net/wireless/ath/ath9k/debug.c +3 -57
77 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 8/10 ath9k_htc: use ath9k_cmn_debug_recv
In reply to Oleksij Rempel--- drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/htc_drv_debug.c +4 -1
@@ -542,8 +542,11 @@ int ath9k_htc_init_debug(struct ath_hw *ah) priv, &fops_tgt_rx_stats);debugfs_create_file ("xmit" ,S_IRUSR , priv->debug.debugfs_phy, priv, &fops_xmit); -debugfs_create_file ("recv" ,S_IRUSR , priv->debug.debugfs_phy, +debugfs_create_file ("phy_err" ,S_IRUSR , priv->debug.debugfs_phy, priv, &fops_recv); + +ath9k_cmn_debug_recv (priv->debug.debugfs_phy, &priv->debug.rx_stats); +debugfs_create_file ("slot" ,S_IRUSR , priv->debug.debugfs_phy, priv, &fops_slot); debugfs_create_file("queue", S_IRUSR, priv->debug.debugfs_phy,
Signature · 1 line
1.9.1
PATCH 9/10 ath9k: move phy_err to ath9k_cmn_debug_phy_err
In reply to Oleksij Rempel--- drivers/net/wireless/ath/ath9k/common-debug.c | 69 +++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/common-debug.h | 2 + drivers/net/wireless/ath/ath9k/debug.c | 64 +------------------------ 3 files changed, 72 insertions(+), 63 deletions(-)
drivers/net/wireless/ath/ath9k/common-debug.c +69 -0
@@ -182,3 +182,72 @@ void ath9k_cmn_debug_recv(struct dentry *debugfs_phy, &fops_recv); }EXPORT_SYMBOL (ath9k_cmn_debug_recv); + +static ssize_t read_file_phy_err (struct file *file,char __user *user_buf, +size_t count,loff_t *ppos) +{ +#define PHY_ERR (s, p) \ + len += scnprintf(buf + len, size - len, "%22s : %10u\n", s, \ + rxstats->phy_err_stats[p]); + +struct ath_rx_stats *rxstats = file->private_data; +char *buf; +unsigned int len =0 , size =1600 ; +ssize_t retval =0 ; + + buf =kzalloc (size,GFP_KERNEL ); +if (buf ==NULL ) +return -ENOMEM ; + +PHY_ERR ("UNDERRUN ERR" ,ATH9K_PHYERR_UNDERRUN ); +PHY_ERR ("TIMING ERR" ,ATH9K_PHYERR_TIMING ); +PHY_ERR ("PARITY ERR" ,ATH9K_PHYERR_PARITY ); +PHY_ERR ("RATE ERR" ,ATH9K_PHYERR_RATE ); +PHY_ERR ("LENGTH ERR" ,ATH9K_PHYERR_LENGTH ); +PHY_ERR ("RADAR ERR" ,ATH9K_PHYERR_RADAR ); +PHY_ERR ("SERVICE ERR" ,ATH9K_PHYERR_SERVICE ); +PHY_ERR ("TOR ERR" ,ATH9K_PHYERR_TOR ); +PHY_ERR ("OFDM-TIMING ERR" ,ATH9K_PHYERR_OFDM_TIMING ); +PHY_ERR ("OFDM-SIGNAL-PARITY ERR" ,ATH9K_PHYERR_OFDM_SIGNAL_PARITY ); +PHY_ERR ("OFDM-RATE ERR" ,ATH9K_PHYERR_OFDM_RATE_ILLEGAL ); +PHY_ERR ("OFDM-LENGTH ERR" ,ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL ); +PHY_ERR ("OFDM-POWER-DROP ERR" ,ATH9K_PHYERR_OFDM_POWER_DROP ); +PHY_ERR ("OFDM-SERVICE ERR" ,ATH9K_PHYERR_OFDM_SERVICE ); +PHY_ERR ("OFDM-RESTART ERR" ,ATH9K_PHYERR_OFDM_RESTART ); +PHY_ERR ("FALSE-RADAR-EXT ERR" ,ATH9K_PHYERR_FALSE_RADAR_EXT ); +PHY_ERR ("CCK-TIMING ERR" ,ATH9K_PHYERR_CCK_TIMING ); +PHY_ERR ("CCK-HEADER-CRC ERR" ,ATH9K_PHYERR_CCK_HEADER_CRC ); +PHY_ERR ("CCK-RATE ERR" ,ATH9K_PHYERR_CCK_RATE_ILLEGAL ); +PHY_ERR ("CCK-SERVICE ERR" ,ATH9K_PHYERR_CCK_SERVICE ); +PHY_ERR ("CCK-RESTART ERR" ,ATH9K_PHYERR_CCK_RESTART ); +PHY_ERR ("CCK-LENGTH ERR" ,ATH9K_PHYERR_CCK_LENGTH_ILLEGAL ); +PHY_ERR ("CCK-POWER-DROP ERR" ,ATH9K_PHYERR_CCK_POWER_DROP ); +PHY_ERR ("HT-CRC ERR" ,ATH9K_PHYERR_HT_CRC_ERROR ); +PHY_ERR ("HT-LENGTH ERR" ,ATH9K_PHYERR_HT_LENGTH_ILLEGAL ); +PHY_ERR ("HT-RATE ERR" ,ATH9K_PHYERR_HT_RATE_ILLEGAL ); + +if (len > size) + len = size; + + retval =simple_read_from_buffer (user_buf, count, ppos, buf, len); +kfree (buf); + +return retval; + +#undef PHY_ERR +} + +static const struct file_operations fops_phy_err = { + .read = read_file_phy_err, + .open = simple_open, + .owner =THIS_MODULE , + .llseek = default_llseek, +}; + +void ath9k_cmn_debug_phy_err (struct dentry *debugfs_phy, +struct ath_rx_stats *rxstats) +{ +debugfs_create_file ("phy_err" ,S_IRUSR , debugfs_phy, rxstats, + &fops_phy_err); +} +EXPORT_SYMBOL (ath9k_cmn_debug_phy_err);
drivers/net/wireless/ath/ath9k/common-debug.h +2 -0
@@ -68,3 +68,5 @@ void ath9k_cmn_debug_stat_rx(struct ath_rx_stats *rxstats, struct ath_rx_status *rs);void ath9k_cmn_debug_recv (struct dentry *debugfs_phy,struct ath_rx_stats *rxstats); +void ath9k_cmn_debug_phy_err (struct dentry *debugfs_phy, +struct ath_rx_stats *rxstats);
drivers/net/wireless/ath/ath9k/debug.c +1 -63
77 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 10/10 ath9k_htc: use ath9k_cmn_debug_phy_err
In reply to Oleksij Rempel--- drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 44 ++++---------------------- 1 file changed, 6 insertions(+), 38 deletions(-)
drivers/net/wireless/ath/ath9k/htc_drv_debug.c +6 -38
@@ -248,13 +248,9 @@ void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv,ath9k_cmn_debug_stat_rx (&priv->debug.rx_stats, rs); } -static ssize_t read_file_recv (struct file *file,char __user *user_buf, +static ssize_t read_file_skb_rx (struct file *file,char __user *user_buf,size_t count,loff_t *ppos) { -#define PHY_ERR (s, p) \ - len += scnprintf(buf + len, size - len, "%20s : %10u\n", s, \ - priv->debug.rx_stats.phy_err_stats[p]); -struct ath9k_htc_priv *priv = file->private_data;char *buf;unsigned int len =0 , size =1500 ;
@@ -274,33 +270,6 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf,"%20s : %10u\n" ,"SKBs Dropped" , priv->debug.skbrx_stats.skb_dropped); -PHY_ERR ("UNDERRUN" ,ATH9K_PHYERR_UNDERRUN ); -PHY_ERR ("TIMING" ,ATH9K_PHYERR_TIMING ); -PHY_ERR ("PARITY" ,ATH9K_PHYERR_PARITY ); -PHY_ERR ("RATE" ,ATH9K_PHYERR_RATE ); -PHY_ERR ("LENGTH" ,ATH9K_PHYERR_LENGTH ); -PHY_ERR ("RADAR" ,ATH9K_PHYERR_RADAR ); -PHY_ERR ("SERVICE" ,ATH9K_PHYERR_SERVICE ); -PHY_ERR ("TOR" ,ATH9K_PHYERR_TOR ); -PHY_ERR ("OFDM-TIMING" ,ATH9K_PHYERR_OFDM_TIMING ); -PHY_ERR ("OFDM-SIGNAL-PARITY" ,ATH9K_PHYERR_OFDM_SIGNAL_PARITY ); -PHY_ERR ("OFDM-RATE" ,ATH9K_PHYERR_OFDM_RATE_ILLEGAL ); -PHY_ERR ("OFDM-LENGTH" ,ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL ); -PHY_ERR ("OFDM-POWER-DROP" ,ATH9K_PHYERR_OFDM_POWER_DROP ); -PHY_ERR ("OFDM-SERVICE" ,ATH9K_PHYERR_OFDM_SERVICE ); -PHY_ERR ("OFDM-RESTART" ,ATH9K_PHYERR_OFDM_RESTART ); -PHY_ERR ("FALSE-RADAR-EXT" ,ATH9K_PHYERR_FALSE_RADAR_EXT ); -PHY_ERR ("CCK-TIMING" ,ATH9K_PHYERR_CCK_TIMING ); -PHY_ERR ("CCK-HEADER-CRC" ,ATH9K_PHYERR_CCK_HEADER_CRC ); -PHY_ERR ("CCK-RATE" ,ATH9K_PHYERR_CCK_RATE_ILLEGAL ); -PHY_ERR ("CCK-SERVICE" ,ATH9K_PHYERR_CCK_SERVICE ); -PHY_ERR ("CCK-RESTART" ,ATH9K_PHYERR_CCK_RESTART ); -PHY_ERR ("CCK-LENGTH" ,ATH9K_PHYERR_CCK_LENGTH_ILLEGAL ); -PHY_ERR ("CCK-POWER-DROP" ,ATH9K_PHYERR_CCK_POWER_DROP ); -PHY_ERR ("HT-CRC" ,ATH9K_PHYERR_HT_CRC_ERROR ); -PHY_ERR ("HT-LENGTH" ,ATH9K_PHYERR_HT_LENGTH_ILLEGAL ); -PHY_ERR ("HT-RATE" ,ATH9K_PHYERR_HT_RATE_ILLEGAL ); -if (len > size) len = size;
@@ -308,12 +277,10 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf,kfree (buf);return retval; - -#undef PHY_ERR } -static const struct file_operations fops_recv = { - .read = read_file_recv, +static const struct file_operations fops_skb_rx = { + .read = read_file_skb_rx, .open = simple_open, .owner =THIS_MODULE , .llseek = default_llseek,
@@ -542,10 +509,11 @@ int ath9k_htc_init_debug(struct ath_hw *ah) priv, &fops_tgt_rx_stats);debugfs_create_file ("xmit" ,S_IRUSR , priv->debug.debugfs_phy, priv, &fops_xmit); -debugfs_create_file ("phy_err" ,S_IRUSR , priv->debug.debugfs_phy, - priv, &fops_recv); +debugfs_create_file ("skb_rx" ,S_IRUSR , priv->debug.debugfs_phy, + priv, &fops_skb_rx);ath9k_cmn_debug_recv (priv->debug.debugfs_phy, &priv->debug.rx_stats); +ath9k_cmn_debug_phy_err (priv->debug.debugfs_phy, &priv->debug.rx_stats);debugfs_create_file ("slot" ,S_IRUSR , priv->debug.debugfs_phy, priv, &fops_slot);
Signature · 1 line
1.9.1