From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from tama50.ecl.ntt.co.jp (tama50.ecl.ntt.co.jp [129.60.39.147]) by dpdk.org (Postfix) with ESMTP id 6AA691B1EC for ; Tue, 7 Aug 2018 06:15:17 +0200 (CEST) Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id w774FFgK010813; Tue, 7 Aug 2018 13:15:15 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 4D35DEA8ADA; Tue, 7 Aug 2018 13:15:15 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 42BD0EA8ADF; Tue, 7 Aug 2018 13:15:15 +0900 (JST) Received: from [IPv6:::1] (watercress.nslab.ecl.ntt.co.jp [129.60.13.73]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id 2937940035E; Tue, 7 Aug 2018 13:15:15 +0900 (JST) References: <201808020831.w728V9N5031675@imss03.silk.ntt-tx.co.jp> From: Yasufumi Ogawa Message-ID: <37658b11-a1ca-e1c3-7aab-84b7731b4350@lab.ntt.co.jp> Date: Tue, 7 Aug 2018 13:13:27 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <201808020831.w728V9N5031675@imss03.silk.ntt-tx.co.jp> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CC-Mail-RelayStamp: 1 To: x-fn-spp@sl.ntt-tx.co.jp, ferruh.yigit@intel.com Cc: spp@dpdk.org X-TM-AS-MML: disable Subject: Re: [spp] [PATCH] 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: Tue, 07 Aug 2018 04:15:18 -0000 On 2018/08/02 17:31, x-fn-spp@sl.ntt-tx.co.jp wrote: > 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. Hideyuki, I do not know why claer_forward_info() is requierd because it is called only one time and simply just doing memset(). I think it is not needed to be a function without called from several points. In addition, the name of function is not so good. It does not clear 'forward_info' but 'forward_path'. I think clear_forward_path() is appropriate if you want to make it as a function. Thanks, Yasufumi > > Signed-off-by: Hideyuki Yamashita > Signed-off-by: Naoki Takada > --- > src/vf/spp_forward.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c > index 0a43608..ee1254c 100644 > --- a/src/vf/spp_forward.c > +++ b/src/vf/spp_forward.c > @@ -51,9 +51,9 @@ spp_forward_init(void) > > /* Clear info for one element. */ > static void > -clear_forward_info(int id) > +clear_forward_info(struct forward_path *path) > { > - memset(&g_forward_info[id].path, 0x00, sizeof(struct forward_path)); > + memset(path, 0x00, sizeof(struct forward_path)); > } > > /* Update forward info */ > @@ -84,7 +84,7 @@ spp_forward_update(struct spp_component_info *component) > return -1; > } > > - clear_forward_info(component->component_id); > + clear_forward_info(path); > > RTE_LOG(INFO, FORWARD, > "Component[%d] Start update component. (name = %s, type = %d)\n", >