1 /* 2 * Copyright (c) 2016-2019,2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2023 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 /** 21 * DOC: cdp_txrx_cfg.h 22 * Define the host data path configuration API functions 23 */ 24 #ifndef _CDP_TXRX_CFG_H_ 25 #define _CDP_TXRX_CFG_H_ 26 #include "cdp_txrx_handle.h" 27 #include <cdp_txrx_cmn.h> 28 29 /** 30 * cdp_cfg_set_rx_fwd_disabled() - enable/disable rx forwarding 31 * @soc: data path soc handle 32 * @cfg_pdev: data path device instance 33 * @disable_rx_fwd: enable or disable rx forwarding 34 * 35 * enable/disable rx forwarding 36 * 37 * return NONE 38 */ 39 static inline void cdp_cfg_set_rx_fwd_disabled(ol_txrx_soc_handle soc,struct cdp_cfg * cfg_pdev,uint8_t disable_rx_fwd)40 cdp_cfg_set_rx_fwd_disabled(ol_txrx_soc_handle soc, struct cdp_cfg *cfg_pdev, 41 uint8_t disable_rx_fwd) 42 { 43 if (!soc || !soc->ops) { 44 dp_cdp_debug("invalid instance"); 45 QDF_BUG(0); 46 return; 47 } 48 49 if (!soc->ops->cfg_ops || 50 !soc->ops->cfg_ops->set_cfg_rx_fwd_disabled) 51 return; 52 53 soc->ops->cfg_ops->set_cfg_rx_fwd_disabled(cfg_pdev, 54 disable_rx_fwd); 55 } 56 57 /** 58 * cdp_cfg_set_packet_log_enabled() - enable/disable packet log 59 * @soc: data path soc handle 60 * @cfg_pdev: data path device instance 61 * @val: enable or disable packet log 62 * 63 * packet log enable or disable 64 * 65 * return NONE 66 */ 67 static inline void cdp_cfg_set_packet_log_enabled(ol_txrx_soc_handle soc,struct cdp_cfg * cfg_pdev,uint8_t val)68 cdp_cfg_set_packet_log_enabled(ol_txrx_soc_handle soc, 69 struct cdp_cfg *cfg_pdev, uint8_t val) 70 { 71 if (!soc || !soc->ops) { 72 dp_cdp_debug("invalid instance"); 73 QDF_BUG(0); 74 return; 75 } 76 77 if (!soc->ops->cfg_ops || 78 !soc->ops->cfg_ops->set_cfg_packet_log_enabled) 79 return; 80 81 soc->ops->cfg_ops->set_cfg_packet_log_enabled(cfg_pdev, 82 val); 83 } 84 85 /** 86 * cdp_cfg_attach() - attach config module 87 * @soc: data path soc handle 88 * @osdev: os instance 89 * @cfg_param: configuration parameter should be propagated 90 * 91 * Allocate configuration module instance, and propagate configuration values 92 * 93 * return soc configuration module instance 94 */ 95 static inline struct cdp_cfg cdp_cfg_attach(ol_txrx_soc_handle soc,qdf_device_t osdev,void * cfg_param)96 *cdp_cfg_attach(ol_txrx_soc_handle soc, 97 qdf_device_t osdev, void *cfg_param) 98 { 99 if (!soc || !soc->ops) { 100 dp_cdp_debug("invalid instance"); 101 QDF_BUG(0); 102 return NULL; 103 } 104 105 if (!soc->ops->cfg_ops || 106 !soc->ops->cfg_ops->cfg_attach) 107 return NULL; 108 109 return soc->ops->cfg_ops->cfg_attach(osdev, cfg_param); 110 } 111 112 /** 113 * cdp_cfg_vdev_rx_set_intrabss_fwd() - enable/disable intra bass forwarding 114 * @soc: data path soc handle 115 * @vdev_id: virtual interface id 116 * @val: enable or disable intra bss forwarding 117 * 118 * ap isolate, do not forward intra bss traffic 119 * 120 * return NONE 121 */ 122 static inline void cdp_cfg_vdev_rx_set_intrabss_fwd(ol_txrx_soc_handle soc,uint8_t vdev_id,bool val)123 cdp_cfg_vdev_rx_set_intrabss_fwd(ol_txrx_soc_handle soc, 124 uint8_t vdev_id, bool val) 125 { 126 if (!soc || !soc->ops) { 127 dp_cdp_debug("invalid instance"); 128 QDF_BUG(0); 129 return; 130 } 131 132 if (!soc->ops->cfg_ops || 133 !soc->ops->cfg_ops->vdev_rx_set_intrabss_fwd) 134 return; 135 136 soc->ops->cfg_ops->vdev_rx_set_intrabss_fwd(soc, vdev_id, val); 137 } 138 139 /** 140 * cdp_cfg_is_rx_fwd_disabled() - get vdev rx forward 141 * @soc: data path soc handle 142 * @vdev: virtual interface instance 143 * 144 * Return rx forward feature enable status 145 * 146 * return 1 enabled 147 * 0 disabled 148 */ 149 static inline uint8_t cdp_cfg_is_rx_fwd_disabled(ol_txrx_soc_handle soc,struct cdp_vdev * vdev)150 cdp_cfg_is_rx_fwd_disabled(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) 151 { 152 if (!soc || !soc->ops) { 153 dp_cdp_debug("invalid instance"); 154 QDF_BUG(0); 155 return 0; 156 } 157 158 if (!soc->ops->cfg_ops || 159 !soc->ops->cfg_ops->is_rx_fwd_disabled) 160 return 0; 161 162 return soc->ops->cfg_ops->is_rx_fwd_disabled(vdev); 163 164 } 165 166 /** 167 * cdp_cfg_tx_set_is_mgmt_over_wmi_enabled() - mgmt tx over wmi enable/disable 168 * @soc: data path soc handle 169 * @value: feature enable or disable 170 * 171 * Enable or disable management packet TX over WMI feature 172 * 173 * return None 174 */ 175 static inline void cdp_cfg_tx_set_is_mgmt_over_wmi_enabled(ol_txrx_soc_handle soc,uint8_t value)176 cdp_cfg_tx_set_is_mgmt_over_wmi_enabled(ol_txrx_soc_handle soc, 177 uint8_t value) 178 { 179 if (!soc || !soc->ops) { 180 dp_cdp_debug("invalid instance"); 181 QDF_BUG(0); 182 return; 183 } 184 185 if (!soc->ops->cfg_ops || 186 !soc->ops->cfg_ops->tx_set_is_mgmt_over_wmi_enabled) 187 return; 188 189 soc->ops->cfg_ops->tx_set_is_mgmt_over_wmi_enabled(value); 190 } 191 192 /** 193 * cdp_cfg_is_high_latency() - query data path is in high or low latency 194 * @soc: data path soc handle 195 * @cfg_pdev: data path device instance 196 * 197 * query data path is in high or low latency 198 * 199 * return 1 high latency data path, usb or sdio 200 * 0 low latency data path 201 */ 202 static inline int cdp_cfg_is_high_latency(ol_txrx_soc_handle soc,struct cdp_cfg * cfg_pdev)203 cdp_cfg_is_high_latency(ol_txrx_soc_handle soc, struct cdp_cfg *cfg_pdev) 204 { 205 if (!soc || !soc->ops) { 206 dp_cdp_debug("invalid instance"); 207 QDF_BUG(0); 208 return 0; 209 } 210 211 if (!soc->ops->cfg_ops || 212 !soc->ops->cfg_ops->is_high_latency) 213 return 0; 214 215 return soc->ops->cfg_ops->is_high_latency(cfg_pdev); 216 } 217 218 /** 219 * cdp_cfg_set_flow_control_parameters() - set flow control params 220 * @soc: data path soc handle 221 * @cfg_pdev: dp config module instance 222 * @param: parameters should set 223 * 224 * set flow control params 225 * 226 * return None 227 */ 228 static inline void cdp_cfg_set_flow_control_parameters(ol_txrx_soc_handle soc,struct cdp_cfg * cfg_pdev,void * param)229 cdp_cfg_set_flow_control_parameters(ol_txrx_soc_handle soc, 230 struct cdp_cfg *cfg_pdev, void *param) 231 { 232 if (!soc || !soc->ops) { 233 dp_cdp_debug("invalid instance"); 234 QDF_BUG(0); 235 return; 236 } 237 238 if (!soc->ops->cfg_ops || 239 !soc->ops->cfg_ops->set_flow_control_parameters) 240 return; 241 242 soc->ops->cfg_ops->set_flow_control_parameters(cfg_pdev, 243 param); 244 } 245 246 /** 247 * cdp_cfg_set_flow_steering - Set Rx flow steering config based on CFG ini 248 * config. 249 * @soc: data path soc handle 250 * @cfg_pdev: handle to the physical device 251 * @val: 0 - disable, 1 - enable 252 * 253 * Return: None 254 */ cdp_cfg_set_flow_steering(ol_txrx_soc_handle soc,struct cdp_cfg * cfg_pdev,uint8_t val)255 static inline void cdp_cfg_set_flow_steering(ol_txrx_soc_handle soc, 256 struct cdp_cfg *cfg_pdev, uint8_t val) 257 { 258 if (!soc || !soc->ops) { 259 dp_cdp_debug("invalid instance"); 260 QDF_BUG(0); 261 return; 262 } 263 264 if (!soc->ops->cfg_ops || 265 !soc->ops->cfg_ops->set_flow_steering) 266 return; 267 268 soc->ops->cfg_ops->set_flow_steering(cfg_pdev, val); 269 } 270 cdp_cfg_get_max_peer_id(ol_txrx_soc_handle soc,struct cdp_cfg * cfg_pdev)271 static inline void cdp_cfg_get_max_peer_id(ol_txrx_soc_handle soc, 272 struct cdp_cfg *cfg_pdev) 273 { 274 } 275 276 /** 277 * cdp_cfg_set_ptp_rx_opt_enabled() - enable/disable ptp rx timestamping 278 * @soc: data path soc handle 279 * @cfg_pdev: data path device instance 280 * @val: enable or disable packet log 281 * 282 * ptp rx timestamping enable or disable 283 * 284 * return NONE 285 */ 286 static inline void cdp_cfg_set_ptp_rx_opt_enabled(ol_txrx_soc_handle soc,struct cdp_cfg * cfg_pdev,uint8_t val)287 cdp_cfg_set_ptp_rx_opt_enabled(ol_txrx_soc_handle soc, 288 struct cdp_cfg *cfg_pdev, uint8_t val) 289 { 290 if (!soc || !soc->ops) { 291 dp_cdp_debug("invalid instance"); 292 QDF_BUG(0); 293 return; 294 } 295 296 if (!soc->ops->cfg_ops || 297 !soc->ops->cfg_ops->set_ptp_rx_opt_enabled) 298 return; 299 300 soc->ops->cfg_ops->set_ptp_rx_opt_enabled(cfg_pdev, val); 301 } 302 303 /** 304 * cdp_cfg_set_new_htt_msg_format() - set htt h2t msg feature 305 * @soc: datapath soc handle 306 * @val: enable or disable new htt h2t msg feature 307 * 308 * Enable whether htt h2t message length includes htc header length 309 * 310 * return NONE 311 */ 312 static inline void cdp_cfg_set_new_htt_msg_format(ol_txrx_soc_handle soc,uint8_t val)313 cdp_cfg_set_new_htt_msg_format(ol_txrx_soc_handle soc, 314 uint8_t val) 315 { 316 if (!soc || !soc->ops) { 317 dp_cdp_debug("invalid instance"); 318 return; 319 } 320 321 if (!soc->ops->cfg_ops || 322 !soc->ops->cfg_ops->set_new_htt_msg_format) 323 return; 324 325 soc->ops->cfg_ops->set_new_htt_msg_format(val); 326 } 327 328 /** 329 * cdp_cfg_set_peer_unmap_conf_support() - set peer unmap conf feature 330 * @soc: datapath soc handle 331 * @val: enable or disable peer unmap conf feature 332 * 333 * Set if peer unmap confirmation feature is supported by both FW and in INI 334 * 335 * return NONE 336 */ 337 static inline void cdp_cfg_set_peer_unmap_conf_support(ol_txrx_soc_handle soc,bool val)338 cdp_cfg_set_peer_unmap_conf_support(ol_txrx_soc_handle soc, bool val) 339 { 340 if (!soc || !soc->ops) { 341 dp_cdp_debug("invalid instance"); 342 QDF_BUG(0); 343 return; 344 } 345 346 if (!soc->ops->cfg_ops || 347 !soc->ops->cfg_ops->set_peer_unmap_conf_support) 348 return; 349 350 soc->ops->cfg_ops->set_peer_unmap_conf_support(val); 351 } 352 353 /** 354 * cdp_cfg_get_peer_unmap_conf_support() - check peer unmap conf feature 355 * @soc: datapath soc handle 356 * 357 * Check if peer unmap confirmation feature is enabled 358 * 359 * return true is peer unmap confirmation feature is enabled else false 360 */ 361 static inline bool cdp_cfg_get_peer_unmap_conf_support(ol_txrx_soc_handle soc)362 cdp_cfg_get_peer_unmap_conf_support(ol_txrx_soc_handle soc) 363 { 364 if (!soc || !soc->ops) { 365 dp_cdp_debug("invalid instance"); 366 QDF_BUG(0); 367 return false; 368 } 369 370 if (!soc->ops->cfg_ops || 371 !soc->ops->cfg_ops->get_peer_unmap_conf_support) 372 return false; 373 374 return soc->ops->cfg_ops->get_peer_unmap_conf_support(); 375 } 376 377 static inline void cdp_cfg_set_tx_compl_tsf64(ol_txrx_soc_handle soc,uint8_t val)378 cdp_cfg_set_tx_compl_tsf64(ol_txrx_soc_handle soc, 379 uint8_t val) 380 { 381 if (!soc || !soc->ops) { 382 dp_debug("invalid instance"); 383 return; 384 } 385 386 if (!soc->ops->cfg_ops || 387 !soc->ops->cfg_ops->set_tx_compl_tsf64) 388 return; 389 390 soc->ops->cfg_ops->set_tx_compl_tsf64(val); 391 } 392 393 static inline bool cdp_cfg_get_tx_compl_tsf64(ol_txrx_soc_handle soc)394 cdp_cfg_get_tx_compl_tsf64(ol_txrx_soc_handle soc) 395 { 396 if (!soc || !soc->ops) { 397 dp_debug("invalid instance"); 398 return false; 399 } 400 401 if (!soc->ops->cfg_ops || 402 !soc->ops->cfg_ops->get_tx_compl_tsf64) 403 return false; 404 405 return soc->ops->cfg_ops->get_tx_compl_tsf64(); 406 } 407 408 #endif /* _CDP_TXRX_CFG_H_ */ 409