DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: Andriy Berestovskyy <Andriy.Berestovskyy@caviumnetworks.com>
Cc: Maciej Czekaj <maciej.czekaj@caviumnetworks.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 2/2] net/thunderx: wait to complete during link update
Date: Mon, 3 Apr 2017 20:25:59 +0530	[thread overview]
Message-ID: <20170403145518.ahzma7cjalosxomx@localhost.localdomain> (raw)
In-Reply-To: <1490968669-9161-2-git-send-email-Andriy.Berestovskyy@caviumnetworks.com>

On Fri, Mar 31, 2017 at 03:57:49PM +0200, Andriy Berestovskyy wrote:
> Some DPDK applications/examples check link status on their
> start. NICVF does not wait for the link, so those apps fail.
> 
> Wait up to 9 seconds for the link as other PMDs do in order
> to fix those apps/examples.
> 
> Signed-off-by: Andriy Berestovskyy <Andriy.Berestovskyy@caviumnetworks.com>

Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

> ---
>  drivers/net/thunderx/nicvf_ethdev.c | 21 +++++++++++++++++----
>  1 file changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
> index 984c218..2fe653a 100644
> --- a/drivers/net/thunderx/nicvf_ethdev.c
> +++ b/drivers/net/thunderx/nicvf_ethdev.c
> @@ -145,16 +145,29 @@ nicvf_periodic_alarm_stop(void (fn)(void *), void *arg)
>   * Return 0 means link status changed, -1 means not changed
>   */
>  static int
> -nicvf_dev_link_update(struct rte_eth_dev *dev,
> -		      int wait_to_complete __rte_unused)
> +nicvf_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
>  {
> +#define CHECK_INTERVAL 100  /* 100ms */
> +#define MAX_CHECK_TIME 90   /* 9s (90 * 100ms) in total */
>  	struct rte_eth_link link;
>  	struct nicvf *nic = nicvf_pmd_priv(dev);
> +	int i;
>  
>  	PMD_INIT_FUNC_TRACE();
>  
> -	memset(&link, 0, sizeof(link));
> -	nicvf_set_eth_link_status(nic, &link);
> +	if (wait_to_complete) {
> +		/* rte_eth_link_get() might need to wait up to 9 seconds */
> +		for (i = 0; i < MAX_CHECK_TIME; i++) {
> +			memset(&link, 0, sizeof(link));
> +			nicvf_set_eth_link_status(nic, &link);
> +			if (link.link_status)
> +				break;
> +			rte_delay_ms(CHECK_INTERVAL);
> +		}
> +	} else {
> +		memset(&link, 0, sizeof(link));
> +		nicvf_set_eth_link_status(nic, &link);
> +	}
>  	return nicvf_atomic_write_link_status(dev, &link);
>  }
>  
> -- 
> 2.7.4
> 

  reply	other threads:[~2017-04-03 14:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 13:57 [dpdk-dev] [PATCH 1/2] net/thunderx: add empty link up/down callbacks Andriy Berestovskyy
2017-03-31 13:57 ` [dpdk-dev] [PATCH 2/2] net/thunderx: wait to complete during link update Andriy Berestovskyy
2017-04-03 14:55   ` Jerin Jacob [this message]
2017-04-03 15:35     ` Ferruh Yigit
2017-04-03 15:13 ` [dpdk-dev] [PATCH 1/2] net/thunderx: add empty link up/down callbacks Jerin Jacob
2017-04-13 11:04   ` Ferruh Yigit
2017-04-14 12:37     ` Jerin Jacob

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=20170403145518.ahzma7cjalosxomx@localhost.localdomain \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=Andriy.Berestovskyy@caviumnetworks.com \
    --cc=dev@dpdk.org \
    --cc=maciej.czekaj@caviumnetworks.com \
    /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).