From patchwork Thu Oct 26 08:29:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xueming Li X-Patchwork-Id: 30936 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A129A1BA71; Thu, 26 Oct 2017 10:29:43 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 6B5D41BA6D for ; Thu, 26 Oct 2017 10:29:42 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from xuemingl@mellanox.com) with ESMTPS (AES256-SHA encrypted); 26 Oct 2017 10:29:39 +0200 Received: from dev-r630-05.mtbc.labs.mlnx (dev-r630-05.mtbc.labs.mlnx [10.12.205.160]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v9Q8TcZV020707; Thu, 26 Oct 2017 11:29:39 +0300 Received: from dev-r630-05.mtbc.labs.mlnx (localhost [127.0.0.1]) by dev-r630-05.mtbc.labs.mlnx (8.14.7/8.14.7) with ESMTP id v9Q8TbEi052220; Thu, 26 Oct 2017 16:29:37 +0800 Received: (from xuemingl@localhost) by dev-r630-05.mtbc.labs.mlnx (8.14.7/8.14.7/Submit) id v9Q8TXoQ052218; Thu, 26 Oct 2017 16:29:33 +0800 From: Xueming Li To: Sergio Gonzalez Monroy Cc: Xueming Li , dev@dpdk.org Date: Thu, 26 Oct 2017 16:29:23 +0800 Message-Id: <1509006563-52179-1-git-send-email-xuemingl@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] examples/simple_mp: fix received message length 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" Simple_mp example receives message size less than 64 chars while send side accepts chars less than 128, this leads to different result when sending text lenght larger than 64. This patch uses same buffer length on both message pool and command line. Fixes: af75078fece3 ("first public release") Signed-off-by: Xueming Li --- examples/multi_process/simple_mp/main.c | 4 ++-- examples/multi_process/simple_mp/mp_commands.c | 2 +- examples/multi_process/simple_mp/mp_commands.h | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/multi_process/simple_mp/main.c b/examples/multi_process/simple_mp/main.c index 2843d94..53b87c5 100644 --- a/examples/multi_process/simple_mp/main.c +++ b/examples/multi_process/simple_mp/main.c @@ -67,6 +67,7 @@ #include #include #include +#include #include #include #include "mp_commands.h" @@ -76,7 +77,6 @@ static const char *_MSG_POOL = "MSG_POOL"; static const char *_SEC_2_PRI = "SEC_2_PRI"; static const char *_PRI_2_SEC = "PRI_2_SEC"; -const unsigned string_size = 64; struct rte_ring *send_ring, *recv_ring; struct rte_mempool *message_pool; @@ -121,7 +121,7 @@ send_ring = rte_ring_create(_PRI_2_SEC, ring_size, rte_socket_id(), flags); recv_ring = rte_ring_create(_SEC_2_PRI, ring_size, rte_socket_id(), flags); message_pool = rte_mempool_create(_MSG_POOL, pool_size, - string_size, pool_cache, priv_data_sz, + STR_TOKEN_SIZE, pool_cache, priv_data_sz, NULL, NULL, NULL, NULL, rte_socket_id(), flags); } else { diff --git a/examples/multi_process/simple_mp/mp_commands.c b/examples/multi_process/simple_mp/mp_commands.c index 8da244b..cde3abd 100644 --- a/examples/multi_process/simple_mp/mp_commands.c +++ b/examples/multi_process/simple_mp/mp_commands.c @@ -78,7 +78,7 @@ static void cmd_send_parsed(void *parsed_result, if (rte_mempool_get(message_pool, &msg) < 0) rte_panic("Failed to get message buffer\n"); - snprintf((char *)msg, string_size, "%s", res->message); + snprintf((char *)msg, STR_TOKEN_SIZE, "%s", res->message); if (rte_ring_enqueue(send_ring, msg) < 0) { printf("Failed to send message - message discarded\n"); rte_mempool_put(message_pool, msg); diff --git a/examples/multi_process/simple_mp/mp_commands.h b/examples/multi_process/simple_mp/mp_commands.h index 7e9a4ab..452b364 100644 --- a/examples/multi_process/simple_mp/mp_commands.h +++ b/examples/multi_process/simple_mp/mp_commands.h @@ -34,7 +34,6 @@ #ifndef _SIMPLE_MP_COMMANDS_H_ #define _SIMPLE_MP_COMMANDS_H_ -extern const unsigned string_size; extern struct rte_ring *send_ring; extern struct rte_mempool *message_pool; extern volatile int quit;