[dpdk-dev,v5,3/3] net/vhost: vHost support to free consumed buffers

Message ID 20170127183800.27466-4-bmcfall@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel compilation fail Compilation issues

Commit Message

Billy McFall Jan. 27, 2017, 6:38 p.m. UTC
  Add support to the vHostdriver for the new API to force free consumed
buffers on Tx ring. vHost does not cache the mbufs so there is no work
to do.

Signed-off-by: Billy McFall <bmcfall@redhat.com>
---
 doc/guides/nics/features/vhost.ini |  1 +
 drivers/net/vhost/rte_eth_vhost.c  | 11 +++++++++++
 2 files changed, 12 insertions(+)
  

Comments

Thomas Monjalon Feb. 27, 2017, 1:50 p.m. UTC | #1
2017-01-27 13:38, Billy McFall:
> Add support to the vHostdriver for the new API to force free consumed
> buffers on Tx ring. vHost does not cache the mbufs so there is no work
> to do.
> 
> Signed-off-by: Billy McFall <bmcfall@redhat.com>

Yuanhan, Maxime, do you agree with this empty function?
  
Yuanhan Liu Feb. 28, 2017, 6:41 a.m. UTC | #2
On Mon, Feb 27, 2017 at 02:50:54PM +0100, Thomas Monjalon wrote:
> 2017-01-27 13:38, Billy McFall:
> > Add support to the vHostdriver for the new API to force free consumed
> > buffers on Tx ring. vHost does not cache the mbufs so there is no work
> > to do.
> > 
> > Signed-off-by: Billy McFall <bmcfall@redhat.com>
> 
> Yuanhan, Maxime, do you agree with this empty function?

For this particular (vhost) implementation, I think it's okay.

	--yliu
  
Maxime Coquelin March 1, 2017, 10:15 a.m. UTC | #3
On 02/28/2017 07:41 AM, Yuanhan Liu wrote:
> On Mon, Feb 27, 2017 at 02:50:54PM +0100, Thomas Monjalon wrote:
>> 2017-01-27 13:38, Billy McFall:
>>> Add support to the vHostdriver for the new API to force free consumed
>>> buffers on Tx ring. vHost does not cache the mbufs so there is no work
>>> to do.
>>>
>>> Signed-off-by: Billy McFall <bmcfall@redhat.com>
>>
>> Yuanhan, Maxime, do you agree with this empty function?
>
> For this particular (vhost) implementation, I think it's okay.

Agree with Yuanhan, it looks good for vhost case:
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  

Patch

diff --git a/doc/guides/nics/features/vhost.ini b/doc/guides/nics/features/vhost.ini
index 23166fb..83fea03 100644
--- a/doc/guides/nics/features/vhost.ini
+++ b/doc/guides/nics/features/vhost.ini
@@ -9,5 +9,6 @@  Link status event    = Y
 Queue status event   = Y
 Basic stats          = Y
 Extended stats       = Y
+Free TX ring buffers = Y
 x86-32               = Y
 x86-64               = Y
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 848a3da..6674536 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -934,6 +934,16 @@  eth_queue_release(void *q)
 }
 
 static int
+eth_tx_done_cleanup(void *txq __rte_unused, uint32_t free_cnt __rte_unused)
+{
+	/*
+	 * vHost does not hang onto mbuf. eth_vhost_tx() copies packet data
+	 * and releases mbuf, so nothing to cleanup.
+	 */
+	return 0;
+}
+
+static int
 eth_link_update(struct rte_eth_dev *dev __rte_unused,
 		int wait_to_complete __rte_unused)
 {
@@ -974,6 +984,7 @@  static const struct eth_dev_ops ops = {
 	.tx_queue_setup = eth_tx_queue_setup,
 	.rx_queue_release = eth_queue_release,
 	.tx_queue_release = eth_queue_release,
+	.tx_done_cleanup = eth_tx_done_cleanup,
 	.link_update = eth_link_update,
 	.stats_get = eth_stats_get,
 	.stats_reset = eth_stats_reset,