From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EB957A00BE; Wed, 29 Apr 2020 04:29:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 975BC1D6FE; Wed, 29 Apr 2020 04:29:50 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 6C0A11D5F8; Wed, 29 Apr 2020 04:29:48 +0200 (CEST) IronPort-SDR: i4Lods/xzxXfr1Nvq/SccgWo1ykF5o9vdH/zVH5ut4vaXKWX5ECpUVbF1S8s8k8FiefPf2oRq8 F4eYq2FZYyAw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2020 19:29:47 -0700 IronPort-SDR: w0Gj0hXQDWRVNaipw+NgkXeNFuLdyRZ0dQ1Wy5HX9uQlmr8sS5baTXiyzan2fR/PXSrzaiVRFE yQN+t17cwREw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,329,1583222400"; d="scan'208";a="257819782" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga003.jf.intel.com with ESMTP; 28 Apr 2020 19:29:46 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 28 Apr 2020 19:29:46 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 28 Apr 2020 19:29:46 -0700 Received: from cdsmsx103.ccr.corp.intel.com (172.17.3.37) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 28 Apr 2020 19:29:45 -0700 Received: from cdsmsx102.ccr.corp.intel.com ([169.254.2.104]) by CDSMSX103.ccr.corp.intel.com ([169.254.5.221]) with mapi id 14.03.0439.000; Wed, 29 Apr 2020 10:29:43 +0800 From: "Xie, WeiX" To: "Kilheeney, Louise" , "dev@dpdk.org" CC: "Kilheeney, Louise" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2] examples/l2fwd-keepalive: fix packet drops limited mbufs Thread-Index: AQHWHKRq4svecvg9uEmaGQDZ3SJ3oqiPYqLg Date: Wed, 29 Apr 2020 02:29:41 +0000 Message-ID: <6FD6A7610D20924F885A4ECF34E8AC91045E7B85@CDSMSX102.ccr.corp.intel.com> References: <20200311120456.36510-1-louise.kilheeney@intel.com> <20200427145743.33840-1-louise.kilheeney@intel.com> In-Reply-To: <20200427145743.33840-1-louise.kilheeney@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.17.6.105] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] examples/l2fwd-keepalive: fix packet drops limited mbufs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Tested-by:zhang,xi Regards, Xie Wei -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Louise Kilheeney Sent: Monday, April 27, 2020 10:58 PM To: dev@dpdk.org Cc: Kilheeney, Louise ; stable@dpdk.org Subject: [dpdk-dev] [PATCH v2] examples/l2fwd-keepalive: fix packet drops l= imited mbufs MBUF pool of size 8192 was causing packet loss when using four ports. To fi= x this issue this patch specifies the number of MBUF's per port instead of = having one set MBUF pool size, this way it will adapt to any number of port= s. Fixes: e64833f2273a ("examples/l2fwd-keepalive: add sample application") Cc: stable@dpdk.org Signed-off-by: Louise Kilheeney Tested-by: Xi Zhang --- v2: moved variable initialisation to top of function. --- examples/l2fwd-keepalive/main.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/mai= n.c index 2ae5a3c6a..32482158d 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -44,7 +44,7 @@ =20 #define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1 =20 -#define NB_MBUF 8192 +#define NB_MBUF_PER_PORT 3000 =20 #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -536,6 +536,7= @@ main(int argc, char **argv) uint16_t portid, last_port; unsigned lcore_id, rx_lcore_id; unsigned nb_ports_in_mask =3D 0; + unsigned int total_nb_mbufs; struct sigaction signal_handler; struct rte_keepalive_shm *ka_shm; =20 @@ -561,16 +562,19 @@ main(int argc, char **argv) if (ret < 0) rte_exit(EXIT_FAILURE, "Invalid L2FWD arguments\n"); =20 - /* create the mbuf pool */ - l2fwd_pktmbuf_pool =3D rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32, - 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); - if (l2fwd_pktmbuf_pool =3D=3D NULL) - rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); - nb_ports =3D rte_eth_dev_count_avail(); if (nb_ports =3D=3D 0) rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n"); =20 + /* create the mbuf pool */ + total_nb_mbufs =3D NB_MBUF_PER_PORT * nb_ports; + + l2fwd_pktmbuf_pool =3D rte_pktmbuf_pool_create("mbuf_pool", + total_nb_mbufs, 32, 0, RTE_MBUF_DEFAULT_BUF_SIZE, + rte_socket_id()); + if (l2fwd_pktmbuf_pool =3D=3D NULL) + rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); + /* reset l2fwd_dst_ports */ for (portid =3D 0; portid < RTE_MAX_ETHPORTS; portid++) l2fwd_dst_ports[portid] =3D 0; -- 2.17.1