blob: d642e3be4ee78cdfe26b30d7a3fbc9363a4a1c66 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Johannes Berg9bb7e0f2018-09-10 13:29:12 +02002/*
3 * Portions of this file
Johannes Bergce6b6972021-10-29 09:25:39 +02004 * Copyright (C) 2018, 2020-2021 Intel Corporation
Johannes Berg9bb7e0f2018-09-10 13:29:12 +02005 */
Johannes Berg55682962007-09-20 13:09:35 -04006#ifndef __NET_WIRELESS_NL80211_H
7#define __NET_WIRELESS_NL80211_H
8
9#include "core.h"
10
Johannes Bergdad82332009-07-01 21:26:46 +020011int nl80211_init(void);
12void nl80211_exit(void);
Johannes Berg9bb7e0f2018-09-10 13:29:12 +020013
Johannes Berg9bb7e0f2018-09-10 13:29:12 +020014void *nl80211hdr_put(struct sk_buff *skb, u32 portid, u32 seq,
15 int flags, u8 cmd);
16bool nl80211_put_sta_rate(struct sk_buff *msg, struct rate_info *info,
17 int attr);
18
19static 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
Johannes Berg9bb7e0f2018-09-10 13:29:12 +020025int nl80211_parse_chandef(struct cfg80211_registered_device *rdev,
26 struct genl_info *info,
27 struct cfg80211_chan_def *chandef);
28int nl80211_parse_random_mac(struct nlattr **attrs,
29 u8 *mac_addr, u8 *mac_addr_mask);
30
Johannes Berg3bb20552014-05-26 13:52:25 +020031void nl80211_notify_wiphy(struct cfg80211_registered_device *rdev,
32 enum nl80211_commands cmd);
Denis Kenzior896ff062016-08-03 16:58:33 -050033void nl80211_notify_iface(struct cfg80211_registered_device *rdev,
34 struct wireless_dev *wdev,
35 enum nl80211_commands cmd);
Johannes Bergdad82332009-07-01 21:26:46 +020036void nl80211_send_scan_start(struct cfg80211_registered_device *rdev,
Johannes Bergfd014282012-06-18 19:17:03 +020037 struct wireless_dev *wdev);
Johannes Bergf9d15d12014-01-22 11:14:19 +020038struct sk_buff *nl80211_build_scan_msg(struct cfg80211_registered_device *rdev,
39 struct wireless_dev *wdev, bool aborted);
Arend Van Spriel505a2e82016-12-16 11:21:54 +000040void nl80211_send_scan_msg(struct cfg80211_registered_device *rdev,
41 struct sk_buff *msg);
Arend Van Spriel96b08fd2017-04-13 13:06:27 +010042void nl80211_send_sched_scan(struct cfg80211_sched_scan_request *req, u32 cmd);
Jonathan Doronb0d7aa52014-12-15 19:26:00 +020043void nl80211_common_reg_change_event(enum nl80211_commands cmd_id,
44 struct regulatory_request *request);
45
46static inline void
47nl80211_send_reg_change_event(struct regulatory_request *request)
48{
49 nl80211_common_reg_change_event(NL80211_CMD_REG_CHANGE, request);
50}
51
52static inline void
53nl80211_send_wiphy_reg_change_event(struct regulatory_request *request)
54{
55 nl80211_common_reg_change_event(NL80211_CMD_WIPHY_REG_CHANGE, request);
56}
57
Johannes Bergdad82332009-07-01 21:26:46 +020058void nl80211_send_rx_auth(struct cfg80211_registered_device *rdev,
59 struct net_device *netdev,
Johannes Berge6d6e342009-07-01 21:26:47 +020060 const u8 *buf, size_t len, gfp_t gfp);
Johannes Bergdad82332009-07-01 21:26:46 +020061void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev,
62 struct net_device *netdev,
Eliad Pellerb0b6aa22014-09-09 17:09:45 +030063 const u8 *buf, size_t len, gfp_t gfp,
Jouni Malinen4d9ec732019-02-15 02:14:33 +020064 int uapsd_queues,
65 const u8 *req_ies, size_t req_ies_len);
Johannes Bergdad82332009-07-01 21:26:46 +020066void nl80211_send_deauth(struct cfg80211_registered_device *rdev,
67 struct net_device *netdev,
Johannes Berg3bb02142020-12-06 14:54:42 +020068 const u8 *buf, size_t len,
69 bool reconnect, gfp_t gfp);
Johannes Bergdad82332009-07-01 21:26:46 +020070void nl80211_send_disassoc(struct cfg80211_registered_device *rdev,
71 struct net_device *netdev,
Johannes Berg3bb02142020-12-06 14:54:42 +020072 const u8 *buf, size_t len,
73 bool reconnect, gfp_t gfp);
Johannes Bergdad82332009-07-01 21:26:46 +020074void nl80211_send_auth_timeout(struct cfg80211_registered_device *rdev,
75 struct net_device *netdev,
Johannes Berge6d6e342009-07-01 21:26:47 +020076 const u8 *addr, gfp_t gfp);
Johannes Bergdad82332009-07-01 21:26:46 +020077void nl80211_send_assoc_timeout(struct cfg80211_registered_device *rdev,
Jouni Malinen53b46b82009-03-27 20:53:56 +020078 struct net_device *netdev,
Johannes Berge6d6e342009-07-01 21:26:47 +020079 const u8 *addr, gfp_t gfp);
Samuel Ortizb23aa672009-07-01 21:26:54 +020080void nl80211_send_connect_result(struct cfg80211_registered_device *rdev,
Vidyullatha Kanchanapally5349a0f2017-03-31 00:22:33 +030081 struct net_device *netdev,
82 struct cfg80211_connect_resp_params *params,
Purushottam Kushwaha3093ebbeab2017-01-13 01:12:21 +020083 gfp_t gfp);
Samuel Ortizb23aa672009-07-01 21:26:54 +020084void nl80211_send_roamed(struct cfg80211_registered_device *rdev,
Avraham Stern29ce6ec2017-04-26 10:58:49 +030085 struct net_device *netdev,
86 struct cfg80211_roam_info *info, gfp_t gfp);
Avraham Stern503c1fb2017-09-29 14:21:49 +020087void nl80211_send_port_authorized(struct cfg80211_registered_device *rdev,
88 struct net_device *netdev, const u8 *bssid);
Samuel Ortizb23aa672009-07-01 21:26:54 +020089void nl80211_send_disconnected(struct cfg80211_registered_device *rdev,
90 struct net_device *netdev, u16 reason,
Johannes Berg667503d2009-07-07 03:56:11 +020091 const u8 *ie, size_t ie_len, bool from_ap);
Samuel Ortizb23aa672009-07-01 21:26:54 +020092
Johannes Bergdad82332009-07-01 21:26:46 +020093void
Jouni Malinena3b8b052009-03-27 21:59:49 +020094nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev,
95 struct net_device *netdev, const u8 *addr,
96 enum nl80211_key_type key_type,
Johannes Berge6d6e342009-07-01 21:26:47 +020097 int key_id, const u8 *tsc, gfp_t gfp);
Johannes Berg55682962007-09-20 13:09:35 -040098
Johannes Bergdad82332009-07-01 21:26:46 +020099void
Luis R. Rodriguez6bad8762009-04-02 14:08:09 -0400100nl80211_send_beacon_hint_event(struct wiphy *wiphy,
101 struct ieee80211_channel *channel_before,
102 struct ieee80211_channel *channel_after);
103
Johannes Berg04a773a2009-04-19 21:24:32 +0200104void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev,
105 struct net_device *netdev, const u8 *bssid,
106 gfp_t gfp);
107
Johannes Berg2e161f782010-08-12 15:38:38 +0200108int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
Johannes Berg71bbc992012-06-15 15:30:18 +0200109 struct wireless_dev *wdev, u32 nlpid,
Johannes Berg804483e2012-03-05 22:18:41 +0100110 int freq, int sig_dbm,
Vladimir Kondratiev19504cf2013-08-15 14:51:28 +0300111 const u8 *buf, size_t len, u32 flags, gfp_t gfp);
Simon Wunderlich04f39042013-02-08 18:16:19 +0100112
113void
114nl80211_radar_notify(struct cfg80211_registered_device *rdev,
Janusz Dziedzicd2859df2013-11-06 13:55:51 +0100115 const struct cfg80211_chan_def *chandef,
Simon Wunderlich04f39042013-02-08 18:16:19 +0100116 enum nl80211_radar_event event,
117 struct net_device *netdev, gfp_t gfp);
118
Johannes Berg348baf02014-01-24 14:06:29 +0100119void nl80211_send_ap_stopped(struct wireless_dev *wdev);
120
Amitkumar Karwarbe29b99a2013-06-28 11:51:26 -0700121void cfg80211_rdev_free_coalesce(struct cfg80211_registered_device *rdev);
122
Johannes Berg9bb7e0f2018-09-10 13:29:12 +0200123/* peer measurement */
124int nl80211_pmsr_start(struct sk_buff *skb, struct genl_info *info);
125int nl80211_pmsr_dump_results(struct sk_buff *skb, struct netlink_callback *cb);
126
Johannes Berg55682962007-09-20 13:09:35 -0400127#endif /* __NET_WIRELESS_NL80211_H */