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