[dpdk-dev] [PATCH] rte_delay_us can be replaced with user function
Thomas Monjalon
thomas.monjalon at 6wind.com
Tue Jul 19 15:21:11 CEST 2016
Hi,
2016-07-19 14:42, jozmarti at 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)?
More information about the dev
mailing list