summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9b124dd)
raw | patch | inline | side by side (parent: 9b124dd)
author | Victor Goldenshtein <victorg@ti.com> | |
Mon, 10 Oct 2011 12:53:32 +0000 (14:53 +0200) | ||
committer | Arik Nemtsov <arik@wizery.com> | |
Thu, 13 Sep 2012 11:53:16 +0000 (14:53 +0300) |
Add NL80211_CMD_AP_CH_SWITCH command which
triggers an AP channel switch process.
Usermode notified about channel switch complete
event with NL80211_CMD_CH_SWITCH_NOTIFY.
Usermode (hostapd) is responsible to update the
channel switch announcement IE in the beacon
prior and after the channel switch operation.
Signed-off-by: Victor Goldenshtein <victorg@ti.com>
triggers an AP channel switch process.
Usermode notified about channel switch complete
event with NL80211_CMD_CH_SWITCH_NOTIFY.
Usermode (hostapd) is responsible to update the
channel switch announcement IE in the beacon
prior and after the channel switch operation.
Signed-off-by: Victor Goldenshtein <victorg@ti.com>
include/linux/nl80211.h | patch | blob | history | |
include/net/cfg80211.h | patch | blob | history | |
net/wireless/nl80211.c | patch | blob | history |
index cede7609e7e34edb0d3a776e67e81b6301a0dfb3..fa07bc03a7ef14e5a0ba5406cb974e59737d13a6 100644 (file)
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
* %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ with
* %NL80211_ATTR_WIPHY_CHANNEL_TYPE.
*
+* @NL80211_CMD_AP_CH_SWITCH: Perform a channel switch in the driver (for
+ * AP/GO).
+ * %NL80211_ATTR_WIPHY_FREQ: new channel frequency.
+ * %NL80211_ATTR_CH_SWITCH_BLOCK_TX: block tx on the current channel.
+ * %NL80211_ATTR_CH_SWITCH_POST_BLOCK_TX: block tx on the target channel.
+ * %NL80211_FREQ_ATTR_CH_SWITCH_COUNT: number of TBTT's until the channel
+ * switch event.
+ *
* @NL80211_CMD_SCAN_CANCEL: Stop currently running scan (both sw and hw).
* This operation will eventually invoke %NL80211_CMD_SCAN_ABORTED
* event, partial scan results will be available. Returns -ENOENT
NL80211_CMD_CH_SWITCH_NOTIFY,
+ NL80211_CMD_AP_CH_SWITCH,
+
/* leave some room for adding nl80211 commands for old kernels */
NL80211_CMD_SCAN_CANCEL = NL80211_CMD_CH_SWITCH_NOTIFY + 10,
* @NL80211_ATTR_ROAMING_DISABLED: indicates that the driver can't do roaming
* currently.
*
+ * @NL80211_ATTR_CH_SWITCH_COUNT: the number of TBTT's until the channel
+ * switch event
+ * @NL80211_ATTR_CH_SWITCH_BLOCK_TX: block tx on the current channel before the
+ * channel switch operation.
+ * @NL80211_ATTR_CH_SWITCH_POST_BLOCK_TX: block tx on the target channel after
+ * the channel switch operation, should be set if the target channel is
+ * DFS channel.
+ *
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
NL80211_ATTR_SCHED_SCAN_NUM_SHORT_INTERVALS,
NL80211_ATTR_ROAMING_DISABLED,
+ NL80211_ATTR_CH_SWITCH_COUNT,
+ NL80211_ATTR_CH_SWITCH_BLOCK_TX,
+ NL80211_ATTR_CH_SWITCH_POST_BLOCK_TX,
/* add attributes here, update the policy in nl80211.c */
* @NL80211_FEATURE_SCHED_SCAN_INTERVALS: This driver supports using
* short interval for sched scan and then switching to a longer
* interval.
+ * @NL80211_FEATURE_AP_CH_SWITCH: This driver supports AP channel switch.
*/
enum nl80211_feature_flags {
NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
NL80211_FEATURE_HT_IBSS = 1 << 1,
NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2,
NL80211_FEATURE_CELL_BASE_REG_HINTS = 1 << 3,
+ NL80211_FEATURE_AP_CH_SWITCH = 1 << 4,
/* leave room for new feature flags */
NL80211_FEATURE_SCHED_SCAN_INTERVALS = 1 << 20,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index ff28f02eedd91dc1f1a026564210b26bf8dcc841..871cf227fdd255ad289e75888c64f895f7fb5936 100644 (file)
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
int orig_mag, orig_mpwr;
};
+/**
+ * struct ieee80211_ap_ch_switch - holds the ap channel switch data
+ *
+ * The information provided in this structure is required for the ap channel
+ * switch operation.
+ *
+ * @timestamp: value in microseconds of the 64-bit Time Synchronization
+ * Function (TSF) timer when the frame containing the channel switch
+ * announcement was received. This is simply the rx.mactime parameter
+ * the driver passed into mac80211.
+ * @block_tx: Indicates whether transmission must be blocked before the
+ * scheduled channel switch, as indicated by the AP.
+ * @post_switch_block_tx: Indicates whether transmission must be blocked after
+ * the scheduled channel switch, this should be set if the target channel
+ * is DFS channel.
+ * @channel: the new channel to switch to
+ * @channel_type: the type of the new channel
+ * @count: the number of TBTT's until the channel switch event
+ */
+struct ieee80211_ap_ch_switch {
+ u64 timestamp;
+ bool block_tx;
+ bool post_switch_block_tx;
+ struct ieee80211_channel *channel;
+ enum nl80211_channel_type channel_type;
+ u8 count;
+};
+
/**
* enum ieee80211_rate_flags - rate flags
*
* later passes to cfg80211_probe_status().
*
* @set_noack_map: Set the NoAck Map for the TIDs.
+ *
+ * @ap_channel_switch: Perform AP channel switch.
*/
struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
struct cfg80211_wowlan *wowlan);
struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy);
+
+ int (*ap_channel_switch)(struct wiphy *wiphy,
+ struct net_device *dev,
+ struct ieee80211_ap_ch_switch *ap_ch_sw);
};
/*
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 03075590b1d3ce54bf265922809897b05c6c391c..bf3e7194d26b7d8281e810f94fff26dfa17f63cc 100644 (file)
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
[NL80211_ATTR_SCHED_SCAN_SHORT_INTERVAL] = { .type = NLA_U32 },
[NL80211_ATTR_SCHED_SCAN_NUM_SHORT_INTERVALS] = { .type = NLA_U8 },
[NL80211_ATTR_ROAMING_DISABLED] = { .type = NLA_FLAG },
+ [NL80211_ATTR_CH_SWITCH_COUNT] = { .type = NLA_U32 },
+ [NL80211_ATTR_CH_SWITCH_BLOCK_TX] = { .type = NLA_FLAG },
+ [NL80211_ATTR_CH_SWITCH_POST_BLOCK_TX] = { .type = NLA_FLAG },
};
/* policy for the key attributes */
return err;
}
+static int nl80211_ap_channel_switch(struct sk_buff *skb,
+ struct genl_info *info)
+{
+ struct cfg80211_registered_device *rdev = info->user_ptr[0];
+ struct net_device *dev = info->user_ptr[1];
+ u32 freq = 0;
+ struct ieee80211_ap_ch_switch ap_ch_sw;
+
+ if (!rdev->ops->ap_channel_switch)
+ return -EOPNOTSUPP;
+
+ if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
+ return -EOPNOTSUPP;
+
+ if (!info->attrs[NL80211_ATTR_CH_SWITCH_COUNT] ||
+ !info->attrs[NL80211_ATTR_WIPHY_FREQ] ||
+ !info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE])
+ return -EINVAL;
+
+ memset(&ap_ch_sw, 0, sizeof(ap_ch_sw));
+
+ ap_ch_sw.channel_type =
+ nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]);
+ if (ap_ch_sw.channel_type != NL80211_CHAN_HT20)
+ return -EOPNOTSUPP;
+
+ ap_ch_sw.count = nla_get_u32(info->attrs[NL80211_ATTR_CH_SWITCH_COUNT]);
+ freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]);
+
+ ap_ch_sw.channel = ieee80211_get_channel(&rdev->wiphy, freq);
+ if (!ap_ch_sw.channel ||
+ ap_ch_sw.channel->flags & IEEE80211_CHAN_DISABLED)
+ return -EINVAL;
+
+ if (info->attrs[NL80211_ATTR_CH_SWITCH_BLOCK_TX])
+ ap_ch_sw.block_tx = true;
+
+ if (info->attrs[NL80211_ATTR_CH_SWITCH_POST_BLOCK_TX])
+ ap_ch_sw.post_switch_block_tx = true;
+
+ return rdev->ops->ap_channel_switch(&rdev->wiphy, dev, &ap_ch_sw);
+}
+
static int nl80211_scan_cancel(struct sk_buff *skb, struct genl_info *info)
{
return cfg80211_scan_cancel(info->user_ptr[0]);
.internal_flags = NL80211_FLAG_NEED_NETDEV |
NL80211_FLAG_NEED_RTNL,
},
+ {
+ .cmd = NL80211_CMD_AP_CH_SWITCH,
+ .doit = nl80211_ap_channel_switch,
+ .policy = nl80211_policy,
+ .flags = GENL_ADMIN_PERM,
+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
+ NL80211_FLAG_NEED_RTNL,
+ },
};