* Post a work request to queue. */
| 121 | * Post a work request to queue. |
| 122 | */ |
| 123 | int |
| 124 | gdma_post_work_request(struct mana_gdma_queue *queue, |
| 125 | struct gdma_work_request *work_req, |
| 126 | uint32_t *wqe_size_in_bu) |
| 127 | { |
| 128 | uint32_t client_oob_size = |
| 129 | work_req->inline_oob_size_in_bytes > |
| 130 | INLINE_OOB_SMALL_SIZE_IN_BYTES ? |
| 131 | INLINE_OOB_LARGE_SIZE_IN_BYTES : |
| 132 | INLINE_OOB_SMALL_SIZE_IN_BYTES; |
| 133 | |
| 134 | uint32_t sgl_data_size = sizeof(struct gdma_sgl_element) * |
| 135 | RTE_MAX((uint32_t)1, work_req->num_sgl_elements); |
| 136 | uint32_t wqe_size = |
| 137 | RTE_ALIGN(sizeof(struct gdma_wqe_dma_oob) + |
| 138 | client_oob_size + sgl_data_size, |
| 139 | GDMA_WQE_ALIGNMENT_UNIT_SIZE); |
| 140 | uint8_t *wq_buffer_pointer; |
| 141 | uint32_t queue_free_units = queue->count - (queue->head - queue->tail); |
| 142 | |
| 143 | if (wqe_size / GDMA_WQE_ALIGNMENT_UNIT_SIZE > queue_free_units) { |
| 144 | DP_LOG(DEBUG, "WQE size %u queue count %u head %u tail %u", |
| 145 | wqe_size, queue->count, queue->head, queue->tail); |
| 146 | return -EBUSY; |
| 147 | } |
| 148 | |
| 149 | DP_LOG(DEBUG, "client_oob_size %u sgl_data_size %u wqe_size %u", |
| 150 | client_oob_size, sgl_data_size, wqe_size); |
| 151 | |
| 152 | *wqe_size_in_bu = wqe_size / GDMA_WQE_ALIGNMENT_UNIT_SIZE; |
| 153 | |
| 154 | wq_buffer_pointer = gdma_get_wqe_pointer(queue); |
| 155 | wq_buffer_pointer += write_dma_client_oob(wq_buffer_pointer, work_req, |
| 156 | client_oob_size); |
| 157 | if (wq_buffer_pointer >= ((uint8_t *)queue->buffer) + queue->size) |
| 158 | wq_buffer_pointer -= queue->size; |
| 159 | |
| 160 | write_scatter_gather_list((uint8_t *)queue->buffer, |
| 161 | (uint8_t *)queue->buffer + queue->size, |
| 162 | wq_buffer_pointer, work_req); |
| 163 | |
| 164 | queue->head += wqe_size / GDMA_WQE_ALIGNMENT_UNIT_SIZE; |
| 165 | |
| 166 | return 0; |
| 167 | } |
| 168 | |
| 169 | #ifdef RTE_ARCH_32 |
| 170 | union gdma_short_doorbell_entry { |
no test coverage detected