From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id CB8AF1B2E8 for ; Thu, 21 Dec 2017 22:31:02 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E3433356E6; Thu, 21 Dec 2017 21:31:01 +0000 (UTC) Received: from [10.36.112.15] (unknown [10.36.112.15]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5DF131800F; Thu, 21 Dec 2017 21:30:58 +0000 (UTC) To: Stefan Hajnoczi , dev@dpdk.org Cc: Yuanhan Liu , Tetsuya Mukawa References: <20171221164128.20001-1-stefanha@redhat.com> From: Maxime Coquelin Message-ID: <95c9797f-3571-6843-0a79-7d3d1ed1a5c1@redhat.com> Date: Thu, 21 Dec 2017 22:30:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20171221164128.20001-1-stefanha@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 21 Dec 2017 21:31:01 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH] vhost: introduce rte_vhost_vring_call() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Dec 2017 21:31:03 -0000 Hi Stefan, On 12/21/2017 05:41 PM, Stefan Hajnoczi wrote: > +int > +rte_vhost_vring_call(int vid, uint16_t vring_idx) > +{ > + struct virtio_net *dev; > + struct vhost_virtqueue *vq; > + > + dev = get_device(vid); > + if (!dev) > + return -1; > + > + if (vring_idx >= VHOST_MAX_VRING) > + return -1; > + > + vq = dev->virtqueue[vring_idx]; > + if (!vq) > + return -1; > + > + /* flush used->idx update before we read avail->flags. */ > + rte_mb(); > + > + /* Kick the guest if necessary. */ > + if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT) > + && (vq->callfd >= 0)) > + eventfd_write(vq->callfd, (eventfd_t)1); > + return 0; > +} I think it may be better to have an internal function that just take the vq as argument to avoid getting again the vq from the vid & vring index in the hot path. Also, this internal function could be tagged as always inlined. Thanks, Maxime