aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-10-13 06:06:23 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-10-13 15:45:22 -0400
commit271733cf844a2f5f186ef3b40c26d6397b71039a (patch)
tree6b674540afe189b48599ae423c2174ebd48a8ffe
parent7a8266524af7ec70d1b3d10f964ce911d922d466 (diff)
cfg80211: notify drivers about frame registrations
Drivers may need to adjust their filters according to frame registrations, so notify them about them. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--include/net/cfg80211.h7
-rw-r--r--net/wireless/mlme.c23
2 files changed, 27 insertions, 3 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 24d5b5869272..2a7936d7851d 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1147,6 +1147,9 @@ struct cfg80211_pmksa {
1147 * allows the driver to adjust the dynamic ps timeout value. 1147 * allows the driver to adjust the dynamic ps timeout value.
1148 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 1148 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
1149 * 1149 *
1150 * @mgmt_frame_register: Notify driver that a management frame type was
1151 * registered. Note that this callback may not sleep, and cannot run
1152 * concurrently with itself.
1150 */ 1153 */
1151struct cfg80211_ops { 1154struct cfg80211_ops {
1152 int (*suspend)(struct wiphy *wiphy); 1155 int (*suspend)(struct wiphy *wiphy);
@@ -1297,6 +1300,10 @@ struct cfg80211_ops {
1297 int (*set_cqm_rssi_config)(struct wiphy *wiphy, 1300 int (*set_cqm_rssi_config)(struct wiphy *wiphy,
1298 struct net_device *dev, 1301 struct net_device *dev,
1299 s32 rssi_thold, u32 rssi_hyst); 1302 s32 rssi_thold, u32 rssi_hyst);
1303
1304 void (*mgmt_frame_register)(struct wiphy *wiphy,
1305 struct net_device *dev,
1306 u16 frame_type, bool reg);
1300}; 1307};
1301 1308
1302/* 1309/*
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index caf11a427507..26838d903b9a 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -764,6 +764,8 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_pid,
764 u16 frame_type, const u8 *match_data, 764 u16 frame_type, const u8 *match_data,
765 int match_len) 765 int match_len)
766{ 766{
767 struct wiphy *wiphy = wdev->wiphy;
768 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
767 struct cfg80211_mgmt_registration *reg, *nreg; 769 struct cfg80211_mgmt_registration *reg, *nreg;
768 int err = 0; 770 int err = 0;
769 u16 mgmt_type; 771 u16 mgmt_type;
@@ -810,22 +812,37 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_pid,
810 nreg->frame_type = cpu_to_le16(frame_type); 812 nreg->frame_type = cpu_to_le16(frame_type);
811 list_add(&nreg->list, &wdev->mgmt_registrations); 813 list_add(&nreg->list, &wdev->mgmt_registrations);
812 814
815 if (rdev->ops->mgmt_frame_register)
816 rdev->ops->mgmt_frame_register(wiphy, wdev->netdev,
817 frame_type, true);
818
813 out: 819 out:
814 spin_unlock_bh(&wdev->mgmt_registrations_lock); 820 spin_unlock_bh(&wdev->mgmt_registrations_lock);
821
815 return err; 822 return err;
816} 823}
817 824
818void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlpid) 825void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlpid)
819{ 826{
827 struct wiphy *wiphy = wdev->wiphy;
828 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
820 struct cfg80211_mgmt_registration *reg, *tmp; 829 struct cfg80211_mgmt_registration *reg, *tmp;
821 830
822 spin_lock_bh(&wdev->mgmt_registrations_lock); 831 spin_lock_bh(&wdev->mgmt_registrations_lock);
823 832
824 list_for_each_entry_safe(reg, tmp, &wdev->mgmt_registrations, list) { 833 list_for_each_entry_safe(reg, tmp, &wdev->mgmt_registrations, list) {
825 if (reg->nlpid == nlpid) { 834 if (reg->nlpid != nlpid)
826 list_del(&reg->list); 835 continue;
827 kfree(reg); 836
837 if (rdev->ops->mgmt_frame_register) {
838 u16 frame_type = le16_to_cpu(reg->frame_type);
839
840 rdev->ops->mgmt_frame_register(wiphy, wdev->netdev,
841 frame_type, false);
828 } 842 }
843
844 list_del(&reg->list);
845 kfree(reg);
829 } 846 }
830 847
831 spin_unlock_bh(&wdev->mgmt_registrations_lock); 848 spin_unlock_bh(&wdev->mgmt_registrations_lock);