DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/i40e: fix avx2 driver check for rx rearm
@ 2018-07-30 17:30 Harry van Haaren
  2018-07-30 17:34 ` [dpdk-dev] [PATCH v2] " Harry van Haaren
  0 siblings, 1 reply; 4+ messages in thread
From: Harry van Haaren @ 2018-07-30 17:30 UTC (permalink / raw)
  To: dev
  Cc: Harry van Haaren, bruce.richardson, stable, thomas, david.coyle,
	beilei.xing, qi.z.zhang

This commit fixes an infinite loop bug that could occur
if the i40e AVX2 driver is used, and high traffic rates
cause the mempool from which the rxq pulls mbufs to become
empty.

The result would be an infinite loop of checking if we
should perform an rx rearm, calling the function and an
error return due the the mempool being emtpy.

The fix is to align the code in the AVX2 driver with the
SSE driver, where an if() is used instead of a while(),
allowing the thread to return from i40e rx funtion even
if the mempool is empty.

Fixes: dafadd73762e ("net/i40e: add AVX2 Rx function")
Cc: bruce.richardson@intel.com
Cc: stable@dpdk.org

Reported-by: David Coyle <david.coyle@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

---

Cc: thomas@monjalon.net
@Thomas, please consider this fix for inclusion in 18.08-rc3
assuming it gets verified as a good fix and Acked.

Reporter please verify:
Cc: david.coyle@intel.com

i40e maintainers, please Review/Ack:
Cc: beilei.xing@intel.com
Cc: qi.z.zhang@intel.com
---
 drivers/net/i40e/i40e_rxtx_vec_avx2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx2.c b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
index dbcb61f..23179b3 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx2.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
@@ -188,7 +188,7 @@ _recv_raw_pkts_vec_avx2(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
 	/* See if we need to rearm the RX queue - gives the prefetch a bit
 	 * of time to act
 	 */
-	while (rxq->rxrearm_nb > RTE_I40E_RXQ_REARM_THRESH)
+	if (rxq->rxrearm_nb > RTE_I40E_RXQ_REARM_THRESH)
 		i40e_rxq_rearm(rxq);
 
 	/* Before we start moving massive data around, check to see if
-- 
2.7.4

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

* [dpdk-dev] [PATCH v2] net/i40e: fix avx2 driver check for rx rearm
  2018-07-30 17:30 [dpdk-dev] [PATCH] net/i40e: fix avx2 driver check for rx rearm Harry van Haaren
@ 2018-07-30 17:34 ` Harry van Haaren
  2018-07-31 14:24   ` Coyle, David
  0 siblings, 1 reply; 4+ messages in thread
From: Harry van Haaren @ 2018-07-30 17:34 UTC (permalink / raw)
  To: dev
  Cc: Harry van Haaren, bruce.richardson, stable, thomas, david.coyle,
	beilei.xing, qi.z.zhang

This commit fixes an infinite loop bug that could occur
if the i40e AVX2 driver is used, and high traffic rates
cause the mempool from which the rxq pulls mbufs to become
empty.

The result would be an infinite loop of checking if we
should perform an rx rearm, calling the function and an
error return due the the mempool being emtpy.

The fix is to align the code in the AVX2 driver with the
SSE driver, where an if() is used instead of a while(),
allowing the thread to return from i40e rx function even
if the mempool is empty.

Fixes: dafadd73762e ("net/i40e: add AVX2 Rx function")
Cc: bruce.richardson@intel.com
Cc: stable@dpdk.org

Reported-by: David Coyle <david.coyle@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

---

v2:
- Fix typo, sorry for email flood :)

Cc: thomas@monjalon.net
@Thomas, please consider this fix for inclusion in 18.08-rc3
assuming it gets verified as a good fix and Acked.

Reporter please verify:
Cc: david.coyle@intel.com

i40e maintainers, please Review/Ack:
Cc: beilei.xing@intel.com
Cc: qi.z.zhang@intel.com
---
 drivers/net/i40e/i40e_rxtx_vec_avx2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx2.c b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
index dbcb61f..23179b3 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx2.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
@@ -188,7 +188,7 @@ _recv_raw_pkts_vec_avx2(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
 	/* See if we need to rearm the RX queue - gives the prefetch a bit
 	 * of time to act
 	 */
-	while (rxq->rxrearm_nb > RTE_I40E_RXQ_REARM_THRESH)
+	if (rxq->rxrearm_nb > RTE_I40E_RXQ_REARM_THRESH)
 		i40e_rxq_rearm(rxq);
 
 	/* Before we start moving massive data around, check to see if
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH v2] net/i40e: fix avx2 driver check for rx rearm
  2018-07-30 17:34 ` [dpdk-dev] [PATCH v2] " Harry van Haaren
