| 1290 | } |
| 1291 | |
| 1292 | static __rte_always_inline struct vhost_virtqueue * |
| 1293 | vhost_crypto_finalize_one_request(struct rte_crypto_op *op, |
| 1294 | struct vhost_virtqueue *old_vq) |
| 1295 | { |
| 1296 | struct rte_mbuf *m_src = op->sym->m_src; |
| 1297 | struct rte_mbuf *m_dst = op->sym->m_dst; |
| 1298 | struct vhost_crypto_data_req *vc_req = rte_mbuf_to_priv(m_src); |
| 1299 | struct vhost_virtqueue *vq; |
| 1300 | uint16_t used_idx, desc_idx; |
| 1301 | |
| 1302 | if (unlikely(!vc_req)) { |
| 1303 | VC_LOG_ERR("Failed to retrieve vc_req"); |
| 1304 | return NULL; |
| 1305 | } |
| 1306 | vq = vc_req->vq; |
| 1307 | used_idx = vc_req->desc_idx; |
| 1308 | |
| 1309 | if (old_vq && (vq != old_vq)) |
| 1310 | return vq; |
| 1311 | |
| 1312 | if (unlikely(op->status != RTE_CRYPTO_OP_STATUS_SUCCESS)) |
| 1313 | vc_req->inhdr->status = VIRTIO_CRYPTO_ERR; |
| 1314 | else { |
| 1315 | if (vc_req->zero_copy == 0) |
| 1316 | write_back_data(vc_req); |
| 1317 | } |
| 1318 | |
| 1319 | desc_idx = vq->avail->ring[used_idx]; |
| 1320 | vq->used->ring[desc_idx].id = vq->avail->ring[desc_idx]; |
| 1321 | vq->used->ring[desc_idx].len = vc_req->len; |
| 1322 | |
| 1323 | rte_mempool_put(m_src->pool, (void *)m_src); |
| 1324 | |
| 1325 | if (m_dst) |
| 1326 | rte_mempool_put(m_dst->pool, (void *)m_dst); |
| 1327 | |
| 1328 | return vc_req->vq; |
| 1329 | } |
| 1330 | |
| 1331 | static __rte_always_inline uint16_t |
| 1332 | vhost_crypto_complete_one_vm_requests(struct rte_crypto_op **ops, |
no test coverage detected