aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-11-11 09:07:23 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-11-16 16:39:08 -0500
commit8f0729b16ae354f9db89394fc1d2d65003455d56 (patch)
tree260a562d0c0079ebfc1c507c9aa50e55a1592b6d
parent885a46d0f7942d76c2f3860acb45f75237d3bb42 (diff)
mac80211: add support for setting the ad-hoc multicast rate
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--include/net/mac80211.h6
-rw-r--r--net/mac80211/ibss.c1
-rw-r--r--net/mac80211/rate.c19
-rw-r--r--net/mac80211/tx.c5
4 files changed, 23 insertions, 8 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index af7e84199e62..1248369a7c30 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -205,6 +205,7 @@ enum ieee80211_bss_change {
205 * @basic_rates: bitmap of basic rates, each bit stands for an 205 * @basic_rates: bitmap of basic rates, each bit stands for an
206 * index into the rate table configured by the driver in 206 * index into the rate table configured by the driver in
207 * the current band. 207 * the current band.
208 * @mcast_rate: multicast rate for AP and Ad-Hoc (in 100 kbps)
208 * @bssid: The BSSID for this BSS 209 * @bssid: The BSSID for this BSS
209 * @enable_beacon: whether beaconing should be enabled or not 210 * @enable_beacon: whether beaconing should be enabled or not
210 * @channel_type: Channel type for this BSS -- the hardware might be 211 * @channel_type: Channel type for this BSS -- the hardware might be
@@ -244,6 +245,7 @@ struct ieee80211_bss_conf {
244 u16 assoc_capability; 245 u16 assoc_capability;
245 u64 timestamp; 246 u64 timestamp;
246 u32 basic_rates; 247 u32 basic_rates;
248 u32 mcast_rate;
247 u16 ht_operation_mode; 249 u16 ht_operation_mode;
248 s32 cqm_rssi_thold; 250 s32 cqm_rssi_thold;
249 u32 cqm_rssi_hyst; 251 u32 cqm_rssi_hyst;
@@ -2663,7 +2665,7 @@ enum rate_control_changed {
2663 * @rate_idx_mask: user-requested rate mask (not MCS for now) 2665 * @rate_idx_mask: user-requested rate mask (not MCS for now)
2664 * @skb: the skb that will be transmitted, the control information in it needs 2666 * @skb: the skb that will be transmitted, the control information in it needs
2665 * to be filled in 2667 * to be filled in
2666 * @ap: whether this frame is sent out in AP mode 2668 * @bss: whether this frame is sent out in AP or IBSS mode
2667 */ 2669 */
2668struct ieee80211_tx_rate_control { 2670struct ieee80211_tx_rate_control {
2669 struct ieee80211_hw *hw; 2671 struct ieee80211_hw *hw;
@@ -2674,7 +2676,7 @@ struct ieee80211_tx_rate_control {
2674 bool rts, short_preamble; 2676 bool rts, short_preamble;
2675 u8 max_rate_idx; 2677 u8 max_rate_idx;
2676 u32 rate_idx_mask; 2678 u32 rate_idx_mask;
2677 bool ap; 2679 bool bss;
2678}; 2680};
2679 2681
2680struct rate_control_ops { 2682struct rate_control_ops {
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 239c4836a946..6fe6837dc134 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -915,6 +915,7 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
915 915
916 sdata->u.ibss.privacy = params->privacy; 916 sdata->u.ibss.privacy = params->privacy;
917 sdata->u.ibss.basic_rates = params->basic_rates; 917 sdata->u.ibss.basic_rates = params->basic_rates;
918 sdata->vif.bss_conf.mcast_rate = params->mcast_rate;
918 919
919 sdata->vif.bss_conf.beacon_int = params->beacon_interval; 920 sdata->vif.bss_conf.beacon_int = params->beacon_interval;
920 921
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 33f76993da08..76de4f8d9327 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -211,10 +211,20 @@ static bool rc_no_data_or_no_ack(struct ieee80211_tx_rate_control *txrc)
211 return (info->flags & IEEE80211_TX_CTL_NO_ACK) || !ieee80211_is_data(fc); 211 return (info->flags & IEEE80211_TX_CTL_NO_ACK) || !ieee80211_is_data(fc);
212} 212}
213 213
214static void rc_send_low_broadcast(s8 *idx, u32 basic_rates, u8 max_rate_idx) 214static void rc_send_low_broadcast(s8 *idx, u32 basic_rates, u32 mcast_rate,
215 struct ieee80211_supported_band *sband)
215{ 216{
216 u8 i; 217 u8 i;
217 218
219 if (mcast_rate) {
220 for (i = 0; i < sband->n_bitrates; i++) {
221 if (sband->bitrates[i].bitrate == mcast_rate) {
222 *idx = i;
223 return;
224 }
225 }
226 }
227
218 if (basic_rates == 0) 228 if (basic_rates == 0)
219 return; /* assume basic rates unknown and accept rate */ 229 return; /* assume basic rates unknown and accept rate */
220 if (*idx < 0) 230 if (*idx < 0)
@@ -222,7 +232,7 @@ static void rc_send_low_broadcast(s8 *idx, u32 basic_rates, u8 max_rate_idx)
222 if (basic_rates & (1 << *idx)) 232 if (basic_rates & (1 << *idx))
223 return; /* selected rate is a basic rate */ 233 return; /* selected rate is a basic rate */
224 234
225 for (i = *idx + 1; i <= max_rate_idx; i++) { 235 for (i = *idx + 1; i <= sband->n_bitrates; i++) {
226 if (basic_rates & (1 << i)) { 236 if (basic_rates & (1 << i)) {
227 *idx = i; 237 *idx = i;
228 return; 238 return;
@@ -243,10 +253,11 @@ bool rate_control_send_low(struct ieee80211_sta *sta,
243 info->control.rates[0].count = 253 info->control.rates[0].count =
244 (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 254 (info->flags & IEEE80211_TX_CTL_NO_ACK) ?
245 1 : txrc->hw->max_rate_tries; 255 1 : txrc->hw->max_rate_tries;
246 if (!sta && txrc->ap) 256 if (!sta && txrc->bss)
247 rc_send_low_broadcast(&info->control.rates[0].idx, 257 rc_send_low_broadcast(&info->control.rates[0].idx,
248 txrc->bss_conf->basic_rates, 258 txrc->bss_conf->basic_rates,
249 txrc->sband->n_bitrates); 259 txrc->bss_conf->mcast_rate,
260 txrc->sband);
250 return true; 261 return true;
251 } 262 }
252 return false; 263 return false;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index b392876af7d8..e69483647f33 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -622,7 +622,8 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
622 txrc.max_rate_idx = -1; 622 txrc.max_rate_idx = -1;
623 else 623 else
624 txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1; 624 txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1;
625 txrc.ap = tx->sdata->vif.type == NL80211_IFTYPE_AP; 625 txrc.bss = (tx->sdata->vif.type == NL80211_IFTYPE_AP ||
626 tx->sdata->vif.type == NL80211_IFTYPE_ADHOC);
626 627
627 /* set up RTS protection if desired */ 628 /* set up RTS protection if desired */
628 if (len > tx->local->hw.wiphy->rts_threshold) { 629 if (len > tx->local->hw.wiphy->rts_threshold) {
@@ -2308,7 +2309,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
2308 txrc.max_rate_idx = -1; 2309 txrc.max_rate_idx = -1;
2309 else 2310 else
2310 txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1; 2311 txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1;
2311 txrc.ap = true; 2312 txrc.bss = true;
2312 rate_control_get_rate(sdata, NULL, &txrc); 2313 rate_control_get_rate(sdata, NULL, &txrc);
2313 2314
2314 info->control.vif = vif; 2315 info->control.vif = vif;