Commit ac0bb767 authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by John W. Linville

ath9k_hw: allow for spliting up ANI operations by family

The AR9003 hardware family will use a slightly modified ANI
implementation which has not yet been tested on the other hardware
families. To allow for this new ANI implementation a few ANI
calls need to be abstracted away. This patch just allows for
each hardware family to declare their own ANI ops and annotates
the current ANI implementation as old.
Signed-off-by: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 6e97f0fb
...@@ -17,6 +17,12 @@ ...@@ -17,6 +17,12 @@
#include "hw.h" #include "hw.h"
#include "hw-ops.h" #include "hw-ops.h"
/* Private to ani.c */
static inline void ath9k_hw_ani_lower_immunity(struct ath_hw *ah)
{
ath9k_hw_private_ops(ah)->ani_lower_immunity(ah);
}
static int ath9k_hw_get_ani_channel_idx(struct ath_hw *ah, static int ath9k_hw_get_ani_channel_idx(struct ath_hw *ah,
struct ath9k_channel *chan) struct ath9k_channel *chan)
{ {
...@@ -206,7 +212,7 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah) ...@@ -206,7 +212,7 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
} }
} }
static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah) static void ath9k_hw_ani_lower_immunity_old(struct ath_hw *ah)
{ {
struct ar5416AniState *aniState; struct ar5416AniState *aniState;
int32_t rssi; int32_t rssi;
...@@ -316,7 +322,7 @@ static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah) ...@@ -316,7 +322,7 @@ static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah)
return listenTime; return listenTime;
} }
void ath9k_ani_reset(struct ath_hw *ah) static void ath9k_ani_reset_old(struct ath_hw *ah)
{ {
struct ar5416AniState *aniState; struct ar5416AniState *aniState;
struct ath9k_channel *chan = ah->curchan; struct ath9k_channel *chan = ah->curchan;
...@@ -402,8 +408,8 @@ void ath9k_ani_reset(struct ath_hw *ah) ...@@ -402,8 +408,8 @@ void ath9k_ani_reset(struct ath_hw *ah)
DISABLE_REGWRITE_BUFFER(ah); DISABLE_REGWRITE_BUFFER(ah);
} }
void ath9k_hw_ani_monitor(struct ath_hw *ah, static void ath9k_hw_ani_monitor_old(struct ath_hw *ah,
struct ath9k_channel *chan) struct ath9k_channel *chan)
{ {
struct ar5416AniState *aniState; struct ar5416AniState *aniState;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
...@@ -487,7 +493,6 @@ void ath9k_hw_ani_monitor(struct ath_hw *ah, ...@@ -487,7 +493,6 @@ void ath9k_hw_ani_monitor(struct ath_hw *ah,
} }
} }
} }
EXPORT_SYMBOL(ath9k_hw_ani_monitor);
void ath9k_enable_mib_counters(struct ath_hw *ah) void ath9k_enable_mib_counters(struct ath_hw *ah)
{ {
...@@ -572,7 +577,7 @@ u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah, ...@@ -572,7 +577,7 @@ u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah,
* any of the MIB counters overflow/trigger so don't assume we're * any of the MIB counters overflow/trigger so don't assume we're
* here because a PHY error counter triggered. * here because a PHY error counter triggered.
*/ */
void ath9k_hw_procmibevent(struct ath_hw *ah) static void ath9k_hw_proc_mib_event_old(struct ath_hw *ah)
{ {
u32 phyCnt1, phyCnt2; u32 phyCnt1, phyCnt2;
...@@ -628,7 +633,6 @@ void ath9k_hw_procmibevent(struct ath_hw *ah) ...@@ -628,7 +633,6 @@ void ath9k_hw_procmibevent(struct ath_hw *ah)
ath9k_ani_restart(ah); ath9k_ani_restart(ah);
} }
} }
EXPORT_SYMBOL(ath9k_hw_procmibevent);
void ath9k_hw_ani_setup(struct ath_hw *ah) void ath9k_hw_ani_setup(struct ath_hw *ah)
{ {
...@@ -694,3 +698,15 @@ void ath9k_hw_ani_init(struct ath_hw *ah) ...@@ -694,3 +698,15 @@ void ath9k_hw_ani_init(struct ath_hw *ah)
if (ah->config.enable_ani) if (ah->config.enable_ani)
ah->proc_phyerr |= HAL_PROCESS_ANI; ah->proc_phyerr |= HAL_PROCESS_ANI;
} }
void ath9k_hw_attach_ani_ops_old(struct ath_hw *ah)
{
struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
struct ath_hw_ops *ops = ath9k_hw_ops(ah);
priv_ops->ani_reset = ath9k_ani_reset_old;
priv_ops->ani_lower_immunity = ath9k_hw_ani_lower_immunity_old;
ops->ani_proc_mib_event = ath9k_hw_proc_mib_event_old;
ops->ani_monitor = ath9k_hw_ani_monitor_old;
}
...@@ -108,14 +108,10 @@ struct ar5416Stats { ...@@ -108,14 +108,10 @@ struct ar5416Stats {
}; };
#define ah_mibStats stats.ast_mibstats #define ah_mibStats stats.ast_mibstats
void ath9k_ani_reset(struct ath_hw *ah);
void ath9k_hw_ani_monitor(struct ath_hw *ah,
struct ath9k_channel *chan);
void ath9k_enable_mib_counters(struct ath_hw *ah); void ath9k_enable_mib_counters(struct ath_hw *ah);
void ath9k_hw_disable_mib_counters(struct ath_hw *ah); void ath9k_hw_disable_mib_counters(struct ath_hw *ah);
u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah, u32 *rxc_pcnt, u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah, u32 *rxc_pcnt,
u32 *rxf_pcnt, u32 *txf_pcnt); u32 *rxf_pcnt, u32 *txf_pcnt);
void ath9k_hw_procmibevent(struct ath_hw *ah);
void ath9k_hw_ani_setup(struct ath_hw *ah); void ath9k_hw_ani_setup(struct ath_hw *ah);
void ath9k_hw_ani_init(struct ath_hw *ah); void ath9k_hw_ani_init(struct ath_hw *ah);
......
...@@ -636,4 +636,6 @@ void ar9002_hw_attach_ops(struct ath_hw *ah) ...@@ -636,4 +636,6 @@ void ar9002_hw_attach_ops(struct ath_hw *ah)
ar9002_hw_attach_calib_ops(ah); ar9002_hw_attach_calib_ops(ah);
ar9002_hw_attach_mac_ops(ah); ar9002_hw_attach_mac_ops(ah);
ath9k_hw_attach_ani_ops_old(ah);
} }
...@@ -313,4 +313,6 @@ void ar9003_hw_attach_ops(struct ath_hw *ah) ...@@ -313,4 +313,6 @@ void ar9003_hw_attach_ops(struct ath_hw *ah)
ar9003_hw_attach_phy_ops(ah); ar9003_hw_attach_phy_ops(ah);
ar9003_hw_attach_calib_ops(ah); ar9003_hw_attach_calib_ops(ah);
ar9003_hw_attach_mac_ops(ah); ar9003_hw_attach_mac_ops(ah);
ath9k_hw_attach_ani_ops_old(ah);
} }
...@@ -128,6 +128,17 @@ static inline void ath9k_hw_set11n_virtualmorefrag(struct ath_hw *ah, void *ds, ...@@ -128,6 +128,17 @@ static inline void ath9k_hw_set11n_virtualmorefrag(struct ath_hw *ah, void *ds,
ath9k_hw_ops(ah)->set11n_virtualmorefrag(ah, ds, vmf); ath9k_hw_ops(ah)->set11n_virtualmorefrag(ah, ds, vmf);
} }
static inline void ath9k_hw_procmibevent(struct ath_hw *ah)
{
ath9k_hw_ops(ah)->ani_proc_mib_event(ah);
}
static inline void ath9k_hw_ani_monitor(struct ath_hw *ah,
struct ath9k_channel *chan)
{
ath9k_hw_ops(ah)->ani_monitor(ah, chan);
}
/* Private hardware call ops */ /* Private hardware call ops */
/* PHY ops */ /* PHY ops */
...@@ -277,4 +288,9 @@ static inline bool ath9k_hw_iscal_supported(struct ath_hw *ah, ...@@ -277,4 +288,9 @@ static inline bool ath9k_hw_iscal_supported(struct ath_hw *ah,
return ath9k_hw_private_ops(ah)->iscal_supported(ah, calType); return ath9k_hw_private_ops(ah)->iscal_supported(ah, calType);
} }
static inline void ath9k_ani_reset(struct ath_hw *ah)
{
ath9k_hw_private_ops(ah)->ani_reset(ah);
}
#endif /* ATH9K_HW_OPS_H */ #endif /* ATH9K_HW_OPS_H */
...@@ -511,6 +511,15 @@ struct ath_gen_timer_table { ...@@ -511,6 +511,15 @@ struct ath_gen_timer_table {
* @setup_calibration: set up calibration * @setup_calibration: set up calibration
* @iscal_supported: used to query if a type of calibration is supported * @iscal_supported: used to query if a type of calibration is supported
* @loadnf: load noise floor read from each chain on the CCA registers * @loadnf: load noise floor read from each chain on the CCA registers
*
* @ani_reset: reset ANI parameters to default values
* @ani_lower_immunity: lower the noise immunity level. The level controls
* the power-based packet detection on hardware. If a power jump is
* detected the adapter takes it as an indication that a packet has
* arrived. The level ranges from 0-5. Each level corresponds to a
* few dB more of noise immunity. If you have a strong time-varying
* interference that is causing false detections (OFDM timing errors or
* CCK timing errors) the level can be increased.
*/ */
struct ath_hw_private_ops { struct ath_hw_private_ops {
/* Calibration ops */ /* Calibration ops */
...@@ -554,6 +563,10 @@ struct ath_hw_private_ops { ...@@ -554,6 +563,10 @@ struct ath_hw_private_ops {
int param); int param);
void (*do_getnf)(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS]); void (*do_getnf)(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS]);
void (*loadnf)(struct ath_hw *ah, struct ath9k_channel *chan); void (*loadnf)(struct ath_hw *ah, struct ath9k_channel *chan);
/* ANI */
void (*ani_reset)(struct ath_hw *ah);
void (*ani_lower_immunity)(struct ath_hw *ah);
}; };
/** /**
...@@ -564,6 +577,11 @@ struct ath_hw_private_ops { ...@@ -564,6 +577,11 @@ struct ath_hw_private_ops {
* *
* @config_pci_powersave: * @config_pci_powersave:
* @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
*
* @ani_proc_mib_event: process MIB events, this would happen upon specific ANI
* thresholds being reached or having overflowed.
* @ani_monitor: called periodically by the core driver to collect
* MIB stats and adjust ANI if specific thresholds have been reached.
*/ */
struct ath_hw_ops { struct ath_hw_ops {
void (*config_pci_powersave)(struct ath_hw *ah, void (*config_pci_powersave)(struct ath_hw *ah,
...@@ -604,6 +622,9 @@ struct ath_hw_ops { ...@@ -604,6 +622,9 @@ struct ath_hw_ops {
u32 burstDuration); u32 burstDuration);
void (*set11n_virtualmorefrag)(struct ath_hw *ah, void *ds, void (*set11n_virtualmorefrag)(struct ath_hw *ah, void *ds,
u32 vmf); u32 vmf);
void (*ani_proc_mib_event)(struct ath_hw *ah);
void (*ani_monitor)(struct ath_hw *ah, struct ath9k_channel *chan);
}; };
struct ath_hw { struct ath_hw {
...@@ -934,6 +955,14 @@ void ar9003_hw_attach_calib_ops(struct ath_hw *ah); ...@@ -934,6 +955,14 @@ void ar9003_hw_attach_calib_ops(struct ath_hw *ah);
void ar9002_hw_attach_ops(struct ath_hw *ah); void ar9002_hw_attach_ops(struct ath_hw *ah);
void ar9003_hw_attach_ops(struct ath_hw *ah); void ar9003_hw_attach_ops(struct ath_hw *ah);
/*
* ANI work can be shared between all families but a next
* generation implementation of ANI will be used only for AR9003 only
* for now as the other families still need to be tested with the same
* next generation ANI.
*/
void ath9k_hw_attach_ani_ops_old(struct ath_hw *ah);
#define ATH_PCIE_CAP_LINK_CTRL 0x70 #define ATH_PCIE_CAP_LINK_CTRL 0x70
#define ATH_PCIE_CAP_LINK_L0S 1 #define ATH_PCIE_CAP_LINK_L0S 1
#define ATH_PCIE_CAP_LINK_L1 2 #define ATH_PCIE_CAP_LINK_L1 2
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*/ */
#include "hw.h" #include "hw.h"
#include "hw-ops.h"
static void ath9k_hw_set_txq_interrupts(struct ath_hw *ah, static void ath9k_hw_set_txq_interrupts(struct ath_hw *ah,
struct ath9k_tx_queue_info *qi) struct ath9k_tx_queue_info *qi)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment