Skip to content

Commit

Permalink
examples/multi_process: fix buffer underrun
Browse files Browse the repository at this point in the history
[ upstream commit 7c22ccd ]

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: af75078 ("first public release")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
  • Loading branch information
yskoh-mellanox authored and kevintraynor committed May 8, 2019
1 parent 5036b8b commit c35f7d9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions examples/multi_process/client_server_mp/mp_server/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -63,8 +61,15 @@ 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_server =
RTE_MP_RX_DESC_DEFAULT * ports->num_ports;
const unsigned int num_mbufs_client =
num_clients * (CLIENT_QUEUE_RINGSIZE +
RTE_MP_TX_DESC_DEFAULT * ports->num_ports);
const unsigned int num_mbufs_mp_cache =
(num_clients + 1) * MBUF_CACHE_SIZE;
const unsigned int num_mbufs =
num_mbufs_server + num_mbufs_client + num_mbufs_mp_cache;

/* don't pass single-producer/single-consumer flags to mbuf create as it
* seems faster to use a cache instead */
Expand Down

0 comments on commit c35f7d9

Please sign in to comment.