[dpdk-stable] [PATCH] examples/multi_process: fix buffer underrun
Yongseok Koh
yskoh at mellanox.com
Wed Apr 10 00:59:37 CEST 2019
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 at dpdk.org
Signed-off-by: Yongseok Koh <yskoh at 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
More information about the stable
mailing list