examples/multi_process: fix buffer underrun

Message ID 20190410194154.43758-1-yskoh@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series examples/multi_process: fix buffer underrun |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Yongseok Koh April 10, 2019, 7:41 p.m. UTC
  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>
---

v2:
* split up the calculation

 examples/multi_process/client_server_mp/mp_server/init.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
  

Comments

Yongseok Koh April 11, 2019, 7:18 a.m. UTC | #1
> On Apr 10, 2019, at 12:41 PM, Yongseok Koh <yskoh@mellanox.com> wrote:
> 
> 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>
> ---
> 
> v2:
> * split up the calculation

Sorry, I forgot to specify 'v2' in the title of this email.


Thanks,
Yongseok

> examples/multi_process/client_server_mp/mp_server/init.c | 13 +++++++++----
> 1 file changed, 9 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..3af5dc6994 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,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 */
> -- 
> 2.11.0
>
  
Yongseok Koh April 30, 2019, 6:01 p.m. UTC | #2
> On Apr 11, 2019, at 12:18 AM, Yongseok Koh <yskoh@mellanox.com> wrote:
> 
>> On Apr 10, 2019, at 12:41 PM, Yongseok Koh <yskoh@mellanox.com> wrote:
>> 
>> 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>
>> ---
>> 
>> v2:
>> * split up the calculation
> 
> Sorry, I forgot to specify 'v2' in the title of this email.

No ack? No merge?

Yongseok

> 
>> examples/multi_process/client_server_mp/mp_server/init.c | 13 +++++++++----
>> 1 file changed, 9 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..3af5dc6994 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,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 */
>> -- 
>> 2.11.0
>> 
>
  
Thomas Monjalon May 2, 2019, 11:36 p.m. UTC | #3
10/04/2019 21:41, Yongseok Koh:
> 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>

Applied, thanks
  

Patch

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..3af5dc6994 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,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 */