Branch data Line data Source code
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 : 0 : 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 : 0 : vq->vq_ring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT; 22 : 0 : } 23 : : 24 : : void 25 : 0 : virtqueue_detatch_unused(struct virtqueue *vq) 26 : : { 27 : : struct rte_crypto_op *cop = NULL; 28 : : 29 : : int idx; 30 : : 31 [ # # ]: 0 : if (vq != NULL) 32 [ # # ]: 0 : for (idx = 0; idx < vq->vq_nentries; idx++) { 33 : 0 : cop = vq->vq_descx[idx].crypto_op; 34 [ # # ]: 0 : if (cop) { 35 : 0 : rte_pktmbuf_free(cop->sym->m_src); 36 : 0 : rte_pktmbuf_free(cop->sym->m_dst); 37 : 0 : rte_crypto_op_free(cop); 38 : 0 : vq->vq_descx[idx].crypto_op = NULL; 39 : : } 40 : : } 41 : 0 : }