aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAshok Nagarajan <ashok@cozybit.com>2012-04-03 00:21:20 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-04-11 16:23:46 -0400
commit657c3e0c4147bb3d3fdd338e32b83b968b0f9d02 (patch)
tree06f4f3fb9f7a01b6eb823d2f7a7d0f76c76a28aa /net
parentd934f7d0d6a3f8aa3049ca0692948ec59d738928 (diff)
mac80211: Indicate basic rates when adding rate IEs
Basic rates are added with supported rates IE and extended supported rates IE. Signed-off-by: Ashok Nagarajan <ashok@cozybit.com> Signed-off-by: Thomas Pedersen <thomas@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/cfg.c12
-rw-r--r--net/mac80211/mesh_plink.c4
-rw-r--r--net/mac80211/tx.c4
-rw-r--r--net/mac80211/util.c18
4 files changed, 24 insertions, 14 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 83e08dcb2f5d..42e1fb2e700f 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2358,8 +2358,8 @@ ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev,
2358 tf->u.setup_req.capability = 2358 tf->u.setup_req.capability =
2359 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 2359 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata));
2360 2360
2361 ieee80211_add_srates_ie(&sdata->vif, skb); 2361 ieee80211_add_srates_ie(&sdata->vif, skb, false);
2362 ieee80211_add_ext_srates_ie(&sdata->vif, skb); 2362 ieee80211_add_ext_srates_ie(&sdata->vif, skb, false);
2363 ieee80211_tdls_add_ext_capab(skb); 2363 ieee80211_tdls_add_ext_capab(skb);
2364 break; 2364 break;
2365 case WLAN_TDLS_SETUP_RESPONSE: 2365 case WLAN_TDLS_SETUP_RESPONSE:
@@ -2372,8 +2372,8 @@ ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev,
2372 tf->u.setup_resp.capability = 2372 tf->u.setup_resp.capability =
2373 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 2373 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata));
2374 2374
2375 ieee80211_add_srates_ie(&sdata->vif, skb); 2375 ieee80211_add_srates_ie(&sdata->vif, skb, false);
2376 ieee80211_add_ext_srates_ie(&sdata->vif, skb); 2376 ieee80211_add_ext_srates_ie(&sdata->vif, skb, false);
2377 ieee80211_tdls_add_ext_capab(skb); 2377 ieee80211_tdls_add_ext_capab(skb);
2378 break; 2378 break;
2379 case WLAN_TDLS_SETUP_CONFIRM: 2379 case WLAN_TDLS_SETUP_CONFIRM:
@@ -2433,8 +2433,8 @@ ieee80211_prep_tdls_direct(struct wiphy *wiphy, struct net_device *dev,
2433 mgmt->u.action.u.tdls_discover_resp.capability = 2433 mgmt->u.action.u.tdls_discover_resp.capability =
2434 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 2434 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata));
2435 2435
2436 ieee80211_add_srates_ie(&sdata->vif, skb); 2436 ieee80211_add_srates_ie(&sdata->vif, skb, false);
2437 ieee80211_add_ext_srates_ie(&sdata->vif, skb); 2437 ieee80211_add_ext_srates_ie(&sdata->vif, skb, false);
2438 ieee80211_tdls_add_ext_capab(skb); 2438 ieee80211_tdls_add_ext_capab(skb);
2439 break; 2439 break;
2440 default: 2440 default:
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 923269b62b43..73fa687edc7c 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -212,8 +212,8 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
212 pos = skb_put(skb, 2); 212 pos = skb_put(skb, 2);
213 memcpy(pos + 2, &plid, 2); 213 memcpy(pos + 2, &plid, 2);
214 } 214 }
215 if (ieee80211_add_srates_ie(&sdata->vif, skb) || 215 if (ieee80211_add_srates_ie(&sdata->vif, skb, true) ||
216 ieee80211_add_ext_srates_ie(&sdata->vif, skb) || 216 ieee80211_add_ext_srates_ie(&sdata->vif, skb, true) ||
217 mesh_add_rsn_ie(skb, sdata) || 217 mesh_add_rsn_ie(skb, sdata) ||
218 mesh_add_meshid_ie(skb, sdata) || 218 mesh_add_meshid_ie(skb, sdata) ||
219 mesh_add_meshconf_ie(skb, sdata)) 219 mesh_add_meshconf_ie(skb, sdata))
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index daab5adeb93c..4109ec7999a3 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2418,9 +2418,9 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
2418 *pos++ = WLAN_EID_SSID; 2418 *pos++ = WLAN_EID_SSID;
2419 *pos++ = 0x0; 2419 *pos++ = 0x0;
2420 2420
2421 if (ieee80211_add_srates_ie(&sdata->vif, skb) || 2421 if (ieee80211_add_srates_ie(&sdata->vif, skb, true) ||
2422 mesh_add_ds_params_ie(skb, sdata) || 2422 mesh_add_ds_params_ie(skb, sdata) ||
2423 ieee80211_add_ext_srates_ie(&sdata->vif, skb) || 2423 ieee80211_add_ext_srates_ie(&sdata->vif, skb, true) ||
2424 mesh_add_rsn_ie(skb, sdata) || 2424 mesh_add_rsn_ie(skb, sdata) ||
2425 mesh_add_ht_cap_ie(skb, sdata) || 2425 mesh_add_ht_cap_ie(skb, sdata) ||
2426 mesh_add_ht_oper_ie(skb, sdata) || 2426 mesh_add_ht_oper_ie(skb, sdata) ||
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 471a831066dd..468a18ea1f1b 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1683,13 +1683,15 @@ ieee80211_ht_oper_to_channel_type(struct ieee80211_ht_operation *ht_oper)
1683 return channel_type; 1683 return channel_type;
1684} 1684}
1685 1685
1686int ieee80211_add_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb) 1686int ieee80211_add_srates_ie(struct ieee80211_vif *vif,
1687 struct sk_buff *skb, bool need_basic)
1687{ 1688{
1688 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); 1689 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
1689 struct ieee80211_local *local = sdata->local; 1690 struct ieee80211_local *local = sdata->local;
1690 struct ieee80211_supported_band *sband; 1691 struct ieee80211_supported_band *sband;
1691 int rate; 1692 int rate;
1692 u8 i, rates, *pos; 1693 u8 i, rates, *pos;
1694 u32 basic_rates = vif->bss_conf.basic_rates;
1693 1695
1694 sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; 1696 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
1695 rates = sband->n_bitrates; 1697 rates = sband->n_bitrates;
@@ -1703,20 +1705,25 @@ int ieee80211_add_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb)
1703 *pos++ = WLAN_EID_SUPP_RATES; 1705 *pos++ = WLAN_EID_SUPP_RATES;
1704 *pos++ = rates; 1706 *pos++ = rates;
1705 for (i = 0; i < rates; i++) { 1707 for (i = 0; i < rates; i++) {
1708 u8 basic = 0;
1709 if (need_basic && basic_rates & BIT(i))
1710 basic = 0x80;
1706 rate = sband->bitrates[i].bitrate; 1711 rate = sband->bitrates[i].bitrate;
1707 *pos++ = (u8) (rate / 5); 1712 *pos++ = basic | (u8) (rate / 5);
1708 } 1713 }
1709 1714
1710 return 0; 1715 return 0;
1711} 1716}
1712 1717
1713int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb) 1718int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif,
1719 struct sk_buff *skb, bool need_basic)
1714{ 1720{
1715 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); 1721 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
1716 struct ieee80211_local *local = sdata->local; 1722 struct ieee80211_local *local = sdata->local;
1717 struct ieee80211_supported_band *sband; 1723 struct ieee80211_supported_band *sband;
1718 int rate; 1724 int rate;
1719 u8 i, exrates, *pos; 1725 u8 i, exrates, *pos;
1726 u32 basic_rates = vif->bss_conf.basic_rates;
1720 1727
1721 sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; 1728 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
1722 exrates = sband->n_bitrates; 1729 exrates = sband->n_bitrates;
@@ -1733,8 +1740,11 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb)
1733 *pos++ = WLAN_EID_EXT_SUPP_RATES; 1740 *pos++ = WLAN_EID_EXT_SUPP_RATES;
1734 *pos++ = exrates; 1741 *pos++ = exrates;
1735 for (i = 8; i < sband->n_bitrates; i++) { 1742 for (i = 8; i < sband->n_bitrates; i++) {
1743 u8 basic = 0;
1744 if (need_basic && basic_rates & BIT(i))
1745 basic = 0x80;
1736 rate = sband->bitrates[i].bitrate; 1746 rate = sband->bitrates[i].bitrate;
1737 *pos++ = (u8) (rate / 5); 1747 *pos++ = basic | (u8) (rate / 5);
1738 } 1748 }
1739 } 1749 }
1740 return 0; 1750 return 0;