1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD. 3 */ 4 5 #include <stdint.h> 6 7 #include <rte_mbuf.h> 8 #include <rte_crypto.h> 9 #include <rte_malloc.h> 10 11 #include "virtqueue.h" 12 13 void virtqueue_disable_intr(struct virtqueue * vq)14virtqueue_disable_intr(struct virtqueue *vq) 15 { 16 /* 17 * Set VRING_AVAIL_F_NO_INTERRUPT to hint host 18 * not to interrupt when it consumes packets 19 * Note: this is only considered a hint to the host 20 */ 21 vq->vq_ring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT; 22 } 23 24 void virtqueue_detatch_unused(struct virtqueue * vq)25virtqueue_detatch_unused(struct virtqueue *vq) 26 { 27 struct rte_crypto_op *cop = NULL; 28 29 int idx; 30 31 if (vq != NULL) 32 for (idx = 0; idx < vq->vq_nentries; idx++) { 33 cop = vq->vq_descx[idx].crypto_op; 34 if (cop) { 35 rte_pktmbuf_free(cop->sym->m_src); 36 rte_pktmbuf_free(cop->sym->m_dst); 37 rte_crypto_op_free(cop); 38 vq->vq_descx[idx].crypto_op = NULL; 39 } 40 } 41 } 42