1 --- a/include/net/cfg80211.h
2 +++ b/include/net/cfg80211.h
3 @@ -924,7 +924,7 @@ struct cfg80211_disassoc_request {
4 * @privacy: this is a protected network, keys will be configured
6 * @basic_rates: bitmap of basic rates to use when creating the IBSS
7 - * @mcast_rate: multicast tx rate (in 100 kbps)
8 + * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
10 struct cfg80211_ibss_params {
12 @@ -936,7 +936,7 @@ struct cfg80211_ibss_params {
17 + int mcast_rate[IEEE80211_NUM_BANDS];
21 --- a/include/net/mac80211.h
22 +++ b/include/net/mac80211.h
23 @@ -219,7 +219,7 @@ enum ieee80211_bss_change {
24 * @basic_rates: bitmap of basic rates, each bit stands for an
25 * index into the rate table configured by the driver in
27 - * @mcast_rate: multicast rate for AP and Ad-Hoc (in 100 kbps)
28 + * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
29 * @bssid: The BSSID for this BSS
30 * @enable_beacon: whether beaconing should be enabled or not
31 * @channel_type: Channel type for this BSS -- the hardware might be
32 @@ -259,7 +259,7 @@ struct ieee80211_bss_conf {
37 + int mcast_rate[IEEE80211_NUM_BANDS];
38 u16 ht_operation_mode;
41 --- a/net/mac80211/ibss.c
42 +++ b/net/mac80211/ibss.c
43 @@ -915,7 +915,8 @@ int ieee80211_ibss_join(struct ieee80211
45 sdata->u.ibss.privacy = params->privacy;
46 sdata->u.ibss.basic_rates = params->basic_rates;
47 - sdata->vif.bss_conf.mcast_rate = params->mcast_rate;
48 + memcpy(sdata->vif.bss_conf.mcast_rate, params->mcast_rate,
49 + sizeof(params->mcast_rate));
51 sdata->vif.bss_conf.beacon_int = params->beacon_interval;
53 --- a/net/mac80211/rate.c
54 +++ b/net/mac80211/rate.c
55 @@ -211,20 +211,11 @@ static bool rc_no_data_or_no_ack(struct
56 return (info->flags & IEEE80211_TX_CTL_NO_ACK) || !ieee80211_is_data(fc);
59 -static void rc_send_low_broadcast(s8 *idx, u32 basic_rates, u32 mcast_rate,
60 +static void rc_send_low_broadcast(s8 *idx, u32 basic_rates,
61 struct ieee80211_supported_band *sband)
66 - for (i = 0; i < sband->n_bitrates; i++) {
67 - if (sband->bitrates[i].bitrate == mcast_rate) {
75 return; /* assume basic rates unknown and accept rate */
77 @@ -247,17 +238,25 @@ bool rate_control_send_low(struct ieee80
78 struct ieee80211_tx_rate_control *txrc)
80 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
81 + struct ieee80211_supported_band *sband = txrc->sband;
84 if (!sta || !priv_sta || rc_no_data_or_no_ack(txrc)) {
85 info->control.rates[0].idx = rate_lowest_index(txrc->sband, sta);
86 info->control.rates[0].count =
87 (info->flags & IEEE80211_TX_CTL_NO_ACK) ?
88 1 : txrc->hw->max_rate_tries;
89 - if (!sta && txrc->bss)
90 + if (!sta && txrc->bss) {
91 + mcast_rate = txrc->bss_conf->mcast_rate[sband->band];
92 + if (mcast_rate > 0) {
93 + info->control.rates[0].idx = mcast_rate - 1;
97 rc_send_low_broadcast(&info->control.rates[0].idx,
98 txrc->bss_conf->basic_rates,
99 - txrc->bss_conf->mcast_rate,
106 --- a/net/wireless/nl80211.c
107 +++ b/net/wireless/nl80211.c
108 @@ -3600,6 +3600,34 @@ static int nl80211_disassociate(struct s
113 +nl80211_parse_mcast_rate(struct cfg80211_registered_device *rdev,
114 + int mcast_rate[IEEE80211_NUM_BANDS],
117 + struct wiphy *wiphy = &rdev->wiphy;
118 + bool found = false;
121 + for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
122 + struct ieee80211_supported_band *sband;
124 + sband = wiphy->bands[band];
128 + for (i = 0; i < sband->n_bitrates; i++) {
129 + if (sband->bitrates[i].bitrate == rateval) {
130 + mcast_rate[band] = i + 1;
140 static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
142 struct cfg80211_registered_device *rdev = info->user_ptr[0];
143 @@ -3683,9 +3711,11 @@ static int nl80211_join_ibss(struct sk_b
147 - if (info->attrs[NL80211_ATTR_MCAST_RATE])
149 - nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE]);
151 + if (info->attrs[NL80211_ATTR_MCAST_RATE] &&
152 + !nl80211_parse_mcast_rate(rdev, ibss.mcast_rate,
153 + nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE])))
156 if (ibss.privacy && info->attrs[NL80211_ATTR_KEYS]) {
157 connkeys = nl80211_parse_connkeys(rdev,