diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2008-11-17 22:36:44 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-11-26 09:47:27 -0500 |
commit | 5ddfac3b550250388f1222ec7d09069784a68af6 (patch) | |
tree | b557cfff97beca56cdb8c9bf2e84efcdcdf7c981 /drivers/net/wireless/ath9k/rc.c | |
parent | ffd651c620a2f27502ee5d4517a122c072f13073 (diff) |
ath9k: Remove rate control reference in VAP
Rate control init is now confined to itself, using the
HT capabilites of the STA from rate_init().
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/rc.c')
-rw-r--r-- | drivers/net/wireless/ath9k/rc.c | 82 |
1 files changed, 27 insertions, 55 deletions
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c index 8a45b2502d23..0fa1b30bdcb6 100644 --- a/drivers/net/wireless/ath9k/rc.c +++ b/drivers/net/wireless/ath9k/rc.c | |||
@@ -1446,35 +1446,39 @@ static void ath_rate_tx_complete(struct ath_softc *sc, | |||
1446 | info_priv->tx.ts_longretry); | 1446 | info_priv->tx.ts_longretry); |
1447 | } | 1447 | } |
1448 | 1448 | ||
1449 | /* | 1449 | static void ath_rc_init(struct ath_softc *sc, |
1450 | * Update the SIB's rate control information | 1450 | struct ath_rate_node *ath_rc_priv, |
1451 | * | 1451 | struct ieee80211_supported_band *sband, |
1452 | * This should be called when the supported rates change | 1452 | struct ieee80211_sta *sta) |
1453 | * (e.g. SME operation, wireless mode change) | ||
1454 | * | ||
1455 | * It will determine which rates are valid for use. | ||
1456 | */ | ||
1457 | static void ath_rc_sib_update(struct ath_softc *sc, | ||
1458 | struct ath_rate_node *ath_rc_priv, | ||
1459 | u32 capflag, int keep_state, | ||
1460 | struct ath_rateset *negotiated_rates, | ||
1461 | struct ath_rateset *negotiated_htrates) | ||
1462 | { | 1453 | { |
1463 | struct ath_rate_table *rate_table = NULL; | 1454 | struct ath_rate_table *rate_table = NULL; |
1464 | struct ath_rate_softc *asc = (struct ath_rate_softc *)sc->sc_rc; | 1455 | struct ath_rate_softc *asc = (struct ath_rate_softc *)sc->sc_rc; |
1465 | struct ath_rateset *rateset = negotiated_rates; | 1456 | struct ath_rateset *rateset = &ath_rc_priv->neg_rates; |
1466 | u8 *ht_mcs = (u8 *)negotiated_htrates; | 1457 | u8 *ht_mcs = (u8 *)&ath_rc_priv->neg_ht_rates; |
1467 | u8 i, j, k, hi = 0, hthi = 0; | 1458 | u8 i, j, k, hi = 0, hthi = 0; |
1468 | 1459 | ||
1469 | rate_table = (struct ath_rate_table *) | 1460 | rate_table = (struct ath_rate_table *) |
1470 | asc->hw_rate_table[sc->sc_curmode]; | 1461 | asc->hw_rate_table[sc->sc_curmode]; |
1471 | 1462 | ||
1463 | if (sta->ht_cap.ht_supported) { | ||
1464 | if (sband->band == IEEE80211_BAND_2GHZ) | ||
1465 | rate_table = (struct ath_rate_table *) | ||
1466 | asc->hw_rate_table[ATH9K_MODE_11NG_HT20]; | ||
1467 | else | ||
1468 | rate_table = (struct ath_rate_table *) | ||
1469 | asc->hw_rate_table[ATH9K_MODE_11NA_HT20]; | ||
1470 | |||
1471 | ath_rc_priv->ht_cap = (WLAN_RC_HT_FLAG | WLAN_RC_DS_FLAG); | ||
1472 | if (sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) | ||
1473 | ath_rc_priv->ht_cap |= WLAN_RC_40_FLAG; | ||
1474 | } | ||
1475 | |||
1472 | /* Initial rate table size. Will change depending | 1476 | /* Initial rate table size. Will change depending |
1473 | * on the working rate set */ | 1477 | * on the working rate set */ |
1474 | ath_rc_priv->rate_table_size = MAX_TX_RATE_TBL; | 1478 | ath_rc_priv->rate_table_size = MAX_TX_RATE_TBL; |
1475 | 1479 | ||
1476 | /* Initialize thresholds according to the global rate table */ | 1480 | /* Initialize thresholds according to the global rate table */ |
1477 | for (i = 0 ; (i < ath_rc_priv->rate_table_size) && (!keep_state); i++) { | 1481 | for (i = 0 ; i < ath_rc_priv->rate_table_size; i++) { |
1478 | ath_rc_priv->state[i].rssi_thres = | 1482 | ath_rc_priv->state[i].rssi_thres = |
1479 | rate_table->info[i].rssi_ack_validmin; | 1483 | rate_table->info[i].rssi_ack_validmin; |
1480 | ath_rc_priv->state[i].per = 0; | 1484 | ath_rc_priv->state[i].per = 0; |
@@ -1488,24 +1492,24 @@ static void ath_rc_sib_update(struct ath_softc *sc, | |||
1488 | ath_rc_priv->valid_phy_rateidx[i][j] = 0; | 1492 | ath_rc_priv->valid_phy_rateidx[i][j] = 0; |
1489 | ath_rc_priv->valid_phy_ratecnt[i] = 0; | 1493 | ath_rc_priv->valid_phy_ratecnt[i] = 0; |
1490 | } | 1494 | } |
1491 | ath_rc_priv->rc_phy_mode = (capflag & WLAN_RC_40_FLAG); | 1495 | ath_rc_priv->rc_phy_mode = (ath_rc_priv->ht_cap & WLAN_RC_40_FLAG); |
1492 | 1496 | ||
1493 | /* Set stream capability */ | 1497 | /* Set stream capability */ |
1494 | ath_rc_priv->single_stream = (capflag & WLAN_RC_DS_FLAG) ? 0 : 1; | 1498 | ath_rc_priv->single_stream = (ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG) ? 0 : 1; |
1495 | 1499 | ||
1496 | if (!rateset->rs_nrates) { | 1500 | if (!rateset->rs_nrates) { |
1497 | /* No working rate, just initialize valid rates */ | 1501 | /* No working rate, just initialize valid rates */ |
1498 | hi = ath_rc_sib_init_validrates(ath_rc_priv, rate_table, | 1502 | hi = ath_rc_sib_init_validrates(ath_rc_priv, rate_table, |
1499 | capflag); | 1503 | ath_rc_priv->ht_cap); |
1500 | } else { | 1504 | } else { |
1501 | /* Use intersection of working rates and valid rates */ | 1505 | /* Use intersection of working rates and valid rates */ |
1502 | hi = ath_rc_sib_setvalid_rates(ath_rc_priv, rate_table, | 1506 | hi = ath_rc_sib_setvalid_rates(ath_rc_priv, rate_table, |
1503 | rateset, capflag); | 1507 | rateset, ath_rc_priv->ht_cap); |
1504 | if (capflag & WLAN_RC_HT_FLAG) { | 1508 | if (ath_rc_priv->ht_cap & WLAN_RC_HT_FLAG) { |
1505 | hthi = ath_rc_sib_setvalid_htrates(ath_rc_priv, | 1509 | hthi = ath_rc_sib_setvalid_htrates(ath_rc_priv, |
1506 | rate_table, | 1510 | rate_table, |
1507 | ht_mcs, | 1511 | ht_mcs, |
1508 | capflag); | 1512 | ath_rc_priv->ht_cap); |
1509 | } | 1513 | } |
1510 | hi = A_MAX(hi, hthi); | 1514 | hi = A_MAX(hi, hthi); |
1511 | } | 1515 | } |
@@ -1539,29 +1543,6 @@ static void ath_rc_sib_update(struct ath_softc *sc, | |||
1539 | ath_rc_priv->rate_max_phy = ath_rc_priv->valid_rate_index[k-4]; | 1543 | ath_rc_priv->rate_max_phy = ath_rc_priv->valid_rate_index[k-4]; |
1540 | } | 1544 | } |
1541 | 1545 | ||
1542 | void ath_rc_node_update(struct ieee80211_hw *hw, struct ath_rate_node *rc_priv) | ||
1543 | { | ||
1544 | struct ath_softc *sc = hw->priv; | ||
1545 | u32 capflag = 0; | ||
1546 | |||
1547 | if (hw->conf.ht.enabled) { | ||
1548 | capflag |= ATH_RC_HT_FLAG | ATH_RC_DS_FLAG; | ||
1549 | if (sc->sc_ht_info.tx_chan_width == ATH9K_HT_MACMODE_2040) | ||
1550 | capflag |= ATH_RC_CW40_FLAG; | ||
1551 | } | ||
1552 | |||
1553 | rc_priv->ht_cap = | ||
1554 | ((capflag & ATH_RC_DS_FLAG) ? WLAN_RC_DS_FLAG : 0) | | ||
1555 | ((capflag & ATH_RC_SGI_FLAG) ? WLAN_RC_SGI_FLAG : 0) | | ||
1556 | ((capflag & ATH_RC_HT_FLAG) ? WLAN_RC_HT_FLAG : 0) | | ||
1557 | ((capflag & ATH_RC_CW40_FLAG) ? WLAN_RC_40_FLAG : 0); | ||
1558 | |||
1559 | |||
1560 | ath_rc_sib_update(sc, rc_priv, rc_priv->ht_cap, 0, | ||
1561 | &rc_priv->neg_rates, | ||
1562 | &rc_priv->neg_ht_rates); | ||
1563 | } | ||
1564 | |||
1565 | /* Rate Control callbacks */ | 1546 | /* Rate Control callbacks */ |
1566 | static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, | 1547 | static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, |
1567 | struct ieee80211_sta *sta, void *priv_sta, | 1548 | struct ieee80211_sta *sta, void *priv_sta, |
@@ -1684,7 +1665,7 @@ static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, | |||
1684 | ath_rc_priv->neg_ht_rates.rs_nrates = j; | 1665 | ath_rc_priv->neg_ht_rates.rs_nrates = j; |
1685 | } | 1666 | } |
1686 | 1667 | ||
1687 | ath_rc_node_update(sc->hw, priv_sta); | 1668 | ath_rc_init(sc, priv_sta, sband, sta); |
1688 | } | 1669 | } |
1689 | 1670 | ||
1690 | static void *ath_rate_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) | 1671 | static void *ath_rate_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) |
@@ -1699,16 +1680,9 @@ static void ath_rate_free(void *priv) | |||
1699 | 1680 | ||
1700 | static void *ath_rate_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) | 1681 | static void *ath_rate_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) |
1701 | { | 1682 | { |
1702 | struct ieee80211_vif *vif; | ||
1703 | struct ath_softc *sc = priv; | 1683 | struct ath_softc *sc = priv; |
1704 | struct ath_vap *avp; | ||
1705 | struct ath_rate_node *rate_priv; | 1684 | struct ath_rate_node *rate_priv; |
1706 | 1685 | ||
1707 | vif = sc->sc_vaps[0]; | ||
1708 | ASSERT(vif); | ||
1709 | |||
1710 | avp = (void *)vif->drv_priv; | ||
1711 | |||
1712 | rate_priv = kzalloc(sizeof(struct ath_rate_node), gfp); | 1686 | rate_priv = kzalloc(sizeof(struct ath_rate_node), gfp); |
1713 | if (!rate_priv) { | 1687 | if (!rate_priv) { |
1714 | DPRINTF(sc, ATH_DBG_FATAL, | 1688 | DPRINTF(sc, ATH_DBG_FATAL, |
@@ -1717,9 +1691,7 @@ static void *ath_rate_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp | |||
1717 | return NULL; | 1691 | return NULL; |
1718 | } | 1692 | } |
1719 | 1693 | ||
1720 | rate_priv->avp = avp; | ||
1721 | rate_priv->asc = sc->sc_rc; | 1694 | rate_priv->asc = sc->sc_rc; |
1722 | avp->rc_node = rate_priv; | ||
1723 | rate_priv->rssi_down_time = jiffies_to_msecs(jiffies); | 1695 | rate_priv->rssi_down_time = jiffies_to_msecs(jiffies); |
1724 | 1696 | ||
1725 | return rate_priv; | 1697 | return rate_priv; |