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>
This commit is contained in:

committed by
John W. Linville

parent
54ab1ffb6c
commit
f743ff4907
@@ -64,18 +64,18 @@ static void ieee80211_mesh_housekeeping_timer(unsigned long data)
|
||||
/**
|
||||
* mesh_matches_local - check if the config of a mesh point matches ours
|
||||
*
|
||||
* @ie: information elements of a management frame from the mesh peer
|
||||
* @sdata: local mesh subif
|
||||
* @basic_rates: BSSBasicRateSet of the peer candidate
|
||||
* @ie: information elements of a management frame from the mesh peer
|
||||
*
|
||||
* This function checks if the mesh configuration of a mesh point matches the
|
||||
* local mesh configuration, i.e. if both nodes belong to the same mesh network.
|
||||
*/
|
||||
bool mesh_matches_local(struct ieee802_11_elems *ie,
|
||||
struct ieee80211_sub_if_data *sdata, u32 basic_rates)
|
||||
bool mesh_matches_local(struct ieee80211_sub_if_data *sdata,
|
||||
struct ieee802_11_elems *ie)
|
||||
{
|
||||
struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
|
||||
struct ieee80211_local *local = sdata->local;
|
||||
u32 basic_rates = 0;
|
||||
|
||||
/*
|
||||
* As support for each feature is added, check for matching
|
||||
@@ -96,6 +96,9 @@ bool mesh_matches_local(struct ieee802_11_elems *ie,
|
||||
(ifmsh->mesh_auth_id == ie->mesh_config->meshconf_auth)))
|
||||
goto mismatch;
|
||||
|
||||
ieee80211_sta_get_rates(local, ie, local->oper_channel->band,
|
||||
&basic_rates);
|
||||
|
||||
if (sdata->vif.bss_conf.basic_rates != basic_rates)
|
||||
goto mismatch;
|
||||
|
||||
@@ -630,7 +633,6 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
|
||||
struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
|
||||
struct ieee802_11_elems elems;
|
||||
struct ieee80211_channel *channel;
|
||||
u32 supp_rates = 0, basic_rates = 0;
|
||||
size_t baselen;
|
||||
int freq;
|
||||
enum ieee80211_band band = rx_status->band;
|
||||
@@ -661,12 +663,9 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
|
||||
if (!channel || channel->flags & IEEE80211_CHAN_DISABLED)
|
||||
return;
|
||||
|
||||
supp_rates = ieee80211_sta_get_rates(local, &elems,
|
||||
band, &basic_rates);
|
||||
|
||||
if (elems.mesh_id && elems.mesh_config &&
|
||||
mesh_matches_local(&elems, sdata, basic_rates))
|
||||
mesh_neighbour_update(mgmt->sa, supp_rates, sdata, &elems);
|
||||
mesh_matches_local(sdata, &elems))
|
||||
mesh_neighbour_update(sdata, mgmt->sa, &elems);
|
||||
|
||||
if (ifmsh->sync_ops)
|
||||
ifmsh->sync_ops->rx_bcn_presp(sdata,
|
||||
|
Reference in New Issue
Block a user