Skip to content

Commit

Permalink
Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/jberg/mac80211
  • Loading branch information
John W. Linville committed Nov 25, 2013
2 parents 517543f + 24d4730 commit d5aedd7
Show file tree
Hide file tree
Showing 15 changed files with 101 additions and 63 deletions.
16 changes: 12 additions & 4 deletions drivers/net/wireless/mac80211_hwsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,14 @@ struct hwsim_radiotap_hdr {
__le16 rt_chbitmask;
} __packed;

struct hwsim_radiotap_ack_hdr {
struct ieee80211_radiotap_header hdr;
u8 rt_flags;
u8 pad;
__le16 rt_channel;
__le16 rt_chbitmask;
} __packed;

/* MAC80211_HWSIM netlinf family */
static struct genl_family hwsim_genl_family = {
.id = GENL_ID_GENERATE,
Expand Down Expand Up @@ -500,7 +508,7 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan,
const u8 *addr)
{
struct sk_buff *skb;
struct hwsim_radiotap_hdr *hdr;
struct hwsim_radiotap_ack_hdr *hdr;
u16 flags;
struct ieee80211_hdr *hdr11;

Expand All @@ -511,14 +519,14 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan,
if (skb == NULL)
return;

hdr = (struct hwsim_radiotap_hdr *) skb_put(skb, sizeof(*hdr));
hdr = (struct hwsim_radiotap_ack_hdr *) skb_put(skb, sizeof(*hdr));
hdr->hdr.it_version = PKTHDR_RADIOTAP_VERSION;
hdr->hdr.it_pad = 0;
hdr->hdr.it_len = cpu_to_le16(sizeof(*hdr));
hdr->hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) |
(1 << IEEE80211_RADIOTAP_CHANNEL));
hdr->rt_flags = 0;
hdr->rt_rate = 0;
hdr->pad = 0;
hdr->rt_channel = cpu_to_le16(chan->center_freq);
flags = IEEE80211_CHAN_2GHZ;
hdr->rt_chbitmask = cpu_to_le16(flags);
Expand Down Expand Up @@ -1230,7 +1238,7 @@ static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw,
HRTIMER_MODE_REL);
} else if (!info->enable_beacon) {
unsigned int count = 0;
ieee80211_iterate_active_interfaces(
ieee80211_iterate_active_interfaces_atomic(
data->hw, IEEE80211_IFACE_ITER_NORMAL,
mac80211_hwsim_bcn_en_iter, &count);
wiphy_debug(hw->wiphy, " beaconing vifs remaining: %u",
Expand Down
15 changes: 11 additions & 4 deletions net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ static int sta_apply_parameters(struct ieee80211_local *local,
changed |=
ieee80211_mps_set_sta_local_pm(sta,
params->local_pm);
ieee80211_bss_info_change_notify(sdata, changed);
ieee80211_mbss_info_change_notify(sdata, changed);
#endif
}

Expand Down Expand Up @@ -2488,8 +2488,7 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);

if (sdata->vif.type != NL80211_IFTYPE_STATION &&
sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
if (sdata->vif.type != NL80211_IFTYPE_STATION)
return -EOPNOTSUPP;

if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS))
Expand Down Expand Up @@ -3120,9 +3119,17 @@ static int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
params->chandef.chan->band)
return -EINVAL;

ifmsh->chsw_init = true;
if (!ifmsh->pre_value)
ifmsh->pre_value = 1;
else
ifmsh->pre_value++;

err = ieee80211_mesh_csa_beacon(sdata, params, true);
if (err < 0)
if (err < 0) {
ifmsh->chsw_init = false;
return err;
}
break;
#endif
default:
Expand Down
1 change: 1 addition & 0 deletions net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,7 @@ struct ieee80211_csa_ie {
u8 mode;
u8 count;
u8 ttl;
u16 pre_value;
};

/* Parsed Information Elements */
Expand Down
1 change: 0 additions & 1 deletion net/mac80211/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1325,7 +1325,6 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
sdata->vif.bss_conf.bssid = NULL;
break;
case NL80211_IFTYPE_AP_VLAN:
break;
case NL80211_IFTYPE_P2P_DEVICE:
sdata->vif.bss_conf.bssid = sdata->vif.addr;
break;
Expand Down
3 changes: 3 additions & 0 deletions net/mac80211/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n",
result);

local->hw.conf.flags = IEEE80211_CONF_IDLE;

ieee80211_led_init(local);

