[dpdk-dev] [PATCH v2] eal: redefine logtype values
De Lara Guarch, Pablo
pablo.de.lara.guarch at intel.com
Thu Apr 13 10:32:19 CEST 2017
Hi Olivier,
> -----Original Message-----
> From: Olivier MATZ [mailto:olivier.matz at 6wind.com]
> Sent: Wednesday, April 12, 2017 8:24 PM
> To: De Lara Guarch, Pablo
> Cc: thomas.monjalon at 6wind.com; dev at dpdk.org
> Subject: Re: [PATCH v2] eal: redefine logtype values
>
> Hi Pablo,
>
>
> On Wed, 12 Apr 2017 16:35:32 +0100
> Pablo de Lara <pablo.de.lara.guarch at intel.com> wrote:
...
>
>
> Thanks for spotting this issue. I think there is still a problem with
> the deprecated functions for which we want to keep compat:
>
> /* Set global log type */
> __rte_deprecated void
> rte_set_log_type(uint32_t type, int enable)
> {
> if (type < RTE_LOGTYPE_FIRST_EXT_ID) {
> if (enable)
> rte_logs.type |= type;
> else
> rte_logs.type &= ~type;
> }
>
> if (enable)
> rte_log_set_level(type, 0);
> else
> rte_log_set_level(type, RTE_LOG_DEBUG);
> }
>
> /* Get global log type */
> __rte_deprecated uint32_t
> rte_get_log_type(void)
> {
> return rte_logs.type;
> }
>
>
> There is a problem in these functions because they expect bitmasks
> for the first part.
>
> I does not look so easy to both fix the issue and keep a full compat
> with previous functions.
>
> The first solution is your patch + add a shift in rte_set_log_type().
> It would work except if an application uses rte_get_log_type() and masks
> the result with a RTE_LOGTYPE_* (which will not be a bitmask). I think
> it's a rare case.
>
> The second approach would be to define new constants for the new
> functions and keep the old ones for the old functions. This approach
> is probably more confusing. It also requires to check the doc and
> examples again.
>
> Any opinion?
> I would prefer the first solution. If you want I can send a patch
> updated based on yours.
Oh yes, I missed that too. First option looks ok to me, so send a patch if you like.
More information about the dev
mailing list