From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 8E829159 for ; Mon, 7 Apr 2014 10:53:13 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 07 Apr 2014 01:49:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,808,1389772800"; d="scan'208";a="488494857" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga001.jf.intel.com with ESMTP; 07 Apr 2014 01:54:01 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.78]) by IRSMSX103.ger.corp.intel.com ([163.33.3.157]) with mapi id 14.03.0123.003; Mon, 7 Apr 2014 09:53:53 +0100 From: "Ananyev, Konstantin" To: "dev@dpdk.org" Thread-Topic: [dpdk-dev] rte_pktmbuf_alloc fails Thread-Index: AQHPTZrHVVc8358MfkSbsYwzq1Jn0pr8lhqAgAkjVwCAACCCgA== Date: Mon, 7 Apr 2014 08:53:52 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772580EF94DE9@IRSMSX105.ger.corp.intel.com> References: <4032649.DyNZWczOjm@platinum> In-Reply-To: <4032649.DyNZWczOjm@platinum> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] rte_pktmbuf_alloc fails X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Apr 2014 08:53:14 -0000 Hi, Yep indeed, there is a bug in eth_pcap_tx() that can cause mbuf corruption. I think it should be something like that instead: --- a/lib/librte_pmd_pcap/rte_eth_pcap.c +++ b/lib/librte_pmd_pcap/rte_eth_pcap.c @@ -205,8 +205,9 @@ eth_pcap_tx(void *queue, mbuf =3D bufs[i]; ret =3D pcap_sendpacket(tx_queue->pcap, (u_char*) mbuf->pkt= .data, mbuf->pkt.data_len); - if(likely(!ret)) - num_tx++; + if(unlikely(ret !=3D 0)) + break; + num_tx++; rte_pktmbuf_free(mbuf); } Thanks Konstantin -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Olivier MATZ Sent: Monday, April 07, 2014 8:27 AM To: dev@dpdk.org Cc: Meir Tseitlin Subject: Re: [dpdk-dev] rte_pktmbuf_alloc fails Hi Meir, On Tuesday, April 01, 2014 02:53:47 PM Meir Tseitlin wrote: > I think I found the problem - it was solved by manually calling=20 > rte_pktmbuf_free for each packet. > It seems that rte_pktmbuf_free is not automatically called from within=20 > rte_eth_tx_burst if packets are sent to pcap device. By looking at the eth_pcap_tx(pkts, nb_pkts) function, I think it may not w= ork properly. I think it should return nb_pkts instead of num_tx. Indeed, i= f pcap_sendpacket() fails -- I don't know in which case it can occur -- the f= unction will return a number lower than nb_pkts, causing a caller like l2fwd_send_burst() to free some mbufs. But all mbufs are already freed by e= th_pcap_tx(). I don't know if it's related to your problem but it may help. Regards, Olivier