DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] virtio: Fix vring entry number issue
@ 2014-10-11  8:05 Ouyang Changchun
  2014-10-14 15:12 ` [dpdk-dev] [PATCH v3] " Ouyang Changchun
  0 siblings, 1 reply; 8+ messages in thread
From: Ouyang Changchun @ 2014-10-11  8:05 UTC (permalink / raw)
  To: dev

-- V1 change:
  Fix one issue in virtio TX: it needs one more vring descriptor to hold the virtio 
  header when transmitting packets, it is used later to determine whether to free
  more entries from used vring.

  It fixes failing to transmit any packet with 1 segment in the circumstance of only
  1 descriptor in the vring free list.

-- V2 change:
  Refine description, 'vring descriptor' is more accurate than 'vring entry';
  Accordingly update test condition (it needs one more descriptor for virtio header) to 
  put packets to transmit queue.
 
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
 lib/librte_pmd_virtio/virtio_rxtx.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c b/lib/librte_pmd_virtio/virtio_rxtx.c
index 0b10108..c736362 100644
--- a/lib/librte_pmd_virtio/virtio_rxtx.c
+++ b/lib/librte_pmd_virtio/virtio_rxtx.c
@@ -699,7 +699,8 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	num = (uint16_t)(likely(nb_used < VIRTIO_MBUF_BURST_SZ) ? nb_used : VIRTIO_MBUF_BURST_SZ);
 
 	while (nb_tx < nb_pkts) {
-		int need = tx_pkts[nb_tx]->pkt.nb_segs - txvq->vq_free_cnt;
+		/* Need one more descriptor for virtio header. */
+		int need = tx_pkts[nb_tx]->pkt.nb_segs - txvq->vq_free_cnt + 1;
 		int deq_cnt = RTE_MIN(need, (int)num);
 
 		num -= (deq_cnt > 0) ? deq_cnt : 0;
@@ -708,7 +709,12 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 			deq_cnt--;
 		}
 
-		if (tx_pkts[nb_tx]->pkt.nb_segs <= txvq->vq_free_cnt) {
+		need = (int)tx_pkts[nb_tx]->pkt.nb_segs - txvq->vq_free_cnt + 1;
+		/*
+		 * Zero or negative value indicates it has enough free
+		 * decriptors to transmit.
+		 */
+		if (need <= 0) {
 			txm = tx_pkts[nb_tx];
 			/* Enqueue Packet buffers */
 			error = virtqueue_enqueue_xmit(txvq, txm);
-- 
1.8.4.2

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

* [dpdk-dev] [PATCH v3] virtio: Fix vring entry number issue
  2014-10-11  8:05 [dpdk-dev] [PATCH v2] virtio: Fix vring entry number issue Ouyang Changchun
@ 2014-10-14 15:12 ` Ouyang Changchun
  2014-10-14 15:28   ` Ouyang, Changchun
  2014-10-14 16:03   ` [dpdk-dev] [PATCH v4] " Ouyang Changchun
  0 siblings, 2 replies; 8+ messages in thread
From: Ouyang Changchun @ 2014-10-14 15:12 UTC (permalink / raw)
  To: dev

-- V1 change:
  Fix one issue in virtio TX: it needs one more vring descriptor to hold the virtio
  header when transmitting packets, it is used later to determine whether to free
  more entries from used vring.
 
  It fixes failing to transmit any packet with 1 segment in the circumstance of only
  1 descriptor in the vring free list.
 
-- V2 change:
  Refine description, 'vring descriptor' is more accurate than 'vring entry';
  Accordingly update test condition (it needs one more descriptor for virtio header) to
  put packets to transmit queue.

-- V3 change:
  Resolve compilation issue due to mbuf re-structure.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
 lib/librte_pmd_virtio/virtio_rxtx.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c b/lib/librte_pmd_virtio/virtio_rxtx.c
index 0b10108..ac44c65 100644
--- a/lib/librte_pmd_virtio/virtio_rxtx.c
+++ b/lib/librte_pmd_virtio/virtio_rxtx.c
@@ -699,7 +699,8 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	num = (uint16_t)(likely(nb_used < VIRTIO_MBUF_BURST_SZ) ? nb_used : VIRTIO_MBUF_BURST_SZ);
 
 	while (nb_tx < nb_pkts) {
-		int need = tx_pkts[nb_tx]->pkt.nb_segs - txvq->vq_free_cnt;
+		/* Need one more descriptor for virtio header. */
+		int need = tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1;
 		int deq_cnt = RTE_MIN(need, (int)num);
 
 		num -= (deq_cnt > 0) ? deq_cnt : 0;
@@ -708,7 +709,12 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 			deq_cnt--;
 		}
 
