aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/rc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/rc.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 89978d71617f..85c8e9310cae 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -381,25 +381,6 @@ static const struct ath_rate_table ar5416_11g_ratetable = {
381static int ath_rc_get_rateindex(const struct ath_rate_table *rate_table, 381static int ath_rc_get_rateindex(const struct ath_rate_table *rate_table,
382 struct ieee80211_tx_rate *rate); 382 struct ieee80211_tx_rate *rate);
383 383
384static inline int8_t median(int8_t a, int8_t b, int8_t c)
385{
386 if (a >= b) {
387 if (b >= c)
388 return b;
389 else if (a > c)
390 return c;
391 else
392 return a;
393 } else {
394 if (a >= c)
395 return a;
396 else if (b >= c)
397 return c;
398 else
399 return b;
400 }
401}
402
403static void ath_rc_sort_validrates(const struct ath_rate_table *rate_table, 384static void ath_rc_sort_validrates(const struct ath_rate_table *rate_table,
404 struct ath_rate_priv *ath_rc_priv) 385 struct ath_rate_priv *ath_rc_priv)
405{ 386{
@@ -1444,12 +1425,12 @@ static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,
1444 ath_rc_priv->neg_ht_rates.rs_nrates = j; 1425 ath_rc_priv->neg_ht_rates.rs_nrates = j;
1445 } 1426 }
1446 1427
1447 is_cw40 = sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40; 1428 is_cw40 = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40);
1448 1429
1449 if (is_cw40) 1430 if (is_cw40)
1450 is_sgi = sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40; 1431 is_sgi = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40);
1451 else if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_SGI_20) 1432 else if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_SGI_20)
1452 is_sgi = sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20; 1433 is_sgi = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20);
1453 1434
1454 /* Choose rate table first */ 1435 /* Choose rate table first */
1455 1436
@@ -1468,10 +1449,8 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
1468 struct ath_rate_priv *ath_rc_priv = priv_sta; 1449 struct ath_rate_priv *ath_rc_priv = priv_sta;
1469 const struct ath_rate_table *rate_table = NULL; 1450 const struct ath_rate_table *rate_table = NULL;
1470 bool oper_cw40 = false, oper_sgi; 1451 bool oper_cw40 = false, oper_sgi;
1471 bool local_cw40 = (ath_rc_priv->ht_cap & WLAN_RC_40_FLAG) ? 1452 bool local_cw40 = !!(ath_rc_priv->ht_cap & WLAN_RC_40_FLAG);
1472 true : false; 1453 bool local_sgi = !!(ath_rc_priv->ht_cap & WLAN_RC_SGI_FLAG);
1473 bool local_sgi = (ath_rc_priv->ht_cap & WLAN_RC_SGI_FLAG) ?
1474 true : false;
1475 1454
1476 /* FIXME: Handle AP mode later when we support CWM */ 1455 /* FIXME: Handle AP mode later when we support CWM */
1477 1456