aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/nl80211.h7
-rw-r--r--include/net/cfg80211.h11
-rw-r--r--net/wireless/mlme.c27
-rw-r--r--net/wireless/nl80211.c32
-rw-r--r--net/wireless/nl80211.h4
5 files changed, 81 insertions, 0 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index c6d26328a166..1335084b1c69 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -548,6 +548,11 @@
548 * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether 548 * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether
549 * No Acknowledgement Policy should be applied. 549 * No Acknowledgement Policy should be applied.
550 * 550 *
551 * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels
552 * independently of the userspace SME, send this event indicating
553 * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ with
554 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE.
555 *
551 * @NL80211_CMD_MAX: highest used command number 556 * @NL80211_CMD_MAX: highest used command number
552 * @__NL80211_CMD_AFTER_LAST: internal use 557 * @__NL80211_CMD_AFTER_LAST: internal use
553 */ 558 */
@@ -689,6 +694,8 @@ enum nl80211_commands {
689 694
690 NL80211_CMD_SET_NOACK_MAP, 695 NL80211_CMD_SET_NOACK_MAP,
691 696
697 NL80211_CMD_CH_SWITCH_NOTIFY,
698
692 /* add new commands above here */ 699 /* add new commands above here */
693 700
694 /* used to define NL80211_CMD_MAX below */ 701 /* used to define NL80211_CMD_MAX below */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 1fd1c4acfc8e..a587867375b2 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3355,6 +3355,17 @@ int cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
3355 enum nl80211_channel_type channel_type); 3355 enum nl80211_channel_type channel_type);
3356 3356
3357/* 3357/*
3358 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
3359 * @dev: the device which switched channels
3360 * @freq: new channel frequency (in MHz)
3361 * @type: channel type
3362 *
3363 * Acquires wdev_lock, so must only be called from sleepable driver context!
3364 */
3365void cfg80211_ch_switch_notify(struct net_device *dev, int freq,
3366 enum nl80211_channel_type type);
3367
3368/*
3358 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 3369 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
3359 * @rate: given rate_info to calculate bitrate from 3370 * @rate: given rate_info to calculate bitrate from
3360 * 3371 *
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index e14fdcc1d7cd..6801d96bc224 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -930,6 +930,33 @@ void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
930} 930}
931EXPORT_SYMBOL(cfg80211_pmksa_candidate_notify); 931EXPORT_SYMBOL(cfg80211_pmksa_candidate_notify);
932 932
933void cfg80211_ch_switch_notify(struct net_device *dev, int freq,
934 enum nl80211_channel_type type)
935{
936 struct wireless_dev *wdev = dev->ieee80211_ptr;
937 struct wiphy *wiphy = wdev->wiphy;
938 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
939 struct ieee80211_channel *chan;
940
941 wdev_lock(wdev);
942
943 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_AP &&
944 wdev->iftype != NL80211_IFTYPE_P2P_GO))
945 goto out;
946
947 chan = rdev_freq_to_chan(rdev, freq, type);
948 if (WARN_ON(!chan))
949 goto out;
950
951 wdev->channel = chan;
952
953 nl80211_ch_switch_notify(rdev, dev, freq, type, GFP_KERNEL);
954out:
955 wdev_unlock(wdev);
956 return;
957}
958EXPORT_SYMBOL(cfg80211_ch_switch_notify);
959
933bool cfg80211_rx_spurious_frame(struct net_device *dev, 960bool cfg80211_rx_spurious_frame(struct net_device *dev,
934 const u8 *addr, gfp_t gfp) 961 const u8 *addr, gfp_t gfp)
935{ 962{
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 40e5620e5fde..c3e82af72bf5 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -7922,6 +7922,38 @@ void nl80211_pmksa_candidate_notify(struct cfg80211_registered_device *rdev,
7922 nlmsg_free(msg); 7922 nlmsg_free(msg);
7923} 7923}
7924 7924
7925void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev,
7926 struct net_device *netdev, int freq,
7927 enum nl80211_channel_type type, gfp_t gfp)
7928{
7929 struct sk_buff *msg;
7930 void *hdr;
7931
7932 msg = nlmsg_new(NLMSG_GOODSIZE, gfp);
7933 if (!msg)
7934 return;
7935
7936 hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_CH_SWITCH_NOTIFY);
7937 if (!hdr) {
7938 nlmsg_free(msg);
7939 return;
7940 }
7941
7942 NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex);
7943 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq);
7944 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, type);
7945
7946 genlmsg_end(msg, hdr);
7947
7948 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
7949 nl80211_mlme_mcgrp.id, gfp);
7950 return;
7951
7952 nla_put_failure:
7953 genlmsg_cancel(msg, hdr);
7954 nlmsg_free(msg);
7955}
7956
7925void 7957void
7926nl80211_send_cqm_pktloss_notify(struct cfg80211_registered_device *rdev, 7958nl80211_send_cqm_pktloss_notify(struct cfg80211_registered_device *rdev,
7927 struct net_device *netdev, const u8 *peer, 7959 struct net_device *netdev, const u8 *peer,
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h
index 4ffe50df9f31..01a1122c3b33 100644
--- a/net/wireless/nl80211.h
+++ b/net/wireless/nl80211.h
@@ -118,6 +118,10 @@ void nl80211_pmksa_candidate_notify(struct cfg80211_registered_device *rdev,
118 struct net_device *netdev, int index, 118 struct net_device *netdev, int index,
119 const u8 *bssid, bool preauth, gfp_t gfp); 119 const u8 *bssid, bool preauth, gfp_t gfp);
120 120
121void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev,
122 struct net_device *dev, int freq,
123 enum nl80211_channel_type type, gfp_t gfp);
124
121bool nl80211_unexpected_frame(struct net_device *dev, 125bool nl80211_unexpected_frame(struct net_device *dev,
122 const u8 *addr, gfp_t gfp); 126 const u8 *addr, gfp_t gfp);
123bool nl80211_unexpected_4addr_frame(struct net_device *dev, 127bool nl80211_unexpected_4addr_frame(struct net_device *dev,