aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorLuciano Coelho <luciano.coelho@intel.com>2014-11-07 07:31:35 -0500
committerJohannes Berg <johannes.berg@intel.com>2014-11-10 04:20:14 -0500
commitf8d7552e945d38bd8d2e9c23aebf98042ce12302 (patch)
tree40592740dd326c8a2ebe6818f91d2b823852ca1c /net/wireless
parent127f10ec6069aa0ddc214f14cb424198e1741256 (diff)
cfg80211: add channel switch started notification
Add a new NL80211_CH_SWITCH_STARTED_NOTIFY message that can be sent to the userspace when a channel switch process has started. This allows userspace to take action, for instance, by requesting other interfaces to switch channel as necessary. This patch introduces a function that allows the drivers to send this notification. It should be used when the driver starts processing a channel switch initiated by a remote device (eg. when a STA receives a CSA from the AP) and when it successfully starts a userspace-triggered channel switch (eg. when hostapd triggers a channel swith in the AP). Signed-off-by: Luciano Coelho <luciano.coelho@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/nl80211.c28
-rw-r--r--net/wireless/trace.h16
2 files changed, 41 insertions, 3 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 24549cbe0b54..24fd2925b281 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -11653,7 +11653,9 @@ EXPORT_SYMBOL(cfg80211_pmksa_candidate_notify);
11653static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev, 11653static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev,
11654 struct net_device *netdev, 11654 struct net_device *netdev,
11655 struct cfg80211_chan_def *chandef, 11655 struct cfg80211_chan_def *chandef,
11656 gfp_t gfp) 11656 gfp_t gfp,
11657 enum nl80211_commands notif,
11658 u8 count)
11657{ 11659{
11658 struct sk_buff *msg; 11660 struct sk_buff *msg;
11659 void *hdr; 11661 void *hdr;
@@ -11662,7 +11664,7 @@ static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev,
11662 if (!msg) 11664 if (!msg)
11663 return; 11665 return;
11664 11666
11665 hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_CH_SWITCH_NOTIFY); 11667 hdr = nl80211hdr_put(msg, 0, 0, 0, notif);
11666 if (!hdr) { 11668 if (!hdr) {
11667 nlmsg_free(msg); 11669 nlmsg_free(msg);
11668 return; 11670 return;
@@ -11674,6 +11676,10 @@ static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev,
11674 if (nl80211_send_chandef(msg, chandef)) 11676 if (nl80211_send_chandef(msg, chandef))
11675 goto nla_put_failure; 11677 goto nla_put_failure;
11676 11678
11679 if ((notif == NL80211_CMD_CH_SWITCH_STARTED_NOTIFY) &&
11680 (nla_put_u32(msg, NL80211_ATTR_CH_SWITCH_COUNT, count)))
11681 goto nla_put_failure;
11682
11677 genlmsg_end(msg, hdr); 11683 genlmsg_end(msg, hdr);
11678 11684
11679 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, 11685 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
@@ -11704,10 +11710,26 @@ void cfg80211_ch_switch_notify(struct net_device *dev,
11704 11710
11705 wdev->chandef = *chandef; 11711 wdev->chandef = *chandef;
11706 wdev->preset_chandef = *chandef; 11712 wdev->preset_chandef = *chandef;
11707 nl80211_ch_switch_notify(rdev, dev, chandef, GFP_KERNEL); 11713 nl80211_ch_switch_notify(rdev, dev, chandef, GFP_KERNEL,
11714 NL80211_CMD_CH_SWITCH_NOTIFY, 0);
11708} 11715}
11709EXPORT_SYMBOL(cfg80211_ch_switch_notify); 11716EXPORT_SYMBOL(cfg80211_ch_switch_notify);
11710 11717
11718void cfg80211_ch_switch_started_notify(struct net_device *dev,
11719 struct cfg80211_chan_def *chandef,
11720 u8 count)
11721{
11722 struct wireless_dev *wdev = dev->ieee80211_ptr;
11723 struct wiphy *wiphy = wdev->wiphy;
11724 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
11725
11726 trace_cfg80211_ch_switch_started_notify(dev, chandef);
11727
11728 nl80211_ch_switch_notify(rdev, dev, chandef, GFP_KERNEL,
11729 NL80211_CMD_CH_SWITCH_STARTED_NOTIFY, count);
11730}
11731EXPORT_SYMBOL(cfg80211_ch_switch_started_notify);
11732
11711void cfg80211_cqm_txe_notify(struct net_device *dev, 11733void cfg80211_cqm_txe_notify(struct net_device *dev,
11712 const u8 *peer, u32 num_packets, 11734 const u8 *peer, u32 num_packets,
11713 u32 rate, u32 intvl, gfp_t gfp) 11735 u32 rate, u32 intvl, gfp_t gfp)
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 277a85df910e..6e25370d3ce7 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -2355,6 +2355,22 @@ TRACE_EVENT(cfg80211_ch_switch_notify,
2355 NETDEV_PR_ARG, CHAN_DEF_PR_ARG) 2355 NETDEV_PR_ARG, CHAN_DEF_PR_ARG)
2356); 2356);
2357 2357
2358TRACE_EVENT(cfg80211_ch_switch_started_notify,
2359 TP_PROTO(struct net_device *netdev,
2360 struct cfg80211_chan_def *chandef),
2361 TP_ARGS(netdev, chandef),
2362 TP_STRUCT__entry(
2363 NETDEV_ENTRY
2364 CHAN_DEF_ENTRY
2365 ),
2366 TP_fast_assign(
2367 NETDEV_ASSIGN;
2368 CHAN_DEF_ASSIGN(chandef);
2369 ),
2370 TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT,
2371 NETDEV_PR_ARG, CHAN_DEF_PR_ARG)
2372);
2373
2358TRACE_EVENT(cfg80211_radar_event, 2374TRACE_EVENT(cfg80211_radar_event,
2359 TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef), 2375 TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef),
2360 TP_ARGS(wiphy, chandef), 2376 TP_ARGS(wiphy, chandef),