DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: jozmarti@cisco.com
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] rte_delay_us can be replaced with user function
Date: Tue, 13 Sep 2016 22:04:38 +0200	[thread overview]
Message-ID: <8519806.gZT5cxUFJR@xps13> (raw)
In-Reply-To: <1469016644-6521-1-git-send-email-jozmarti@cisco.com>

Hi,

Sorry for late review.
This patch was in a summer hole :/

First a general comment: please check your patch with
scripts/checkpatches.sh.
In order to ease tracking of this patch, please increment the version
when sending a new one in the same thread:
	git send-email -1 -v3 --annotate --to dev@dpdk.org \
	--in-reply-to 1469016644-6521-1-git-send-email-jozmarti@cisco.com

More comments below.

2016-07-20 14:10, jozmarti@cisco.com:
> +void rte_delay_us_callback_register(void (*userfunc)(unsigned))
> +{
> +    if (userfunc == NULL)
> +        rte_delay_us = rte_delay_us_block;

Here you are creating an exception for rte_delay_us_block which is
mapped as a NULL handler.
What will happen if we need to provide more builtin handlers?
I still think that rte_delay_us_block can be exported and initialized
as the default handler. Other opinions are obviously welcome.

> +    else
> +        rte_delay_us = userfunc;
> +}
> +
> +static void __attribute__((constructor))
> +rte_timer_init(void)
> +{
> +    /* set rte_delay_us_block as a delay function */
> +    rte_delay_us_callback_register(NULL);
> +}
> diff --git a/lib/librte_eal/common/include/generic/rte_cycles.h b/lib/librte_eal/common/include/generic/rte_cycles.h
> index 8cc21f2..7a45b58 100644
> --- a/lib/librte_eal/common/include/generic/rte_cycles.h
> +++ b/lib/librte_eal/common/include/generic/rte_cycles.h
> @@ -182,13 +182,16 @@ rte_get_timer_hz(void)
>  }
>  
>  /**
> + *

useless newline

>   * Wait at least us microseconds.
> + * This function can be replaced with user-defined function using
> + * rte_delay_us_callback_register

I think you can use @see to point to rte_delay_us_callback_register.

>   *
>   * @param us
>   *   The number of microseconds to wait.
>   */
>  void
> -rte_delay_us(unsigned us);
> +(*rte_delay_us)(unsigned us);
>  
>  /**
>   * Wait at least ms milliseconds.
> @@ -202,4 +205,14 @@ rte_delay_ms(unsigned ms)
>  	rte_delay_us(ms * 1000);
>  }
>  
> +/**
> + * Replace rte_delay_us with user defined function.
> + *
> + * @param userfunc
> + *   User function which replaces rte_delay_us. NULL restores
> + *   buildin block delay function.

buildin -> builtin ?

> + */
> +void rte_delay_us_callback_register(void(*userfunc)(unsigned));

  reply	other threads:[~2016-09-13 20:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-20 12:10 jozmarti
2016-09-13 20:04 ` Thomas Monjalon [this message]
2016-09-21 13:12   ` Thomas Monjalon
2016-09-22  8:37     ` Jozef Martiniak -X (jozmarti - PANTHEON TECHNOLOGIES at Cisco)
2016-09-22 15:08       ` Thomas Monjalon
2016-09-23  6:39 ` [dpdk-dev] [PATCH v3] " jozmarti
2016-09-23 14:03   ` Thomas Monjalon
2016-09-26  8:35 ` jozmarti
2016-09-26 12:48   ` Thomas Monjalon
  -- strict thread matches above, loose matches on Subject: below --
2016-07-19 12:42 [dpdk-dev] [PATCH] " jozmarti
2016-07-19 13:17 ` Wiles, Keith
2016-07-19 13:21 ` Thomas Monjalon
2016-07-19 13:52   ` Jozef Martiniak -X (jozmarti - PANTHEON TECHNOLOGIES at Cisco)

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=8519806.gZT5cxUFJR@xps13 \
    --to=thomas.monjalon@6wind.com \
    --cc=dev@dpdk.org \
    --cc=jozmarti@cisco.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).