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, 19 Jul 2016 15:21:11 +0200	[thread overview]
Message-ID: <81613915.CvR5looQMP@xps13> (raw)
In-Reply-To: <1468932143-9321-1-git-send-email-jozmarti@cisco.com>

Hi,

2016-07-19 14:42, jozmarti@cisco.com:
> when running single-core, some drivers tend to call rte_delay_us for a
> long time, and that is causing packet drops.
> Attached patch introduces 2 new functions:
> 
> void rte_delay_us_callback_register(void(*userfunc)(unsigned));
> void rte_delay_us_callback_unregister(void);
> 
> First one replaces rte_delay_us with userfunc and second one restores
> original rte_delay_us.

I think we could avoid the function unregister by exporting the
default implementation (let's say rte_delay_us_block).


> +REGISTER_TEST_COMMAND(user_delay_us, test_user_delay_us);

Thanks for providing an unit test.


> --- a/lib/librte_eal/common/eal_common_timer.c
> +++ b/lib/librte_eal/common/eal_common_timer.c
>  void
>  rte_delay_us(unsigned us)
>  {
> +	if (unlikely(rte_delay_us_override != NULL))
> +	{
> +	    rte_delay_us_override(us);
> +	    return;
> +	}

Why not always call the registered callback and initialize it
to the default implementation (maybe using a constructor)?

  parent reply	other threads:[~2016-07-19 13:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-19 12:42 jozmarti
2016-07-19 13:17 ` Wiles, Keith
2016-07-19 13:21 ` Thomas Monjalon [this message]
2016-07-19 13:52   ` Jozef Martiniak -X (jozmarti - PANTHEON TECHNOLOGIES at Cisco)
2016-07-20 12:10 jozmarti
2016-09-13 20:04 ` Thomas Monjalon
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

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=81613915.CvR5looQMP@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).