1 /*
2 * Copyright (c) 2021, The Linux Foundation. All rights reserved.
3 * Copyright (c) 2022-2023 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 * @cfg: Target 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 * wlan_hdd_check_11be_support() - check if beacon IE and update hw mode
52 * @beacon: beacon IE buffer
53 * @config: pointer to sap config
54 *
55 * Check if EHT cap IE is present in beacon IE, if present update hw mode
56 * to 11be.
57 *
58 * Return: None
59 */
60 void wlan_hdd_check_11be_support(struct hdd_beacon_data *beacon,
61 struct sap_config *config);
62
63 /**
64 * hdd_update_wiphy_eht_cap() - update the wiphy with eht capabilities
65 * @hdd_ctx: HDD context
66 *
67 * update wiphy with the eht capabilities.
68 *
69 * Return: None
70 */
71 void hdd_update_wiphy_eht_cap(struct hdd_context *hdd_ctx);
72
73 /**
74 * wlan_hdd_get_mlo_link_id() - get link id and number of links
75 * @beacon: beacon IE buffer
76 * @link_id: link id to return
77 * @num_link: total links
78 *
79 * Return: None
80 */
81 void wlan_hdd_get_mlo_link_id(struct hdd_beacon_data *beacon,
82 uint8_t *link_id, uint8_t *num_link);
83
84 /**
85 * hdd_set_11be_rate_code() - set 11be rate code
86 * @adapter: net device adapter
87 * @rate_code: new 11be rate code
88 *
89 * Return: 0 on success, negative errno on failure
90 */
91 int hdd_set_11be_rate_code(struct hdd_adapter *adapter, uint16_t rate_code);
92
93 /**
94 * wlan_hdd_fill_os_eht_rateflags() - Fill EHT related rate_info
95 * @os_rate: rate info for os
96 * @rate_flags: rate flags
97 * @dcm: dcm from rate
98 * @guard_interval: guard interval from rate
99 *
100 * Return: none
101 */
102 void wlan_hdd_fill_os_eht_rateflags(struct rate_info *os_rate,
103 enum tx_rate_info rate_flags,
104 uint8_t dcm,
105 enum txrate_gi guard_interval);
106 #else
107 static inline
hdd_update_tgt_eht_cap(struct hdd_context * hdd_ctx,struct wma_tgt_cfg * cfg)108 void hdd_update_tgt_eht_cap(struct hdd_context *hdd_ctx,
109 struct wma_tgt_cfg *cfg)
110 {
111 }
112
wlan_hdd_check_11be_support(struct hdd_beacon_data * beacon,struct sap_config * config)113 static inline void wlan_hdd_check_11be_support(struct hdd_beacon_data *beacon,
114 struct sap_config *config)
115 {
116 }
117
118 static inline
hdd_update_wiphy_eht_cap(struct hdd_context * hdd_ctx)119 void hdd_update_wiphy_eht_cap(struct hdd_context *hdd_ctx)
120 {
121 }
122
123 static inline int
hdd_set_11be_rate_code(struct hdd_adapter * adapter,uint16_t rate_code)124 hdd_set_11be_rate_code(struct hdd_adapter *adapter, uint16_t rate_code)
125 {
126 return 0;
127 }
128
wlan_hdd_get_mlo_link_id(struct hdd_beacon_data * beacon,uint8_t * link_id,uint8_t * num_link)129 static inline void wlan_hdd_get_mlo_link_id(struct hdd_beacon_data *beacon,
130 uint8_t *link_id, uint8_t *num_link)
131 {
132 }
133
134 static inline
wlan_hdd_fill_os_eht_rateflags(struct rate_info * os_rate,enum tx_rate_info rate_flags,uint8_t dcm,enum txrate_gi guard_interval)135 void wlan_hdd_fill_os_eht_rateflags(struct rate_info *os_rate,
136 enum tx_rate_info rate_flags,
137 uint8_t dcm,
138 enum txrate_gi guard_interval)
139 {
140 }
141 #endif
142
143 #if defined(WLAN_FEATURE_11BE) && defined(CFG80211_11BE_BASIC) && \
144 defined(FEATURE_RX_LINKSPEED_ROAM_TRIGGER)
145 /**
146 * wlan_hdd_refill_os_eht_rateflags() - Refill EHT rate flag
147 * @os_rate: rate info for os
148 * @preamble: Use to acquire wlan mode, whether in EHT mode
149 *
150 * Fill out os ETH MCS rate flag according to preamble.
151 *
152 * Return: none
153 */
154 void
155 wlan_hdd_refill_os_eht_rateflags(struct rate_info *os_rate, uint8_t preamble);
156
157 /**
158 * wlan_hdd_refill_os_eht_bw() - Refill EHT bandwidth
159 * @os_rate: rate info for os
160 * @bw: Bandwidth of the frame
161 *
162 * Fill out os ETH BW flag according to CMN BW from driver.
163 *
164 * Return: none
165 */
166 void
167 wlan_hdd_refill_os_eht_bw(struct rate_info *os_rate, enum rx_tlv_bw bw);
168 #else
169 static inline void
wlan_hdd_refill_os_eht_rateflags(struct rate_info * os_rate,uint8_t preamble)170 wlan_hdd_refill_os_eht_rateflags(struct rate_info *os_rate, uint8_t preamble)
171 {
172 }
173
174 static inline void
wlan_hdd_refill_os_eht_bw(struct rate_info * os_rate,enum rx_tlv_bw bw)175 wlan_hdd_refill_os_eht_bw(struct rate_info *os_rate, enum rx_tlv_bw bw)
176 {
177 }
178 #endif
179 #endif /* if !defined(WLAN_HDD_EHT_H)*/
180