xref: /openbmc/linux/net/wireless/nl80211.h (revision 78289b4a)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Portions of this file
4  * Copyright (C) 2018 Intel Corporation
5  */
6 #ifndef __NET_WIRELESS_NL80211_H
7 #define __NET_WIRELESS_NL80211_H
8 
9 #include "core.h"
10 
11 int nl80211_init(void);
12 void nl80211_exit(void);
13 
14 void *nl80211hdr_put(struct sk_buff *skb, u32 portid, u32 seq,
15 		     int flags, u8 cmd);
16 bool nl80211_put_sta_rate(struct sk_buff *msg, struct rate_info *info,
17 			  int attr);
18 
19 static inline u64 wdev_id(struct wireless_dev *wdev)
20 {
21 	return (u64)wdev->identifier |
22 	       ((u64)wiphy_to_rdev(wdev->wiphy)->wiphy_idx << 32);
23 }
24 
25 int nl80211_prepare_wdev_dump(struct netlink_callback *cb,
26 			      struct cfg80211_registered_device **rdev,
27 			      struct wireless_dev **wdev);
28 
29 int nl80211_parse_chandef(struct cfg80211_registered_device *rdev,
30 			  struct genl_info *info,
31 			  struct cfg80211_chan_def *chandef);
32 int nl80211_parse_random_mac(struct nlattr **attrs,
33 			     u8 *mac_addr, u8 *mac_addr_mask);
34 
35 void nl80211_notify_wiphy(struct cfg80211_registered_device *rdev,
36 			  enum nl80211_commands cmd);
37 void nl80211_notify_iface(struct cfg80211_registered_device *rdev,
38 			  struct wireless_dev *wdev,
39 			  enum nl80211_commands cmd);
40 void nl80211_send_scan_start(struct cfg80211_registered_device *rdev,
41 			     struct wireless_dev *wdev);
42 struct sk_buff *nl80211_build_scan_msg(struct cfg80211_registered_device *rdev,
43 				       struct wireless_dev *wdev, bool aborted);
44 void nl80211_send_scan_msg(struct cfg80211_registered_device *rdev,
45 			   struct sk_buff *msg);
46 void nl80211_send_sched_scan(struct cfg80211_sched_scan_request *req, u32 cmd);
47 void nl80211_common_reg_change_event(enum nl80211_commands cmd_id,
48 				     struct regulatory_request *request);
49 
50 static inline void
51 nl80211_send_reg_change_event(struct regulatory_request *request)
52 {
53 	nl80211_common_reg_change_event(NL80211_CMD_REG_CHANGE, request);
54 }
55 
56 static inline void
57 nl80211_send_wiphy_reg_change_event(struct regulatory_request *request)
58 {
59 	nl80211_common_reg_change_event(NL80211_CMD_WIPHY_REG_CHANGE, request);
60 }
61 
62 void nl80211_send_rx_auth(struct cfg80211_registered_device *rdev,
63 			  struct net_device *netdev,
64 			  const u8 *buf, size_t len, gfp_t gfp);
65 void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev,
66 			   struct net_device *netdev,
67 			   const u8 *buf, size_t len, gfp_t gfp,
68 			   int uapsd_queues,
69 			   const u8 *req_ies, size_t req_ies_len);
70 void nl80211_send_deauth(struct cfg80211_registered_device *rdev,
71 			 struct net_device *netdev,
72 			 const u8 *buf, size_t len, gfp_t gfp);
73 void nl80211_send_disassoc(struct cfg80211_registered_device *rdev,
74 			   struct net_device *netdev,
75 			   const u8 *buf, size_t len, gfp_t gfp);
76 void nl80211_send_auth_timeout(struct cfg80211_registered_device *rdev,
77 			       struct net_device *netdev,
78 			       const u8 *addr, gfp_t gfp);
79 void nl80211_send_assoc_timeout(struct cfg80211_registered_device *rdev,
80 				struct net_device *netdev,
81 				const u8 *addr, gfp_t gfp);
82 void nl80211_send_connect_result(struct cfg80211_registered_device *rdev,
83 				 struct net_device *netdev,
84 				 struct cfg80211_connect_resp_params *params,
85 				 gfp_t gfp);
86 void nl80211_send_roamed(struct cfg80211_registered_device *rdev,
87 			 struct net_device *netdev,
88 			 struct cfg80211_roam_info *info, gfp_t gfp);
89 void nl80211_send_port_authorized(struct cfg80211_registered_device *rdev,
90 				  struct net_device *netdev, const u8 *bssid);
91 void nl80211_send_disconnected(struct cfg80211_registered_device *rdev,
92 			       struct net_device *netdev, u16 reason,
93 			       const u8 *ie, size_t ie_len, bool from_ap);
94 
95 void
96 nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev,
97 			    struct net_device *netdev, const u8 *addr,
98 			    enum nl80211_key_type key_type,
99 			    int key_id, const u8 *tsc, gfp_t gfp);
100 
101 void
102 nl80211_send_beacon_hint_event(struct wiphy *wiphy,
103 			       struct ieee80211_channel *channel_before,
104 			       struct ieee80211_channel *channel_after);
105 
106 void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev,
107 			     struct net_device *netdev, const u8 *bssid,
108 			     gfp_t gfp);
109 
110 int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
111 		      struct wireless_dev *wdev, u32 nlpid,
112 		      int freq, int sig_dbm,
113 		      const u8 *buf, size_t len, u32 flags, gfp_t gfp);
114 
115 void
116 nl80211_radar_notify(struct cfg80211_registered_device *rdev,
117 		     const struct cfg80211_chan_def *chandef,
118 		     enum nl80211_radar_event event,
119 		     struct net_device *netdev, gfp_t gfp);
120 
121 void nl80211_send_ap_stopped(struct wireless_dev *wdev);
122 
123 void cfg80211_rdev_free_coalesce(struct cfg80211_registered_device *rdev);
124 
125 /* peer measurement */
126 int nl80211_pmsr_start(struct sk_buff *skb, struct genl_info *info);
127 int nl80211_pmsr_dump_results(struct sk_buff *skb, struct netlink_callback *cb);
128 
129 #endif /* __NET_WIRELESS_NL80211_H */
130