xref: /wlan-dirver/qcacld-3.0/core/hdd/src/wlan_hdd_ioctl.h (revision a24510696edc222f9e9b89d388912a346710831d)
1 /*
2  * Copyright (c) 2012-2014, 2017-2019, 2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #if !defined(WLAN_HDD_IOCTL_H)
21 #define WLAN_HDD_IOCTL_H
22 
23 #include <linux/netdevice.h>
24 #include <uapi/linux/if.h>
25 #include "wlan_hdd_main.h"
26 
27 extern struct sock *cesium_nl_srv_sock;
28 
29 /**
30  * hdd_ioctl() - ioctl handler (wrapper) for wlan network interfaces
31  * @net_dev: device upon which the ioctl was received
32  * @ifr: ioctl request information
33  * @cmd: ioctl command
34  *
35  * This function acts as an SSR-protecting wrapper to __hdd_ioctl()
36  * which is where the ioctls are really handled.
37  *
38  * Return: 0 on success, non-zero on error
39  */
40 int hdd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
41 
42 /**
43  * hdd_dev_private_ioctl() - private ioctl handler for wlan network interfaces
44  * @net_dev: device upon which the ioctl was received
45  * @ifr: ioctl request information
46  * @data: pointer to the raw command data in the ioctl request
47  * @cmd: ioctl command
48  *
49  * For Kernel 5.15+, this function acts as an SSR-protecting wrapper
50  * to __hdd_ioctl(), which is where the ioctls are really handled.
51  *
52  * Return: 0 on success, non-zero on error
53  */
54 int hdd_dev_private_ioctl(struct net_device *dev, struct ifreq *ifr,
55 			  void __user *data, int cmd);
56 int wlan_hdd_set_mc_rate(struct hdd_adapter *adapter, int target_rate);
57 
58 /**
59  * hdd_update_smps_antenna_mode() - set smps and antenna mode
60  * @hdd_ctx: Pointer to hdd context
61  * @mode: antenna mode
62  *
63  * This function will set smps and antenna mode.
64  *
65  * Return: QDF_STATUS
66  */
67 QDF_STATUS hdd_update_smps_antenna_mode(struct hdd_context *hdd_ctx, int mode);
68 
69 /**
70  * hdd_set_antenna_mode() - SET ANTENNA MODE command handler
71  * @adapter: Pointer to network adapter
72  * @hdd_ctx: Pointer to hdd context
73  * @mode: new anteena mode
74  */
75 int hdd_set_antenna_mode(struct hdd_adapter *adapter,
76 			  struct hdd_context *hdd_ctx, int mode);
77 
78 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
79 /**
80  * hdd_get_roam_scan_ch_cb() - roam scan channel list callback handler
81  * @hdd_handle: Pointer to hdd context
82  * @roam_ch: pointer to roam scan ch event data
83  * @context: cookie
84  *
85  * Callback function to processes roam scan chaanel list event. If
86  * command response field in the response message is set that means
87  * event received as a response of GETROAMSCANCHANNELS command else
88  * event was rasied by firmware upon disconnection.
89  *
90  * Return: none
91  */
92 void hdd_get_roam_scan_ch_cb(hdd_handle_t hdd_handle,
93 			     struct roam_scan_ch_resp *roam_ch,
94 			     void *context);
95 
96 /**
97  * hdd_get_roam_scan_freq() - roam scan freq list
98  * @adapter: Pointer to hdd adapter
99  * @mac_handle: pointer to mac_handle
100  * @chan_list: Pointer to hold roam scan freq list
101  * @num_channels: Pointer to hold num of roam scan channels in list
102  *
103  * This function gets roam scan frequencies from FW if FW is capable else
104  * roam scan frequencies are taken from host maintained list.
105  *
106  * Return: 0 on success else error value
107  */
108 int
109 hdd_get_roam_scan_freq(struct hdd_adapter *adapter, mac_handle_t mac_handle,
110 		       uint32_t *chan_list, uint8_t *num_channels);
111 #else
112 static inline void
113 hdd_get_roam_scan_ch_cb(hdd_handle_t hdd_handle,
114 			void *roam_ch,
115 			void *context)
116 {
117 }
118 
119 static inline int
120 hdd_get_roam_scan_freq(struct hdd_adapter *adapter, mac_handle_t mac_handle,
121 		       uint32_t *chan_list, uint8_t *num_channels)
122 {
123 	return -EFAULT;
124 }
125 #endif
126 #endif /* end #if !defined(WLAN_HDD_IOCTL_H) */
127