From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
To: x-fn-spp@sl.ntt-tx.co.jp, ferruh.yigit@intel.com
Cc: spp@dpdk.org
Subject: Re: [spp] [PATCH] spp_vf: fix unexpected tx port is shown in status
Date: Thu, 9 Aug 2018 11:24:38 +0900 [thread overview]
Message-ID: <6524128b-0907-ec85-5133-cc77a407c50c@lab.ntt.co.jp> (raw)
In-Reply-To: <201807300510.w6U5AoRU010221@imss03.silk.ntt-tx.co.jp>
On 2018/07/30 14:10, x-fn-spp@sl.ntt-tx.co.jp wrote:
> From: Hideyuki Yamashita <yamashita.hideyuki@po.ntt-tx.co.jp>
>
> 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 <ogawa.yasufumi@lab.ntt.co.jp>
>
> Signed-off-by: Hideyuki Yamashita <yamashita.hideyuki@po.ntt-tx.co.jp>
> Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
> ---
> 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
next prev parent reply other threads:[~2018-08-09 2:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-30 5:10 x-fn-spp
2018-08-09 2:24 ` Yasufumi Ogawa [this message]
2018-08-22 9:37 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6524128b-0907-ec85-5133-cc77a407c50c@lab.ntt.co.jp \
--to=ogawa.yasufumi@lab.ntt.co.jp \
--cc=ferruh.yigit@intel.com \
--cc=spp@dpdk.org \
--cc=x-fn-spp@sl.ntt-tx.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).