From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id CF3E668F8 for ; Mon, 9 May 2016 20:00:16 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP; 09 May 2016 10:59:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,601,1455004800"; d="scan'208";a="699285846" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by FMSMGA003.fm.intel.com with ESMTP; 09 May 2016 10:59:53 -0700 Date: Mon, 9 May 2016 11:04:28 -0700 From: Yuanhan Liu To: "Tan, Jianfeng" Cc: "dev@dpdk.org" , "Xie, Huawei" Message-ID: <20160509180428.GC5641@yliu-dev.sh.intel.com> References: <1461673932-128879-1-git-send-email-jianfeng.tan@intel.com> <1461890926-16727-1-git-send-email-jianfeng.tan@intel.com> <1461890926-16727-2-git-send-email-jianfeng.tan@intel.com> <20160505031931.GV5641@yliu-dev.sh.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v3 1/2] virtio: cleanup virtio_dev_queue_setup() 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: Mon, 09 May 2016 18:00:17 -0000 On Mon, May 09, 2016 at 07:58:26AM +0000, Tan, Jianfeng wrote: > Hi Yuanhan, > > > -----Original Message----- > > From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com] > > Sent: Thursday, May 5, 2016 11:20 AM > > To: Tan, Jianfeng > > Cc: dev@dpdk.org; Xie, Huawei > > Subject: Re: [PATCH v3 1/2] virtio: cleanup virtio_dev_queue_setup() > > > > On Fri, Apr 29, 2016 at 12:48:45AM +0000, Jianfeng Tan wrote: > > > + if (queue_type < VTNET_RQ || queue_type > VTNET_CQ) { > > > + PMD_INIT_LOG(ERR, "invalid queue type: %d", queue_type); > > > + return -EINVAL; > > > } > > > > I'm thinking this check is not necessary. We can make sure it's a valid > > queue type. > > Yes, this is not necessary, and I was also entangled with whether to keep it or not. And ok, I'll send a new version with this check removed. Not necessary; it's trivial for me to fix it while applying it. So, this series is applied to dpdk-next-virtio, with following changes: --yliu --- diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 6b291f5..70ee12a 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -266,7 +266,7 @@ virtio_dev_queue_release(struct virtqueue *vq) if (vq) { hw = vq->hw; - if (vq->started) + if (vq->configured) hw->vtpci_ops->del_queue(hw, vq); rte_memzone_free(vq->mz); @@ -311,11 +311,6 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev, return -EINVAL; } - if (queue_type < VTNET_RQ || queue_type > VTNET_CQ) { - PMD_INIT_LOG(ERR, "invalid queue type: %d", queue_type); - return -EINVAL; - } - snprintf(vq_name, sizeof(vq_name), "port%d_%s%d", dev->data->port_id, queue_names[queue_type], queue_idx); vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) + @@ -453,7 +448,7 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev, hw->vtpci_ops->setup_queue(hw, vq); - vq->started = 1; + vq->configured = 1; *pvq = vq; return 0; } diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h index 0006a29..4e543d2 100644 --- a/drivers/net/virtio/virtqueue.h +++ b/drivers/net/virtio/virtqueue.h @@ -201,7 +201,7 @@ struct virtqueue { uint16_t *notify_addr; - int started; + int configured; struct vq_desc_extra { void *cookie;