DPDK patches and discussions
 help / color / mirror / Atom feed
From: "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] fix for eth_pcap_tx() can cause mbuf corruption
Date: Thu, 5 Jun 2014 15:33:25 +0000	[thread overview]
Message-ID: <E115CCD9D858EF4F90C690B0DCB4D897082C8CCC@IRSMSX103.ger.corp.intel.com> (raw)
In-Reply-To: <1401288422-10449-1-git-send-email-konstantin.ananyev@intel.com>

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

  reply	other threads:[~2014-06-05 15:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-28 14:47 Konstantin Ananyev
2014-06-05 15:33 ` De Lara Guarch, Pablo [this message]
2014-06-06  3:33 ` Cao, Waterman
2014-06-10 11:25 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E115CCD9D858EF4F90C690B0DCB4D897082C8CCC@IRSMSX103.ger.corp.intel.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).