xref: /wlan-dirver/qcacld-3.0/core/hdd/inc/wlan_hdd_eht.h (revision a24510696edc222f9e9b89d388912a346710831d)
1 /*
2  * Copyright (c) 2021, 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 any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /**
19  * DOC : wlan_hdd_eht.h
20  *
21  * WLAN Host Device Driver file for 802.11be (Extremely High Throughput)
22  * support.
23  *
24  */
25 
26 #if !defined(WLAN_HDD_EHT_H)
27 #define WLAN_HDD_EHT_H
28 #include "wlan_osif_features.h"
29 
30 struct hdd_context;
31 struct wma_tgt_cfg;
32 struct hdd_beacon_data;
33 struct sap_config;
34 
35 #if defined(WLAN_FEATURE_11BE) && defined(CFG80211_11BE_BASIC)
36 /**
37  * hdd_update_tgt_eht_cap() - Update EHT related capabilities
38  * @hdd_ctx: HDD context
39  * @eht_cap: Target EHT capabilities
40  *
41  * This function updates WNI CFG with Target capabilities received as part of
42  * Default values present in WNI CFG are the values supported by FW/HW.
43  * INI should be introduced if user control is required to control the value.
44  *
45  * Return: None
46  */
47 void hdd_update_tgt_eht_cap(struct hdd_context *hdd_ctx,
48 			    struct wma_tgt_cfg *cfg);
49 
50 /**
51  * hdd_update_eht_cap_in_cfg() - update EHT cap in global CFG
52  * @hdd_ctx: pointer to hdd context
53  *
54  * This API will update the EHT config in CFG after taking intersection
55  * of INI and firmware capabilities provided reading CFG
56  *
57  * Return: 0 on success and errno on failure
58  */
59 int hdd_update_eht_cap_in_cfg(struct hdd_context *hdd_ctx);
60 
61 /**
62  * wlan_hdd_check_11be_support() - check if beacon IE and update hw mode
63  * @beacon: beacon IE buffer
64  * @config: pointer to sap config
65  *
66  * Check if EHT cap IE is present in beacon IE, if present update hw mode
67  * to 11be.
68  *
69  * Return: None
70  */
71 void wlan_hdd_check_11be_support(struct hdd_beacon_data *beacon,
72 				 struct sap_config *config);
73 
74 /**
75  * hdd_update_wiphy_eht_cap() - update the wiphy with eht capabilities
76  * @hdd_ctx: HDD context
77  *
78  * update wiphy with the eht capabilties.
79  *
80  * Return: None
81  */
82 void hdd_update_wiphy_eht_cap(struct hdd_context *hdd_ctx);
83 
84 /**
85  * wlan_hdd_get_mlo_link_id() - get link id and number of links
86  * @beacon: beacon IE buffer
87  * @link_id: link id to return
88  * @num_link: total links
89  *
90  * Return: None
91  */
92 void wlan_hdd_get_mlo_link_id(struct hdd_beacon_data *beacon,
93 			      uint8_t *link_id, uint8_t *num_link);
94 
95 /**
96  * hdd_set_11be_rate_code() - set 11be rate code
97  * @adapter: net device adapter
98  * @rate_code: new 11be rate code
99  *
100  * Return: 0 on success, negative errno on failure
101  */
102 int hdd_set_11be_rate_code(struct hdd_adapter *adapter, uint16_t rate_code);
103 
104 /**
105  * hdd_sysfs_11be_rate_create() - Create sysfs entry to configure 11be rate
106  * @adapter: net device adapter
107  *
108  * Return: None
109  */
110 void hdd_sysfs_11be_rate_create(struct hdd_adapter *adapter);
111 
112 /**
113  * hdd_sysfs_11be_rate_destroy() - Destroy sysfs entry to configure 11be rate
114  * @adapter: net device adapter
115  *
116  * Return: None
117  */
118 void hdd_sysfs_11be_rate_destroy(struct hdd_adapter *adapter);
119 
120 /**
121  * wlan_hdd_fill_os_eht_rateflags() - Fill EHT related rate_info
122  * @os_rate: rate info for os
123  * @rate_flags: rate flags
124  * @dcm: dcm from rate
125  * @guard_interval: guard interval from rate
126  *
127  * Return: none
128  */
129 void wlan_hdd_fill_os_eht_rateflags(struct rate_info *os_rate,
130 				    enum tx_rate_info rate_flags,
131 				    uint8_t dcm,
132 				    enum txrate_gi guard_interval);
133 #else
134 static inline
135 void hdd_update_tgt_eht_cap(struct hdd_context *hdd_ctx,
136 			    struct wma_tgt_cfg *cfg)
137 {
138 }
139 
140 static inline void wlan_hdd_check_11be_support(struct hdd_beacon_data *beacon,
141 					       struct sap_config *config)
142 {
143 }
144 
145 static inline
146 void hdd_update_wiphy_eht_cap(struct hdd_context *hdd_ctx)
147 {
148 }
149 
150 static inline int
151 hdd_set_11be_rate_code(struct hdd_adapter *adapter, uint16_t rate_code)
152 {
153 	return 0;
154 }
155 
156 static inline void hdd_sysfs_11be_rate_create(struct hdd_adapter *adapter)
157 {
158 }
159 
160 static inline void hdd_sysfs_11be_rate_destroy(struct hdd_adapter *adapter)
161 {
162 }
163 
164 static inline void wlan_hdd_get_mlo_link_id(struct hdd_beacon_data *beacon,
165 					    uint8_t *link_id, uint8_t *num_link)
166 {
167 }
168 
169 static inline
170 void wlan_hdd_fill_os_eht_rateflags(struct rate_info *os_rate,
171 				    enum tx_rate_info rate_flags,
172 				    uint8_t dcm,
173 				    enum txrate_gi guard_interval)
174 {
175 }
176 #endif
177 #endif /* if !defined(WLAN_HDD_EHT_H)*/
178