From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <yskoh@mellanox.com>
Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])
 by dpdk.org (Postfix) with ESMTP id 59CE65587
 for <dev@dpdk.org>; Wed, 10 Apr 2019 00:59:42 +0200 (CEST)
Received: from Internal Mail-Server by MTLPINE1 (envelope-from
 yskoh@mellanox.com)
 with ESMTPS (AES256-SHA encrypted); 10 Apr 2019 01:59:41 +0300
Received: from scfae-sc-2.mti.labs.mlnx (scfae-sc-2.mti.labs.mlnx
 [10.101.0.96])
 by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x39Mxd3a004660;
 Wed, 10 Apr 2019 01:59:40 +0300
From: Yongseok Koh <yskoh@mellanox.com>
To: anatoly.burakov@intel.com
Cc: dev@dpdk.org, stable@dpdk.org
Date: Tue,  9 Apr 2019 15:59:37 -0700
Message-Id: <20190409225937.9269-1-yskoh@mellanox.com>
X-Mailer: git-send-email 2.11.0
Subject: [dpdk-dev] [PATCH] examples/multi_process: fix buffer underrun
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 09 Apr 2019 22:59:42 -0000

For client_server_mp, the total number of buffers for the mbuf mempool
should be correctly calculated. Otherwise, having more clients will stop
traffic.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 examples/multi_process/client_server_mp/mp_server/init.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c
index 30c8e44bc0..0491ba8a1a 100644
--- a/examples/multi_process/client_server_mp/mp_server/init.c
+++ b/examples/multi_process/client_server_mp/mp_server/init.c
@@ -37,8 +37,6 @@
 #include "args.h"
 #include "init.h"
 
-#define MBUFS_PER_CLIENT 1536
-#define MBUFS_PER_PORT 1536
 #define MBUF_CACHE_SIZE 512
 
 #define RTE_MP_RX_DESC_DEFAULT 1024
@@ -63,8 +61,12 @@ struct port_info *ports;
 static int
 init_mbuf_pools(void)
 {
-	const unsigned num_mbufs = (num_clients * MBUFS_PER_CLIENT) \
-			+ (ports->num_ports * MBUFS_PER_PORT);
+	const unsigned int num_mbufs =
+		RTE_MP_RX_DESC_DEFAULT * ports->num_ports + /* Sever */
+		num_clients *
+		(CLIENT_QUEUE_RINGSIZE +
+		 RTE_MP_TX_DESC_DEFAULT * ports->num_ports) + /* Clients */
+		(num_clients + 1) * MBUF_CACHE_SIZE; /* Mempool cache */
 
 	/* don't pass single-producer/single-consumer flags to mbuf create as it
 	 * seems faster to use a cache instead */
-- 
2.11.0

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id B3B40A0096
	for <public@inbox.dpdk.org>; Wed, 10 Apr 2019 00:59:46 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 2D95F58C4;
	Wed, 10 Apr 2019 00:59:45 +0200 (CEST)
Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])
 by dpdk.org (Postfix) with ESMTP id 59CE65587
 for <dev@dpdk.org>; Wed, 10 Apr 2019 00:59:42 +0200 (CEST)
Received: from Internal Mail-Server by MTLPINE1 (envelope-from
 yskoh@mellanox.com)
 with ESMTPS (AES256-SHA encrypted); 10 Apr 2019 01:59:41 +0300
Received: from scfae-sc-2.mti.labs.mlnx (scfae-sc-2.mti.labs.mlnx
 [10.101.0.96])
 by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x39Mxd3a004660;
 Wed, 10 Apr 2019 01:59:40 +0300
From: Yongseok Koh <yskoh@mellanox.com>
To: anatoly.burakov@intel.com
Cc: dev@dpdk.org, stable@dpdk.org
Date: Tue,  9 Apr 2019 15:59:37 -0700
Message-Id: <20190409225937.9269-1-yskoh@mellanox.com>
X-Mailer: git-send-email 2.11.0
Subject: [dpdk-dev] [PATCH] examples/multi_process: fix buffer underrun
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Content-Type: text/plain; charset="UTF-8"
Message-ID: <20190409225937.ZkfvuED_E4jFCdWeFZQH3xmZyJzGAndNZKZQVJmQ5f8@z>

For client_server_mp, the total number of buffers for the mbuf mempool
should be correctly calculated. Otherwise, having more clients will stop
traffic.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 examples/multi_process/client_server_mp/mp_server/init.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c
index 30c8e44bc0..0491ba8a1a 100644
--- a/examples/multi_process/client_server_mp/mp_server/init.c
+++ b/examples/multi_process/client_server_mp/mp_server/init.c
@@ -37,8 +37,6 @@
 #include "args.h"
 #include "init.h"
 
-#define MBUFS_PER_CLIENT 1536
-#define MBUFS_PER_PORT 1536
 #define MBUF_CACHE_SIZE 512
 
 #define RTE_MP_RX_DESC_DEFAULT 1024
@@ -63,8 +61,12 @@ struct port_info *ports;
 static int
 init_mbuf_pools(void)
 {
-	const unsigned num_mbufs = (num_clients * MBUFS_PER_CLIENT) \
-			+ (ports->num_ports * MBUFS_PER_PORT);
+	const unsigned int num_mbufs =
+		RTE_MP_RX_DESC_DEFAULT * ports->num_ports + /* Sever */
+		num_clients *
+		(CLIENT_QUEUE_RINGSIZE +
+		 RTE_MP_TX_DESC_DEFAULT * ports->num_ports) + /* Clients */
+		(num_clients + 1) * MBUF_CACHE_SIZE; /* Mempool cache */
 
 	/* don't pass single-producer/single-consumer flags to mbuf create as it
 	 * seems faster to use a cache instead */
-- 
2.11.0