DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: allocate and free packets in bulk in Tx split
@ 2021-05-28 10:26 Balazs Nemeth
  2021-06-04 11:48 ` Maxime Coquelin
  2021-06-04 12:14 ` [dpdk-dev] [PATCH v2] " Balazs Nemeth
  0 siblings, 2 replies; 7+ messages in thread
From: Balazs Nemeth @ 2021-05-28 10:26 UTC (permalink / raw)
  To: bnemeth, dev, maxime.coquelin, david.marchand

Same idea as commit a287ac28919d ("vhost: allocate and free packets
in bulk in Tx packed"), allocate and free packets in bulk. Also remove
the unused function virtio_dev_pktmbuf_alloc.

Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
---
 lib/vhost/virtio_net.c | 37 ++++++++-----------------------------
 1 file changed, 8 insertions(+), 29 deletions(-)

diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index 8da8a86a10..32aa2c19a9 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -2670,32 +2670,6 @@ virtio_dev_pktmbuf_prep(struct virtio_net *dev, struct rte_mbuf *pkt,
 	return -1;
 }
 
-/*
- * Allocate a host supported pktmbuf.
- */
-static __rte_always_inline struct rte_mbuf *
-virtio_dev_pktmbuf_alloc(struct virtio_net *dev, struct rte_mempool *mp,
-			 uint32_t data_len)
-{
-	struct rte_mbuf *pkt = rte_pktmbuf_alloc(mp);
-
-	if (unlikely(pkt == NULL)) {
-		VHOST_LOG_DATA(ERR,
-			"Failed to allocate memory for mbuf.\n");
-		return NULL;
-	}
-
-	if (virtio_dev_pktmbuf_prep(dev, pkt, data_len)) {
-		/* Data doesn't fit into the buffer and the host supports
-		 * only linear buffers
-		 */
-		rte_pktmbuf_free(pkt);
-		return NULL;
-	}
-
-	return pkt;
-}
-
 __rte_always_inline
 static uint16_t
 virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
@@ -2725,6 +2699,9 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 	VHOST_LOG_DATA(DEBUG, "(%d) about to dequeue %u buffers\n",
 			dev->vid, count);
 
+	if (rte_pktmbuf_alloc_bulk(mbuf_pool, pkts, count))
+		return 0;
+
 	for (i = 0; i < count; i++) {
 		struct buf_vector buf_vec[BUF_VECTOR_MAX];
 		uint16_t head_idx;
@@ -2741,8 +2718,8 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 
 		update_shadow_used_ring_split(vq, head_idx, 0);
 
-		pkts[i] = virtio_dev_pktmbuf_alloc(dev, mbuf_pool, buf_len);
-		if (unlikely(pkts[i] == NULL)) {
+		err = virtio_dev_pktmbuf_prep(dev, pkts[i], buf_len);
+		if (unlikely(err)) {
 			/*
 			 * mbuf allocation fails for jumbo packets when external
 			 * buffer allocation is not allowed and linear buffer
@@ -2762,7 +2739,6 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 		err = copy_desc_to_mbuf(dev, vq, buf_vec, nr_vec, pkts[i],
 				mbuf_pool, legacy_ol_flags);
 		if (unlikely(err)) {
-			rte_pktmbuf_free(pkts[i]);
 			if (!allocerr_warned) {
 				VHOST_LOG_DATA(ERR,
 					"Failed to copy desc to mbuf on %s.\n",
@@ -2775,6 +2751,9 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 		}
 	}
 
+	if (i != count)
+		rte_pktmbuf_free_bulk(&pkts[i - 1], count - i);
+
 	vq->last_avail_idx += i;
 
 	do_data_copy_dequeue(vq);
-- 
2.30.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: allocate and free packets in bulk in Tx split
  2021-05-28 10:26 [dpdk-dev] [PATCH] vhost: allocate and free packets in bulk in Tx split Balazs Nemeth
@ 2021-06-04 11:48 ` Maxime Coquelin
  2021-06-04 12:14 ` [dpdk-dev] [PATCH v2] " Balazs Nemeth
  1 sibling, 0 replies; 7+ messages in thread
From: Maxime Coquelin @ 2021-06-04 11:48 UTC (permalink / raw)
  To: Balazs Nemeth, dev, maxime.coquelin, david.marchand

Hi Balazs,

On 5/28/21 12:26 PM, Balazs Nemeth wrote:
> Same idea as commit a287ac28919d ("vhost: allocate and free packets
> in bulk in Tx packed"), allocate and free packets in bulk. Also remove
> the unused function virtio_dev_pktmbuf_alloc.
> 
> Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
> ---
>  lib/vhost/virtio_net.c | 37 ++++++++-----------------------------
>  1 file changed, 8 insertions(+), 29 deletions(-)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH v2] vhost: allocate and free packets in bulk in Tx split
  2021-05-28 10:26 [dpdk-dev] [PATCH] vhost: allocate and free packets in bulk in Tx split Balazs Nemeth
  2021-06-04 11:48 ` Maxime Coquelin
@ 2021-06-04 12:14 ` Balazs Nemeth
  2021-06-08  6:05   ` Xia, Chenbo
  2021-06-08 11:37   ` [dpdk-dev] [PATCH v3] " Balazs Nemeth
  1 sibling, 2 replies; 7+ messages in thread
From: Balazs Nemeth @ 2021-06-04 12:14 UTC (permalink / raw)
  To: bnemeth, dev; +Cc: maxime.coquelin, david.marchand

Same idea as commit a287ac28919d ("vhost: allocate and free packets
in bulk in Tx packed"), allocate and free packets in bulk. Also remove
the unused function virtio_dev_pktmbuf_alloc.

Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
---
 lib/vhost/virtio_net.c | 37 ++++++++-----------------------------
 1 file changed, 8 insertions(+), 29 deletions(-)

diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index 8da8a86a10..fa387b5ff4 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -2670,32 +2670,6 @@ virtio_dev_pktmbuf_prep(struct virtio_net *dev, struct rte_mbuf *pkt,
 	return -1;
 }
 
-/*
- * Allocate a host supported pktmbuf.
- */
-static __rte_always_inline struct rte_mbuf *
-virtio_dev_pktmbuf_alloc(struct virtio_net *dev, struct rte_mempool *mp,
-			 uint32_t data_len)
-{
-	struct rte_mbuf *pkt = rte_pktmbuf_alloc(mp);
-
-	if (unlikely(pkt == NULL)) {
-		VHOST_LOG_DATA(ERR,
-			"Failed to allocate memory for mbuf.\n");
-		return NULL;
-	}
-
-	if (virtio_dev_pktmbuf_prep(dev, pkt, data_len)) {
-		/* Data doesn't fit into the buffer and the host supports
-		 * only linear buffers
-		 */
-		rte_pktmbuf_free(pkt);
-		return NULL;
-	}
-
-	return pkt;
-}
-
 __rte_always_inline
 static uint16_t
 virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
@@ -2725,6 +2699,9 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 	VHOST_LOG_DATA(DEBUG, "(%d) about to dequeue %u buffers\n",
 			dev->vid, count);
 
+	if (rte_pktmbuf_alloc_bulk(mbuf_pool, pkts, count))
+		return 0;
+
 	for (i = 0; i < count; i++) {
 		struct buf_vector buf_vec[BUF_VECTOR_MAX];
 		uint16_t head_idx;
@@ -2741,8 +2718,8 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 
 		update_shadow_used_ring_split(vq, head_idx, 0);
 
-		pkts[i] = virtio_dev_pktmbuf_alloc(dev, mbuf_pool, buf_len);
-		if (unlikely(pkts[i] == NULL)) {
+		err = virtio_dev_pktmbuf_prep(dev, pkts[i], buf_len);
+		if (unlikely(err)) {
 			/*
 			 * mbuf allocation fails for jumbo packets when external
 			 * buffer allocation is not allowed and linear buffer
@@ -2762,7 +2739,6 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 		err = copy_desc_to_mbuf(dev, vq, buf_vec, nr_vec, pkts[i],
 				mbuf_pool, legacy_ol_flags);
 		if (unlikely(err)) {
-			rte_pktmbuf_free(pkts[i]);
 			if (!allocerr_warned) {
 				VHOST_LOG_DATA(ERR,
 					"Failed to copy desc to mbuf on %s.\n",
@@ -2775,6 +2751,9 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 		}
 	}
 
+	if (dropped)
+		rte_pktmbuf_free_bulk(&pkts[i - 1], count - i + 1);
+
 	vq->last_avail_idx += i;
 
 	do_data_copy_dequeue(vq);
-- 
2.31.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v2] vhost: allocate and free packets in bulk in Tx split
  2021-06-04 12:14 ` [dpdk-dev] [PATCH v2] " Balazs Nemeth
@ 2021-06-08  6:05   ` Xia, Chenbo
  2021-06-08 11:37   ` [dpdk-dev] [PATCH v3] " Balazs Nemeth
  1 sibling, 0 replies; 7+ messages in thread
From: Xia, Chenbo @ 2021-06-08  6:05 UTC (permalink / raw)
  To: Balazs Nemeth, dev; +Cc: maxime.coquelin, david.marchand

Hi Balazs,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Balazs Nemeth
> Sent: Friday, June 4, 2021 8:14 PM
> To: bnemeth@redhat.com; dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; david.marchand@redhat.com
> Subject: [dpdk-dev] [PATCH v2] vhost: allocate and free packets in bulk in Tx
> split
> 
> Same idea as commit a287ac28919d ("vhost: allocate and free packets
> in bulk in Tx packed"), allocate and free packets in bulk. Also remove
> the unused function virtio_dev_pktmbuf_alloc.
> 
> Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>

I checked history and I find Maxime added his R-by? Better
add his R-by in commit log for new version 😊

> ---
>  lib/vhost/virtio_net.c | 37 ++++++++-----------------------------
>  1 file changed, 8 insertions(+), 29 deletions(-)
> 
> diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
> index 8da8a86a10..fa387b5ff4 100644
> --- a/lib/vhost/virtio_net.c
> +++ b/lib/vhost/virtio_net.c
> @@ -2670,32 +2670,6 @@ virtio_dev_pktmbuf_prep(struct virtio_net *dev, struct
> rte_mbuf *pkt,
>  	return -1;
>  }
> 
> -/*
> - * Allocate a host supported pktmbuf.
> - */
> -static __rte_always_inline struct rte_mbuf *
> -virtio_dev_pktmbuf_alloc(struct virtio_net *dev, struct rte_mempool *mp,
> -			 uint32_t data_len)
> -{
> -	struct rte_mbuf *pkt = rte_pktmbuf_alloc(mp);
> -
> -	if (unlikely(pkt == NULL)) {
> -		VHOST_LOG_DATA(ERR,
> -			"Failed to allocate memory for mbuf.\n");
> -		return NULL;
> -	}
> -
> -	if (virtio_dev_pktmbuf_prep(dev, pkt, data_len)) {
> -		/* Data doesn't fit into the buffer and the host supports
> -		 * only linear buffers
> -		 */
> -		rte_pktmbuf_free(pkt);
> -		return NULL;
> -	}
> -
> -	return pkt;
> -}
> -
>  __rte_always_inline
>  static uint16_t
>  virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
> @@ -2725,6 +2699,9 @@ virtio_dev_tx_split(struct virtio_net *dev, struct
> vhost_virtqueue *vq,
>  	VHOST_LOG_DATA(DEBUG, "(%d) about to dequeue %u buffers\n",
>  			dev->vid, count);
> 
> +	if (rte_pktmbuf_alloc_bulk(mbuf_pool, pkts, count))
> +		return 0;
> +
>  	for (i = 0; i < count; i++) {
>  		struct buf_vector buf_vec[BUF_VECTOR_MAX];
>  		uint16_t head_idx;
> @@ -2741,8 +2718,8 @@ virtio_dev_tx_split(struct virtio_net *dev, struct
> vhost_virtqueue *vq,
> 
>  		update_shadow_used_ring_split(vq, head_idx, 0);
> 
> -		pkts[i] = virtio_dev_pktmbuf_alloc(dev, mbuf_pool, buf_len);
> -		if (unlikely(pkts[i] == NULL)) {
> +		err = virtio_dev_pktmbuf_prep(dev, pkts[i], buf_len);
> +		if (unlikely(err)) {
>  			/*
>  			 * mbuf allocation fails for jumbo packets when external
>  			 * buffer allocation is not allowed and linear buffer

I think above comment should be updated too as now mbuf allocation is moved to
another place.

Thanks,
Chenbo

> @@ -2762,7 +2739,6 @@ virtio_dev_tx_split(struct virtio_net *dev, struct
> vhost_virtqueue *vq,
>  		err = copy_desc_to_mbuf(dev, vq, buf_vec, nr_vec, pkts[i],
>  				mbuf_pool, legacy_ol_flags);
>  		if (unlikely(err)) {
> -			rte_pktmbuf_free(pkts[i]);
>  			if (!allocerr_warned) {
>  				VHOST_LOG_DATA(ERR,
>  					"Failed to copy desc to mbuf on %s.\n",
> @@ -2775,6 +2751,9 @@ virtio_dev_tx_split(struct virtio_net *dev, struct
> vhost_virtqueue *vq,
>  		}
>  	}
> 
> +	if (dropped)
> +		rte_pktmbuf_free_bulk(&pkts[i - 1], count - i + 1);
> +
>  	vq->last_avail_idx += i;
> 
>  	do_data_copy_dequeue(vq);
> --
> 2.31.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH v3] vhost: allocate and free packets in bulk in Tx split
  2021-06-04 12:14 ` [dpdk-dev] [PATCH v2] " Balazs Nemeth
  2021-06-08  6:05   ` Xia, Chenbo
@ 2021-06-08 11:37   ` Balazs Nemeth
  2021-06-08 11:41     ` [dpdk-dev] [PATCH v4] " Balazs Nemeth
  1 sibling, 1 reply; 7+ messages in thread
From: Balazs Nemeth @ 2021-06-08 11:37 UTC (permalink / raw)
  To: bnemeth, dev; +Cc: chenbo.xia, maxime.coquelin, david.marchand

Same idea as commit a287ac28919d ("vhost: allocate and free packets
in bulk in Tx packed"), allocate and free packets in bulk. Also remove
the unused function virtio_dev_pktmbuf_alloc.

Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/vhost/virtio_net.c | 37 ++++++++-----------------------------
 1 file changed, 8 insertions(+), 29 deletions(-)

diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index 8da8a86a10..fa387b5ff4 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -2670,32 +2670,6 @@ virtio_dev_pktmbuf_prep(struct virtio_net *dev, struct rte_mbuf *pkt,
 	return -1;
 }
 
-/*
- * Allocate a host supported pktmbuf.
- */
-static __rte_always_inline struct rte_mbuf *
-virtio_dev_pktmbuf_alloc(struct virtio_net *dev, struct rte_mempool *mp,
-			 uint32_t data_len)
-{
-	struct rte_mbuf *pkt = rte_pktmbuf_alloc(mp);
-
-	if (unlikely(pkt == NULL)) {
-		VHOST_LOG_DATA(ERR,
-			"Failed to allocate memory for mbuf.\n");
-		return NULL;
-	}
-
-	if (virtio_dev_pktmbuf_prep(dev, pkt, data_len)) {
-		/* Data doesn't fit into the buffer and the host supports
-		 * only linear buffers
-		 */
-		rte_pktmbuf_free(pkt);
-		return NULL;
-	}
-
-	return pkt;
-}
-
 __rte_always_inline
 static uint16_t
 virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
@@ -2725,6 +2699,9 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 	VHOST_LOG_DATA(DEBUG, "(%d) about to dequeue %u buffers\n",
 			dev->vid, count);
 
+	if (rte_pktmbuf_alloc_bulk(mbuf_pool, pkts, count))
+		return 0;
+
 	for (i = 0; i < count; i++) {
 		struct buf_vector buf_vec[BUF_VECTOR_MAX];
 		uint16_t head_idx;
@@ -2741,8 +2718,8 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 
 		update_shadow_used_ring_split(vq, head_idx, 0);
 
-		pkts[i] = virtio_dev_pktmbuf_alloc(dev, mbuf_pool, buf_len);
-		if (unlikely(pkts[i] == NULL)) {
+		err = virtio_dev_pktmbuf_prep(dev, pkts[i], buf_len);
+		if (unlikely(err)) {
 			/*
 			 * mbuf allocation fails for jumbo packets when external
 			 * buffer allocation is not allowed and linear buffer
@@ -2762,7 +2739,6 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 		err = copy_desc_to_mbuf(dev, vq, buf_vec, nr_vec, pkts[i],
 				mbuf_pool, legacy_ol_flags);
 		if (unlikely(err)) {
-			rte_pktmbuf_free(pkts[i]);
 			if (!allocerr_warned) {
 				VHOST_LOG_DATA(ERR,
 					"Failed to copy desc to mbuf on %s.\n",
@@ -2775,6 +2751,9 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 		}
 	}
 
+	if (dropped)
+		rte_pktmbuf_free_bulk(&pkts[i - 1], count - i + 1);
+
 	vq->last_avail_idx += i;
 
 	do_data_copy_dequeue(vq);
-- 
2.31.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH v4] vhost: allocate and free packets in bulk in Tx split
  2021-06-08 11:37   ` [dpdk-dev] [PATCH v3] " Balazs Nemeth
@ 2021-06-08 11:41     ` Balazs Nemeth
  2021-06-17 16:48       ` Maxime Coquelin
  0 siblings, 1 reply; 7+ messages in thread
From: Balazs Nemeth @ 2021-06-08 11:41 UTC (permalink / raw)
  To: bnemeth, dev; +Cc: chenbo.xia, maxime.coquelin, david.marchand

Same idea as commit a287ac28919d ("vhost: allocate and free packets
in bulk in Tx packed"), allocate and free packets in bulk. Also remove
the unused function virtio_dev_pktmbuf_alloc.

Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/vhost/virtio_net.c | 40 +++++++++++-----------------------------
 1 file changed, 11 insertions(+), 29 deletions(-)

diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index 8da8a86a10..b93482587c 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -2652,6 +2652,9 @@ virtio_dev_extbuf_alloc(struct rte_mbuf *pkt, uint32_t size)
 	return 0;
 }
 
+/*
+ * Prepare a host supported pktmbuf.
+ */
 static __rte_always_inline int
 virtio_dev_pktmbuf_prep(struct virtio_net *dev, struct rte_mbuf *pkt,
 			 uint32_t data_len)
@@ -2670,32 +2673,6 @@ virtio_dev_pktmbuf_prep(struct virtio_net *dev, struct rte_mbuf *pkt,
 	return -1;
 }
 
-/*
- * Allocate a host supported pktmbuf.
- */
-static __rte_always_inline struct rte_mbuf *
-virtio_dev_pktmbuf_alloc(struct virtio_net *dev, struct rte_mempool *mp,
-			 uint32_t data_len)
-{
-	struct rte_mbuf *pkt = rte_pktmbuf_alloc(mp);
-
-	if (unlikely(pkt == NULL)) {
-		VHOST_LOG_DATA(ERR,
-			"Failed to allocate memory for mbuf.\n");
-		return NULL;
-	}
-
-	if (virtio_dev_pktmbuf_prep(dev, pkt, data_len)) {
-		/* Data doesn't fit into the buffer and the host supports
-		 * only linear buffers
-		 */
-		rte_pktmbuf_free(pkt);
-		return NULL;
-	}
-
-	return pkt;
-}
-
 __rte_always_inline
 static uint16_t
 virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
@@ -2725,6 +2702,9 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 	VHOST_LOG_DATA(DEBUG, "(%d) about to dequeue %u buffers\n",
 			dev->vid, count);
 
+	if (rte_pktmbuf_alloc_bulk(mbuf_pool, pkts, count))
+		return 0;
+
 	for (i = 0; i < count; i++) {
 		struct buf_vector buf_vec[BUF_VECTOR_MAX];
 		uint16_t head_idx;
@@ -2741,8 +2721,8 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 
 		update_shadow_used_ring_split(vq, head_idx, 0);
 
-		pkts[i] = virtio_dev_pktmbuf_alloc(dev, mbuf_pool, buf_len);
-		if (unlikely(pkts[i] == NULL)) {
+		err = virtio_dev_pktmbuf_prep(dev, pkts[i], buf_len);
+		if (unlikely(err)) {
 			/*
 			 * mbuf allocation fails for jumbo packets when external
 			 * buffer allocation is not allowed and linear buffer
@@ -2762,7 +2742,6 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 		err = copy_desc_to_mbuf(dev, vq, buf_vec, nr_vec, pkts[i],
 				mbuf_pool, legacy_ol_flags);
 		if (unlikely(err)) {
-			rte_pktmbuf_free(pkts[i]);
 			if (!allocerr_warned) {
 				VHOST_LOG_DATA(ERR,
 					"Failed to copy desc to mbuf on %s.\n",
@@ -2775,6 +2754,9 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 		}
 	}
 
+	if (dropped)
+		rte_pktmbuf_free_bulk(&pkts[i - 1], count - i + 1);
+
 	vq->last_avail_idx += i;
 
 	do_data_copy_dequeue(vq);
-- 
2.31.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v4] vhost: allocate and free packets in bulk in Tx split
  2021-06-08 11:41     ` [dpdk-dev] [PATCH v4] " Balazs Nemeth
@ 2021-06-17 16:48       ` Maxime Coquelin
  0 siblings, 0 replies; 7+ messages in thread
From: Maxime Coquelin @ 2021-06-17 16:48 UTC (permalink / raw)
  To: Balazs Nemeth, dev; +Cc: chenbo.xia, david.marchand



On 6/8/21 1:41 PM, Balazs Nemeth wrote:
> Same idea as commit a287ac28919d ("vhost: allocate and free packets
> in bulk in Tx packed"), allocate and free packets in bulk. Also remove
> the unused function virtio_dev_pktmbuf_alloc.
> 
> Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  lib/vhost/virtio_net.c | 40 +++++++++++-----------------------------
>  1 file changed, 11 insertions(+), 29 deletions(-)
> 

Applied to dpdk-next-virtio/main.

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-06-17 16:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-28 10:26 [dpdk-dev] [PATCH] vhost: allocate and free packets in bulk in Tx split Balazs Nemeth
2021-06-04 11:48 ` Maxime Coquelin
2021-06-04 12:14 ` [dpdk-dev] [PATCH v2] " Balazs Nemeth
2021-06-08  6:05   ` Xia, Chenbo
2021-06-08 11:37   ` [dpdk-dev] [PATCH v3] " Balazs Nemeth
2021-06-08 11:41     ` [dpdk-dev] [PATCH v4] " Balazs Nemeth
2021-06-17 16:48       ` Maxime Coquelin

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git