Skip to content

Commit ffb3cf3

Browse files
ashokrajnagarajanjmberg-intel
authored andcommitted
{nl,mac,cfg}80211: Allow user to configure basic rates for mesh
Currently mesh uses mandatory rates as the default basic rates. Allow basic rates to be configured during mesh join. Basic rates are applied only if channel is also provided with mesh join command. Signed-off-by: Ashok Nagarajan <ashok@cozybit.com> [some whitespace fixes, refuse basic rates w/o channel] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 66de671 commit ffb3cf3

5 files changed

Lines changed: 30 additions & 4 deletions

File tree

‎include/net/cfg80211.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,7 @@ struct mesh_config {
11761176
* @dtim_period: DTIM period to use
11771177
* @beacon_interval: beacon interval to use
11781178
* @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
1179+
* @basic_rates: basic rates to use when creating the mesh
11791180
*
11801181
* These parameters are fixed when the mesh is created.
11811182
*/
@@ -1195,6 +1196,7 @@ struct mesh_setup {
11951196
u8 dtim_period;
11961197
u16 beacon_interval;
11971198
int mcast_rate[IEEE80211_NUM_BANDS];
1199+
u32 basic_rates;
11981200
};
11991201

12001202
/**

‎net/mac80211/cfg.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,6 +1759,7 @@ static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh,
17591759
/* mcast rate setting in Mesh Node */
17601760
memcpy(sdata->vif.bss_conf.mcast_rate, setup->mcast_rate,
17611761
sizeof(setup->mcast_rate));
1762+
sdata->vif.bss_conf.basic_rates = setup->basic_rates;
17621763

17631764
sdata->vif.bss_conf.beacon_int = setup->beacon_interval;
17641765
sdata->vif.bss_conf.dtim_period = setup->dtim_period;

‎net/mac80211/mesh.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -738,9 +738,6 @@ int ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
738738
BSS_CHANGED_HT |
739739
BSS_CHANGED_BASIC_RATES |
740740
BSS_CHANGED_BEACON_INT;
741-
enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
742-
struct ieee80211_supported_band *sband =
743-
sdata->local->hw.wiphy->bands[band];
744741

745742
local->fif_other_bss++;
746743
/* mesh ifaces must set allmulti to forward mcast traffic */
@@ -758,7 +755,6 @@ int ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
758755
sdata->vif.bss_conf.ht_operation_mode =
759756
ifmsh->mshcfg.ht_opmode;
760757
sdata->vif.bss_conf.enable_beacon = true;
761-
sdata->vif.bss_conf.basic_rates = ieee80211_mandatory_rates(sband);
762758

763759
changed |= ieee80211_mps_local_status_update(sdata);
764760

‎net/wireless/mesh.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,16 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
162162
setup->chandef.center_freq1 = setup->chandef.chan->center_freq;
163163
}
164164

165+
/*
166+
* check if basic rates are available otherwise use mandatory rates as
167+
* basic rates
168+
*/
169+
if (!setup->basic_rates) {
170+
struct ieee80211_supported_band *sband =
171+
rdev->wiphy.bands[setup->chandef.chan->band];
172+
setup->basic_rates = ieee80211_mandatory_rates(sband);
173+
}
174+
165175
if (!cfg80211_reg_can_beacon(&rdev->wiphy, &setup->chandef))
166176
return -EINVAL;
167177

‎net/wireless/nl80211.c‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7487,6 +7487,23 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
74877487
setup.chandef.chan = NULL;
74887488
}
74897489

7490+
if (info->attrs[NL80211_ATTR_BSS_BASIC_RATES]) {
7491+
u8 *rates = nla_data(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]);
7492+
int n_rates =
7493+
nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]);
7494+
struct ieee80211_supported_band *sband;
7495+
7496+
if (!setup.chandef.chan)
7497+
return -EINVAL;
7498+
7499+
sband = rdev->wiphy.bands[setup.chandef.chan->band];
7500+
7501+
err = ieee80211_get_ratemask(sband, rates, n_rates,
7502+
&setup.basic_rates);
7503+
if (err)
7504+
return err;
7505+
}
7506+
74907507
return cfg80211_join_mesh(rdev, dev, &setup, &cfg);
74917508
}
74927509

0 commit comments

Comments
 (0)