From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail04.ics.ntt-tx.co.jp (mail05.ics.ntt-tx.co.jp [210.232.35.69]) by dpdk.org (Postfix) with ESMTP id 9ED2123D for ; Thu, 9 Aug 2018 02:39:06 +0200 (CEST) Received: from gwchk03.silk.ntt-tx.co.jp (gwchk03.silk.ntt-tx.co.jp [10.107.0.111]) by mail04.ics.ntt-tx.co.jp (unknown) with ESMTP id w790d3tZ018755; Thu, 9 Aug 2018 09:39:03 +0900 Received: (from root@localhost) by gwchk03.silk.ntt-tx.co.jp (unknown) id w790d3SF019133; Thu, 9 Aug 2018 09:39:03 +0900 Received: from gwchk.silk.ntt-tx.co.jp [10.107.0.110] by gwchk03.silk.ntt-tx.co.jp with ESMTP id KAA18846; Thu, 9 Aug 2018 09:38:06 +0900 Received: from imss04.silk.ntt-tx.co.jp (localhost [127.0.0.1]) by imss04.silk.ntt-tx.co.jp (unknown) with ESMTP id w790c6r6022193; Thu, 9 Aug 2018 09:38:06 +0900 Received: from mgate01.silk.ntt-tx.co.jp (smtp02.silk.ntt-tx.co.jp [10.107.0.37]) by imss04.silk.ntt-tx.co.jp (unknown) with ESMTP id w790c6aE022190; Thu, 9 Aug 2018 09:38:06 +0900 Message-Id: <201808090038.w790c6aE022190@imss04.silk.ntt-tx.co.jp> Received: from localhost by mgate01.silk.ntt-tx.co.jp (unknown) id w790c6Nl029826 ; Thu, 9 Aug 2018 09:38:06 +0900 From: x-fn-spp@sl.ntt-tx.co.jp To: ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp Cc: spp@dpdk.org Date: Thu, 9 Aug 2018 09:38:05 +0900 X-Mailer: git-send-email 2.18.0 In-Reply-To: <201808020831.w728V9N5031675@imss03.silk.ntt-tx.co.jp> References: <201808020831.w728V9N5031675@imss03.silk.ntt-tx.co.jp> X-TM-AS-MML: No Subject: [spp] [PATCH v2 1/1] spp_vf: fix initializing bug of forwarder X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2018 00:39:07 -0000 From: Hideyuki Yamashita clear_forward_info() always initializes path[0] of g_forward_info[id]. It is a bug and causes stopping forwarding accidentally if path[0] is referenced by spp_forward(). This patch changes initializing as path[info->upd_index] instead of 0. It also includes refactoring to be simple by using local vars. Signed-off-by: Hideyuki Yamashita Signed-off-by: Naoki Takada --- src/vf/spp_forward.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c index 0a43608..03bda10 100644 --- a/src/vf/spp_forward.c +++ b/src/vf/spp_forward.c @@ -49,13 +49,6 @@ spp_forward_init(void) } } -/* Clear info for one element. */ -static void -clear_forward_info(int id) -{ - memset(&g_forward_info[id].path, 0x00, sizeof(struct forward_path)); -} - /* Update forward info */ int spp_forward_update(struct spp_component_info *component) @@ -84,7 +77,7 @@ spp_forward_update(struct spp_component_info *component) return -1; } - clear_forward_info(component->component_id); + memset(path, 0x00, sizeof(struct forward_path)); RTE_LOG(INFO, FORWARD, "Component[%d] Start update component. (name = %s, type = %d)\n", -- 2.18.0