[dpdk-dev,3/3] vhost: update comments

Message ID 1478056501-9321-4-git-send-email-yuanhan.liu@linux.intel.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Yuanhan Liu Nov. 2, 2016, 3:15 a.m. UTC
  vhost-cuse is removed, update corresponding comments that are still
referencing it.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 examples/tep_termination/main.c   | 7 ++-----
 examples/vhost/main.c             | 4 +---
 examples/vhost_xen/main.c         | 3 +--
 lib/librte_vhost/rte_virtio_net.h | 5 ++---
 lib/librte_vhost/vhost.c          | 9 ++++-----
 lib/librte_vhost/vhost.h          | 4 +++-
 6 files changed, 13 insertions(+), 19 deletions(-)
  

Comments

John McNamara Nov. 4, 2016, 1:28 p.m. UTC | #1
> -----Original Message-----
> From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com]
> Sent: Wednesday, November 2, 2016 3:15 AM
> To: dev@dpdk.org
> Cc: Mcnamara, John <john.mcnamara@intel.com>; Yuanhan Liu
> <yuanhan.liu@linux.intel.com>
> Subject: [PATCH 3/3] vhost: update comments
> 
> vhost-cuse is removed, update corresponding comments that are still
> referencing it.
> 
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
>
> ...
>
>  /*
> - * Backend-specific cleanup. Defined by vhost-cuse and vhost-user.
> + * Backend-specific cleanup.
> + *
> + * TODO: fix it; we have one backend now
>   */
>  void vhost_backend_cleanup(struct virtio_net *dev);

In general it is not a good idea to leave TODOs/Fixmes around unless they
that a better explanation of why they are there.

Apart from that:


Acked-by: John McNamara <john.mcnamara@intel.com>
  
Yuanhan Liu Nov. 4, 2016, 2:15 p.m. UTC | #2
On Fri, Nov 04, 2016 at 01:28:45PM +0000, Mcnamara, John wrote:
> 
> 
> > -----Original Message-----
> > From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com]
> > Sent: Wednesday, November 2, 2016 3:15 AM
> > To: dev@dpdk.org
> > Cc: Mcnamara, John <john.mcnamara@intel.com>; Yuanhan Liu
> > <yuanhan.liu@linux.intel.com>
> > Subject: [PATCH 3/3] vhost: update comments
> > 
> > vhost-cuse is removed, update corresponding comments that are still
> > referencing it.
> > 
> > Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> >
> > ...
> >
> >  /*
> > - * Backend-specific cleanup. Defined by vhost-cuse and vhost-user.
> > + * Backend-specific cleanup.
> > + *
> > + * TODO: fix it; we have one backend now
> >   */
> >  void vhost_backend_cleanup(struct virtio_net *dev);
> 
> In general it is not a good idea to leave TODOs/Fixmes around unless they
> that a better explanation of why they are there.

Agreed.

In this case, if you look at the delete line, you will find we have such
function implemented both in vhost-user and vhost-cuse. Now we get one
only. So, we may could just rename it to vhost_user_cleanup(). Or even,
remove it completely by doing some small refactors.

It's obvious that we need do that in another patch. Thus, the TODO is
been added.

	--yliu

> 
> Apart from that:
> 
> 
> Acked-by: John McNamara <john.mcnamara@intel.com>
>
  

Patch

diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c
index 622f248..1d6d463 100644
--- a/examples/tep_termination/main.c
+++ b/examples/tep_termination/main.c
@@ -1151,8 +1151,7 @@  print_stats(void)
 }
 
 /**
- * Main function, does initialisation and calls the per-lcore functions. The CUSE
- * device is also registered here to handle the IOCTLs.
+ * Main function, does initialisation and calls the per-lcore functions.
  */
 int
 main(int argc, char *argv[])
@@ -1253,14 +1252,12 @@  main(int argc, char *argv[])
 	}
 	rte_vhost_feature_disable(1ULL << VIRTIO_NET_F_MRG_RXBUF);
 
