1 | --- a/net/mac80211/ibss.c |
2 | +++ b/net/mac80211/ibss.c |
3 | @@ -914,6 +914,7 @@ int ieee80211_ibss_join(struct ieee80211 |
4 | |
5 | sdata->u.ibss.privacy = params->privacy; |
6 | sdata->u.ibss.basic_rates = params->basic_rates; |
7 | + sdata->vif.bss_conf.mcast_rate = params->mcast_rate; |
8 | |
9 | sdata->vif.bss_conf.beacon_int = params->beacon_interval; |
10 | |
11 | --- a/include/net/mac80211.h |
12 | +++ b/include/net/mac80211.h |
13 | @@ -244,6 +244,7 @@ struct ieee80211_bss_conf { |
14 | u16 assoc_capability; |
15 | u64 timestamp; |
16 | u32 basic_rates; |
17 | + u32 mcast_rate; |
18 | u16 ht_operation_mode; |
19 | s32 cqm_rssi_thold; |
20 | u32 cqm_rssi_hyst; |
21 | @@ -2644,7 +2645,7 @@ enum rate_control_changed { |
22 | * @rate_idx_mask: user-requested rate mask (not MCS for now) |
23 | * @skb: the skb that will be transmitted, the control information in it needs |
24 | * to be filled in |
25 | - * @ap: whether this frame is sent out in AP mode |
26 | + * @bss: whether this frame is sent out in AP or IBSS mode |
27 | */ |
28 | struct ieee80211_tx_rate_control { |
29 | struct ieee80211_hw *hw; |
30 | @@ -2655,7 +2656,7 @@ struct ieee80211_tx_rate_control { |
31 | bool rts, short_preamble; |
32 | u8 max_rate_idx; |
33 | u32 rate_idx_mask; |
34 | - bool ap; |
35 | + bool bss; |
36 | }; |
37 | |
38 | struct rate_control_ops { |
39 | --- a/net/mac80211/rate.c |
40 | +++ b/net/mac80211/rate.c |
41 | @@ -210,10 +210,20 @@ static bool rc_no_data_or_no_ack(struct |
42 | return ((info->flags & IEEE80211_TX_CTL_NO_ACK) || !ieee80211_is_data(fc)); |
43 | } |
44 | |
45 | -static void rc_send_low_broadcast(s8 *idx, u32 basic_rates, u8 max_rate_idx) |
46 | +static void rc_send_low_broadcast(s8 *idx, u32 basic_rates, u32 mcast_rate, |
47 | + struct ieee80211_supported_band *sband) |
48 | { |
49 | u8 i; |
50 | |
51 | + if (mcast_rate) { |
52 | + for (i = 0; i < sband->n_bitrates; i++) { |
53 | + if (sband->bitrates[i].bitrate == mcast_rate) { |
54 | + *idx = i; |
55 | + return; |
56 | + } |
57 | + } |
58 | + } |
59 | + |
60 | if (basic_rates == 0) |
61 | return; /* assume basic rates unknown and accept rate */ |
62 | if (*idx < 0) |
63 | @@ -221,7 +231,7 @@ static void rc_send_low_broadcast(s8 *id |
64 | if (basic_rates & (1 << *idx)) |
65 | return; /* selected rate is a basic rate */ |
66 | |
67 | - for (i = *idx + 1; i <= max_rate_idx; i++) { |
68 | + for (i = *idx + 1; i <= sband->n_bitrates; i++) { |
69 | if (basic_rates & (1 << i)) { |
70 | *idx = i; |
71 | return; |
72 | @@ -242,10 +252,11 @@ bool rate_control_send_low(struct ieee80 |
73 | info->control.rates[0].count = |
74 | (info->flags & IEEE80211_TX_CTL_NO_ACK) ? |
75 | 1 : txrc->hw->max_rate_tries; |
76 | - if (!sta && txrc->ap) |
77 | + if (!sta && txrc->bss) |
78 | rc_send_low_broadcast(&info->control.rates[0].idx, |
79 | txrc->bss_conf->basic_rates, |
80 | - txrc->sband->n_bitrates); |
81 | + txrc->bss_conf->mcast_rate, |
82 | + txrc->sband); |
83 | return true; |
84 | } |
85 | return false; |
86 | --- a/net/mac80211/tx.c |
87 | +++ b/net/mac80211/tx.c |
88 | @@ -622,7 +622,8 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 |
89 | txrc.max_rate_idx = -1; |
90 | else |
91 | txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1; |
92 | - txrc.ap = tx->sdata->vif.type == NL80211_IFTYPE_AP; |
93 | + txrc.bss = (tx->sdata->vif.type == NL80211_IFTYPE_AP || |
94 | + tx->sdata->vif.type == NL80211_IFTYPE_ADHOC); |
95 | |
96 | /* set up RTS protection if desired */ |
97 | if (len > tx->local->hw.wiphy->rts_threshold) { |
98 | @@ -2312,7 +2313,7 @@ struct sk_buff *ieee80211_beacon_get_tim |
99 | txrc.max_rate_idx = -1; |
100 | else |
101 | txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1; |
102 | - txrc.ap = true; |
103 | + txrc.bss = true; |
104 | rate_control_get_rate(sdata, NULL, &txrc); |
105 | |
106 | info->control.vif = vif; |
107 | |