1 /* 2 * Copyright (c) 2022 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_entry_attach() - attach the ppe vp interface. 22 * @soc: data path soc handle 23 * @vdev_id: vdev id 24 * @vpai: PPE VP opaque 25 * @ppe_vp_num: Allocated VP Port number 26 * 27 * return: qdf_status where vp entry got allocated or not. 28 */ 29 static inline 30 QDF_STATUS cdp_ppesds_entry_attach(struct cdp_soc_t *soc, uint8_t vdev_id, 31 void *vpai, int32_t *ppe_vp_num) 32 { 33 if (!soc || !soc->ops || !soc->ops->ppe_ops) { 34 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 35 "%s invalid instance", __func__); 36 return QDF_STATUS_E_INVAL; 37 } 38 39 if (soc->ops->ppe_ops->ppeds_entry_attach) { 40 return soc->ops->ppe_ops->ppeds_entry_attach(soc, vdev_id, 41 vpai, ppe_vp_num); 42 } 43 44 return QDF_STATUS_E_NOSUPPORT; 45 } 46 47 /** 48 * cdp_ppesds_entry_detach() - Detach the PPE VP interface. 49 * @soc: data path soc handle 50 * @vdev_id: vdev ID 51 * 52 * return: void 53 */ 54 static inline 55 void cdp_ppesds_entry_detach(struct cdp_soc_t *soc, uint8_t vdev_id) 56 { 57 if (!soc || !soc->ops || !soc->ops->ppe_ops) { 58 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 59 "%s invalid instance", __func__); 60 return; 61 } 62 63 if (soc->ops->ppe_ops->ppeds_entry_detach) { 64 return soc->ops->ppe_ops->ppeds_entry_detach 65 (soc, vdev_id); 66 } 67 } 68 69 /** 70 * cdp_ppesds_set_int_pri2tid() - Set the INT_PRI to TID 71 * @soc: data path soc handle 72 * @pri2tid: PRI2TID table 73 * 74 * return: void 75 */ 76 static inline 77 void cdp_ppesds_set_int_pri2tid(struct cdp_soc_t *soc, 78 uint8_t *pri2tid) 79 { 80 if (!soc || !soc->ops || !soc->ops->ppe_ops) { 81 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 82 "%s invalid instance", __func__); 83 return; 84 } 85 86 if (soc->ops->ppe_ops->ppeds_set_int_pri2tid) { 87 return soc->ops->ppe_ops->ppeds_set_int_pri2tid 88 (soc, pri2tid); 89 } 90 } 91 92 /** 93 * cdp_ppesds_update_int_pri2tid() - Update the INT_PRI to TID 94 * @soc: data path soc handle 95 * @pri: Priority index 96 * @tid: TID mapped to the input priority 97 * 98 * return: void 99 */ 100 static inline 101 void cdp_ppesds_update_int_pri2tid(struct cdp_soc_t *soc, 102 uint8_t pri, uint8_t tid) 103 { 104 if (!soc || !soc->ops || !soc->ops->ppe_ops) { 105 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 106 "%s invalid instance", __func__); 107 } 108 109 if (soc->ops->ppe_ops->ppeds_update_int_pri2tid) { 110 return soc->ops->ppe_ops->ppeds_update_int_pri2tid 111 (soc, pri, tid); 112 } 113 } 114 115 /** 116 * cdp_ppesds_entry_dump() - Dump the PPE VP entries 117 * @soc: data path soc handle 118 * 119 * return: void 120 */ 121 static inline 122 void cdp_ppesds_entry_dump(struct cdp_soc_t *soc) 123 { 124 if (!soc || !soc->ops || !soc->ops->ppe_ops) { 125 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 126 "%s invalid instance", __func__); 127 return; 128 } 129 130 if (soc->ops->ppe_ops->ppeds_entry_dump) 131 soc->ops->ppe_ops->ppeds_entry_dump(soc); 132 } 133 134 /** 135 * cdp_ppesds_enable_pri2tid() - Enable PPE VP PRI2TID table 136 * @soc: data path soc handle 137 * @vdev_id: vdev id 138 * @val: Boolean value to enable/disable 139 * 140 * return: QDF_STATUS 141 */ 142 static inline 143 QDF_STATUS cdp_ppesds_enable_pri2tid(struct cdp_soc_t *soc, 144 uint8_t vdev_id, bool val) 145 { 146 if (!soc || !soc->ops || !soc->ops->ppe_ops) { 147 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 148 "%s invalid instance", __func__); 149 return QDF_STATUS_E_INVAL; 150 } 151 152 if (soc->ops->ppe_ops->ppeds_enable_pri2tid) { 153 return soc->ops->ppe_ops->ppeds_enable_pri2tid(soc, 154 vdev_id, val); 155 } 156 157 return QDF_STATUS_E_NOSUPPORT; 158 } 159 #endif /* _CDP_TXRX_PPE_H_ */ 160