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 DFE0D1075 for ; Thu, 16 Mar 2017 10:20:08 +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 85557C05680F; Thu, 16 Mar 2017 09:20:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 85557C05680F Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=maxime.coquelin@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 85557C05680F Received: from [10.36.116.177] (ovpn-116-177.ams2.redhat.com [10.36.116.177]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B97834DA60; Thu, 16 Mar 2017 09:20:06 +0000 (UTC) To: Yuanhan Liu References: <1488534682-3494-1-git-send-email-yuanhan.liu@linux.intel.com> <1488534682-3494-8-git-send-email-yuanhan.liu@linux.intel.com> <482f834a-9e22-0bec-1fd7-1be68563b7f7@redhat.com> <20170316072411.GP18844@yliu-dev.sh.intel.com> Cc: dev@dpdk.org, Harris James R , Liu Changpeng From: Maxime Coquelin Message-ID: Date: Thu, 16 Mar 2017 10:20:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170316072411.GP18844@yliu-dev.sh.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed 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.32]); Thu, 16 Mar 2017 09:20:08 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH 07/17] vhost: export vhost vring info 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, 16 Mar 2017 09:20:09 -0000 On 03/16/2017 08:24 AM, Yuanhan Liu wrote: > On Tue, Mar 14, 2017 at 01:11:24PM +0100, Maxime Coquelin wrote: >>> +int >>> +rte_vhost_get_vhost_vring(int vid, uint16_t vring_idx, >>> + struct rte_vhost_vring *vring) >>> +{ >>> + struct virtio_net *dev; >>> + struct vhost_virtqueue *vq; >>> + >>> + dev = get_device(vid); >>> + if (!dev) >>> + return -1; >>> + >>> + if (vring_idx > VHOST_MAX_VRING) >> Shouldn't be ">=" ? > > Nice catch! > >>> +#define VHOST_MAX_VRING 0x100 >> Looking at the code, I'm not clear where this limitation comes from. >> It seems that it can be up to 0x10000, no? > > It comes from the vhost-user spec: > > --yliu > > --- > * VHOST_USER_SET_VRING_KICK > > Id: 12 > Equivalent ioctl: VHOST_SET_VRING_KICK > Master payload: u64 > > Set the event file descriptor for adding buffers to the vring. It > is passed in the ancillary data. > Bits (0-7) of the payload contain the vring index. Bit 8 is the > invalid FD flag. This flag is set when there is no file descriptor > in the ancillary data. This signals that polling should be used > instead of waiting for a kick. Thanks for the pointer. With the vring_idx check fixed you can add my: Reviewed-by: Maxime Coquelin Cheers, Maxime