Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 183572
b: refs/heads/master
c: e00cfce
h: refs/heads/master
v: v3
  • Loading branch information
Jouni Malinen authored and John W. Linville committed Jan 12, 2010
1 parent 958b0a5 commit 66c98b6
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 12 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: 3dc1de0bf23816ed557ac8addf680cd5ee57e805
refs/heads/master: e00cfce0cb2a397859607bf515c6de9ce064b64a
2 changes: 2 additions & 0 deletions trunk/include/net/mac80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -2299,6 +2299,7 @@ enum rate_control_changed {
* @max_rate_idx: user-requested maximum rate (not MCS for now)
* @skb: the skb that will be transmitted, the control information in it needs
* to be filled in
* @ap: whether this frame is sent out in AP mode
*/
struct ieee80211_tx_rate_control {
struct ieee80211_hw *hw;
Expand All @@ -2308,6 +2309,7 @@ struct ieee80211_tx_rate_control {
struct ieee80211_tx_rate reported_rate;
bool rts, short_preamble;
u8 max_rate_idx;
bool ap;
};

struct rate_control_ops {
Expand Down
25 changes: 25 additions & 0 deletions trunk/net/mac80211/rate.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,27 @@ static bool rc_no_data_or_no_ack(struct ieee80211_tx_rate_control *txrc)
return ((info->flags & IEEE80211_TX_CTL_NO_ACK) || !ieee80211_is_data(fc));
}

static void rc_send_low_broadcast(s8 *idx, u32 basic_rates, u8 max_rate_idx)
{
u8 i;

if (basic_rates == 0)
return; /* assume basic rates unknown and accept rate */
if (*idx < 0)
return;
if (basic_rates & (1 << *idx))
return; /* selected rate is a basic rate */

for (i = *idx + 1; i <= max_rate_idx; i++) {
if (basic_rates & (1 << i)) {
*idx = i;
return;
}
}

/* could not find a basic rate; use original selection */
}

bool rate_control_send_low(struct ieee80211_sta *sta,
void *priv_sta,
struct ieee80211_tx_rate_control *txrc)
Expand All @@ -218,6 +239,10 @@ bool rate_control_send_low(struct ieee80211_sta *sta,
info->control.rates[0].count =
(info->flags & IEEE80211_TX_CTL_NO_ACK) ?
1 : txrc->hw->max_rate_tries;
if (!sta && txrc->ap)
rc_send_low_broadcast(&info->control.rates[0].idx,
txrc->bss_conf->basic_rates,
txrc->sband->n_bitrates);
return true;
}
return false;
Expand Down
24 changes: 13 additions & 11 deletions trunk/net/mac80211/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
txrc.skb = tx->skb;
txrc.reported_rate.idx = -1;
txrc.max_rate_idx = tx->sdata->max_ratectrl_rateidx;
txrc.ap = tx->sdata->vif.type == NL80211_IFTYPE_AP;

/* set up RTS protection if desired */
if (len > tx->local->hw.wiphy->rts_threshold) {
Expand Down Expand Up @@ -2060,6 +2061,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
struct beacon_data *beacon;
struct ieee80211_supported_band *sband;
enum ieee80211_band band = local->hw.conf.channel->band;
struct ieee80211_tx_rate_control txrc;

sband = local->hw.wiphy->bands[band];

Expand Down Expand Up @@ -2167,21 +2169,21 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
info = IEEE80211_SKB_CB(skb);

info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
info->flags |= IEEE80211_TX_CTL_NO_ACK;
info->band = band;
/*
* XXX: For now, always use the lowest rate
*/
info->control.rates[0].idx = 0;
info->control.rates[0].count = 1;
info->control.rates[1].idx = -1;
info->control.rates[2].idx = -1;
info->control.rates[3].idx = -1;
info->control.rates[4].idx = -1;
BUILD_BUG_ON(IEEE80211_TX_MAX_RATES != 5);

memset(&txrc, 0, sizeof(txrc));
txrc.hw = hw;
txrc.sband = sband;
txrc.bss_conf = &sdata->vif.bss_conf;
txrc.skb = skb;
txrc.reported_rate.idx = -1;
txrc.max_rate_idx = sdata->max_ratectrl_rateidx;
txrc.ap = true;
rate_control_get_rate(sdata, NULL, &txrc);

info->control.vif = vif;

info->flags |= IEEE80211_TX_CTL_NO_ACK;
info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ;
out:
Expand Down

0 comments on commit 66c98b6

Please sign in to comment.