Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 122311
b: refs/heads/master
c: a8efee4
h: refs/heads/master
i:
  122309: 2476823
  122307: 5cf102b
  122303: 656b833
v: v3
  • Loading branch information
Sujith authored and John W. Linville committed Nov 26, 2008
1 parent 1d4df91 commit b9c73e5
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 227 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fe7f4a77450c1d0e463a9b1456b40c2305433e41
refs/heads/master: a8efee4f4740c61fccaf73608df282c4ee24ae86
1 change: 0 additions & 1 deletion trunk/drivers/net/wireless/ath9k/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ struct ath_buf_state {
int bfs_seqno; /* sequence number */
int bfs_tidno; /* tid of this frame */
int bfs_retries; /* current retries */
struct ath_rc_series bfs_rcs[4]; /* rate series */
u32 bf_type; /* BUF_* (enum buffer_type) */
/* key type use to encrypt this frame */
u32 bfs_keyix;
Expand Down
9 changes: 4 additions & 5 deletions trunk/drivers/net/wireless/ath9k/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,12 @@ void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
DPRINTF(sc, ATH_DBG_XMIT,
"%s: TX complete: skb: %p\n", __func__, skb);

ieee80211_tx_info_clear_status(tx_info);
if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK ||
tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) {
/* free driver's private data area of tx_info, XXX: HACK! */
if (tx_info->control.vif != NULL)
kfree(tx_info->control.vif);
tx_info->control.vif = NULL;
if (tx_info->rate_driver_data[0] != NULL) {
kfree(tx_info->rate_driver_data[0]);
tx_info->rate_driver_data[0] = NULL;
}
}

