diff options
author | Thomas Pedersen <thomas@cozybit.com> | 2012-04-18 22:23:43 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-04-23 15:34:07 -0400 |
commit | f743ff4907fa5bc2b460f48ace831a560806a9fb (patch) | |
tree | 2bf0f42ee4935ff5ee558d5db6a6e529ec1997e3 /net/mac80211/mesh.c | |
parent | 54ab1ffb6cd94e5c013d61c192e78e30fdf25f8a (diff) |
mac80211: refactor mesh peer rate handling
To avoid passing supp_rates and basic_rates around all the time, just
derive these when needed in mesh_matches_local() and mesh_peer_init().
Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mesh.c')
-rw-r--r-- | net/mac80211/mesh.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 133c118526fb..598a96a3a051 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -64,18 +64,18 @@ static void ieee80211_mesh_housekeeping_timer(unsigned long data) | |||
64 | /** | 64 | /** |
65 | * mesh_matches_local - check if the config of a mesh point matches ours | 65 | * mesh_matches_local - check if the config of a mesh point matches ours |
66 | * | 66 | * |
67 | * @ie: information elements of a management frame from the mesh peer | ||
68 | * @sdata: local mesh subif | 67 | * @sdata: local mesh subif |
69 | * @basic_rates: BSSBasicRateSet of the peer candidate | 68 | * @ie: information elements of a management frame from the mesh peer |
70 | * | 69 | * |
71 | * This function checks if the mesh configuration of a mesh point matches the | 70 | * This function checks if the mesh configuration of a mesh point matches the |
72 | * local mesh configuration, i.e. if both nodes belong to the same mesh network. | 71 | * local mesh configuration, i.e. if both nodes belong to the same mesh network. |
73 | */ | 72 | */ |
74 | bool mesh_matches_local(struct ieee802_11_elems *ie, | 73 | bool mesh_matches_local(struct ieee80211_sub_if_data *sdata, |
75 | struct ieee80211_sub_if_data *sdata, u32 basic_rates) | 74 | struct ieee802_11_elems *ie) |
76 | { | 75 | { |
77 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; | 76 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
78 | struct ieee80211_local *local = sdata->local; | 77 | struct ieee80211_local *local = sdata->local; |
78 | u32 basic_rates = 0; | ||
79 | 79 | ||
80 | /* | 80 | /* |
81 | * As support for each feature is added, check for matching | 81 | * As support for each feature is added, check for matching |
@@ -96,6 +96,9 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, | |||
96 | (ifmsh->mesh_auth_id == ie->mesh_config->meshconf_auth))) | 96 | (ifmsh->mesh_auth_id == ie->mesh_config->meshconf_auth))) |
97 | goto mismatch; | 97 | goto mismatch; |
98 | 98 | ||
99 | ieee80211_sta_get_rates(local, ie, local->oper_channel->band, | ||
100 | &basic_rates); | ||
101 | |||
99 | if (sdata->vif.bss_conf.basic_rates != basic_rates) | 102 | if (sdata->vif.bss_conf.basic_rates != basic_rates) |
100 | goto mismatch; | 103 | goto mismatch; |
101 | 104 | ||
@@ -630,7 +633,6 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, | |||
630 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; | 633 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
631 | struct ieee802_11_elems elems; | 634 | struct ieee802_11_elems elems; |
632 | struct ieee80211_channel *channel; | 635 | struct ieee80211_channel *channel; |
633 | u32 supp_rates = 0, basic_rates = 0; | ||
634 | size_t baselen; | 636 | size_t baselen; |
635 | int freq; | 637 | int freq; |
636 | enum ieee80211_band band = rx_status->band; | 638 | enum ieee80211_band band = rx_status->band; |
@@ -661,12 +663,9 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, | |||
661 | if (!channel || channel->flags & IEEE80211_CHAN_DISABLED) | 663 | if (!channel || channel->flags & IEEE80211_CHAN_DISABLED) |
662 | return; | 664 | return; |
663 | 665 | ||
664 | supp_rates = ieee80211_sta_get_rates(local, &elems, | ||
665 | band, &basic_rates); | ||
666 | |||
667 | if (elems.mesh_id && elems.mesh_config && | 666 | if (elems.mesh_id && elems.mesh_config && |
668 | mesh_matches_local(&elems, sdata, basic_rates)) | 667 | mesh_matches_local(sdata, &elems)) |
669 | mesh_neighbour_update(mgmt->sa, supp_rates, sdata, &elems); | 668 | mesh_neighbour_update(sdata, mgmt->sa, &elems); |
670 | 669 | ||
671 | if (ifmsh->sync_ops) | 670 | if (ifmsh->sync_ops) |
672 | ifmsh->sync_ops->rx_bcn_presp(sdata, | 671 | ifmsh->sync_ops->rx_bcn_presp(sdata, |