1 /* 2 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 #ifndef _CDP_TXRX_PPE_H_ 18 #define _CDP_TXRX_PPE_H_ 19 20 /** 21 * cdp_ppesds_vp_setup_fw_recovery() - Setup DS VP on FW recovery. 22 * @soc: data path soc handle 23 * @vdev_id: vdev id 24 * @profile_idx: DS profile index. 25 * 26 * return: qdf_status where DS VP setup is done or not. 27 */ 28 static inline 29 QDF_STATUS cdp_ppesds_vp_setup_fw_recovery(struct cdp_soc_t *soc, 30 uint8_t vdev_id, 31 uint16_t profile_idx) 32 { 33 if (!soc || !soc->ops || !soc->ops->ppeds_ops) { 34 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 35 "%s invalid instance", __func__); 36 return QDF_STATUS_E_NOSUPPORT; 37 } 38 39 if (soc->ops->ppeds_ops->ppeds_vp_setup_recovery) 40 return soc->ops->ppeds_ops->ppeds_vp_setup_recovery(soc, 41 vdev_id, 42 profile_idx); 43 44 return QDF_STATUS_E_INVAL; 45 } 46 47 /** 48 * cdp_ppesds_entry_attach() - attach the ppe vp interface. 49 * @soc: data path soc handle 50 * @vdev_id: vdev id 51 * @vpai: PPE VP opaque 52 * @ppe_vp_num: Allocated VP Port number 53 * @vp_params: VP params 54 * 55 * return: qdf_status where vp entry got allocated or not. 56 */ 57 static inline 58 QDF_STATUS cdp_ppesds_entry_attach(struct cdp_soc_t *soc, uint8_t vdev_id, 59 void *vpai, int32_t *ppe_vp_num, 60 struct cdp_ds_vp_params *vp_params) 61 { 62 if (!soc || !soc->ops || !soc->ops->ppeds_ops) { 63 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 64 "%s invalid instance", __func__); 65 return QDF_STATUS_E_NOSUPPORT; 66 } 67 68 if (soc->ops->ppeds_ops->ppeds_entry_attach) 69 return soc->ops->ppeds_ops->ppeds_entry_attach(soc, vdev_id, 70 vpai, 71 ppe_vp_num, 72 vp_params); 73 74 return QDF_STATUS_E_INVAL; 75 } 76 77 /** 78 * cdp_ppesds_entry_detach() - Detach the PPE VP interface. 79 * @soc: data path soc handle 80 * @vdev_id: vdev ID 81 * @vp_params: VP params 82 * 83 * return: void 84 */ 85 static inline 86 void cdp_ppesds_entry_detach(struct cdp_soc_t *soc, uint8_t vdev_id, 87 struct cdp_ds_vp_params *vp_params) 88 { 89 if (!soc || !soc->ops || !soc->ops->ppeds_ops) { 90 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 91 "%s invalid instance", __func__); 92 return; 93 } 94 95 if (soc->ops->ppeds_ops->ppeds_entry_detach) 96 return soc->ops->ppeds_ops->ppeds_entry_detach(soc, 97 vdev_id, 98 vp_params); 99 } 100 101 /** 102 * cdp_ppesds_set_int_pri2tid() - Set the INT_PRI to TID 103 * @soc: data path soc handle 104 * @pri2tid: PRI2TID table 105 * 106 * return: void 107 */ 108 static inline 109 void cdp_ppesds_set_int_pri2tid(struct cdp_soc_t *soc, 110 uint8_t *pri2tid) 111 { 112 if (!soc || !soc->ops || !soc->ops->ppeds_ops) { 113 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 114 "%s invalid instance", __func__); 115 return; 116 } 117 118 if (soc->ops->ppeds_ops->ppeds_set_int_pri2tid) 119 return soc->ops->ppeds_ops->ppeds_set_int_pri2tid(soc, pri2tid); 120 } 121 122 /** 123 * cdp_ppesds_update_int_pri2tid() - Update the INT_PRI to TID 124 * @soc: data path soc handle 125 * @pri: Priority index 126 * @tid: TID mapped to the input priority 127 * 128 * return: void 129 */ 130 static inline 131 void cdp_ppesds_update_int_pri2tid(struct cdp_soc_t *soc, 132 uint8_t pri, uint8_t tid) 133 { 134 if (!soc || !soc->ops || !soc->ops->ppeds_ops) { 135 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 136 "%s invalid instance", __func__); 137 } 138 139 if (soc->ops->ppeds_ops->ppeds_update_int_pri2tid) 140 return soc->ops->ppeds_ops->ppeds_update_int_pri2tid(soc, pri, 141 tid); 142 } 143 144 /** 145 * cdp_ppesds_entry_dump() - Dump the PPE VP entries 146 * @soc: data path soc handle 147 * 148 * return: void 149 */ 150 static inline 151 void cdp_ppesds_entry_dump(struct cdp_soc_t *soc) 152 { 153 if (!soc || !soc->ops || !soc->ops->ppeds_ops) { 154 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 155 "%s invalid instance", __func__); 156 return; 157 } 158 159 if (soc->ops->ppeds_ops->ppeds_entry_dump) 160 soc->ops->ppeds_ops->ppeds_entry_dump(soc); 161 } 162 163 /** 164 * cdp_ppesds_enable_pri2tid() - Enable PPE VP PRI2TID table 165 * @soc: data path soc handle 166 * @vdev_id: vdev id 167 * @val: Boolean value to enable/disable 168 * 169 * return: QDF_STATUS 170 */ 171 static inline 172 QDF_STATUS cdp_ppesds_enable_pri2tid(struct cdp_soc_t *soc, 173 uint8_t vdev_id, bool val) 174 { 175 if (!soc || !soc->ops || !soc->ops->ppeds_ops) { 176 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 177 "%s invalid instance", __func__); 178 return QDF_STATUS_E_INVAL; 179 } 180 181 if (soc->ops->ppeds_ops->ppeds_enable_pri2tid) 182 return soc->ops->ppeds_ops->ppeds_enable_pri2tid(soc, vdev_id, 183 val); 184 185 return QDF_STATUS_E_NOSUPPORT; 186 } 187 #endif /* _CDP_TXRX_PPE_H_ */ 188