if (tx_status->flags & ATH_TX_BAR) {
Expand Down
145 changes: 61 additions & 84 deletions trunk/drivers/net/wireless/ath9k/rc.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,22 +805,22 @@ static u8 ath_rc_ratefind_ht(struct ath_softc *sc,
}

static void ath_rc_rate_set_series(struct ath_rate_table *rate_table ,
struct ath_rc_series *series,
struct ieee80211_tx_rate *rate,
u8 tries,
u8 rix,
int rtsctsenable)
{
series->tries = tries;
series->flags = (rtsctsenable ? ATH_RC_RTSCTS_FLAG : 0) |
(WLAN_RC_PHY_DS(rate_table->info[rix].phy) ?
ATH_RC_DS_FLAG : 0) |
(WLAN_RC_PHY_40(rate_table->info[rix].phy) ?
ATH_RC_CW40_FLAG : 0) |
(WLAN_RC_PHY_SGI(rate_table->info[rix].phy) ?
ATH_RC_SGI_FLAG : 0);

series->rix = rate_table->info[rix].base_index;
series->max_4ms_framelen = rate_table->info[rix].max_4ms_framelen;
rate->count = tries;
rate->idx = rix;

if (rtsctsenable)
rate->flags |= IEEE80211_TX_RC_USE_RTS_CTS;
if (WLAN_RC_PHY_40(rate_table->info[rix].phy))
rate->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
if (WLAN_RC_PHY_SGI(rate_table->info[rix].phy))
rate->flags |= IEEE80211_TX_RC_SHORT_GI;
if (WLAN_RC_PHY_HT(rate_table->info[rix].phy))
rate->flags |= IEEE80211_TX_RC_MCS;
}

static u8 ath_rc_rate_getidx(struct ath_softc *sc,
Expand Down Expand Up @@ -855,11 +855,12 @@ static u8 ath_rc_rate_getidx(struct ath_softc *sc,
static void ath_rc_ratefind(struct ath_softc *sc,
struct ath_rate_node *ath_rc_priv,
int num_tries, int num_rates, unsigned int rcflag,
struct ath_rc_series series[], int *is_probe,
struct ieee80211_tx_info *tx_info, int *is_probe,
int is_retry)
{
u8 try_per_rate = 0, i = 0, rix, nrix;
struct ath_rate_table *rate_table;
struct ieee80211_tx_rate *rates = tx_info->control.rates;

rate_table = sc->hw_rate_table[sc->sc_curmode];
rix = ath_rc_ratefind_ht(sc, ath_rc_priv, rate_table,
Expand All @@ -871,7 +872,7 @@ static void ath_rc_ratefind(struct ath_softc *sc,
/* set one try for probe rates. For the
* probes don't enable rts */
ath_rc_rate_set_series(rate_table,
&series[i++], 1, nrix, FALSE);
&rates[i++], 1, nrix, FALSE);

try_per_rate = (num_tries/num_rates);
/* Get the next tried/allowed rate. No RTS for the next series
Expand All @@ -880,12 +881,12 @@ static void ath_rc_ratefind(struct ath_softc *sc,
nrix = ath_rc_rate_getidx(sc,
ath_rc_priv, rate_table, nrix, 1, FALSE);
ath_rc_rate_set_series(rate_table,
&series[i++], try_per_rate, nrix, 0);
&rates[i++], try_per_rate, nrix, 0);
} else {
try_per_rate = (num_tries/num_rates);
/* Set the choosen rate. No RTS for first series entry. */
ath_rc_rate_set_series(rate_table,
&series[i++], try_per_rate, nrix, FALSE);
&rates[i++], try_per_rate, nrix, FALSE);
}

/* Fill in the other rates for multirate retry */
Expand All @@ -902,7 +903,7 @@ static void ath_rc_ratefind(struct ath_softc *sc,
rate_table, nrix, 1, min_rate);
/* All other rates in the series have RTS enabled */
ath_rc_rate_set_series(rate_table,
&series[i], try_num, nrix, TRUE);
&rates[i], try_num, nrix, TRUE);
}

/*
Expand All @@ -928,9 +929,8 @@ static void ath_rc_ratefind(struct ath_softc *sc,
if (i == 4 &&
((dot11rate == 2 && phy == WLAN_RC_PHY_HT_40_SS) ||
(dot11rate == 3 && phy == WLAN_RC_PHY_HT_20_SS))) {
series[3].rix = series[2].rix;
series[3].flags = series[2].flags;
series[3].max_4ms_framelen = series[2].max_4ms_framelen;
rates[3].idx = rates[2].idx;
rates[3].flags = rates[2].flags;
}
}
}
Expand All @@ -943,15 +943,15 @@ static void ath_rate_findrate(struct ath_softc *sc,
int num_tries,
int num_rates,
unsigned int rcflag,
struct ath_rc_series series[],
struct ieee80211_tx_info *tx_info,
int *is_probe,
int is_retry)
{
if (!num_rates || !num_tries)
return;

ath_rc_ratefind(sc, ath_rc_priv, num_tries, num_rates,
rcflag, series, is_probe, is_retry);
rcflag, tx_info, is_probe, is_retry);
}

static void ath_rc_update_ht(struct ath_softc *sc,
Expand Down Expand Up @@ -1283,17 +1283,17 @@ static void ath_rc_update_ht(struct ath_softc *sc,
*/
static void ath_rc_update(struct ath_softc *sc,
struct ath_rate_node *ath_rc_priv,
struct ath_tx_info_priv *info_priv, int final_ts_idx,
struct ieee80211_tx_info *tx_info, int final_ts_idx,
int xretries, int long_retry)
{
struct ath_tx_info_priv *info_priv =
(struct ath_tx_info_priv *)tx_info->rate_driver_data[0];
struct ath_rate_table *rate_table;
struct ath_rc_series rcs[4];
struct ieee80211_tx_rate *rates = tx_info->status.rates;
u8 flags;
u32 series = 0, rix;

memcpy(rcs, info_priv->rcs, 4 * sizeof(rcs[0]));
rate_table = sc->hw_rate_table[sc->sc_curmode];
ASSERT(rcs[0].tries != 0);

/*
* If the first rate is not the final index, there
Expand All @@ -1302,31 +1302,31 @@ static void ath_rc_update(struct ath_softc *sc,
if (final_ts_idx != 0) {
/* Process intermediate rates that failed.*/
for (series = 0; series < final_ts_idx ; series++) {
if (rcs[series].tries != 0) {
flags = rcs[series].flags;
if (rates[series].count != 0) {
flags = rates[series].flags;
/* If HT40 and we have switched mode from
* 40 to 20 => don't update */
if ((flags & ATH_RC_CW40_FLAG) &&
if ((flags & IEEE80211_TX_RC_40_MHZ_WIDTH) &&
(ath_rc_priv->rc_phy_mode !=
(flags & ATH_RC_CW40_FLAG)))
(flags & IEEE80211_TX_RC_40_MHZ_WIDTH)))
return;
if ((flags & ATH_RC_CW40_FLAG) &&
(flags & ATH_RC_SGI_FLAG))
if ((flags & IEEE80211_TX_RC_40_MHZ_WIDTH) &&
(flags & IEEE80211_TX_RC_SHORT_GI))
rix = rate_table->info[
rcs[series].rix].ht_index;
else if (flags & ATH_RC_SGI_FLAG)
rates[series].idx].ht_index;
else if (flags & IEEE80211_TX_RC_SHORT_GI)
rix = rate_table->info[
rcs[series].rix].sgi_index;
else if (flags & ATH_RC_CW40_FLAG)
rates[series].idx].sgi_index;
else if (flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
rix = rate_table->info[
rcs[series].rix].cw40index;
rates[series].idx].cw40index;
else
rix = rate_table->info[
rcs[series].rix].base_index;
rates[series].idx].base_index;
ath_rc_update_ht(sc, ath_rc_priv,
info_priv, rix,
xretries ? 1 : 2,
rcs[series].tries);
rates[series].count);
}
}
} else {
Expand All @@ -1336,24 +1336,24 @@ static void ath_rc_update(struct ath_softc *sc,
* Treating it as an excessive retry penalizes the rate
* inordinately.
*/
if (rcs[0].tries == 1 && xretries == 1)
if (rates[0].count == 1 && xretries == 1)
xretries = 2;
}

flags = rcs[series].flags;
flags = rates[series].flags;
/* If HT40 and we have switched mode from 40 to 20 => don't update */
if ((flags & ATH_RC_CW40_FLAG) &&
(ath_rc_priv->rc_phy_mode != (flags & ATH_RC_CW40_FLAG)))
if ((flags & IEEE80211_TX_RC_40_MHZ_WIDTH) &&
(ath_rc_priv->rc_phy_mode != (flags & IEEE80211_TX_RC_40_MHZ_WIDTH)))
return;

if ((flags & ATH_RC_CW40_FLAG) && (flags & ATH_RC_SGI_FLAG))
rix = rate_table->info[rcs[series].rix].ht_index;
else if (flags & ATH_RC_SGI_FLAG)
rix = rate_table->info[rcs[series].rix].sgi_index;
else if (flags & ATH_RC_CW40_FLAG)
rix = rate_table->info[rcs[series].rix].cw40index;
if ((flags & IEEE80211_TX_RC_40_MHZ_WIDTH) && (flags & IEEE80211_TX_RC_SHORT_GI))
rix = rate_table->info[rates[series].idx].ht_index;
else if (flags & IEEE80211_TX_RC_SHORT_GI)
rix = rate_table->info[rates[series].idx].sgi_index;
else if (flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
rix = rate_table->info[rates[series].idx].cw40index;
else
rix = rate_table->info[rcs[series].rix].base_index;
rix = rate_table->info[rates[series].idx].base_index;

ath_rc_update_ht(sc, ath_rc_priv, info_priv, rix,
xretries, long_retry);
Expand All @@ -1365,8 +1365,10 @@ static void ath_rc_update(struct ath_softc *sc,
static void ath_rate_tx_complete(struct ath_softc *sc,
struct ath_node *an,
struct ath_rate_node *rc_priv,
struct ath_tx_info_priv *info_priv)
struct ieee80211_tx_info *tx_info)
{
struct ath_tx_info_priv *info_priv =
(struct ath_tx_info_priv *)tx_info->rate_driver_data[0];
int final_ts_idx = info_priv->tx.ts_rateindex;
int tx_status = 0, is_underrun = 0;

Expand Down Expand Up @@ -1395,7 +1397,7 @@ static void ath_rate_tx_complete(struct ath_softc *sc,
(info_priv->tx.ts_status & ATH9K_TXERR_FIFO))
tx_status = 1;

ath_rc_update(sc, rc_priv, info_priv, final_ts_idx, tx_status,
ath_rc_update(sc, rc_priv, tx_info, final_ts_idx, tx_status,
(is_underrun) ? ATH_11N_TXMAXTRY :
info_priv->tx.ts_longretry);
}
Expand Down Expand Up @@ -1507,19 +1509,17 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,

hdr = (struct ieee80211_hdr *)skb->data;
fc = hdr->frame_control;
/* XXX: UGLY HACK!! */
tx_info_priv = (struct ath_tx_info_priv *)tx_info->control.vif;
tx_info_priv = (struct ath_tx_info_priv *)tx_info->rate_driver_data[0];

an = (struct ath_node *)sta->drv_priv;

if (tx_info_priv == NULL)
return;

if (an && priv_sta && ieee80211_is_data(fc))
ath_rate_tx_complete(sc, an, priv_sta, tx_info_priv);
ath_rate_tx_complete(sc, an, priv_sta, tx_info);

kfree(tx_info_priv);
tx_info->control.vif = NULL;
}

static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
Expand All @@ -1530,53 +1530,30 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct ath_softc *sc = priv;
struct ieee80211_hw *hw = sc->hw;
struct ath_tx_info_priv *tx_info_priv;
struct ath_rate_node *ath_rc_priv = priv_sta;
struct ath_node *an;
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
int is_probe = FALSE;
s8 lowest_idx;
__le16 fc = hdr->frame_control;
u8 *qc, tid;

DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__);

/* allocate driver private area of tx_info, XXX: UGLY HACK! */
tx_info->control.vif = kzalloc(sizeof(*tx_info_priv), GFP_ATOMIC);
tx_info_priv = (struct ath_tx_info_priv *)tx_info->control.vif;
ASSERT(tx_info_priv != NULL);

lowest_idx = rate_lowest_index(sband, sta);
tx_info_priv->min_rate = (sband->bitrates[lowest_idx].bitrate * 2) / 10;
/* lowest rate for management and multicast/broadcast frames */
if (!ieee80211_is_data(fc) ||
is_multicast_ether_addr(hdr->addr1) || !sta) {
tx_info->control.rates[0].idx = lowest_idx;
if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1)) {
tx_info->control.rates[0].idx = rate_lowest_index(sband, sta);
tx_info->control.rates[0].count =
is_multicast_ether_addr(hdr->addr1) ? 1 : ATH_MGT_TXMAXTRY;
return;
}