-	/* Register CUSE device to handle IOCTLs. */
 	ret = rte_vhost_driver_register((char *)&dev_basename, 0);
 	if (ret != 0)
-		rte_exit(EXIT_FAILURE, "CUSE device setup failure.\n");
+		rte_exit(EXIT_FAILURE, "failed to register vhost driver.\n");
 
 	rte_vhost_driver_callback_register(&virtio_net_device_ops);
 
-	/* Start CUSE session. */
 	rte_vhost_driver_session_start();
 
 	return 0;
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 91000e8..0709859 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -1409,8 +1409,7 @@  create_mbuf_pool(uint16_t nr_port, uint32_t nr_switch_core, uint32_t mbuf_size,
 }
 
 /*
- * Main function, does initialisation and calls the per-lcore functions. The CUSE
- * device is also registered here to handle the IOCTLs.
+ * Main function, does initialisation and calls the per-lcore functions.
  */
 int
 main(int argc, char *argv[])
@@ -1531,7 +1530,6 @@  main(int argc, char *argv[])
 
 	rte_vhost_driver_callback_register(&virtio_net_device_ops);
 
-	/* Start CUSE session. */
 	rte_vhost_driver_session_start();
 	return 0;
 
diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c
index 2e40357..f4dbaa4 100644
--- a/examples/vhost_xen/main.c
+++ b/examples/vhost_xen/main.c
@@ -1407,8 +1407,7 @@  print_stats(void)
 int init_virtio_net(struct virtio_net_device_ops const * const ops);
 
 /*
- * Main function, does initialisation and calls the per-lcore functions. The CUSE
- * device is also registered here to handle the IOCTLs.
+ * Main function, does initialisation and calls the per-lcore functions.
  */
 int
 main(int argc, char *argv[])
diff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h
index c53ff64..926039c 100644
--- a/lib/librte_vhost/rte_virtio_net.h
+++ b/lib/librte_vhost/rte_virtio_net.h
@@ -123,9 +123,8 @@  int rte_vhost_get_numa_node(int vid);
 uint32_t rte_vhost_get_queue_num(int vid);
 
 /**
- * Get the virtio net device's ifname. For vhost-cuse, ifname is the
- * path of the char device. For vhost-user, ifname is the vhost-user
- * socket file path.
+ * Get the virtio net device's ifname, which is the vhost-user socket
+ * file path.
  *
  * @param vid
  *  virtio-net device ID
diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
index d8116ff..31825b8 100644
--- a/lib/librte_vhost/vhost.c
+++ b/lib/librte_vhost/vhost.c
@@ -227,9 +227,8 @@  reset_device(struct virtio_net *dev)
 }
 
 /*
- * Function is called from the CUSE open function. The device structure is
- * initialised and a new entry is added to the device configuration linked
- * list.
+ * Invoked when there is a new vhost-user connection established (when
+ * there is a new virtio device being attached).
  */
 int
 vhost_new_device(void)
@@ -261,8 +260,8 @@  vhost_new_device(void)
 }
 
 /*
- * Function is called from the CUSE release function. This function will
- * cleanup the device and remove it from device configuration linked list.
+ * Invoked when there is the vhost-user connection is broken (when
+ * the virtio device is being detached).
  */
 void
 vhost_destroy_device(int vid)
diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
index acec772..22564f1 100644
--- a/lib/librte_vhost/vhost.h
+++ b/lib/librte_vhost/vhost.h
@@ -284,7 +284,9 @@  void vhost_set_ifname(int, const char *if_name, unsigned int if_len);
 void vhost_enable_dequeue_zero_copy(int vid);
 
 /*
- * Backend-specific cleanup. Defined by vhost-cuse and vhost-user.
+ * Backend-specific cleanup.
+ *
+ * TODO: fix it; we have one backend now
  */
 void vhost_backend_cleanup(struct virtio_net *dev);