Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 313995
b: refs/heads/master
c: aa430da
h: refs/heads/master
i:
  313993: 1f5c937
  313991: 347677c
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Jun 5, 2012
1 parent 5e9833d commit 3d806e6
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 41 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d58e7e37aac0465b08527adadc8016421bd4060e
refs/heads/master: aa430da41019c1694f6a8e3b8bef1d12ed52b0ad
36 changes: 3 additions & 33 deletions trunk/drivers/net/wireless/ath/ath6kl/cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -2585,35 +2585,6 @@ static int ath6kl_set_ies(struct ath6kl_vif *vif,
return 0;
}

static int ath6kl_set_channel(struct wiphy *wiphy, struct net_device *dev,
struct ieee80211_channel *chan,
enum nl80211_channel_type channel_type)
{
struct ath6kl_vif *vif;

/*
* 'dev' could be NULL if a channel change is required for the hardware
* device itself, instead of a particular VIF.
*
* FIXME: To be handled properly when monitor mode is supported.
*/
if (!dev)
return -EBUSY;

vif = netdev_priv(dev);

if (!ath6kl_cfg80211_ready(vif))
return -EIO;

ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: center_freq=%u hw_value=%u\n",
__func__, chan->center_freq, chan->hw_value);
vif->next_chan = chan->center_freq;
vif->next_ch_type = channel_type;
vif->next_ch_band = chan->band;

return 0;
}

static int ath6kl_get_rsn_capab(struct cfg80211_beacon_data *beacon,
u8 *rsn_capab)
{
Expand Down Expand Up @@ -2791,7 +2762,7 @@ static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev,
p.ssid_len = vif->ssid_len;
memcpy(p.ssid, vif->ssid, vif->ssid_len);
p.dot11_auth_mode = vif->dot11_auth_mode;
p.ch = cpu_to_le16(vif->next_chan);
p.ch = cpu_to_le16(info->channel->center_freq);

/* Enable uAPSD support by default */
res = ath6kl_wmi_ap_set_apsd(ar->wmi, vif->fw_vif_idx, true);
Expand All @@ -2815,8 +2786,8 @@ static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev,
return res;
}

if (ath6kl_set_htcap(vif, vif->next_ch_band,
vif->next_ch_type != NL80211_CHAN_NO_HT))
if (ath6kl_set_htcap(vif, info->channel->band,
info->channel_type != NL80211_CHAN_NO_HT))
return -EIO;

