1 #include <linux/ieee80211.h>
2 #include <linux/export.h>
3 #include <net/cfg80211.h>
9 static int __cfg80211_stop_ap(struct cfg80211_registered_device
*rdev
,
10 struct net_device
*dev
)
12 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
15 ASSERT_WDEV_LOCK(wdev
);
17 if (!rdev
->ops
->stop_ap
)
20 if (dev
->ieee80211_ptr
->iftype
!= NL80211_IFTYPE_AP
&&
21 dev
->ieee80211_ptr
->iftype
!= NL80211_IFTYPE_P2P_GO
)
24 if (!wdev
->beacon_interval
)
27 err
= rdev_stop_ap(rdev
, dev
);
29 wdev
->beacon_interval
= 0;
37 int cfg80211_stop_ap(struct cfg80211_registered_device
*rdev
,
38 struct net_device
*dev
)
40 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
44 err
= __cfg80211_stop_ap(rdev
, dev
);
50 void cfg80211_ch_switch_notify(struct net_device
*dev
,
51 struct cfg80211_chan_def
*chandef
)
53 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
54 struct wiphy
*wiphy
= wdev
->wiphy
;
55 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wiphy
);
57 trace_cfg80211_ch_switch_notify(dev
, chandef
);
61 if (WARN_ON(wdev
->iftype
!= NL80211_IFTYPE_AP
&&
62 wdev
->iftype
!= NL80211_IFTYPE_P2P_GO
))
65 wdev
->channel
= chandef
->chan
;
66 nl80211_ch_switch_notify(rdev
, dev
, chandef
, GFP_KERNEL
);
71 EXPORT_SYMBOL(cfg80211_ch_switch_notify
);
73 bool cfg80211_rx_spurious_frame(struct net_device
*dev
,
74 const u8
*addr
, gfp_t gfp
)
76 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
79 trace_cfg80211_rx_spurious_frame(dev
, addr
);
81 if (WARN_ON(wdev
->iftype
!= NL80211_IFTYPE_AP
&&
82 wdev
->iftype
!= NL80211_IFTYPE_P2P_GO
)) {
83 trace_cfg80211_return_bool(false);
86 ret
= nl80211_unexpected_frame(dev
, addr
, gfp
);
87 trace_cfg80211_return_bool(ret
);
90 EXPORT_SYMBOL(cfg80211_rx_spurious_frame
);
92 bool cfg80211_rx_unexpected_4addr_frame(struct net_device
*dev
,
93 const u8
*addr
, gfp_t gfp
)
95 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
98 trace_cfg80211_rx_unexpected_4addr_frame(dev
, addr
);
100 if (WARN_ON(wdev
->iftype
!= NL80211_IFTYPE_AP
&&
101 wdev
->iftype
!= NL80211_IFTYPE_P2P_GO
&&
102 wdev
->iftype
!= NL80211_IFTYPE_AP_VLAN
)) {
103 trace_cfg80211_return_bool(false);
106 ret
= nl80211_unexpected_4addr_frame(dev
, addr
, gfp
);
107 trace_cfg80211_return_bool(ret
);
110 EXPORT_SYMBOL(cfg80211_rx_unexpected_4addr_frame
);