rtnl_lock();
Expand Down Expand Up @@ -1047,6 +1049,7 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)

cancel_work_sync(&local->restart_work);
cancel_work_sync(&local->reconfig_filter);
flush_work(&local->sched_scan_stopped_work);

ieee80211_clear_tx_pending(local);
rate_control_deinitialize(local);
Expand Down
20 changes: 12 additions & 8 deletions net/mac80211/mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -943,14 +943,19 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
params.chandef.chan->center_freq);

params.block_tx = csa_ie.mode & WLAN_EID_CHAN_SWITCH_PARAM_TX_RESTRICT;
if (beacon)
if (beacon) {
ifmsh->chsw_ttl = csa_ie.ttl - 1;
else
ifmsh->chsw_ttl = 0;
if (ifmsh->pre_value >= csa_ie.pre_value)
return false;
ifmsh->pre_value = csa_ie.pre_value;
}

if (ifmsh->chsw_ttl > 0)
if (ifmsh->chsw_ttl < ifmsh->mshcfg.dot11MeshTTL) {
if (ieee80211_mesh_csa_beacon(sdata, &params, false) < 0)
return false;
} else {
return false;
}

sdata->csa_radar_required = params.radar_required;

Expand Down Expand Up @@ -1163,7 +1168,6 @@ static int mesh_fwd_csa_frame(struct ieee80211_sub_if_data *sdata,
offset_ttl = (len < 42) ? 7 : 10;
*(pos + offset_ttl) -= 1;
*(pos + offset_ttl + 1) &= ~WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR;
sdata->u.mesh.chsw_ttl = *(pos + offset_ttl);

memcpy(mgmt_fwd, mgmt, len);
eth_broadcast_addr(mgmt_fwd->da);
Expand All @@ -1182,7 +1186,7 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata,
u16 pre_value;
bool fwd_csa = true;
size_t baselen;
u8 *pos, ttl;
u8 *pos;

if (mgmt->u.action.u.measurement.action_code !=
WLAN_ACTION_SPCT_CHL_SWITCH)
Expand All @@ -1193,8 +1197,8 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata,
u.action.u.chan_switch.variable);
ieee802_11_parse_elems(pos, len - baselen, false, &elems);

ttl = elems.mesh_chansw_params_ie->mesh_ttl;
if (!--ttl)
ifmsh->chsw_ttl = elems.mesh_chansw_params_ie->mesh_ttl;
if (!--ifmsh->chsw_ttl)
fwd_csa = false;

pre_value = le16_to_cpu(elems.mesh_chansw_params_ie->mesh_pre_value);
Expand Down
2 changes: 2 additions & 0 deletions net/mac80211/mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -1910,6 +1910,8 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata,
if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL)
already = true;

ifmgd->flags |= IEEE80211_STA_CONNECTION_POLL;

mutex_unlock(&sdata->local->mtx);

if (already)
Expand Down
7 changes: 4 additions & 3 deletions net/mac80211/rc80211_minstrel_ht.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ minstrel_ht_calc_tp(struct minstrel_ht_sta *mi, int group, int rate)
nsecs = 1000 * mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len);

nsecs += minstrel_mcs_groups[group].duration[rate];
tp = 1000000 * ((mr->probability * 1000) / nsecs);
tp = 1000000 * ((prob * 1000) / nsecs);

mr->cur_tp = MINSTREL_TRUNC(tp);
}
Expand Down Expand Up @@ -277,21 +277,22 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
if (!(mg->supported & BIT(i)))
continue;

index = MCS_GROUP_RATES * group + i;

/* initialize rates selections starting indexes */
if (!mg_rates_valid) {
mg->max_tp_rate = mg->max_tp_rate2 =
mg->max_prob_rate = i;
if (!mi_rates_valid) {
mi->max_tp_rate = mi->max_tp_rate2 =
mi->max_prob_rate = i;
mi->max_prob_rate = index;
mi_rates_valid = true;
}
mg_rates_valid = true;
}

mr = &mg->rates[i];
mr->retry_updated = false;
index = MCS_GROUP_RATES * group + i;
minstrel_calc_rate_ewma(mr);
minstrel_ht_calc_tp(mi, group, i);

