[dpdk-dev] [PATCH v3 1/2] virtio: cleanup virtio_dev_queue_setup()

Yuanhan Liu yuanhan.liu at linux.intel.com
Mon May 9 20:04:28 CEST 2016


On Mon, May 09, 2016 at 07:58:26AM +0000, Tan, Jianfeng wrote:
> Hi Yuanhan,
> 
> > -----Original Message-----
> > From: Yuanhan Liu [mailto:yuanhan.liu at linux.intel.com]
> > Sent: Thursday, May 5, 2016 11:20 AM
> > To: Tan, Jianfeng
> > Cc: dev at 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;



More information about the dev mailing list