1 /* 2 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2022 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: This target interface shall be used by DP 22 * to communicate with target using WMI. 23 */ 24 25 #ifndef _WLAN_TARGET_IF_DP_H_ 26 #define _WLAN_TARGET_IF_DP_H_ 27 28 #include <qdf_types.h> 29 #include <qdf_status.h> 30 #include <wmi_unified_priv.h> 31 #include <wlan_objmgr_psoc_obj.h> 32 #include <target_if.h> 33 #include <cdp_txrx_ops.h> 34 35 #define PEER_ROUTING_LMAC_ID_INDEX 6 36 #define PEER_ROUTING_LMAC_ID_BITS 2 37 /** 38 * struct reorder_q_setup - reorder queue setup params 39 * @psoc: psoc 40 * @vdev_id: vdev id 41 * @pdev_id: pdev id 42 * @peer_macaddr: peer mac address 43 * @hw_qdesc: hw queue descriptor 44 * @tid: tid number 45 * @queue_no: queue number 46 * @ba_window_size_valid: BA window size validity flag 47 * @ba_window_size: BA window size 48 */ 49 struct reorder_q_setup { 50 struct cdp_ctrl_objmgr_psoc *psoc; 51 uint8_t vdev_id; 52 uint8_t pdev_id; 53 uint8_t peer_mac[QDF_MAC_ADDR_SIZE]; 54 qdf_dma_addr_t hw_qdesc_paddr; 55 uint8_t tid; 56 uint16_t queue_no; 57 uint8_t ba_window_size_valid; 58 uint16_t ba_window_size; 59 }; 60 61 /** 62 * target_if_get_active_mac_phy_number() - Get max MAC-PHY number enabled by 63 * target 64 * @psoc: psoc 65 * 66 * Get max active MAC-PHY number in all type of hw modes. 67 * 68 * return: active number of MAC-PHY pairs 69 */ 70 uint32_t target_if_get_active_mac_phy_number(struct wlan_objmgr_psoc *psoc); 71 72 /** 73 * target_if_peer_set_default_routing() - set peer default routing 74 * @psoc: psoc pointer 75 * @pdev_id: pdev id 76 * @peer_macaddr: peer mac address 77 * @vdev_id: vdev id 78 * @hash_based: hash based routing 79 * @ring_num: ring number 80 * @lmac_peer_id_msb: lmac_peer_id_msb 81 * 82 * return: void 83 */ 84 void 85 target_if_peer_set_default_routing(struct cdp_ctrl_objmgr_psoc *psoc, 86 uint8_t pdev_id, 87 uint8_t *peer_macaddr, uint8_t vdev_id, 88 bool hash_based, uint8_t ring_num, 89 uint8_t lmac_peer_id_msb); 90 /** 91 * target_if_peer_rx_reorder_queue_setup() - setup rx reorder queue 92 * @pdev: pdev pointer 93 * @pdev_id: pdev id 94 * @vdev_id: vdev id 95 * @peer_macaddr: peer mac address 96 * @hw_qdesc: hw queue descriptor 97 * @tid: tid number 98 * @queue_no: queue number 99 * @ba_window_size_valid: BA window size validity flag 100 * @ba_window_size: BA window size 101 * 102 * return: QDF_STATUS_SUCCESS for success or error code 103 */ 104 QDF_STATUS 105 target_if_peer_rx_reorder_queue_setup(struct cdp_ctrl_objmgr_psoc *psoc, 106 uint8_t pdev_id, 107 uint8_t vdev_id, uint8_t *peer_macaddr, 108 qdf_dma_addr_t hw_qdesc, int tid, 109 uint16_t queue_no, 110 uint8_t ba_window_size_valid, 111 uint16_t ba_window_size); 112 113 /** 114 * target_if_peer_rx_reorder_queue_remove() - remove rx reorder queue 115 * @psoc: psoc pointer 116 * @pdev_id: pdev id 117 * @vdev_id: vdev id 118 * @peer_macaddr: peer mac address 119 * @peer_tid_bitmap: peer tid bitmap 120 * 121 * return: QDF_STATUS_SUCCESS for success or error code 122 */ 123 QDF_STATUS 124 target_if_peer_rx_reorder_queue_remove(struct cdp_ctrl_objmgr_psoc *psoc, 125 uint8_t pdev_id, 126 uint8_t vdev_id, uint8_t *peer_macaddr, 127 uint32_t peer_tid_bitmap); 128 129 /** 130 * target_if_lro_hash_config() - send LRO hash config to FW 131 * @psoc_handle: psoc handle pointer 132 * @lro_hash_cfg: LRO hash config parameters 133 * 134 * return: QDF_STATUS_SUCCESS for success or error code 135 */ 136 QDF_STATUS 137 target_if_lro_hash_config(struct cdp_ctrl_objmgr_psoc *psoc, uint8_t pdev_id, 138 struct cdp_lro_hash_config *lro_hash_cfg); 139 140 #ifdef WDS_CONV_TARGET_IF_OPS_ENABLE 141 /** 142 * target_if_add_wds_entry() - send wds peer add command to fw 143 * @soc: SoC handle 144 * @vdev_id: vdev_id 145 * @peer_mac: peer mac address 146 * @dest_mac: MAC address of ast node 147 * @flags: WDS entry type WMI_HOST_WDS_FLAG_STATIC for static entry 148 * @type: type from enum cdp_txrx_ast_entry_type 149 * 150 * This API is used by WDS source port learning function to 151 * add a new AST entry in the fw. 152 * 153 * return: QDF_STATUS_SUCCESS for success or error code 154 */ 155 QDF_STATUS 156 target_if_add_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id, 157 uint8_t *peer_mac, const uint8_t *dest_mac, 158 uint32_t flags, uint8_t type); 159 160 /** 161 * target_if_del_wds_entry() - send wds peer del command to fw 162 * @soc: SoC handle 163 * @vdev_id: vdev_id 164 * @dest_mac: MAC address of ast node 165 * @type: type from enum cdp_txrx_ast_entry_type 166 * @delete_in_fw: flag to indicate if entry needs to be deleted in fw 167 * 168 * This API is used to delete an AST entry from fw 169 * 170 * Return: None 171 */ 172 void 173 target_if_del_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id, 174 uint8_t *dest_mac, uint8_t type, uint8_t delete_in_fw); 175 176 /** 177 * target_if_update_wds_entry() - send wds peer update command to fw 178 * @soc: SoC handle 179 * @vdev_id: vdev_id 180 * @dest_mac: MAC address of ast node 181 * @peer_mac: peer mac address 182 * @flags: WDS entry type WMI_HOST_WDS_FLAG_STATIC for static entry 183 * 184 * This API is used by update the peer mac address for the ast 185 * in the fw. 186 * 187 * return: QDF_STATUS_SUCCESS for success or error code 188 */ 189 QDF_STATUS 190 target_if_update_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id, 191 uint8_t *dest_mac, uint8_t *peer_mac, 192 uint32_t flags); 193 #else 194 static inline QDF_STATUS 195 target_if_add_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id, 196 uint8_t *peer_mac, const uint8_t *dest_mac, 197 uint32_t flags, uint8_t type) 198 { 199 return QDF_STATUS_SUCCESS; 200 } 201 202 static inline void 203 target_if_del_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id, 204 uint8_t *dest_mac, uint8_t type, uint8_t delete_in_fw) 205 { 206 } 207 208 static inline QDF_STATUS 209 target_if_update_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id, 210 uint8_t *dest_mac, uint8_t *peer_mac, 211 uint32_t flags) 212 { 213 return QDF_STATUS_SUCCESS; 214 } 215 #endif /* FEATURE_MCL_REPEATER */ 216 217 #ifdef WLAN_FEATURE_PEER_TXQ_FLUSH_CONF 218 /** 219 * target_if_peer_txq_flush_config() - Send flush command for pending frames 220 * @psoc: psoc handle pointer 221 * @vdev_id: VDEV id 222 * @mac: MAC addr of peer for which the tx queue flush is intended 223 * @ac: AC mask for identifying the tx queues to be flushed 224 * @tid: TID mask for identifying the tx queues to be flushed 225 * @policy: Defines the flush policy 226 * 227 * Return: 0 for success or error code 228 */ 229 int target_if_peer_txq_flush_config(struct cdp_ctrl_objmgr_psoc *psoc, 230 uint8_t vdev_id, uint8_t *mac, 231 uint8_t ac, uint32_t tid, uint32_t policy); 232 #else 233 static inline int 234 target_if_peer_txq_flush_config(struct cdp_ctrl_objmgr_psoc *psoc, 235 uint8_t vdev_id, uint8_t *mac, 236 uint8_t ac, uint32_t tid, 237 enum cdp_peer_txq_flush_policy policy) 238 { 239 return 0; 240 } 241 #endif /* WLAN_FEATURE_PEER_TXQ_FLUSH_CONF */ 242 #endif /* _WLAN_TARGET_IF_DP_H_ */ 243