aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAshok Nagarajan <ashok@cozybit.com>2012-04-03 00:21:21 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-04-11 16:23:47 -0400
commit9ebb61a23d90703344fc609fbee8da67b1e7456c (patch)
tree021483e65ed424166b539d9a26d92d415c842d86 /net
parent657c3e0c4147bb3d3fdd338e32b83b968b0f9d02 (diff)
mac80211: Modify sta_get_rates to give basic rates
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/ibss.c4
-rw-r--r--net/mac80211/ieee80211_i.h2
-rw-r--r--net/mac80211/mesh.c5
-rw-r--r--net/mac80211/mesh_plink.c7
-rw-r--r--net/mac80211/util.c16
5 files changed, 23 insertions, 11 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index e910449dead0..49a207980338 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -408,7 +408,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
408 408
409 if (elems->supp_rates) { 409 if (elems->supp_rates) {
410 supp_rates = ieee80211_sta_get_rates(local, elems, 410 supp_rates = ieee80211_sta_get_rates(local, elems,
411 band); 411 band, NULL);
412 if (sta) { 412 if (sta) {
413 u32 prev_rates; 413 u32 prev_rates;
414 414
@@ -558,7 +558,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
558 sdata->name, mgmt->bssid); 558 sdata->name, mgmt->bssid);
559#endif 559#endif
560 ieee80211_sta_join_ibss(sdata, bss); 560 ieee80211_sta_join_ibss(sdata, bss);
561 supp_rates = ieee80211_sta_get_rates(local, elems, band); 561 supp_rates = ieee80211_sta_get_rates(local, elems, band, NULL);
562 ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 562 ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa,
563 supp_rates, true); 563 supp_rates, true);
564 rcu_read_unlock(); 564 rcu_read_unlock();
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index ea9623cbd969..41f7295cd891 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1480,7 +1480,7 @@ void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
1480 const u8 *supp_rates); 1480 const u8 *supp_rates);
1481u32 ieee80211_sta_get_rates(struct ieee80211_local *local, 1481u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
1482 struct ieee802_11_elems *elems, 1482 struct ieee802_11_elems *elems,
1483 enum ieee80211_band band); 1483 enum ieee80211_band band, u32 *basic_rates);
1484int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata, 1484int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata,
1485 enum ieee80211_smps_mode smps_mode); 1485 enum ieee80211_smps_mode smps_mode);
1486void ieee80211_recalc_smps(struct ieee80211_local *local); 1486void ieee80211_recalc_smps(struct ieee80211_local *local);
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index f1d9685d959c..7b22822d4208 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -625,7 +625,7 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
625 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 625 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
626 struct ieee802_11_elems elems; 626 struct ieee802_11_elems elems;
627 struct ieee80211_channel *channel; 627 struct ieee80211_channel *channel;
628 u32 supp_rates = 0; 628 u32 supp_rates = 0, basic_rates = 0;
629 size_t baselen; 629 size_t baselen;
630 int freq; 630 int freq;
631 enum ieee80211_band band = rx_status->band; 631 enum ieee80211_band band = rx_status->band;
@@ -658,7 +658,8 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
658 658
659 if (elems.mesh_id && elems.mesh_config && 659 if (elems.mesh_id && elems.mesh_config &&
660 mesh_matches_local(&elems, sdata)) { 660 mesh_matches_local(&elems, sdata)) {
661 supp_rates = ieee80211_sta_get_rates(local, &elems, band); 661 supp_rates = ieee80211_sta_get_rates(local, &elems,
662 band, &basic_rates);
662 mesh_neighbour_update(mgmt->sa, supp_rates, sdata, &elems); 663 mesh_neighbour_update(mgmt->sa, supp_rates, sdata, &elems);
663 } 664 }
664 665
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 73fa687edc7c..91e2043bc9b2 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -465,6 +465,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
465 bool deactivated, matches_local = true; 465 bool deactivated, matches_local = true;
466 u8 ie_len; 466 u8 ie_len;
467 u8 *baseaddr; 467 u8 *baseaddr;
468 u32 rates, basic_rates = 0;
468 __le16 plid, llid, reason; 469 __le16 plid, llid, reason;
469#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG 470#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
470 static const char *mplstates[] = { 471 static const char *mplstates[] = {
@@ -559,6 +560,9 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
559 560
560 /* Now we will figure out the appropriate event... */ 561 /* Now we will figure out the appropriate event... */
561 event = PLINK_UNDEFINED; 562 event = PLINK_UNDEFINED;
563 rates = ieee80211_sta_get_rates(local, &elems,
564 rx_status->band, &basic_rates);
565
562 if (ftype != WLAN_SP_MESH_PEERING_CLOSE && 566 if (ftype != WLAN_SP_MESH_PEERING_CLOSE &&
563 (!mesh_matches_local(&elems, sdata))) { 567 (!mesh_matches_local(&elems, sdata))) {
564 matches_local = false; 568 matches_local = false;
@@ -583,7 +587,6 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
583 return; 587 return;
584 } else if (!sta) { 588 } else if (!sta) {
585 /* ftype == WLAN_SP_MESH_PEERING_OPEN */ 589 /* ftype == WLAN_SP_MESH_PEERING_OPEN */
586 u32 rates;
587 590
588 rcu_read_unlock(); 591 rcu_read_unlock();
589 592
@@ -591,8 +594,6 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
591 mpl_dbg("Mesh plink error: no more free plinks\n"); 594 mpl_dbg("Mesh plink error: no more free plinks\n");
592 return; 595 return;
593 } 596 }
594
595 rates = ieee80211_sta_get_rates(local, &elems, rx_status->band);
596 sta = mesh_plink_alloc(sdata, mgmt->sa, rates, &elems); 597 sta = mesh_plink_alloc(sdata, mgmt->sa, rates, &elems);
597 if (!sta) { 598 if (!sta) {
598 mpl_dbg("Mesh plink error: plink table full\n"); 599 mpl_dbg("Mesh plink error: plink table full\n");
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 468a18ea1f1b..a18b693042b2 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1109,7 +1109,7 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
1109 1109
1110u32 ieee80211_sta_get_rates(struct ieee80211_local *local, 1110u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
1111 struct ieee802_11_elems *elems, 1111 struct ieee802_11_elems *elems,
1112 enum ieee80211_band band) 1112 enum ieee80211_band band, u32 *basic_rates)
1113{ 1113{
1114 struct ieee80211_supported_band *sband; 1114 struct ieee80211_supported_band *sband;
1115 struct ieee80211_rate *bitrates; 1115 struct ieee80211_rate *bitrates;
@@ -1130,15 +1130,25 @@ u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
1130 elems->ext_supp_rates_len; i++) { 1130 elems->ext_supp_rates_len; i++) {
1131 u8 rate = 0; 1131 u8 rate = 0;
1132 int own_rate; 1132 int own_rate;
1133 bool is_basic;
1133 if (i < elems->supp_rates_len) 1134 if (i < elems->supp_rates_len)
1134 rate = elems->supp_rates[i]; 1135 rate = elems->supp_rates[i];
1135 else if (elems->ext_supp_rates) 1136 else if (elems->ext_supp_rates)
1136 rate = elems->ext_supp_rates 1137 rate = elems->ext_supp_rates
1137 [i - elems->supp_rates_len]; 1138 [i - elems->supp_rates_len];
1138 own_rate = 5 * (rate & 0x7f); 1139 own_rate = 5 * (rate & 0x7f);
1139 for (j = 0; j < num_rates; j++) 1140 is_basic = !!(rate & 0x80);
1140 if (bitrates[j].bitrate == own_rate) 1141
1142 if (is_basic && (rate & 0x7f) == BSS_MEMBERSHIP_SELECTOR_HT_PHY)
1143 continue;
1144
1145 for (j = 0; j < num_rates; j++) {
1146 if (bitrates[j].bitrate == own_rate) {
1141 supp_rates |= BIT(j); 1147 supp_rates |= BIT(j);
1148 if (basic_rates && is_basic)
1149 *basic_rates |= BIT(j);
1150 }
1151 }
1142 } 1152 }
1143 return supp_rates; 1153 return supp_rates;
1144} 1154}