From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from tama500.ecl.ntt.co.jp (tama500.ecl.ntt.co.jp [129.60.39.148]) by dpdk.org (Postfix) with ESMTP id CC6892C23 for ; Thu, 9 Aug 2018 04:26:37 +0200 (CEST) Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id w792QZWP005874; Thu, 9 Aug 2018 11:26:35 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 81374EA75A9; Thu, 9 Aug 2018 11:26:35 +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 6D107EA753C; Thu, 9 Aug 2018 11:26:35 +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 64D34400365; Thu, 9 Aug 2018 11:26:35 +0900 (JST) References: <201807300510.w6U5AoRU010221@imss03.silk.ntt-tx.co.jp> From: Yasufumi Ogawa Message-ID: <6524128b-0907-ec85-5133-cc77a407c50c@lab.ntt.co.jp> Date: Thu, 9 Aug 2018 11:24:38 +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: <201807300510.w6U5AoRU010221@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 unexpected tx port is shown in status 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 02:26:38 -0000 On 2018/07/30 14:10, x-fn-spp@sl.ntt-tx.co.jp wrote: > From: Hideyuki Yamashita > > Unexpected tx port is shown without adding it because of bug of status > command. Here is an example. > > spp > sec 1;component start fwd1 12 forward > spp > sec 1;port add ring:0 rx fwd1 > spp > sec 1;flush > spp > sec 1;status > { "results": [ { "result": "success" } ],"info": { "client-id": 2, > ... > "tx_port": [ { "port": "phy:0", "vlan": { "operation": # Here > ... > > It is because status command wrongly assumes the number of tx port is > equal to rx if the number of rx port is greater than zero. To fix the > problem, add 'num_tx' in struct forward_path to hold the number exactly. Thanks for your update. Acked-by: Yasufumi Ogawa > > Signed-off-by: Hideyuki Yamashita > Signed-off-by: Naoki Takada > --- > src/vf/spp_forward.c | 24 +++++++++++++----------- > 1 file changed, 13 insertions(+), 11 deletions(-) > > diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c > index f8bd1d1..0a43608 100644 > --- a/src/vf/spp_forward.c > +++ b/src/vf/spp_forward.c > @@ -21,7 +21,8 @@ struct forward_path { > char name[SPP_NAME_STR_LEN]; /* component name */ > volatile enum spp_component_type type; > /* component type */ > - int num; /* number of receive ports */ > + int num_rx; /* number of receive ports */ > + int num_tx; /* number of trans ports */ > struct forward_rxtx ports[RTE_MAX_ETHPORTS]; > /* port used for transfer */ > }; > @@ -93,7 +94,8 @@ spp_forward_update(struct spp_component_info *component) > > memcpy(&path->name, component->name, SPP_NAME_STR_LEN); > path->type = component->type; > - path->num = component->num_rx_port; > + path->num_rx = component->num_rx_port; > + path->num_tx = component->num_tx_port; > for (cnt = 0; cnt < num_rx; cnt++) > memcpy(&path->ports[cnt].rx, component->rx_ports[cnt], > sizeof(struct spp_port_info)); > @@ -137,7 +139,7 @@ change_forward_index(int id) > int > spp_forward(int id) > { > - int cnt, num, buf; > + int cnt, buf; > int nb_rx = 0; > int nb_tx = 0; > struct forward_info *info = &g_forward_info[id]; > @@ -148,9 +150,8 @@ spp_forward(int id) > > change_forward_index(id); > path = &info->path[info->ref_index]; > - num = path->num; > > - for (cnt = 0; cnt < num; cnt++) { > + for (cnt = 0; cnt < path->num_rx; cnt++) { > rx = &path->ports[cnt].rx; > tx = &path->ports[cnt].tx; > > @@ -179,7 +180,7 @@ spp_forward_get_component_status( > struct spp_iterate_core_params *params) > { > int ret = -1; > - int cnt, num_tx; > + int cnt; > const char *component_type = NULL; > struct forward_info *info = &g_forward_info[id]; > struct forward_path *path = &info->path[info->ref_index]; > @@ -199,21 +200,22 @@ spp_forward_get_component_status( > component_type = SPP_TYPE_FORWARD_STR; > > memset(rx_ports, 0x00, sizeof(rx_ports)); > - for (cnt = 0; cnt < path->num; cnt++) { > + for (cnt = 0; cnt < path->num_rx; cnt++) { > rx_ports[cnt].iface_type = path->ports[cnt].rx.iface_type; > rx_ports[cnt].iface_no = path->ports[cnt].rx.iface_no; > } > > memset(tx_ports, 0x00, sizeof(tx_ports)); > - num_tx = (path->num > 0)?1:0; > - tx_ports[0].iface_type = path->ports[0].tx.iface_type; > - tx_ports[0].iface_no = path->ports[0].tx.iface_no; > + for (cnt = 0; cnt < path->num_tx; cnt++) { > + tx_ports[cnt].iface_type = path->ports[cnt].tx.iface_type; > + tx_ports[cnt].iface_no = path->ports[cnt].tx.iface_no; > + } > > /* Set the information with the function specified by the command. */ > ret = (*params->element_proc)( > params, lcore_id, > path->name, component_type, > - path->num, rx_ports, num_tx, tx_ports); > + path->num_rx, rx_ports, path->num_tx, tx_ports); > if (unlikely(ret != 0)) > return -1; > > -- Yasufumi Ogawa NTT Network Service Systems Labs