From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp02.srv.cs.cmu.edu (SMTP02.SRV.CS.CMU.EDU [128.2.217.197]) by dpdk.org (Postfix) with ESMTP id 6D2A8256 for ; Thu, 2 May 2013 16:25:12 +0200 (CEST) Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) (authenticated bits=0) by smtp02.srv.cs.cmu.edu (8.13.6/8.13.6) with ESMTP id r42EOJxJ013174 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Thu, 2 May 2013 10:24:20 -0400 (EDT) Received: by mail-pa0-f49.google.com with SMTP id hk2so380544pac.8 for ; Thu, 02 May 2013 07:24:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=vva0dzAcmITTjIaEI7jND/Os967uV2gUbKmOQdqr2Fc=; b=lVfY+RITCsXPQ9a6MXziHkTKhiPkW+REElSWNOKDOX7zr24Iy6+wv821ytmu8nwKa2 SxtDL/UfZiNYVskNYAO6ziewnT5SgfjuSDZu6W1sbLwwJJc22GfVmd6HHpYffu4jOj5l vuA2tRpWoeFx6Xa1t+W8Q2jO1bwDowoS4YW6gq/7K6qB59k2AXzqI8pChSOvBvhRVrLW GTQrRZKSEM+rnK+thnGVOWtRI90hBM59P8DNyt96WqVQgLFf+hVYcOA9qFD3WDGnPICy DD9+5vnmuodTj4t0nP8koxc37knebdj9PsgI6jSaHw1KG6Tyy++jwaDwTVAQ5+8Xhmc4 iq4A== MIME-Version: 1.0 X-Received: by 10.68.213.162 with SMTP id nt2mr9030286pbc.179.1367504658852; Thu, 02 May 2013 07:24:18 -0700 (PDT) Received: by 10.66.148.199 with HTTP; Thu, 2 May 2013 07:24:18 -0700 (PDT) Date: Thu, 2 May 2013 10:24:18 -0400 Message-ID: From: "Han, Dongsu" To: dev@dpdk.org Content-Type: multipart/alternative; boundary=e89a8ff24e956b78e504dbbcfd72 X-Scanned-By: mimedefang-cmuscs on 128.2.217.197 X-Mailman-Approved-At: Thu, 02 May 2013 16:34:51 +0200 Subject: [dpdk-dev] suggested patch: testpmd txonly mbuf_alloc does not increment refcnt 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: Thu, 02 May 2013 14:25:12 -0000 --e89a8ff24e956b78e504dbbcfd72 Content-Type: text/plain; charset=ISO-8859-1 Hi dpdk-dev, test-pmd txonly leaks mbuf from the pool. tx_mbuf_alloc does not change the refcnt and the refcnt is 0 when it is first allocated. However, rte_pktmbuf_free_seg called by the driver's xmit code decrements reference count to -1. So mbuf never goes back to the pool. As a result, txonly can't send packets after it exhausts the mempool. There might be multiple ways to fix this. I decided not to touch memory management. Thanks, -Dongsu Han --- diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index d7c8c31..ee673e5 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -92,14 +92,7 @@ static struct udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packets. */ static inline struct rte_mbuf * tx_mbuf_alloc(struct rte_mempool *mp) { - struct rte_mbuf *m; - void *mb; - - if (rte_mempool_get(mp, &mb) < 0) - return NULL; - m = (struct rte_mbuf *)mb; - __rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 1); - return m; + return rte_pktmbuf_alloc(mp); } --e89a8ff24e956b78e504dbbcfd72 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi dpdk-dev,
=A0 test-pmd txonl= y leaks mbuf from the pool.
tx_mbuf_alloc does not change t= he refcnt and the refcnt is 0 when it is first allocated.=A0

=A0However, rte_pktmbuf_free_seg called by the driver'= s xmit code decrements reference count to -1. So mbuf never goes back to th= e pool.=A0

=A0As a result, txonly can&= #39;t send packets after it=A0exhausts=A0the mempool.=A0
There might be multiple ways to fix this. I decided not to touch= memory=A0management.

Thanks,
-Dongsu Han=A0

---
<= br>
diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
=
index d7c8c31..ee673e5 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -92,14 +92,7 @@ static str= uct udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packets. */
=A0static inline struct rte_mbuf *
=A0tx_mbuf_alloc(struct r= te_mempool *mp)
=A0{
- =A0 =A0 =A0 struct rte_mbuf *m;<= /div>
- =A0 =A0 =A0 void *mb;
-
- =A0 =A0 =A0 if (r= te_mempool_get(mp, &mb) < 0)
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 return NULL;
- =A0 =A0 =A0 m = =3D (struct rte_mbuf *)mb;
- =A0 =A0 =A0 __rte_mbuf_sanity_check(= m, RTE_MBUF_PKT, 1);
- =A0 =A0 =A0 return m;
+ =A0 =A0 = =A0 return rte_pktmbuf_alloc(mp);
=A0}
=A0

--e89a8ff24e956b78e504dbbcfd72--