xref: /linux/net/wireless/nl80211.h (revision 77de28cd7cf172e782319a144bf64e693794d78b)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Portions of this file
4  * Copyright (C) 2018, 2020-2025 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_parse_chandef(struct cfg80211_registered_device *rdev,
26 			  struct netlink_ext_ack *extack,
27 			  struct nlattr **attrs,
28 			  struct cfg80211_chan_def *chandef);
29 int nl80211_parse_random_mac(struct nlattr **attrs,
30 			     u8 *mac_addr, u8 *mac_addr_mask);
31 
32 void nl80211_notify_wiphy(struct cfg80211_registered_device *rdev,
33 			  enum nl80211_commands cmd);
34 void nl80211_notify_iface(struct cfg80211_registered_device *rdev,
35 			  struct wireless_dev *wdev,
36 			  enum nl80211_commands cmd);
37 void nl80211_send_scan_start(struct cfg80211_registered_device *rdev,
38 			     struct wireless_dev *wdev);
39 struct sk_buff *nl80211_build_scan_msg(struct cfg80211_registered_device *rdev,
40 				       struct wireless_dev *wdev, bool aborted);
41 void nl80211_send_scan_msg(struct cfg80211_registered_device *rdev,
42 			   struct sk_buff *msg);
43 void nl80211_send_sched_scan(struct cfg80211_sched_scan_request *req, u32 cmd);
44 void nl80211_common_reg_change_event(enum nl80211_commands cmd_id,
45 				     struct regulatory_request *request);
46 
47 static inline void
48 nl80211_send_reg_change_event(struct regulatory_request *request)
49 {
50 	nl80211_common_reg_change_event(NL80211_CMD_REG_CHANGE, request);
51 }
52 
53 static inline void
54 nl80211_send_wiphy_reg_change_event(struct regulatory_request *request)
55 {
56 	nl80211_common_reg_change_event(NL80211_CMD_WIPHY_REG_CHANGE, request);
57 }
58 
59 void nl80211_send_rx_auth(struct cfg80211_registered_device *rdev,
60 			  struct net_device *netdev,
61 			  const u8 *buf, size_t len, gfp_t gfp);
62 void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev,
63 			   struct net_device *netdev,
64 			   const struct cfg80211_rx_assoc_resp_data *data);
65 void nl80211_send_deauth(struct cfg80211_registered_device *rdev,
66 			 struct net_device *netdev,
67 			 const u8 *buf, size_t len,
68 			 bool reconnect, gfp_t gfp);
69 void nl80211_send_disassoc(struct cfg80211_registered_device *rdev,
70 			   struct net_device *netdev,
71 			   const u8 *buf, size_t len,
72 			   bool reconnect, gfp_t gfp);
73 void nl80211_send_auth_timeout(struct cfg80211_registered_device *rdev,
74 			       struct net_device *netdev,
75 			       const u8 *addr, gfp_t gfp);
76 void nl80211_send_assoc_timeout(struct cfg80211_registered_device *rdev,
77 				struct net_device *netdev,
78 				const u8 *addr, gfp_t gfp);
79 void nl80211_send_connect_result(struct cfg80211_registered_device *rdev,
80 				 struct net_device *netdev,
81 				 struct cfg80211_connect_resp_params *params,
82 				 gfp_t gfp);
83 void nl80211_send_roamed(struct cfg80211_registered_device *rdev,
84 			 struct net_device *netdev,
85 			 struct cfg80211_roam_info *info, gfp_t gfp);
86 /* For STA/GC, indicate port authorized with AP/GO bssid.
87  * For GO/AP, use peer GC/STA mac_addr.
88  */
89 void nl80211_send_port_authorized(struct cfg80211_registered_device *rdev,
90 				  struct net_device *netdev, const u8 *peer_addr,
91 				  const u8 *td_bitmap, u8 td_bitmap_len);
92 void nl80211_send_disconnected(struct cfg80211_registered_device *rdev,
93 			       struct net_device *netdev, u16 reason,
94 			       const u8 *ie, size_t ie_len, bool from_ap);
95 
96 void
97 nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev,
98 			    struct net_device *netdev, const u8 *addr,
99 			    enum nl80211_key_type key_type,
100 			    int key_id, const u8 *tsc, gfp_t gfp);
101 
102 void
103 nl80211_send_beacon_hint_event(struct wiphy *wiphy,
104 			       struct ieee80211_channel *channel_before,
105 			       struct ieee80211_channel *channel_after);
106 
107 void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev,
108 			     struct net_device *netdev, const u8 *bssid,
109 			     gfp_t gfp);
110 
111 int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
112 		      struct wireless_dev *wdev, u32 nlpid,
113 		      struct cfg80211_rx_info *info, 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, unsigned int link_id);
122 
123 void cfg80211_free_coalesce(struct cfg80211_coalesce *coalesce);
124 
125 /* peer measurement */
126 int nl80211_pmsr_start(struct sk_buff *skb, struct genl_info *info);
127 
128 void nl80211_mlo_reconf_add_done(struct net_device *dev,
129 				 struct cfg80211_mlo_reconf_done_data *data);
130 
131 #endif /* __NET_WIRELESS_NL80211_H */
132