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->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_entry_attach) 40 return soc->ops->ppeds_ops->ppeds_entry_attach(soc, vdev_id, 41 vpai, 42 ppe_vp_num); 43 44 return QDF_STATUS_E_INVAL; 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->ppeds_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->ppeds_ops->ppeds_entry_detach) 64 return soc->ops->ppeds_ops->ppeds_entry_detach(soc, vdev_id); 65 } 66 67 /** 68 * cdp_ppesds_set_int_pri2tid() - Set the INT_PRI to TID 69 * @soc: data path soc handle 70 * @pri2tid: PRI2TID table 71 * 72 * return: void 73 */ 74 static inline 75 void cdp_ppesds_set_int_pri2tid(struct cdp_soc_t *soc, 76 uint8_t *pri2tid) 77 { 78 if (!soc || !soc->ops || !soc->ops->ppeds_ops) { 79 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 80 "%s invalid instance", __func__); 81 return; 82 } 83 84 if (soc->ops->ppeds_ops->ppeds_set_int_pri2tid) 85 return soc->ops->ppeds_ops->ppeds_set_int_pri2tid(soc, pri2tid); 86 } 87 88 /** 89 * cdp_ppesds_update_int_pri2tid() - Update the INT_PRI to TID 90 * @soc: data path soc handle 91 * @pri: Priority index 92 * @tid: TID mapped to the input priority 93 * 94 * return: void 95 */ 96 static inline 97 void cdp_ppesds_update_int_pri2tid(struct cdp_soc_t *soc, 98 uint8_t pri, uint8_t tid) 99 { 100 if (!soc || !soc->ops || !soc->ops->ppeds_ops) { 101 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 102 "%s invalid instance", __func__); 103 } 104 105 if (soc->ops->ppeds_ops->ppeds_update_int_pri2tid) 106 return soc->ops->ppeds_ops->ppeds_update_int_pri2tid(soc, pri, 107 tid); 108 } 109 110 /** 111 * cdp_ppesds_entry_dump() - Dump the PPE VP entries 112 * @soc: data path soc handle 113 * 114 * return: void 115 */ 116 static inline 117 void cdp_ppesds_entry_dump(struct cdp_soc_t *soc) 118 { 119 if (!soc || !soc->ops || !soc->ops->ppeds_ops) { 120 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 121 "%s invalid instance", __func__); 122 return; 123 } 124 125 if (soc->ops->ppeds_ops->ppeds_entry_dump) 126 soc->ops->ppeds_ops->ppeds_entry_dump(soc); 127 } 128 129 /** 130 * cdp_ppesds_enable_pri2tid() - Enable PPE VP PRI2TID table 131 * @soc: data path soc handle 132 * @vdev_id: vdev id 133 * @val: Boolean value to enable/disable 134 * 135 * return: QDF_STATUS 136 */ 137 static inline 138 QDF_STATUS cdp_ppesds_enable_pri2tid(struct cdp_soc_t *soc, 139 uint8_t vdev_id, bool val) 140 { 141 if (!soc || !soc->ops || !soc->ops->ppeds_ops) { 142 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 143 "%s invalid instance", __func__); 144 return QDF_STATUS_E_INVAL; 145 } 146 147 if (soc->ops->ppeds_ops->ppeds_enable_pri2tid) 148 return soc->ops->ppeds_ops->ppeds_enable_pri2tid(soc, vdev_id, 149 val); 150 151 return QDF_STATUS_E_NOSUPPORT; 152 } 153 #endif /* _CDP_TXRX_PPE_H_ */ 154