/* Find tx rate for unicast frames */
ath_rate_findrate(sc, ath_rc_priv,
ATH_11N_TXMAXTRY, 4,
ATH_RC_PROBE_ALLOWED,
tx_info_priv->rcs,
tx_info,
&is_probe,
false);
#if 0
if (is_probe)
sel->probe_idx = ath_rc_priv->tx_ratectrl.probe_rate;
#endif

/* Ratecontrol sometimes returns invalid rate index */
if (tx_info_priv->rcs[0].rix != 0xff)
ath_rc_priv->prev_data_rix = tx_info_priv->rcs[0].rix;
else
tx_info_priv->rcs[0].rix = ath_rc_priv->prev_data_rix;

tx_info->control.rates[0].idx = tx_info_priv->rcs[0].rix;

/* Check if aggregation has to be enabled for this tid */

if (hw->conf.ht.enabled) {
if (ieee80211_is_data_qos(fc)) {
qc = ieee80211_get_qos_ctl(hdr);
Expand Down
17 changes: 0 additions & 17 deletions trunk/drivers/net/wireless/ath9k/rc.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,20 +169,6 @@ struct ath_rate_table {
#define ATH_RC_PROBE_ALLOWED 0x00000001
#define ATH_RC_MINRATE_LASTRATE 0x00000002

struct ath_rc_series {
u8 rix;
u8 tries;
u8 flags;
u32 max_4ms_framelen;
};

/* rcs_flags definition */
#define ATH_RC_DS_FLAG 0x01
#define ATH_RC_CW40_FLAG 0x02 /* CW 40 */
#define ATH_RC_SGI_FLAG 0x04 /* Short Guard Interval */
#define ATH_RC_HT_FLAG 0x08 /* HT */
#define ATH_RC_RTSCTS_FLAG 0x10 /* RTS-CTS */

/*
* State structures for new rate adaptation code
*/
Expand Down Expand Up @@ -259,13 +245,10 @@ struct ath_rate_node {
struct ath_rate_softc *asc;
};

/* Driver data of ieee80211_tx_info */
struct ath_tx_info_priv {
struct ath_rc_series rcs[4];
struct ath_tx_status tx;
int n_frames;
int n_bad_frames;
u8 min_rate;
};

void ath_rate_attach(struct ath_softc *sc);
Expand Down
Loading

0 comments on commit b9c73e5

Please sign in to comment.