core.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Wireless configuration interface internals.
  4. *
  5. * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
  6. * Copyright (C) 2018-2025 Intel Corporation
  7. */
  8. #ifndef __NET_WIRELESS_CORE_H
  9. #define __NET_WIRELESS_CORE_H
  10. #include <linux/list.h>
  11. #include <linux/netdevice.h>
  12. #include <linux/rbtree.h>
  13. #include <linux/debugfs.h>
  14. #include <linux/rfkill.h>
  15. #include <linux/workqueue.h>
  16. #include <linux/rtnetlink.h>
  17. #include <net/genetlink.h>
  18. #include <net/cfg80211.h>
  19. #include "reg.h"
  20. #define WIPHY_IDX_INVALID -1
  21. struct cfg80211_scan_request_int {
  22. struct cfg80211_scan_info info;
  23. bool notified;
  24. /* must be last - variable members */
  25. struct cfg80211_scan_request req;
  26. };
  27. struct cfg80211_registered_device {
  28. const struct cfg80211_ops *ops;
  29. struct list_head list;
  30. /* rfkill support */
  31. struct rfkill_ops rfkill_ops;
  32. struct work_struct rfkill_block;
  33. /* ISO / IEC 3166 alpha2 for which this device is receiving
  34. * country IEs on, this can help disregard country IEs from APs
  35. * on the same alpha2 quickly. The alpha2 may differ from
  36. * cfg80211_regdomain's alpha2 when an intersection has occurred.
  37. * If the AP is reconfigured this can also be used to tell us if
  38. * the country on the country IE changed. */
  39. char country_ie_alpha2[2];
  40. /*
  41. * the driver requests the regulatory core to set this regulatory
  42. * domain as the wiphy's. Only used for %REGULATORY_WIPHY_SELF_MANAGED
  43. * devices using the regulatory_set_wiphy_regd() API
  44. */
  45. const struct ieee80211_regdomain *requested_regd;
  46. /* If a Country IE has been received this tells us the environment
  47. * which its telling us its in. This defaults to ENVIRON_ANY */
  48. enum environment_cap env;
  49. /* wiphy index, internal only */
  50. int wiphy_idx;
  51. /* protected by RTNL */
  52. int devlist_generation, wdev_id;
  53. int opencount;
  54. wait_queue_head_t dev_wait;
  55. struct list_head beacon_registrations;
  56. spinlock_t beacon_registrations_lock;
  57. /* protected by RTNL only */
  58. int num_running_ifaces;
  59. int num_running_monitor_ifaces;
  60. u64 cookie_counter;
  61. /* BSSes/scanning */
  62. spinlock_t bss_lock;
  63. struct list_head bss_list;
  64. struct rb_root bss_tree;
  65. u32 bss_generation;
  66. u32 bss_entries;
  67. struct cfg80211_scan_request_int *scan_req; /* protected by RTNL */
  68. struct cfg80211_scan_request_int *int_scan_req;
  69. struct sk_buff *scan_msg;
  70. struct list_head sched_scan_req_list;
  71. time64_t suspend_at;
  72. struct wiphy_work scan_done_wk;
  73. struct genl_info *cur_cmd_info;
  74. struct work_struct conn_work;
  75. struct work_struct event_work;
  76. struct delayed_work dfs_update_channels_wk;
  77. struct wireless_dev *background_radar_wdev;
  78. struct cfg80211_chan_def background_radar_chandef;
  79. struct delayed_work background_cac_done_wk;
  80. struct work_struct background_cac_abort_wk;
  81. /* netlink port which started critical protocol (0 means not started) */
  82. u32 crit_proto_nlportid;
  83. struct cfg80211_coalesce *coalesce;
  84. struct work_struct destroy_work;
  85. struct wiphy_work sched_scan_stop_wk;
  86. struct work_struct sched_scan_res_wk;
  87. struct cfg80211_chan_def radar_chandef;
  88. struct work_struct propagate_radar_detect_wk;
  89. struct cfg80211_chan_def cac_done_chandef;
  90. struct work_struct propagate_cac_done_wk;
  91. struct work_struct mgmt_registrations_update_wk;
  92. /* lock for all wdev lists */
  93. spinlock_t mgmt_registrations_lock;
  94. struct work_struct wiphy_work;
  95. struct list_head wiphy_work_list;
  96. /* protects the list above */
  97. spinlock_t wiphy_work_lock;
  98. bool suspended;
  99. /* must be last because of the way we do wiphy_priv(),
  100. * and it should at least be aligned to NETDEV_ALIGN */
  101. struct wiphy wiphy __aligned(NETDEV_ALIGN);
  102. };
  103. static inline
  104. struct cfg80211_registered_device *wiphy_to_rdev(struct wiphy *wiphy)
  105. {
  106. BUG_ON(!wiphy);
  107. return container_of(wiphy, struct cfg80211_registered_device, wiphy);
  108. }
  109. static inline void
  110. cfg80211_rdev_free_wowlan(struct cfg80211_registered_device *rdev)
  111. {
  112. #ifdef CONFIG_PM
  113. int i;
  114. if (!rdev->wiphy.wowlan_config)
  115. return;
  116. for (i = 0; i < rdev->wiphy.wowlan_config->n_patterns; i++)
  117. kfree(rdev->wiphy.wowlan_config->patterns[i].mask);
  118. kfree(rdev->wiphy.wowlan_config->patterns);
  119. if (rdev->wiphy.wowlan_config->tcp &&
  120. rdev->wiphy.wowlan_config->tcp->sock)
  121. sock_release(rdev->wiphy.wowlan_config->tcp->sock);
  122. kfree(rdev->wiphy.wowlan_config->tcp);
  123. kfree(rdev->wiphy.wowlan_config->nd_config);
  124. kfree(rdev->wiphy.wowlan_config);
  125. #endif
  126. }
  127. static inline u64 cfg80211_assign_cookie(struct cfg80211_registered_device *rdev)
  128. {
  129. u64 r = ++rdev->cookie_counter;
  130. if (WARN_ON(r == 0))
  131. r = ++rdev->cookie_counter;
  132. return r;
  133. }
  134. extern struct workqueue_struct *cfg80211_wq;
  135. extern struct list_head cfg80211_rdev_list;
  136. extern int cfg80211_rdev_list_generation;
  137. /* This is constructed like this so it can be used in if/else */
  138. static inline int for_each_rdev_check_rtnl(void)
  139. {
  140. ASSERT_RTNL();
  141. return 0;
  142. }
  143. #define for_each_rdev(rdev) \
  144. if (for_each_rdev_check_rtnl()) {} else \
  145. list_for_each_entry(rdev, &cfg80211_rdev_list, list)
  146. enum bss_source_type {
  147. BSS_SOURCE_DIRECT = 0,
  148. BSS_SOURCE_MBSSID,
  149. BSS_SOURCE_STA_PROFILE,
  150. };
  151. struct cfg80211_internal_bss {
  152. struct list_head list;
  153. struct list_head hidden_list;
  154. struct rb_node rbn;
  155. unsigned long ts;
  156. unsigned long refcount;
  157. atomic_t hold;
  158. /* time at the start of the reception of the first octet of the
  159. * timestamp field of the last beacon/probe received for this BSS.
  160. * The time is the TSF of the BSS specified by %parent_bssid.
  161. */
  162. u64 parent_tsf;
  163. /* the BSS according to which %parent_tsf is set. This is set to
  164. * the BSS that the interface that requested the scan was connected to
  165. * when the beacon/probe was received.
  166. */
  167. u8 parent_bssid[ETH_ALEN] __aligned(2);
  168. enum bss_source_type bss_source;
  169. /* must be last because of priv member */
  170. struct cfg80211_bss pub;
  171. };
  172. static inline struct cfg80211_internal_bss *bss_from_pub(struct cfg80211_bss *pub)
  173. {
  174. return container_of(pub, struct cfg80211_internal_bss, pub);
  175. }
  176. static inline void cfg80211_hold_bss(struct cfg80211_internal_bss *bss)
  177. {
  178. atomic_inc(&bss->hold);
  179. if (bss->pub.transmitted_bss) {
  180. bss = container_of(bss->pub.transmitted_bss,
  181. struct cfg80211_internal_bss, pub);
  182. atomic_inc(&bss->hold);
  183. }
  184. }
  185. static inline void cfg80211_unhold_bss(struct cfg80211_internal_bss *bss)
  186. {
  187. int r = atomic_dec_return(&bss->hold);
  188. WARN_ON(r < 0);
  189. if (bss->pub.transmitted_bss) {
  190. bss = container_of(bss->pub.transmitted_bss,
  191. struct cfg80211_internal_bss, pub);
  192. r = atomic_dec_return(&bss->hold);
  193. WARN_ON(r < 0);
  194. }
  195. }
  196. struct cfg80211_registered_device *cfg80211_rdev_by_wiphy_idx(int wiphy_idx);
  197. int get_wiphy_idx(struct wiphy *wiphy);
  198. struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx);
  199. int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
  200. struct net *net);
  201. void cfg80211_init_wdev(struct wireless_dev *wdev);
  202. void cfg80211_register_wdev(struct cfg80211_registered_device *rdev,
  203. struct wireless_dev *wdev);
  204. static inline bool cfg80211_has_monitors_only(struct cfg80211_registered_device *rdev)
  205. {
  206. lockdep_assert_held(&rdev->wiphy.mtx);
  207. return rdev->num_running_ifaces == rdev->num_running_monitor_ifaces &&
  208. rdev->num_running_ifaces > 0;
  209. }
  210. enum cfg80211_event_type {
  211. EVENT_CONNECT_RESULT,
  212. EVENT_ROAMED,
  213. EVENT_DISCONNECTED,
  214. EVENT_IBSS_JOINED,
  215. EVENT_STOPPED,
  216. EVENT_PORT_AUTHORIZED,
  217. };
  218. struct cfg80211_event {
  219. struct list_head list;
  220. enum cfg80211_event_type type;
  221. union {
  222. struct cfg80211_connect_resp_params cr;
  223. struct cfg80211_roam_info rm;
  224. struct {
  225. const u8 *ie;
  226. size_t ie_len;
  227. u16 reason;
  228. bool locally_generated;
  229. } dc;
  230. struct {
  231. u8 bssid[ETH_ALEN];
  232. struct ieee80211_channel *channel;
  233. } ij;
  234. struct {
  235. u8 peer_addr[ETH_ALEN];
  236. const u8 *td_bitmap;
  237. u8 td_bitmap_len;
  238. } pa;
  239. };
  240. int link_id;
  241. };
  242. struct cfg80211_cached_keys {
  243. struct key_params params[4];
  244. u8 data[4][WLAN_KEY_LEN_WEP104];
  245. int def;
  246. };
  247. struct cfg80211_beacon_registration {
  248. struct list_head list;
  249. u32 nlportid;
  250. };
  251. struct cfg80211_cqm_config {
  252. struct rcu_head rcu_head;
  253. u32 rssi_hyst;
  254. s32 last_rssi_event_value;
  255. enum nl80211_cqm_rssi_threshold_event last_rssi_event_type;
  256. bool use_range_api;
  257. int n_rssi_thresholds;
  258. s32 rssi_thresholds[] __counted_by(n_rssi_thresholds);
  259. };
  260. void cfg80211_cqm_rssi_notify_work(struct wiphy *wiphy,
  261. struct wiphy_work *work);
  262. void cfg80211_destroy_ifaces(struct cfg80211_registered_device *rdev);
  263. /* free object */
  264. void cfg80211_dev_free(struct cfg80211_registered_device *rdev);
  265. int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
  266. char *newname);
  267. void ieee80211_set_bitrate_flags(struct wiphy *wiphy);
  268. void cfg80211_bss_expire(struct cfg80211_registered_device *rdev);
  269. void cfg80211_bss_age(struct cfg80211_registered_device *rdev,
  270. unsigned long age_secs);
  271. void cfg80211_update_assoc_bss_entry(struct wireless_dev *wdev,
  272. unsigned int link,
  273. struct ieee80211_channel *channel);
  274. /* IBSS */
  275. int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev,
  276. struct net_device *dev,
  277. struct cfg80211_ibss_params *params,
  278. struct cfg80211_cached_keys *connkeys);
  279. void cfg80211_clear_ibss(struct net_device *dev, bool nowext);
  280. int cfg80211_leave_ibss(struct cfg80211_registered_device *rdev,
  281. struct net_device *dev, bool nowext);
  282. void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
  283. struct ieee80211_channel *channel);
  284. int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
  285. struct wireless_dev *wdev);
  286. /* mesh */
  287. extern const struct mesh_config default_mesh_config;
  288. extern const struct mesh_setup default_mesh_setup;
  289. int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
  290. struct net_device *dev,
  291. struct mesh_setup *setup,
  292. const struct mesh_config *conf);
  293. int cfg80211_leave_mesh(struct cfg80211_registered_device *rdev,
  294. struct net_device *dev);
  295. int cfg80211_set_mesh_channel(struct cfg80211_registered_device *rdev,
  296. struct wireless_dev *wdev,
  297. struct cfg80211_chan_def *chandef);
  298. /* OCB */
  299. int cfg80211_join_ocb(struct cfg80211_registered_device *rdev,
  300. struct net_device *dev,
  301. struct ocb_setup *setup);
  302. int cfg80211_leave_ocb(struct cfg80211_registered_device *rdev,
  303. struct net_device *dev);
  304. /* AP */
  305. int cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
  306. struct net_device *dev, int link,
  307. bool notify);
  308. /* MLME */
  309. int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
  310. struct net_device *dev,
  311. struct cfg80211_auth_request *req);
  312. int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
  313. struct net_device *dev,
  314. struct cfg80211_assoc_request *req,
  315. struct netlink_ext_ack *extack);
  316. int cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev,
  317. struct net_device *dev, const u8 *bssid,
  318. const u8 *ie, int ie_len, u16 reason,
  319. bool local_state_change);
  320. int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev,
  321. struct net_device *dev, const u8 *ap_addr,
  322. const u8 *ie, int ie_len, u16 reason,
  323. bool local_state_change);
  324. void cfg80211_mlme_down(struct cfg80211_registered_device *rdev,
  325. struct net_device *dev);
  326. int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_pid,
  327. u16 frame_type, const u8 *match_data,
  328. int match_len, bool multicast_rx,
  329. struct netlink_ext_ack *extack);
  330. void cfg80211_mgmt_registrations_update_wk(struct work_struct *wk);
  331. void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlpid);
  332. void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev);
  333. int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
  334. struct wireless_dev *wdev,
  335. struct cfg80211_mgmt_tx_params *params,
  336. u64 *cookie);
  337. void cfg80211_oper_and_ht_capa(struct ieee80211_ht_cap *ht_capa,
  338. const struct ieee80211_ht_cap *ht_capa_mask);
  339. void cfg80211_oper_and_vht_capa(struct ieee80211_vht_cap *vht_capa,
  340. const struct ieee80211_vht_cap *vht_capa_mask);
  341. /* SME events */
  342. int cfg80211_connect(struct cfg80211_registered_device *rdev,
  343. struct net_device *dev,
  344. struct cfg80211_connect_params *connect,
  345. struct cfg80211_cached_keys *connkeys,
  346. const u8 *prev_bssid);
  347. void __cfg80211_connect_result(struct net_device *dev,
  348. struct cfg80211_connect_resp_params *params,
  349. bool wextev);
  350. void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
  351. size_t ie_len, u16 reason, bool from_ap);
  352. int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
  353. struct net_device *dev, u16 reason,
  354. bool wextev);
  355. void __cfg80211_roamed(struct wireless_dev *wdev,
  356. struct cfg80211_roam_info *info);
  357. void __cfg80211_port_authorized(struct wireless_dev *wdev, const u8 *peer_addr,
  358. const u8 *td_bitmap, u8 td_bitmap_len);
  359. int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev,
  360. struct wireless_dev *wdev);
  361. void cfg80211_autodisconnect_wk(struct work_struct *work);
  362. /* SME implementation */
  363. void cfg80211_conn_work(struct work_struct *work);
  364. void cfg80211_sme_scan_done(struct net_device *dev);
  365. bool cfg80211_sme_rx_assoc_resp(struct wireless_dev *wdev, u16 status);
  366. void cfg80211_sme_rx_auth(struct wireless_dev *wdev, const u8 *buf, size_t len);
  367. void cfg80211_sme_disassoc(struct wireless_dev *wdev);
  368. void cfg80211_sme_deauth(struct wireless_dev *wdev);
  369. void cfg80211_sme_auth_timeout(struct wireless_dev *wdev);
  370. void cfg80211_sme_assoc_timeout(struct wireless_dev *wdev);
  371. void cfg80211_sme_abandon_assoc(struct wireless_dev *wdev);
  372. /* internal helpers */
  373. bool cfg80211_supported_cipher_suite(struct wiphy *wiphy, u32 cipher);
  374. bool cfg80211_valid_key_idx(struct cfg80211_registered_device *rdev,
  375. int key_idx, bool pairwise);
  376. int cfg80211_validate_key_settings(struct cfg80211_registered_device *rdev,
  377. struct key_params *params, int key_idx,
  378. bool pairwise, const u8 *mac_addr);
  379. void __cfg80211_scan_done(struct wiphy *wiphy, struct wiphy_work *wk);
  380. void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev,
  381. bool send_message);
  382. void cfg80211_add_sched_scan_req(struct cfg80211_registered_device *rdev,
  383. struct cfg80211_sched_scan_request *req);
  384. int cfg80211_sched_scan_req_possible(struct cfg80211_registered_device *rdev,
  385. bool want_multi);
  386. void cfg80211_sched_scan_results_wk(struct work_struct *work);
  387. int cfg80211_stop_sched_scan_req(struct cfg80211_registered_device *rdev,
  388. struct cfg80211_sched_scan_request *req,
  389. bool driver_initiated);
  390. int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev,
  391. u64 reqid, bool driver_initiated);
  392. void cfg80211_upload_connect_keys(struct wireless_dev *wdev);
  393. int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
  394. struct net_device *dev, enum nl80211_iftype ntype,
  395. struct vif_params *params);
  396. void cfg80211_process_rdev_events(struct cfg80211_registered_device *rdev);
  397. void cfg80211_process_wiphy_works(struct cfg80211_registered_device *rdev,
  398. struct wiphy_work *end);
  399. void cfg80211_process_wdev_events(struct wireless_dev *wdev);
  400. bool cfg80211_does_bw_fit_range(const struct ieee80211_freq_range *freq_range,
  401. u32 center_freq_khz, u32 bw_khz);
  402. int cfg80211_scan(struct cfg80211_registered_device *rdev);
  403. extern struct work_struct cfg80211_disconnect_work;
  404. #define NL80211_BSS_USE_FOR_ALL (NL80211_BSS_USE_FOR_NORMAL | \
  405. NL80211_BSS_USE_FOR_MLD_LINK)
  406. void cfg80211_set_dfs_state(struct wiphy *wiphy,
  407. const struct cfg80211_chan_def *chandef,
  408. enum nl80211_dfs_state dfs_state);
  409. void cfg80211_dfs_channels_update_work(struct work_struct *work);
  410. void cfg80211_sched_dfs_chan_update(struct cfg80211_registered_device *rdev);
  411. int
  412. cfg80211_start_background_radar_detection(struct cfg80211_registered_device *rdev,
  413. struct wireless_dev *wdev,
  414. struct cfg80211_chan_def *chandef);
  415. void cfg80211_stop_radar_detection(struct wireless_dev *wdev);
  416. void cfg80211_stop_background_radar_detection(struct wireless_dev *wdev);
  417. void cfg80211_background_cac_done_wk(struct work_struct *work);
  418. void cfg80211_background_cac_abort_wk(struct work_struct *work);
  419. bool cfg80211_any_wiphy_oper_chan(struct wiphy *wiphy,
  420. struct ieee80211_channel *chan);
  421. bool cfg80211_beaconing_iface_active(struct wireless_dev *wdev);
  422. bool cfg80211_is_sub_chan(struct cfg80211_chan_def *chandef,
  423. struct ieee80211_channel *chan,
  424. bool primary_only);
  425. bool cfg80211_wdev_on_sub_chan(struct wireless_dev *wdev,
  426. struct ieee80211_channel *chan,
  427. bool primary_only);
  428. bool _cfg80211_chandef_usable(struct wiphy *wiphy,
  429. const struct cfg80211_chan_def *chandef,
  430. u32 prohibited_flags,
  431. u32 permitting_flags);
  432. static inline unsigned int elapsed_jiffies_msecs(unsigned long start)
  433. {
  434. unsigned long end = jiffies;
  435. if (end >= start)
  436. return jiffies_to_msecs(end - start);
  437. return jiffies_to_msecs(end + (ULONG_MAX - start) + 1);
  438. }
  439. int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
  440. struct net_device *dev,
  441. struct cfg80211_chan_def *chandef);
  442. int ieee80211_get_ratemask(struct ieee80211_supported_band *sband,
  443. const u8 *rates, unsigned int n_rates,
  444. u32 *mask);
  445. int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
  446. enum nl80211_iftype iftype, u32 beacon_int);
  447. void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev,
  448. enum nl80211_iftype iftype, int num);
  449. void cfg80211_leave(struct cfg80211_registered_device *rdev,
  450. struct wireless_dev *wdev,
  451. int link_id);
  452. void cfg80211_stop_p2p_device(struct cfg80211_registered_device *rdev,
  453. struct wireless_dev *wdev);
  454. void cfg80211_stop_nan(struct cfg80211_registered_device *rdev,
  455. struct wireless_dev *wdev);
  456. struct cfg80211_internal_bss *
  457. cfg80211_bss_update(struct cfg80211_registered_device *rdev,
  458. struct cfg80211_internal_bss *tmp,
  459. bool signal_valid, unsigned long ts);
  460. enum ieee80211_ap_reg_power
  461. cfg80211_get_6ghz_power_type(const u8 *elems, size_t elems_len,
  462. u32 client_flags);
  463. #ifdef CONFIG_CFG80211_DEVELOPER_WARNINGS
  464. #define CFG80211_DEV_WARN_ON(cond) WARN_ON(cond)
  465. #else
  466. /*
  467. * Trick to enable using it as a condition,
  468. * and also not give a warning when it's
  469. * not used that way.
  470. */
  471. #define CFG80211_DEV_WARN_ON(cond) ({bool __r = (cond); __r; })
  472. #endif
  473. void cfg80211_release_pmsr(struct wireless_dev *wdev, u32 portid);
  474. void cfg80211_pmsr_wdev_down(struct wireless_dev *wdev);
  475. void cfg80211_pmsr_free_wk(struct work_struct *work);
  476. void cfg80211_remove_link(struct wireless_dev *wdev, unsigned int link_id);
  477. void cfg80211_remove_links(struct wireless_dev *wdev);
  478. int cfg80211_remove_virtual_intf(struct cfg80211_registered_device *rdev,
  479. struct wireless_dev *wdev);
  480. void cfg80211_wdev_release_link_bsses(struct wireless_dev *wdev, u16 link_mask);
  481. int cfg80211_assoc_ml_reconf(struct cfg80211_registered_device *rdev,
  482. struct net_device *dev,
  483. struct cfg80211_ml_reconf_req *req);
  484. /**
  485. * struct cfg80211_colocated_ap - colocated AP information
  486. *
  487. * @list: linked list to all colocated APs
  488. * @bssid: BSSID of the reported AP
  489. * @ssid: SSID of the reported AP
  490. * @ssid_len: length of the ssid
  491. * @center_freq: frequency the reported AP is on
  492. * @unsolicited_probe: the reported AP is part of an ESS, where all the APs
  493. * that operate in the same channel as the reported AP and that might be
  494. * detected by a STA receiving this frame, are transmitting unsolicited
  495. * Probe Response frames every 20 TUs
  496. * @oct_recommended: OCT is recommended to exchange MMPDUs with the reported AP
  497. * @same_ssid: the reported AP has the same SSID as the reporting AP
  498. * @multi_bss: the reported AP is part of a multiple BSSID set
  499. * @transmitted_bssid: the reported AP is the transmitting BSSID
  500. * @colocated_ess: all the APs that share the same ESS as the reported AP are
  501. * colocated and can be discovered via legacy bands.
  502. * @short_ssid_valid: short_ssid is valid and can be used
  503. * @short_ssid: the short SSID for this SSID
  504. * @psd_20: The 20MHz PSD EIRP of the primary 20MHz channel for the reported AP
  505. */
  506. struct cfg80211_colocated_ap {
  507. struct list_head list;
  508. u8 bssid[ETH_ALEN];
  509. u8 ssid[IEEE80211_MAX_SSID_LEN];
  510. size_t ssid_len;
  511. u32 short_ssid;
  512. u32 center_freq;
  513. u8 unsolicited_probe:1,
  514. oct_recommended:1,
  515. same_ssid:1,
  516. multi_bss:1,
  517. transmitted_bssid:1,
  518. colocated_ess:1,
  519. short_ssid_valid:1;
  520. s8 psd_20;
  521. };
  522. #if IS_ENABLED(CONFIG_CFG80211_KUNIT_TEST)
  523. #define EXPORT_SYMBOL_IF_CFG80211_KUNIT(sym) EXPORT_SYMBOL_IF_KUNIT(sym)
  524. #define VISIBLE_IF_CFG80211_KUNIT
  525. void cfg80211_free_coloc_ap_list(struct list_head *coloc_ap_list);
  526. int cfg80211_parse_colocated_ap(const struct cfg80211_bss_ies *ies,
  527. struct list_head *list);
  528. size_t cfg80211_gen_new_ie(const u8 *ie, size_t ielen,
  529. const u8 *subie, size_t subie_len,
  530. u8 *new_ie, size_t new_ie_len);
  531. #else
  532. #define EXPORT_SYMBOL_IF_CFG80211_KUNIT(sym)
  533. #define VISIBLE_IF_CFG80211_KUNIT static
  534. #endif /* IS_ENABLED(CONFIG_CFG80211_KUNIT_TEST) */
  535. #endif /* __NET_WIRELESS_CORE_H */