DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] fix for eth_pcap_tx() can cause mbuf corruption
@ 2014-05-28 14:47 Konstantin Ananyev
  2014-06-05 15:33 ` De Lara Guarch, Pablo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Konstantin Ananyev @ 2014-05-28 14:47 UTC (permalink / raw)
  To: dev, dev

If pcap_sendpacket() fails, then eth_pcap_tx shouldn't silently free that
mbuf and continue.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 lib/librte_pmd_pcap/rte_eth_pcap.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c b/lib/librte_pmd_pcap/rte_eth_pcap.c
index dc4670c..6f026ab 100644
--- a/lib/librte_pmd_pcap/rte_eth_pcap.c
+++ b/lib/librte_pmd_pcap/rte_eth_pcap.c
@@ -239,8 +239,9 @@ eth_pcap_tx(void *queue,
 		mbuf = bufs[i];
 		ret = pcap_sendpacket(tx_queue->pcap, (u_char*) mbuf->pkt.data,
 				mbuf->pkt.data_len);
-		if(likely(!ret))
-			num_tx++;
+		if (unlikely(ret != 0))
+			break;
+		num_tx++;
 		rte_pktmbuf_free(mbuf);
 	}
 
-- 
1.7.7.6

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

* Re: [dpdk-dev] [PATCH] fix for eth_pcap_tx() can cause mbuf corruption
  2014-05-28 14:47 [dpdk-dev] [PATCH] fix for eth_pcap_tx() can cause mbuf corruption Konstantin Ananyev
@ 2014-06-05 15:33 ` De Lara Guarch, Pablo
  2014-06-06  3:33 ` Cao, Waterman
  2014-06-10 11:25 ` Thomas Monjalon
  2 siblings, 0 replies; 4+ messages in thread
From: De Lara Guarch, Pablo @ 2014-06-05 15:33 UTC (permalink / raw)
  To: Ananyev, Konstantin, dev

Acked-by: Pablo de Lara Guarch <pablo.de.lara.guarch@intel.com>

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin Ananyev
> Sent: Wednesday, May 28, 2014 3:47 PM
> To: dev@dpdk.org; dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] fix for eth_pcap_tx() can cause mbuf corruption
> 
> If pcap_sendpacket() fails, then eth_pcap_tx shouldn't silently free that
> mbuf and continue.
> 
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> ---
>  lib/librte_pmd_pcap/rte_eth_pcap.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c
> b/lib/librte_pmd_pcap/rte_eth_pcap.c
> index dc4670c..6f026ab 100644
> --- a/lib/librte_pmd_pcap/rte_eth_pcap.c
> +++ b/lib/librte_pmd_pcap/rte_eth_pcap.c
> @@ -239,8 +239,9 @@ eth_pcap_tx(void *queue,
>  		mbuf = bufs[i];
>  		ret = pcap_sendpacket(tx_queue->pcap, (u_char*) mbuf-
> >pkt.data,
>  				mbuf->pkt.data_len);
> -		if(likely(!ret))
> -			num_tx++;
> +		if (unlikely(ret != 0))
> +			break;
> +		num_tx++;
>  		rte_pktmbuf_free(mbuf);
>  	}
> 
> --
> 1.7.7.6

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

* Re: [dpdk-dev] [PATCH] fix for eth_pcap_tx() can cause mbuf corruption
  2014-05-28 14:47 [dpdk-dev] [PATCH] fix for eth_pcap_tx() can cause mbuf corruption Konstantin Ananyev
  2014-06-05 15:33 ` De Lara Guarch, Pablo
@ 2014-06-06  3:33 ` Cao, Waterman
  2014-06-10 11:25 ` Thomas Monjalon
  2 siblings, 0 replies; 4+ messages in thread
From: Cao, Waterman @ 2014-06-06  3:33 UTC (permalink / raw)
  To: Ananyev, Konstantin, dev

Tested-by: Waterman Cao <waterman.cao@intel.com>

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

* Re: [dpdk-dev] [PATCH] fix for eth_pcap_tx() can cause mbuf corruption
  2014-05-28 14:47 [dpdk-dev] [PATCH] fix for eth_pcap_tx() can cause mbuf corruption Konstantin Ananyev
  2014-06-05 15:33 ` De Lara Guarch, Pablo
  2014-06-06  3:33 ` Cao, Waterman
@ 2014-06-10 11:25 ` Thomas Monjalon
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2014-06-10 11:25 UTC (permalink / raw)
  To: Konstantin Ananyev; +Cc: dev

> If pcap_sendpacket() fails, then eth_pcap_tx shouldn't silently free that
> mbuf and continue.
> 
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Acked-by: Pablo de Lara Guarch <pablo.de.lara.guarch@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>

Applied for version 1.7.0.

Thanks
-- 
Thomas

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

end of thread, other threads:[~2014-06-10 11:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-28 14:47 [dpdk-dev] [PATCH] fix for eth_pcap_tx() can cause mbuf corruption Konstantin Ananyev
2014-06-05 15:33 ` De Lara Guarch, Pablo
2014-06-06  3:33 ` Cao, Waterman
2014-06-10 11:25 ` 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).