diff options
author | Ashok Nagarajan <ashok@cozybit.com> | 2012-04-03 00:21:20 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-04-11 16:23:46 -0400 |
commit | 657c3e0c4147bb3d3fdd338e32b83b968b0f9d02 (patch) | |
tree | 06f4f3fb9f7a01b6eb823d2f7a7d0f76c76a28aa /net/mac80211/util.c | |
parent | d934f7d0d6a3f8aa3049ca0692948ec59d738928 (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/mac80211/util.c')
-rw-r--r-- | net/mac80211/util.c | 18 |
1 files changed, 14 insertions, 4 deletions
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 | ||
1686 | int ieee80211_add_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb) | 1686 | int 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 | ||
1713 | int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb) | 1718 | int 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; |