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 14 virtqueue_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 25 virtqueue_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 if (cop->sym->m_src) 36 rte_pktmbuf_free(cop->sym->m_src); 37 if (cop->sym->m_dst) 38 rte_pktmbuf_free(cop->sym->m_dst); 39 rte_crypto_op_free(cop); 40 vq->vq_descx[idx].crypto_op = NULL; 41 } 42 } 43 } 44