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 553C7A00BE; Mon, 27 Apr 2020 16:58:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 745681D56E; Mon, 27 Apr 2020 16:58:37 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 2DE971D483; Mon, 27 Apr 2020 16:58:34 +0200 (CEST) IronPort-SDR: WGQipQm7cnv6BV2I95B3qjcra6tgAshgK9HBBAbkl9o+SQJMrJaxLqM3R27w3NJ5968ZFJGhLH Ae1/YlvruvxA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2020 07:58:34 -0700 IronPort-SDR: Cwwma0Mo/qJ3zp7XIWOV8vRbjhSDz3drNdjKPGAjrjIRMfiQ4/e6zwpzDf+OJuU9OqPx1R3Sm8 05TtjBGJxeqw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,324,1583222400"; d="scan'208";a="247430055" Received: from silpixa00389033.ir.intel.com (HELO silpixa00389033.ger.corp.intel.com) ([10.237.223.171]) by fmsmga007.fm.intel.com with ESMTP; 27 Apr 2020 07:58:33 -0700 From: Louise Kilheeney To: dev@dpdk.org Cc: Louise Kilheeney , stable@dpdk.org Date: Mon, 27 Apr 2020 15:57:43 +0100 Message-Id: <20200427145743.33840-1-louise.kilheeney@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200311120456.36510-1-louise.kilheeney@intel.com> References: <20200311120456.36510-1-louise.kilheeney@intel.com> Subject: [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" MBUF pool of size 8192 was causing packet loss when using four ports. To fix 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 ports. 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/main.c index 2ae5a3c6a..32482158d 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -44,7 +44,7 @@ #define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1 -#define NB_MBUF 8192 +#define NB_MBUF_PER_PORT 3000 #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 = 0; + unsigned int total_nb_mbufs; struct sigaction signal_handler; struct rte_keepalive_shm *ka_shm; @@ -561,16 +562,19 @@ main(int argc, char **argv) if (ret < 0) rte_exit(EXIT_FAILURE, "Invalid L2FWD arguments\n"); - /* create the mbuf pool */ - l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32, - 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); - if (l2fwd_pktmbuf_pool == NULL) - rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); - nb_ports = rte_eth_dev_count_avail(); if (nb_ports == 0) rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n"); + /* create the mbuf pool */ + total_nb_mbufs = NB_MBUF_PER_PORT * nb_ports; + + l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", + total_nb_mbufs, 32, 0, RTE_MBUF_DEFAULT_BUF_SIZE, + rte_socket_id()); + if (l2fwd_pktmbuf_pool == NULL) + rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); + /* reset l2fwd_dst_ports */ for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) l2fwd_dst_ports[portid] = 0; -- 2.17.1