Expand Down
3 changes: 2 additions & 1 deletion net/mac80211/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,8 @@ static void ieee80211_rx_reorder_ampdu(struct ieee80211_rx_data *rx,
u16 sc;
u8 tid, ack_policy;

if (!ieee80211_is_data_qos(hdr->frame_control))
if (!ieee80211_is_data_qos(hdr->frame_control) ||
is_multicast_ether_addr(hdr->addr1))
goto dont_reorder;

/*
Expand Down
2 changes: 1 addition & 1 deletion net/mac80211/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,6 @@ void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw)

trace_api_sched_scan_stopped(local);

ieee80211_queue_work(&local->hw, &local->sched_scan_stopped_work);
schedule_work(&local->sched_scan_stopped_work);
}
EXPORT_SYMBOL(ieee80211_sched_scan_stopped);
2 changes: 2 additions & 0 deletions net/mac80211/spectmgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
if (elems->mesh_chansw_params_ie) {
csa_ie->ttl = elems->mesh_chansw_params_ie->mesh_ttl;
csa_ie->mode = elems->mesh_chansw_params_ie->mesh_flags;
csa_ie->pre_value = le16_to_cpu(
elems->mesh_chansw_params_ie->mesh_pre_value);
}

new_freq = ieee80211_channel_to_frequency(new_chan_no, new_band);
Expand Down
11 changes: 2 additions & 9 deletions net/mac80211/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -2278,17 +2278,15 @@ void ieee80211_dfs_radar_detected_work(struct work_struct *work)
{
struct ieee80211_local *local =
container_of(work, struct ieee80211_local, radar_detected_work);
struct cfg80211_chan_def chandef;
struct cfg80211_chan_def chandef = local->hw.conf.chandef;

ieee80211_dfs_cac_cancel(local);

if (local->use_chanctx)
/* currently not handled */
WARN_ON(1);
else {
chandef = local->hw.conf.chandef;
else
cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL);
}
}

void ieee80211_radar_detected(struct ieee80211_hw *hw)
Expand Down Expand Up @@ -2459,14 +2457,9 @@ int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata,
WLAN_EID_CHAN_SWITCH_PARAM_TX_RESTRICT : 0x00;
put_unaligned_le16(WLAN_REASON_MESH_CHAN, pos); /* Reason Cd */
pos += 2;
if (!ifmsh->pre_value)
ifmsh->pre_value = 1;
else
ifmsh->pre_value++;
pre_value = cpu_to_le16(ifmsh->pre_value);
memcpy(pos, &pre_value, 2); /* Precedence Value */
pos += 2;
ifmsh->chsw_init = true;
}

ieee80211_tx_skb(sdata, skb);
Expand Down
3 changes: 3 additions & 0 deletions net/wireless/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,9 @@ int wiphy_register(struct wiphy *wiphy)
int i;
u16 ifmodes = wiphy->interface_modes;

/* support for 5/10 MHz is broken due to nl80211 API mess - disable */
wiphy->flags &= ~WIPHY_FLAG_SUPPORTS_5_10_MHZ;

#ifdef CONFIG_PM
if (WARN_ON(wiphy->wowlan &&
(wiphy->wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) &&
Expand Down
18 changes: 9 additions & 9 deletions net/wireless/ibss.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,

/* try to find an IBSS channel if none requested ... */
if (!wdev->wext.ibss.chandef.chan) {
wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
struct ieee80211_channel *new_chan = NULL;

for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
struct ieee80211_supported_band *sband;
Expand All @@ -278,18 +278,19 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
continue;
if (chan->flags & IEEE80211_CHAN_DISABLED)
continue;
wdev->wext.ibss.chandef.chan = chan;
wdev->wext.ibss.chandef.center_freq1 =
chan->center_freq;
new_chan = chan;
break;
}

if (wdev->wext.ibss.chandef.chan)
if (new_chan)
break;
}

if (!wdev->wext.ibss.chandef.chan)
if (!new_chan)
return -EINVAL;

cfg80211_chandef_create(&wdev->wext.ibss.chandef, new_chan,
NL80211_CHAN_NO_HT);
}

/* don't join -- SSID is not there */
Expand Down Expand Up @@ -363,9 +364,8 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
return err;

if (chan) {
wdev->wext.ibss.chandef.chan = chan;
wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
wdev->wext.ibss.chandef.center_freq1 = freq;
cfg80211_chandef_create(&wdev->wext.ibss.chandef, chan,
NL80211_CHAN_NO_HT);
wdev->wext.ibss.channel_fixed = true;
} else {
/* cfg80211_ibss_wext_join will pick one if needed */
Expand Down
Loading

0 comments on commit d5aedd7

Please sign in to comment.