From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id D5036591F for ; Thu, 12 May 2016 03:00:22 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 11 May 2016 18:00:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,609,1455004800"; d="scan'208";a="973957490" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by orsmga002.jf.intel.com with ESMTP; 11 May 2016 18:00:19 -0700 Date: Wed, 11 May 2016 18:05:17 -0700 From: Yuanhan Liu To: Jianfeng Tan Cc: dev@dpdk.org, Huawei Xie , rich.lane@bigswitch.com, mst@redhat.com, nakajima.yoshihiro@lab.ntt.co.jp, p.fedin@samsung.com, ann.zhuangyanying@huawei.com, mukawa@igel.co.jp, nhorman@tuxdriver.com Message-ID: <20160512010517.GY5641@yliu-dev.sh.intel.com> References: <1461892716-19122-1-git-send-email-jianfeng.tan@intel.com> <1461892716-19122-6-git-send-email-jianfeng.tan@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1461892716-19122-6-git-send-email-jianfeng.tan@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v4 5/8] virtio-user: add device emulation layer APIs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2016 01:00:23 -0000 On Fri, Apr 29, 2016 at 01:18:33AM +0000, Jianfeng Tan wrote: > +static int > +kick_one_vq(struct virtio_user_hw *hw, struct virtqueue *vq, > + unsigned queue_sel) Firstly, "dev" is a more common word than "hw" here. So, name the struct to "virtio_user_device", and name the var to "dev". And you are still mixing virtio driver and virtio device emulation here. Say, struct virtqueue should not be used here: it belongs to driver. Instead, you should define your own. It could be fair simple that is enough for current usage: struct virtqueue { uint32_t num; uint64_t desc_addr; uint64_t avail_addr; uint64_t used_addr; }; That could let us not depend on any structures (or just few if not possible) from virtio PMD driver. --yliu > +{ > + int callfd, kickfd; > + struct vhost_vring_file file; > + struct vhost_vring_state state; > + struct vhost_vring_addr addr = { > + .index = queue_sel, > + .desc_user_addr = (uint64_t)(uintptr_t)vq->vq_ring.desc, > + .avail_user_addr = (uint64_t)(uintptr_t)vq->vq_ring.avail, > + .used_user_addr = (uint64_t)(uintptr_t)vq->vq_ring.used, > + .log_guest_addr = 0, > + .flags = 0, /* disable log */ > + };