DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ori Kam <orika@mellanox.com>
To: Beilei Xing <beilei.xing@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2] examples/flow_filtering: add delay during updating link status
Date: Wed, 24 Jan 2018 08:55:30 +0000	[thread overview]
Message-ID: <AM4PR05MB1476577D316C9FE2DE22412CDBE20@AM4PR05MB1476.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <1516782880-59883-1-git-send-email-beilei.xing@intel.com>

Hi


> -----Original Message-----
> From: Beilei Xing [mailto:beilei.xing@intel.com]
> Sent: Wednesday, January 24, 2018 10:35 AM
> To: Ori Kam <orika@mellanox.com>
> Cc: dev@dpdk.org
> Subject: [PATCH v2] examples/flow_filtering: add delay during updating link
> status
> 
> Add up to 9s delay for getting link status to make sure NIC updates link status
> successfully, just like other applications such as testpmd and l2fwd.
> 
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>
> ---
> 
> v2 changes:
>  - Add rte_delay_ms(CHECK_INTERVAL) which is missed in v1.
> 
>  examples/flow_filtering/main.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c
> index 4a07b63..85d5727 100644
> --- a/examples/flow_filtering/main.c
> +++ b/examples/flow_filtering/main.c
> @@ -55,6 +55,7 @@
>  #include <rte_mbuf.h>
>  #include <rte_net.h>
>  #include <rte_flow.h>
> +#include <rte_cycles.h>
> 
>  static volatile bool force_quit;
> 
> @@ -119,13 +120,23 @@ main_loop(void)
>  	rte_eth_dev_close(port_id);
>  }
> 
> +#define CHECK_INTERVAL 1000  /* 100ms */
> +#define MAX_REPEAT_TIME 90   /* 9s (90 * 100ms) in total */

I know that in other examples there is use of 
MAX_REPEAT_TIME but don't you think the name is incorrect,
It should be called:
MAX_REPEAT_TIMES or MAX_REPEAT_COUNT?
Since it doesn't represent time but iterations.
What do you think?

> +
>  static void
>  assert_link_status(void)
>  {
>  	struct rte_eth_link link;
> +	uint8_t rep_cnt = MAX_REPEAT_TIME;
> 
>  	memset(&link, 0, sizeof(link));
> -	rte_eth_link_get(port_id, &link);
> +	do {
> +		rte_eth_link_get(port_id, &link);
> +		if (link.link_status == ETH_LINK_UP)
> +			break;
> +		rte_delay_ms(CHECK_INTERVAL);
> +	} while (--rep_cnt);
> +
>  	if (link.link_status == ETH_LINK_DOWN)
>  		rte_exit(EXIT_FAILURE, ":: error: link is still down\n");  }
> --
> 2.5.5

  reply	other threads:[~2018-01-24  8:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24  7:52 [dpdk-dev] [PATCH] " Beilei Xing
2018-01-24  8:16 ` Ori Kam
2018-01-24  8:19   ` Xing, Beilei
2018-01-24  8:34 ` [dpdk-dev] [PATCH v2] " Beilei Xing
2018-01-24  8:55   ` Ori Kam [this message]
2018-01-24 10:02     ` Xing, Beilei
2018-01-24 10:15   ` [dpdk-dev] [PATCH v3] " Beilei Xing
2018-01-24 11:42     ` Ori Kam
2018-02-01  0:27       ` Thomas Monjalon

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=AM4PR05MB1476577D316C9FE2DE22412CDBE20@AM4PR05MB1476.eurprd05.prod.outlook.com \
    --to=orika@mellanox.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    /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).