/*
Expand Down Expand Up @@ -3271,7 +3242,6 @@ static struct cfg80211_ops ath6kl_cfg80211_ops = {
.suspend = __ath6kl_cfg80211_suspend,
.resume = __ath6kl_cfg80211_resume,
#endif
.set_channel = ath6kl_set_channel,
.start_ap = ath6kl_start_ap,
.change_beacon = ath6kl_change_beacon,
.stop_ap = ath6kl_stop_ap,
Expand Down
3 changes: 0 additions & 3 deletions trunk/drivers/net/wireless/ath/ath6kl/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -553,9 +553,6 @@ struct ath6kl_vif {
u32 last_cancel_roc_id;
u32 send_action_id;
bool probe_req_report;
u16 next_chan;
enum nl80211_channel_type next_ch_type;
enum ieee80211_band next_ch_band;
u16 assoc_bss_beacon_int;
u16 listen_intvl_t;
u16 bmiss_time_t;
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/net/wireless/ath/ath6kl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,6 @@ static int ath6kl_commit_ch_switch(struct ath6kl_vif *vif, u16 channel)

struct ath6kl *ar = vif->ar;

vif->next_chan = channel;
vif->profile.ch = cpu_to_le16(channel);

switch (vif->nw_type) {
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/nl80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@
* %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS,
* %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY,
* %NL80211_ATTR_AUTH_TYPE and %NL80211_ATTR_INACTIVITY_TIMEOUT.
* The channel to use can be set on the interface or be given using the
* %NL80211_ATTR_WIPHY_FREQ and %NL80211_ATTR_WIPHY_CHANNEL_TYPE attrs.
* @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP
* @NL80211_CMD_STOP_AP: Stop AP operation on the given interface
* @NL80211_CMD_DEL_BEACON: old alias for %NL80211_CMD_STOP_AP
Expand Down
12 changes: 11 additions & 1 deletion trunk/include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ struct cfg80211_beacon_data {
*
* Used to configure an AP interface.
*
* @channel: the channel to start the AP on
* @channel_type: the channel type to use
* @beacon: beacon data
* @beacon_interval: beacon interval
* @dtim_period: DTIM period
Expand All @@ -417,6 +419,9 @@ struct cfg80211_beacon_data {
* @inactivity_timeout: time in seconds to determine station's inactivity.
*/
struct cfg80211_ap_settings {
struct ieee80211_channel *channel;
enum nl80211_channel_type channel_type;

struct cfg80211_beacon_data beacon;

int beacon_interval, dtim_period;
Expand Down Expand Up @@ -2263,7 +2268,10 @@ struct cfg80211_cached_keys;
* @netdev: (private) Used to reference back to the netdev
* @current_bss: (private) Used by the internal configuration code
* @channel: (private) Used by the internal configuration code to track
* user-set AP, monitor and WDS channels for wireless extensions
* the user-set AP, monitor and WDS channel
* @preset_chan: (private) Used by the internal configuration code to
* track the channel to be used for AP later
* @preset_chantype: (private) the corresponding channel type
* @bssid: (private) Used by the internal configuration code
* @ssid: (private) Used by the internal configuration code
* @ssid_len: (private) Used by the internal configuration code
Expand Down Expand Up @@ -2314,6 +2322,8 @@ struct wireless_dev {

struct cfg80211_internal_bss *current_bss; /* associated / joined */
struct ieee80211_channel *channel;
struct ieee80211_channel *preset_chan;
enum nl80211_channel_type preset_chantype;

bool ps;
int ps_timeout;
Expand Down
5 changes: 5 additions & 0 deletions trunk/net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,11 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
if (old)
return -EALREADY;

err = ieee80211_set_channel(wiphy, dev, params->channel,
params->channel_type);
if (err)
return err;

/*
* Apply control port protocol, this allows us to
* not encrypt dynamic WEP control frames.
Expand Down
53 changes: 51 additions & 2 deletions trunk/net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,11 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
if (nla_put_u32(msg, i, NL80211_CMD_SET_WIPHY_NETNS))
goto nla_put_failure;
}
CMD(set_channel, SET_CHANNEL);
if (dev->ops->set_channel || dev->ops->start_ap) {
i++;
if (nla_put_u32(msg, i, NL80211_CMD_SET_CHANNEL))
goto nla_put_failure;
}
CMD(set_wds_peer, SET_WDS_PEER);
if (dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) {
CMD(tdls_mgmt, TDLS_MGMT);
Expand Down Expand Up @@ -1170,6 +1174,9 @@ static bool nl80211_can_set_dev_channel(struct wireless_dev *wdev)
* Monitors are special as they are normally slaved to
* whatever else is going on, so they behave as though
* you tried setting the wiphy channel itself.
*
* For AP/GO modes, it's only for compatibility, you can
* also give the channel to the start-AP command.
*/
return !wdev ||
wdev->iftype == NL80211_IFTYPE_AP ||
Expand Down Expand Up @@ -1204,6 +1211,7 @@ static int __nl80211_set_channel(struct cfg80211_registered_device *rdev,
struct wireless_dev *wdev,
struct genl_info *info)
{
struct ieee80211_channel *channel;
enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;
u32 freq;
int result;
Expand All @@ -1221,7 +1229,25 @@ static int __nl80211_set_channel(struct cfg80211_registered_device *rdev,
freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]);

mutex_lock(&rdev->devlist_mtx);
if (wdev) {
if (wdev) switch (wdev->iftype) {
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_P2P_GO:
if (wdev->beacon_interval) {
result = -EBUSY;
break;
}
channel = rdev_freq_to_chan(rdev, freq, channel_type);
if (!channel || !cfg80211_can_beacon_sec_chan(&rdev->wiphy,
channel,
channel_type)) {
result = -EINVAL;
break;
}
wdev->preset_chan = channel;
wdev->preset_chantype = channel_type;
result = 0;
break;
default:
wdev_lock(wdev);
result = cfg80211_set_freq(rdev, wdev, freq, channel_type);
wdev_unlock(wdev);
Expand Down Expand Up @@ -2299,6 +2325,29 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
info->attrs[NL80211_ATTR_INACTIVITY_TIMEOUT]);
}

if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) {
enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;

if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE] &&
!nl80211_valid_channel_type(info, &channel_type))
return -EINVAL;

params.channel = rdev_freq_to_chan(rdev,
nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]),
channel_type);
if (!params.channel)
return -EINVAL;
params.channel_type = channel_type;
} else if (wdev->preset_chan) {
params.channel = wdev->preset_chan;
params.channel_type = wdev->preset_chantype;
} else
return -EINVAL;

if (!cfg80211_can_beacon_sec_chan(&rdev->wiphy, params.channel,
params.channel_type))
return -EINVAL;

err = rdev->ops->start_ap(&rdev->wiphy, dev, &params);
if (!err)
wdev->beacon_interval = params.beacon_interval;
Expand Down

0 comments on commit 3d806e6

Please sign in to comment.