From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 7C2571396 for ; Thu, 16 Mar 2017 08:25:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1489649155; x=1521185155; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=hA36gRW8p7JBH8oAejl+UvYrTCMkAKskA/LWzVCziD8=; b=WDfQELrmEuhV/Jj2qeG3/UmqaA48B/kF2H91ZEcqoCdUrQyWSU4w3V2s 2hF4LWsMoFYMBF20IknnXd1r2HUu7Q==; Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Mar 2017 00:25:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,170,1486454400"; d="scan'208";a="76820298" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by fmsmga005.fm.intel.com with ESMTP; 16 Mar 2017 00:25:53 -0700 Date: Thu, 16 Mar 2017 15:24:11 +0800 From: Yuanhan Liu To: Maxime Coquelin Cc: dev@dpdk.org, Harris James R , Liu Changpeng Message-ID: <20170316072411.GP18844@yliu-dev.sh.intel.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <482f834a-9e22-0bec-1fd7-1be68563b7f7@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) 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 07:25:55 -0000 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. > > struct virtio_net { > ... > struct vhost_virtqueue *virtqueue[VHOST_MAX_QUEUE_PAIRS * 2]; > > with: > #ifdef VIRTIO_NET_F_MQ > #define VHOST_MAX_QUEUE_PAIRS VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX > #define VHOST_SUPPORTS_MQ (1ULL << VIRTIO_NET_F_MQ) > #else > #define VHOST_MAX_QUEUE_PAIRS 1 > #define VHOST_SUPPORTS_MQ 0 > #endif > > and: > #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000 > > > Regards, > Maxime