From: "Jozef Martiniak -X (jozmarti - PANTHEON TECHNOLOGIES at Cisco)" <jozmarti@cisco.com>
To: Thomas Monjalon <thomas.monjalon@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] rte_delay_us can be replaced with user function
Date: Tue, 19 Jul 2016 13:52:38 +0000 [thread overview]
Message-ID: <ee92ee75689c4b4a85e362f31261ebcf@XCH-RCD-019.cisco.com> (raw)
In-Reply-To: <81613915.CvR5looQMP@xps13>
Hi,
On Tue, 2016-07-19 at 15:21 +0200, Thomas Monjalon wrote:
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).
>
I think register/unregister is the standard way how to handle callbacks. Unregister func is now "empty" but can be extended in the future.
> > +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)?
>
I wanted to touch as few things as possible with this patch.
next prev parent reply other threads:[~2016-07-19 13:52 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
2016-07-19 13:52 ` Jozef Martiniak -X (jozmarti - PANTHEON TECHNOLOGIES at Cisco) [this message]
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=ee92ee75689c4b4a85e362f31261ebcf@XCH-RCD-019.cisco.com \
--to=jozmarti@cisco.com \
--cc=dev@dpdk.org \
--cc=thomas.monjalon@6wind.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).