-		if (tx_pkts[nb_tx]->pkt.nb_segs <= txvq->vq_free_cnt) {
+		need = (int)tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1;
+		/*
+		 * Zero or negative value indicates it has enough free
+		 * decriptors to transmit.
+		 */
+		if (need <= 0) {
 			txm = tx_pkts[nb_tx];
 			/* Enqueue Packet buffers */
 			error = virtqueue_enqueue_xmit(txvq, txm);
-- 
1.8.4.2

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

* Re: [dpdk-dev] [PATCH v3] virtio: Fix vring entry number issue
  2014-10-14 15:12 ` [dpdk-dev] [PATCH v3] " Ouyang Changchun
@ 2014-10-14 15:28   ` Ouyang, Changchun
  2014-10-14 16:03   ` [dpdk-dev] [PATCH v4] " Ouyang Changchun
  1 sibling, 0 replies; 8+ messages in thread
From: Ouyang, Changchun @ 2014-10-14 15:28 UTC (permalink / raw)
  To: 'Olivier MATZ'; +Cc: dev

Hi Olivier,

Any other comments for this v3 patch?

Thanks and regards,
Changchun

> -----Original Message-----
> From: Ouyang, Changchun
> Sent: Tuesday, October 14, 2014 11:13 PM
> To: dev@dpdk.org
> Cc: Cao, Waterman; Ouyang, Changchun
> Subject: [PATCH v3] virtio: Fix vring entry number issue
> 
> -- V1 change:
>   Fix one issue in virtio TX: it needs one more vring descriptor to hold the
> virtio
>   header when transmitting packets, it is used later to determine whether to
> free
>   more entries from used vring.
> 
>   It fixes failing to transmit any packet with 1 segment in the circumstance of
> only
>   1 descriptor in the vring free list.
> 
> -- V2 change:
>   Refine description, 'vring descriptor' is more accurate than 'vring entry';
>   Accordingly update test condition (it needs one more descriptor for virtio
> header) to
>   put packets to transmit queue.
> 
> -- V3 change:
>   Resolve compilation issue due to mbuf re-structure.
> 
> Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
> ---
>  lib/librte_pmd_virtio/virtio_rxtx.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c
> b/lib/librte_pmd_virtio/virtio_rxtx.c
> index 0b10108..ac44c65 100644
> --- a/lib/librte_pmd_virtio/virtio_rxtx.c
> +++ b/lib/librte_pmd_virtio/virtio_rxtx.c
> @@ -699,7 +699,8 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf
> **tx_pkts, uint16_t nb_pkts)
>  	num = (uint16_t)(likely(nb_used < VIRTIO_MBUF_BURST_SZ) ?
> nb_used : VIRTIO_MBUF_BURST_SZ);
> 
>  	while (nb_tx < nb_pkts) {
> -		int need = tx_pkts[nb_tx]->pkt.nb_segs - txvq-
> >vq_free_cnt;
> +		/* Need one more descriptor for virtio header. */
> +		int need = tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1;
>  		int deq_cnt = RTE_MIN(need, (int)num);
> 
>  		num -= (deq_cnt > 0) ? deq_cnt : 0;
> @@ -708,7 +709,12 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf
> **tx_pkts, uint16_t nb_pkts)
>  			deq_cnt--;
>  		}
> 
> -		if (tx_pkts[nb_tx]->pkt.nb_segs <= txvq->vq_free_cnt) {
> +		need = (int)tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt +
> 1;
> +		/*
> +		 * Zero or negative value indicates it has enough free
> +		 * decriptors to transmit.
> +		 */
> +		if (need <= 0) {
>  			txm = tx_pkts[nb_tx];
>  			/* Enqueue Packet buffers */
>  			error = virtqueue_enqueue_xmit(txvq, txm);
> --
> 1.8.4.2

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

* [dpdk-dev] [PATCH v4] virtio: Fix vring entry number issue
  2014-10-14 15:12 ` [dpdk-dev] [PATCH v3] " Ouyang Changchun
  2014-10-14 15:28   ` Ouyang, Changchun
@ 2014-10-14 16:03   ` Ouyang Changchun
  2014-10-14 16:26     ` Xie, Huawei
  2014-10-15  3:11     ` [dpdk-dev] [PATCH v5] " Ouyang Changchun
  1 sibling, 2 replies; 8+ messages in thread
From: Ouyang Changchun @ 2014-10-14 16:03 UTC (permalink / raw)
  To: dev

  Fix one issue in virtio TX: it needs one more vring descriptor to hold the virtio
  header when transmitting packets, it is used later to determine whether to free
  more entries from used vring.
  It fixes failing to transmit any packet with 1 segment in the circumstance of only
  1 descriptor in the vring free list.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
---
-V4 change:
  Relocate those changelog and annotation here.

-V3 change:
  Resolve compilation issue due to mbuf re-structure.

-V2 change:
  Refine description, 'vring descriptor' is more accurate than 'vring entry';
  Accordingly update test condition (it needs one more descriptor for virtio header) to
  put packets to transmit queue.

-V1 change:
  Fix the vring descriptor issue in virtio TX, it needs one more vring descriptor to hold the
  virtio header.

 lib/librte_pmd_virtio/virtio_rxtx.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c b/lib/librte_pmd_virtio/virtio_rxtx.c
index 0b10108..ac44c65 100644
--- a/lib/librte_pmd_virtio/virtio_rxtx.c
+++ b/lib/librte_pmd_virtio/virtio_rxtx.c
@@ -699,7 +699,8 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	num = (uint16_t)(likely(nb_used < VIRTIO_MBUF_BURST_SZ) ? nb_used : VIRTIO_MBUF_BURST_SZ);
 
 	while (nb_tx < nb_pkts) {
-		int need = tx_pkts[nb_tx]->pkt.nb_segs - txvq->vq_free_cnt;
+		/* Need one more descriptor for virtio header. */
+		int need = tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1;
 		int deq_cnt = RTE_MIN(need, (int)num);
 
 		num -= (deq_cnt > 0) ? deq_cnt : 0;
@@ -708,7 +709,12 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 			deq_cnt--;
 		}
 
-		if (tx_pkts[nb_tx]->pkt.nb_segs <= txvq->vq_free_cnt) {
+		need = (int)tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1;
+		/*
+		 * Zero or negative value indicates it has enough free
+		 * decriptors to transmit.
+		 */
+		if (need <= 0) {
 			txm = tx_pkts[nb_tx];
 			/* Enqueue Packet buffers */
 			error = virtqueue_enqueue_xmit(txvq, txm);
-- 
1.8.4.2

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

* Re: [dpdk-dev] [PATCH v4] virtio: Fix vring entry number issue
  2014-10-14 16:03   ` [dpdk-dev] [PATCH v4] " Ouyang Changchun
@ 2014-10-14 16:26     ` Xie, Huawei
  2014-10-15  3:14       ` Ouyang, Changchun
  2014-10-15  3:11     ` [dpdk-dev] [PATCH v5] " Ouyang Changchun
  1 sibling, 1 reply; 8+ messages in thread
From: Xie, Huawei @ 2014-10-14 16:26 UTC (permalink / raw)
  To: Ouyang, Changchun, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ouyang Changchun
> Sent: Tuesday, October 14, 2014 9:04 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v4] virtio: Fix vring entry number issue
> 
>   Fix one issue in virtio TX: it needs one more vring descriptor to hold the virtio
>   header when transmitting packets, it is used later to determine whether to free
>   more entries from used vring.
>   It fixes failing to transmit any packet with 1 segment in the circumstance of
> only
>   1 descriptor in the vring free list.
> 
> Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
> Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
> ---
> -V4 change:
>   Relocate those changelog and annotation here.
> 
> -V3 change:
>   Resolve compilation issue due to mbuf re-structure.
> 
> -V2 change:
>   Refine description, 'vring descriptor' is more accurate than 'vring entry';
>   Accordingly update test condition (it needs one more descriptor for virtio
> header) to
>   put packets to transmit queue.
> 
> -V1 change:
>   Fix the vring descriptor issue in virtio TX, it needs one more vring descriptor to
> hold the
>   virtio header.
> 
>  lib/librte_pmd_virtio/virtio_rxtx.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c
> b/lib/librte_pmd_virtio/virtio_rxtx.c
> index 0b10108..ac44c65 100644
> --- a/lib/librte_pmd_virtio/virtio_rxtx.c
> +++ b/lib/librte_pmd_virtio/virtio_rxtx.c
> @@ -699,7 +699,8 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf
> **tx_pkts, uint16_t nb_pkts)
>  	num = (uint16_t)(likely(nb_used < VIRTIO_MBUF_BURST_SZ) ? nb_used :
> VIRTIO_MBUF_BURST_SZ);
> 
>  	while (nb_tx < nb_pkts) {
> -		int need = tx_pkts[nb_tx]->pkt.nb_segs - txvq->vq_free_cnt;
> +		/* Need one more descriptor for virtio header. */
> +		int need = tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1;
>  		int deq_cnt = RTE_MIN(need, (int)num);
> 
>  		num -= (deq_cnt > 0) ? deq_cnt : 0;
> @@ -708,7 +709,12 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf
> **tx_pkts, uint16_t nb_pkts)
>  			deq_cnt--;
>  		}
> 
> -		if (tx_pkts[nb_tx]->pkt.nb_segs <= txvq->vq_free_cnt) {
> +		need = (int)tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1;
> +		/*
> +		 * Zero or negative value indicates it has enough free
> +		 * decriptors to transmit.
> +		 */
> +		if (need <= 0) {
Could we put a branch hint to favor the fast path?
>  			txm = tx_pkts[nb_tx];
>  			/* Enqueue Packet buffers */
>  			error = virtqueue_enqueue_xmit(txvq, txm);
> --
> 1.8.4.2

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

* [dpdk-dev] [PATCH v5] virtio: Fix vring entry number issue
  2014-10-14 16:03   ` [dpdk-dev] [PATCH v4] " Ouyang Changchun
  2014-10-14 16:26     ` Xie, Huawei
@ 2014-10-15  3:11     ` Ouyang Changchun
  2014-10-15  6:34       ` Thomas Monjalon
  1 sibling, 1 reply; 8+ messages in thread
From: Ouyang Changchun @ 2014-10-15  3:11 UTC (permalink / raw)
  To: dev

  Fix one issue in virtio TX: it needs one more vring descriptor to hold the virtio
  header when transmitting packets, it is used later to determine whether to free
  more entries from used vring.
  It fixes failing to transmit any packet with 1 segment in the circumstance of only
  1 descriptor in the vring free list.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
---

-V5 change:
  Use 'likely' to hint compiler to generate favorable codes.

-V4 change:
  Relocate those changelog and annotation here.
 
-V3 change:
  Resolve compilation issue due to mbuf re-structure.
 
-V2 change:
  Refine description, 'vring descriptor' is more accurate than 'vring entry';
  Accordingly update test condition (it needs one more descriptor for virtio header) to
  put packets to transmit queue.
 
-V1 change:
  Fix the vring descriptor issue in virtio TX, it needs one more vring descriptor to hold the
  virtio header.

 lib/librte_pmd_virtio/virtio_rxtx.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c b/lib/librte_pmd_virtio/virtio_rxtx.c
index ad6401c..3f6bad2 100644
--- a/lib/librte_pmd_virtio/virtio_rxtx.c
+++ b/lib/librte_pmd_virtio/virtio_rxtx.c
@@ -699,7 +699,8 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	num = (uint16_t)(likely(nb_used < VIRTIO_MBUF_BURST_SZ) ? nb_used : VIRTIO_MBUF_BURST_SZ);
 
 	while (nb_tx < nb_pkts) {
-		int need = tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt;
+		/* Need one more descriptor for virtio header. */
+		int need = tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1;
 		int deq_cnt = RTE_MIN(need, (int)num);
 
 		num -= (deq_cnt > 0) ? deq_cnt : 0;
@@ -708,7 +709,12 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 			deq_cnt--;
 		}
 
-		if (tx_pkts[nb_tx]->nb_segs <= txvq->vq_free_cnt) {
+		need = (int)tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1;
+		/*
+		 * Zero or negative value indicates it has enough free
+		 * descriptors to use for transmitting.
+		 */
+		if (likely(need <= 0)) {
 			txm = tx_pkts[nb_tx];
 			/* Enqueue Packet buffers */
 			error = virtqueue_enqueue_xmit(txvq, txm);
-- 
1.8.4.2

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

* Re: [dpdk-dev] [PATCH v4] virtio: Fix vring entry number issue
  2014-10-14 16:26     ` Xie, Huawei
@ 2014-10-15  3:14       ` Ouyang, Changchun
  0 siblings, 0 replies; 8+ messages in thread
From: Ouyang, Changchun @ 2014-10-15  3:14 UTC (permalink / raw)
  To: Xie, Huawei, dev

Hi Huawei,
I have v5 patch for this comment.
Thanks,
Changchun

> -----Original Message-----
> From: Xie, Huawei
> Sent: Wednesday, October 15, 2014 12:26 AM
> To: Ouyang, Changchun; dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v4] virtio: Fix vring entry number issue
> 
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ouyang
> Changchun
> > Sent: Tuesday, October 14, 2014 9:04 AM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH v4] virtio: Fix vring entry number issue
> >
> >   Fix one issue in virtio TX: it needs one more vring descriptor to hold the
> virtio
> >   header when transmitting packets, it is used later to determine whether
> to free
> >   more entries from used vring.
> >   It fixes failing to transmit any packet with 1 segment in the
> > circumstance of only
> >   1 descriptor in the vring free list.
> >
> > Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
> > Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
> > ---
> > -V4 change:
> >   Relocate those changelog and annotation here.
> >
> > -V3 change:
> >   Resolve compilation issue due to mbuf re-structure.
> >
> > -V2 change:
> >   Refine description, 'vring descriptor' is more accurate than 'vring entry';
> >   Accordingly update test condition (it needs one more descriptor for
> > virtio
> > header) to
> >   put packets to transmit queue.
> >
> > -V1 change:
> >   Fix the vring descriptor issue in virtio TX, it needs one more vring
> > descriptor to hold the
> >   virtio header.
> >
> >  lib/librte_pmd_virtio/virtio_rxtx.c | 10 ++++++++--
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c
> > b/lib/librte_pmd_virtio/virtio_rxtx.c
> > index 0b10108..ac44c65 100644
> > --- a/lib/librte_pmd_virtio/virtio_rxtx.c
> > +++ b/lib/librte_pmd_virtio/virtio_rxtx.c
> > @@ -699,7 +699,8 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf
> > **tx_pkts, uint16_t nb_pkts)
> >  	num = (uint16_t)(likely(nb_used < VIRTIO_MBUF_BURST_SZ) ?
> nb_used :
> > VIRTIO_MBUF_BURST_SZ);
> >
> >  	while (nb_tx < nb_pkts) {
> > -		int need = tx_pkts[nb_tx]->pkt.nb_segs - txvq->vq_free_cnt;
> > +		/* Need one more descriptor for virtio header. */
> > +		int need = tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1;
> >  		int deq_cnt = RTE_MIN(need, (int)num);
> >
> >  		num -= (deq_cnt > 0) ? deq_cnt : 0; @@ -708,7 +709,12 @@
> > virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t
> > nb_pkts)
> >  			deq_cnt--;
> >  		}
> >
> > -		if (tx_pkts[nb_tx]->pkt.nb_segs <= txvq->vq_free_cnt) {
> > +		need = (int)tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt +
> 1;
> > +		/*
> > +		 * Zero or negative value indicates it has enough free
> > +		 * decriptors to transmit.
> > +		 */
> > +		if (need <= 0) {
> Could we put a branch hint to favor the fast path?
> >  			txm = tx_pkts[nb_tx];
> >  			/* Enqueue Packet buffers */
> >  			error = virtqueue_enqueue_xmit(txvq, txm);
> > --
> > 1.8.4.2

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

* Re: [dpdk-dev] [PATCH v5] virtio: Fix vring entry number issue
  2014-10-15  3:11     ` [dpdk-dev] [PATCH v5] " Ouyang Changchun
@ 2014-10-15  6:34       ` Thomas Monjalon
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2014-10-15  6:34 UTC (permalink / raw)
  To: Ouyang Changchun; +Cc: dev

2014-10-15 11:11, Ouyang Changchun:
>   Fix one issue in virtio TX: it needs one more vring descriptor to hold the virtio
>   header when transmitting packets, it is used later to determine whether to free
>   more entries from used vring.
>   It fixes failing to transmit any packet with 1 segment in the circumstance of only
>   1 descriptor in the vring free list.
> 
> Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
> Reviewed-by: Olivier Matz <olivier.matz@6wind.com>

Applied

Thanks
-- 
Thomas

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

end of thread, other threads:[~2014-10-15  6:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-11  8:05 [dpdk-dev] [PATCH v2] virtio: Fix vring entry number issue Ouyang Changchun
2014-10-14 15:12 ` [dpdk-dev] [PATCH v3] " Ouyang Changchun
2014-10-14 15:28   ` Ouyang, Changchun
2014-10-14 16:03   ` [dpdk-dev] [PATCH v4] " Ouyang Changchun
2014-10-14 16:26     ` Xie, Huawei
2014-10-15  3:14       ` Ouyang, Changchun
2014-10-15  3:11     ` [dpdk-dev] [PATCH v5] " Ouyang Changchun
2014-10-15  6:34       ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).