1 /* 2 * Copyright (c) 2016-2017 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 /** 27 * cdp_cfg_set_rx_fwd_disabled() - enable/disable rx forwarding 28 * @soc - data path soc handle 29 * @pdev - data path device instance 30 * @disable_rx_fwd - enable or disable rx forwarding 31 * 32 * enable/disable rx forwarding 33 * 34 * return NONE 35 */ 36 static inline void 37 cdp_cfg_set_rx_fwd_disabled(ol_txrx_soc_handle soc, struct cdp_cfg *cfg_pdev, 38 uint8_t disable_rx_fwd) 39 { 40 if (!soc || !soc->ops) { 41 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, 42 "%s invalid instance", __func__); 43 QDF_BUG(0); 44 return; 45 } 46 47 if (!soc->ops->cfg_ops || 48 !soc->ops->cfg_ops->set_cfg_rx_fwd_disabled) 49 return; 50 51 soc->ops->cfg_ops->set_cfg_rx_fwd_disabled(cfg_pdev, 52 disable_rx_fwd); 53 } 54 55 /** 56 * cdp_cfg_set_packet_log_enabled() - enable/disable packet log 57 * @soc - data path soc handle 58 * @pdev - data path device instance 59 * @val - enable or disable packet log 60 * 61 * packet log enable or disable 62 * 63 * return NONE 64 */ 65 static inline void 66 cdp_cfg_set_packet_log_enabled(ol_txrx_soc_handle soc, 67 struct cdp_cfg *cfg_pdev, uint8_t val) 68 { 69 if (!soc || !soc->ops) { 70 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, 71 "%s invalid instance", __func__); 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 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, 100 "%s invalid instance", __func__); 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 - virtual interface instance 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 123 cdp_cfg_vdev_rx_set_intrabss_fwd(ol_txrx_soc_handle soc, 124 struct cdp_vdev *vdev, bool val) 125 { 126 if (!soc || !soc->ops) { 127 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, 128 "%s invalid instance", __func__); 129 QDF_BUG(0); 130 return; 131 } 132 133 if (!soc->ops->cfg_ops || 134 !soc->ops->cfg_ops->vdev_rx_set_intrabss_fwd) 135 return; 136 137 soc->ops->cfg_ops->vdev_rx_set_intrabss_fwd(vdev, val); 138 } 139 140 /** 141 * cdp_cfg_is_rx_fwd_disabled() - get vdev rx forward 142 * @soc - data path soc handle 143 * @vdev - virtual interface instance 144 * 145 * Return rx forward feature enable status 146 * 147 * return 1 enabled 148 * 0 disabled 149 */ 150 static inline uint8_t 151 cdp_cfg_is_rx_fwd_disabled(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) 152 { 153 if (!soc || !soc->ops) { 154 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, 155 "%s invalid instance", __func__); 156 QDF_BUG(0); 157 return 0; 158 } 159 160 if (!soc->ops->cfg_ops || 161 !soc->ops->cfg_ops->is_rx_fwd_disabled) 162 return 0; 163 164 return soc->ops->cfg_ops->is_rx_fwd_disabled(vdev); 165 166 } 167 168 /** 169 * cdp_cfg_tx_set_is_mgmt_over_wmi_enabled() - mgmt tx over wmi enable/disable 170 * @soc - data path soc handle 171 * @value - feature enable or disable 172 * 173 * Enable or disable management packet TX over WMI feature 174 * 175 * return None 176 */ 177 static inline void 178 cdp_cfg_tx_set_is_mgmt_over_wmi_enabled(ol_txrx_soc_handle soc, 179 uint8_t value) 180 { 181 if (!soc || !soc->ops) { 182 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, 183 "%s invalid instance", __func__); 184 QDF_BUG(0); 185 return; 186 } 187 188 if (!soc->ops->cfg_ops || 189 !soc->ops->cfg_ops->tx_set_is_mgmt_over_wmi_enabled) 190 return; 191 192 soc->ops->cfg_ops->tx_set_is_mgmt_over_wmi_enabled(value); 193 } 194 195 /** 196 * cdp_cfg_is_high_latency() - query data path is in high or low latency 197 * @soc - data path soc handle 198 * @pdev - data path device instance 199 * 200 * query data path is in high or low latency 201 * 202 * return 1 high latency data path, usb or sdio 203 * 0 low latency data path 204 */ 205 static inline int 206 cdp_cfg_is_high_latency(ol_txrx_soc_handle soc, struct cdp_cfg *cfg_pdev) 207 { 208 if (!soc || !soc->ops) { 209 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, 210 "%s invalid instance", __func__); 211 QDF_BUG(0); 212 return 0; 213 } 214 215 if (!soc->ops->cfg_ops || 216 !soc->ops->cfg_ops->is_high_latency) 217 return 0; 218 219 return soc->ops->cfg_ops->is_high_latency(cfg_pdev); 220 } 221 222 /** 223 * cdp_cfg_set_flow_control_parameters() - set flow control params 224 * @soc - data path soc handle 225 * @cfg - dp config module instance 226 * @param - parameters should set 227 * 228 * set flow control params 229 * 230 * return None 231 */ 232 static inline void 233 cdp_cfg_set_flow_control_parameters(ol_txrx_soc_handle soc, 234 struct cdp_cfg *cfg_pdev, void *param) 235 { 236 if (!soc || !soc->ops) { 237 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, 238 "%s invalid instance", __func__); 239 QDF_BUG(0); 240 return; 241 } 242 243 if (!soc->ops->cfg_ops || 244 !soc->ops->cfg_ops->set_flow_control_parameters) 245 return; 246 247 soc->ops->cfg_ops->set_flow_control_parameters(cfg_pdev, 248 param); 249 } 250 251 /** 252 * cdp_cfg_set_flow_steering - Set Rx flow steering config based on CFG ini 253 * config. 254 * 255 * @pdev - handle to the physical device 256 * @val - 0 - disable, 1 - enable 257 * 258 * Return: None 259 */ 260 static inline void cdp_cfg_set_flow_steering(ol_txrx_soc_handle soc, 261 struct cdp_cfg *cfg_pdev, uint8_t val) 262 { 263 if (!soc || !soc->ops) { 264 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, 265 "%s invalid instance", __func__); 266 QDF_BUG(0); 267 return; 268 } 269 270 if (!soc->ops->cfg_ops || 271 !soc->ops->cfg_ops->set_flow_steering) 272 return; 273 274 soc->ops->cfg_ops->set_flow_steering(cfg_pdev, val); 275 } 276 277 static inline void cdp_cfg_get_max_peer_id(ol_txrx_soc_handle soc, 278 struct cdp_cfg *cfg_pdev) 279 { 280 } 281 282 /** 283 * cdp_cfg_set_ptp_rx_opt_enabled() - enable/disable ptp rx timestamping 284 * @soc - data path soc handle 285 * @pdev - data path device instance 286 * @val - enable or disable packet log 287 * 288 * ptp rx timestamping enable or disable 289 * 290 * return NONE 291 */ 292 static inline void 293 cdp_cfg_set_ptp_rx_opt_enabled(ol_txrx_soc_handle soc, 294 struct cdp_cfg *cfg_pdev, uint8_t val) 295 { 296 if (!soc || !soc->ops) { 297 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, 298 "%s invalid instance", __func__); 299 QDF_BUG(0); 300 return; 301 } 302 303 if (!soc->ops->cfg_ops || 304 !soc->ops->cfg_ops->set_ptp_rx_opt_enabled) 305 return; 306 307 soc->ops->cfg_ops->set_ptp_rx_opt_enabled(cfg_pdev, val); 308 } 309 #endif /* _CDP_TXRX_CFG_H_ */ 310