@ 2018-07-31 14:24   ` Coyle, David
  2018-08-01  0:42     ` Zhang, Qi Z
  0 siblings, 1 reply; 4+ messages in thread
From: Coyle, David @ 2018-07-31 14:24 UTC (permalink / raw)
  To: Van Haaren, Harry, dev
  Cc: Richardson, Bruce, stable, thomas, Xing, Beilei, Zhang, Qi Z



-----Original Message-----
From: Van Haaren, Harry 
Sent: Monday, July 30, 2018 6:34 PM
To: dev@dpdk.org
Cc: Van Haaren, Harry <harry.van.haaren@intel.com>; Richardson, Bruce <bruce.richardson@intel.com>; stable@dpdk.org; thomas@monjalon.net; Coyle, David <david.coyle@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
Subject: [PATCH v2] net/i40e: fix avx2 driver check for rx rearm

This commit fixes an infinite loop bug that could occur if the i40e AVX2 driver is used, and high traffic rates cause the mempool from which the rxq pulls mbufs to become empty.

The result would be an infinite loop of checking if we should perform an rx rearm, calling the function and an error return due the the mempool being emtpy.

The fix is to align the code in the AVX2 driver with the SSE driver, where an if() is used instead of a while(), allowing the thread to return from i40e rx function even if the mempool is empty.

Fixes: dafadd73762e ("net/i40e: add AVX2 Rx function")
Cc: bruce.richardson@intel.com
Cc: stable@dpdk.org

Reported-by: David Coyle <david.coyle@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Brendan Ryan <brendan.ryan@intel.com>
Tested-by: David Coyle <david.coyle@intel.com>
--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.

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

* Re: [dpdk-dev] [PATCH v2] net/i40e: fix avx2 driver check for rx rearm
  2018-07-31 14:24   ` Coyle, David
@ 2018-08-01  0:42     ` Zhang, Qi Z
  0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Qi Z @ 2018-08-01  0:42 UTC (permalink / raw)
  To: Coyle, David, Van Haaren, Harry, dev
  Cc: Richardson, Bruce, stable, thomas, Xing, Beilei



> -----Original Message-----
> From: Coyle, David
> Sent: Tuesday, July 31, 2018 10:25 PM
> To: Van Haaren, Harry <harry.van.haaren@intel.com>; dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>; stable@dpdk.org;
> thomas@monjalon.net; Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Subject: RE: [PATCH v2] net/i40e: fix avx2 driver check for rx rearm
> 
> 
> 
> -----Original Message-----
> From: Van Haaren, Harry
> Sent: Monday, July 30, 2018 6:34 PM
> To: dev@dpdk.org
> Cc: Van Haaren, Harry <harry.van.haaren@intel.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; stable@dpdk.org; thomas@monjalon.net;
> Coyle, David <david.coyle@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [PATCH v2] net/i40e: fix avx2 driver check for rx rearm
> 
> This commit fixes an infinite loop bug that could occur if the i40e AVX2 driver
> is used, and high traffic rates cause the mempool from which the rxq pulls
> mbufs to become empty.
> 
> The result would be an infinite loop of checking if we should perform an rx
> rearm, calling the function and an error return due the the mempool being
> emtpy.
> 
> The fix is to align the code in the AVX2 driver with the SSE driver, where an if()
> is used instead of a while(), allowing the thread to return from i40e rx
> function even if the mempool is empty.
> 
> Fixes: dafadd73762e ("net/i40e: add AVX2 Rx function")
> Cc: bruce.richardson@intel.com
> Cc: stable@dpdk.org
> 
> Reported-by: David Coyle <david.coyle@intel.com>
> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
> Acked-by: Brendan Ryan <brendan.ryan@intel.com>
> Tested-by: David Coyle <david.coyle@intel.com>

Applied to dpdk-next-net-intel.

Thanks!
Qi

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

end of thread, other threads:[~2018-08-01  0:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-30 17:30 [dpdk-dev] [PATCH] net/i40e: fix avx2 driver check for rx rearm Harry van Haaren
2018-07-30 17:34 ` [dpdk-dev] [PATCH v2] " Harry van Haaren
2018-07-31 14:24   ` Coyle, David
2018-08-01  0:42     ` Zhang, Qi Z

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).