From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH v3] vhost: Expose virtio interrupt need on rte_vhost API Date: Fri, 6 Oct 2017 14:40:15 +0800 Message-ID: <20171006064015.GD1545@yliu-home> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "'dev@dpdk.org'" To: Jan Scheurich Return-path: Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) by dpdk.org (Postfix) with ESMTP id 7289C1B23B for ; Fri, 6 Oct 2017 08:40:20 +0200 (CEST) Content-Disposition: inline In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Sat, Sep 23, 2017 at 08:31:37PM +0000, Jan Scheurich wrote: ... > +int rte_vhost_tx_interrupt_requested(int vid, uint16_t qid) > +{ > + struct virtio_net *dev; > + struct vhost_virtqueue *vq; > + > + dev = get_device(vid); > + if (dev == NULL) > + return 0; > + > + vq = dev->virtqueue[qid]; > + if (vq == NULL) > + return 0; > + > + if (unlikely(vq->enabled == 0 || vq->avail == NULL)) > + return 0; > + > + return !(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT); Two comments here: - as you see, the flags is stored at vq->avail, which is stored at the shared memory. That means, the virtio driver could change the value at any time. That said, this API should not be intended to be invoked once. Then you have to invoke it repeatedly, which might be a bit costy. - OTOH, you might want to try "rte_vhost_get_vhost_vring" API, which exposes the vq->avail, therefore, the interrupt flag is also exposed. --yliu