Commit 46f26ddf authored by Johannes Berg's avatar Johannes Berg Committed by David S. Miller
Browse files

ath5k: use DECLARE_EWMA



This reduces code size slightly (at least on x86/64) while also
removing memory consumption by two unsigned long values for each
ath5k device.

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5377d758
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -5,7 +5,6 @@ config ATH5K
	select MAC80211_LEDS
	select MAC80211_LEDS
	select LEDS_CLASS
	select LEDS_CLASS
	select NEW_LEDS
	select NEW_LEDS
	select AVERAGE
	select ATH5K_AHB if ATH25
	select ATH5K_AHB if ATH25
	select ATH5K_PCI if !ATH25
	select ATH5K_PCI if !ATH25
	---help---
	---help---
+2 −2
Original line number Original line Diff line number Diff line
@@ -223,7 +223,7 @@ static void
ath5k_ani_raise_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as,
ath5k_ani_raise_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as,
			 bool ofdm_trigger)
			 bool ofdm_trigger)
{
{
	int rssi = ewma_read(&ah->ah_beacon_rssi_avg);
	int rssi = ewma_beacon_rssi_read(&ah->ah_beacon_rssi_avg);


	ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "raise immunity (%s)",
	ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "raise immunity (%s)",
		ofdm_trigger ? "ODFM" : "CCK");
		ofdm_trigger ? "ODFM" : "CCK");
@@ -309,7 +309,7 @@ ath5k_ani_raise_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as,
static void
static void
ath5k_ani_lower_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as)
ath5k_ani_lower_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as)
{
{
	int rssi = ewma_read(&ah->ah_beacon_rssi_avg);
	int rssi = ewma_beacon_rssi_read(&ah->ah_beacon_rssi_avg);


	ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "lower immunity");
	ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "lower immunity");


+3 −1
Original line number Original line Diff line number Diff line
@@ -1252,6 +1252,8 @@ struct ath5k_statistics {
#define ATH5K_TXQ_LEN_MAX	(ATH_TXBUF / 4)		/* bufs per queue */
#define ATH5K_TXQ_LEN_MAX	(ATH_TXBUF / 4)		/* bufs per queue */
#define ATH5K_TXQ_LEN_LOW	(ATH5K_TXQ_LEN_MAX / 2)	/* low mark */
#define ATH5K_TXQ_LEN_LOW	(ATH5K_TXQ_LEN_MAX / 2)	/* low mark */


DECLARE_EWMA(beacon_rssi, 1024, 8)

/* Driver state associated with an instance of a device */
/* Driver state associated with an instance of a device */
struct ath5k_hw {
struct ath5k_hw {
	struct ath_common       common;
	struct ath_common       common;
@@ -1432,7 +1434,7 @@ struct ath5k_hw {
	struct ath5k_nfcal_hist ah_nfcal_hist;
	struct ath5k_nfcal_hist ah_nfcal_hist;


	/* average beacon RSSI in our BSS (used by ANI) */
	/* average beacon RSSI in our BSS (used by ANI) */
	struct ewma		ah_beacon_rssi_avg;
	struct ewma_beacon_rssi	ah_beacon_rssi_avg;


	/* noise floor from last periodic calibration */
	/* noise floor from last periodic calibration */
	s32			ah_noise_floor;
	s32			ah_noise_floor;
+2 −2
Original line number Original line Diff line number Diff line
@@ -1430,7 +1430,7 @@ ath5k_receive_frame(struct ath5k_hw *ah, struct sk_buff *skb,
	trace_ath5k_rx(ah, skb);
	trace_ath5k_rx(ah, skb);


	if (ath_is_mybeacon(common, (struct ieee80211_hdr *)skb->data)) {
	if (ath_is_mybeacon(common, (struct ieee80211_hdr *)skb->data)) {
		ewma_add(&ah->ah_beacon_rssi_avg, rs->rs_rssi);
		ewma_beacon_rssi_add(&ah->ah_beacon_rssi_avg, rs->rs_rssi);


		/* check beacons in IBSS mode */
		/* check beacons in IBSS mode */
		if (ah->opmode == NL80211_IFTYPE_ADHOC)
		if (ah->opmode == NL80211_IFTYPE_ADHOC)
@@ -2936,7 +2936,7 @@ ath5k_reset(struct ath5k_hw *ah, struct ieee80211_channel *chan,
	ah->ah_cal_next_short = jiffies +
	ah->ah_cal_next_short = jiffies +
		msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_SHORT);
		msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_SHORT);


	ewma_init(&ah->ah_beacon_rssi_avg, 1024, 8);
	ewma_beacon_rssi_init(&ah->ah_beacon_rssi_avg);


	/* clear survey data and cycle counters */
	/* clear survey data and cycle counters */
	memset(&ah->survey, 0, sizeof(ah->survey));
	memset(&ah->survey, 0, sizeof(ah->survey));
+1 −1
Original line number Original line Diff line number Diff line
@@ -722,7 +722,7 @@ static ssize_t read_file_ani(struct file *file, char __user *user_buf,
			st->mib_intr);
			st->mib_intr);
	len += snprintf(buf + len, sizeof(buf) - len,
	len += snprintf(buf + len, sizeof(buf) - len,
			"beacon RSSI average:\t%d\n",
			"beacon RSSI average:\t%d\n",
			(int)ewma_read(&ah->ah_beacon_rssi_avg));
			(int)ewma_beacon_rssi_read(&ah->ah_beacon_rssi_avg));


#define CC_PRINT(_struct, _field) \
#define CC_PRINT(_struct, _field) \
	_struct._field, \
	_struct._field, \