trace_mem is declared as 'void *' which triggers following error: '...invalid conversion from ‘void*’ to ‘__rte_trace_header*’ [-fpermissive]...' Fix this by changing void to struct __rte_trace_header --- lib/librte_eal/common/eal_common_trace.c | 2 +- lib/librte_eal/include/rte_trace_point.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/common/eal_common_trace.c b/lib/librte_eal/common/eal_common_trace.c index 875553d7e..18e5e64be 100644 --- a/lib/librte_eal/common/eal_common_trace.c +++ b/lib/librte_eal/common/eal_common_trace.c @@ -16,7 +16,7 @@ #include "eal_trace.h" RTE_DEFINE_PER_LCORE(volatile int, trace_point_sz); -RTE_DEFINE_PER_LCORE(void *, trace_mem); +RTE_DEFINE_PER_LCORE(struct __rte_trace_header *, trace_mem); static RTE_DEFINE_PER_LCORE(char, ctf_field[TRACE_CTF_FIELD_SIZE]); static RTE_DEFINE_PER_LCORE(int, ctf_count); diff --git a/lib/librte_eal/include/rte_trace_point.h b/lib/librte_eal/include/rte_trace_point.h index b45171275..587f600ec 100644 --- a/lib/librte_eal/include/rte_trace_point.h +++ b/lib/librte_eal/include/rte_trace_point.h @@ -295,7 +295,7 @@ struct __rte_trace_header { uint8_t mem[]; }; -RTE_DECLARE_PER_LCORE(void *, trace_mem); +RTE_DECLARE_PER_LCORE(struct __rte_trace_header *, trace_mem); static __rte_always_inline void * __rte_trace_mem_get(uint64_t in) -- 2.17.1
Hello Pawel, Thanks for contributing to DPDK. On Tue, Aug 4, 2020 at 7:52 PM Pawel Wodkowski <pawelwod@gmail.com> wrote: > > trace_mem is declared as 'void *' which triggers following error: > '...invalid conversion from ‘void*’ to ‘__rte_trace_header*’ > [-fpermissive]...' > > Fix this by changing void to struct __rte_trace_header I Cc'd trace maintainers. For subsequent revisions, you can do directly Cc them by calling the get-maintainer.sh script like this: $ git send-email --to dev@dpdk.org --cc-cmd devtools/get-maintainer.sh $patch On the form of the patch, this patch is missing a signed-off tag, please have a look at the contribution guidelines: https://doc.dpdk.org/guides/contributing/patches.html Do not forget to chain replies using the --in-reply-to option for git send-email. This is a fix, so we expect a Fixes: tag in the commitlog. This tag should point at the original commit that introduced the issue. Looking at the CI report http://mails.dpdk.org/archives/test-report/2020-August/147927.html, you will see that the windows part is missing an update. $ git grep -wl trace_mem lib/librte_eal/common/eal_common_trace.c lib/librte_eal/include/rte_trace_point.h lib/librte_eal/windows/eal.c -- David Marchand
On 05.08.2020 10:00, David Marchand wrote:
> Hello Pawel,
>
> Thanks for contributing to DPDK.
>
>
Thank for all tips. I will do that and resend V2.
Paweł
Hello Pawel,
See answers inline.
Regards
Sunil Kumar Kori
>-----Original Message-----
>From: David Marchand <david.marchand@redhat.com>
>Sent: Wednesday, August 5, 2020 1:30 PM
>To: Pawel Wodkowski <pawelwod@gmail.com>
>Cc: dev <dev@dpdk.org>; Jerin Jacob Kollanukkaran <jerinj@marvell.com>;
>Sunil Kumar Kori <skori@marvell.com>
>Subject: [EXT] Re: [dpdk-dev] [PATCH] tracepoint: fix compilation with C++
>
>External Email
>
>----------------------------------------------------------------------
>Hello Pawel,
>
>Thanks for contributing to DPDK.
>
>
>On Tue, Aug 4, 2020 at 7:52 PM Pawel Wodkowski <pawelwod@gmail.com>
>wrote:
>>
>> trace_mem is declared as 'void *' which triggers following error:
>> '...invalid conversion from ‘void*’ to ‘__rte_trace_header*’
>> [-fpermissive]...'
>>
>> Fix this by changing void to struct __rte_trace_header
trace_mem is intentionally kept as void * so that it can not be accessed by application directly as it part of global header.
If I understood the problem correctly, it is because of using trace_mem without typecasting and GCC does not report it as error
due to implicit typecast and G++ reports it as error as it does not do implicit typecasting.
If this is the case then, I think it is better to typecast the trace_mem where ever it is being used. Anyways that will be safe for both GCC and G++.
@Jerin Jacob Kollanukkaran Please suggest. If you have some thing mind.
[snippet]
--
On 06.08.2020 08:44, Sunil Kumar Kori wrote: > Hello Pawel, > > See answers inline. > > Regards > Sunil Kumar Kori > >> -----Original Message----- >> From: David Marchand <david.marchand@redhat.com> >> Sent: Wednesday, August 5, 2020 1:30 PM >> To: Pawel Wodkowski <pawelwod@gmail.com> >> Cc: dev <dev@dpdk.org>; Jerin Jacob Kollanukkaran <jerinj@marvell.com>; >> Sunil Kumar Kori <skori@marvell.com> >> Subject: [EXT] Re: [dpdk-dev] [PATCH] tracepoint: fix compilation with C++ >> >> External Email >> >> ---------------------------------------------------------------------- >> Hello Pawel, >> >> Thanks for contributing to DPDK. >> >> >> On Tue, Aug 4, 2020 at 7:52 PM Pawel Wodkowski <pawelwod@gmail.com> >> wrote: >>> trace_mem is declared as 'void *' which triggers following error: >>> '...invalid conversion from ‘void*’ to ‘__rte_trace_header*’ >>> [-fpermissive]...' >>> >>> Fix this by changing void to struct __rte_trace_header > trace_mem is intentionally kept as void * so that it can not be accessed by application directly as it part of global header. But this structure is well defined in this file anyway. It can be casted to 'struct __rte_trace_header *' and used. Isn't the double underscore prefix good enough warning that it is internal datatype? But anyway, I'm not here to discuss the architecture of DPDK so lets go to the next point. > If I understood the problem correctly, it is because of using trace_mem without typecasting and GCC does not report it as error > due to implicit typecast and G++ reports it as error as it does not do implicit typecasting. Actually it is because in C++ implicit cast from void pointer is not allowed. So when it is used like this struct __rte_trace_header *trace = RTE_PER_LCORE(trace_mem); it triggers this type of error: include/rte_trace_point.h: In function ‘void* __rte_trace_mem_get(uint64_t)’: include/rte_per_lcore.h:44:46: error: invalid conversion from ‘void*’ to ‘__rte_trace_header*’ [-fpermissive] #define RTE_PER_LCORE(name) (per_lcore_##name) ^ nclude/rte_trace_point.h:303:37: note: in expansion of macro ‘RTE_PER_LCORE’ struct __rte_trace_header *trace = RTE_PER_LCORE(trace_mem); ^ One can add '-fpermisive' to allow this type of casting but it is only a workaround in C++ code. As you mentioned, other solution is typecast to __rte_trace_header but this is not needed in C and it have "__" prefix this why I decided to change 'void *' into 'struct __rte_trace_header *'. > > > If this is the case then, I think it is better to typecast the trace_mem where ever it is being used. Anyways that will be safe for both GCC and G++. > @Jerin Jacob Kollanukkaran Please suggest. If you have some thing mind. I'm fine any solution that make this code compile with C++. Please let me know what is the decision then I can make V2. Paweł > > > [snippet] > -- >
Answers inline. Regards Sunil Kumar Kori >-----Original Message----- >From: Pawel Wodkowski <pawelwod@gmail.com> >Sent: Friday, August 7, 2020 12:14 AM >To: Sunil Kumar Kori <skori@marvell.com>; Jerin Jacob Kollanukkaran ><jerinj@marvell.com> >Cc: dev <dev@dpdk.org>; David Marchand <david.marchand@redhat.com> >Subject: Re: [EXT] Re: [dpdk-dev] [PATCH] tracepoint: fix compilation with C++ > >On 06.08.2020 08:44, Sunil Kumar Kori wrote: >> Hello Pawel, >> >> See answers inline. >> >> Regards >> Sunil Kumar Kori >> >>> -----Original Message----- >>> From: David Marchand <david.marchand@redhat.com> >>> Sent: Wednesday, August 5, 2020 1:30 PM >>> To: Pawel Wodkowski <pawelwod@gmail.com> >>> Cc: dev <dev@dpdk.org>; Jerin Jacob Kollanukkaran >>> <jerinj@marvell.com>; Sunil Kumar Kori <skori@marvell.com> >>> Subject: [EXT] Re: [dpdk-dev] [PATCH] tracepoint: fix compilation >>> with C++ >>> >>> External Email >>> >>> --------------------------------------------------------------------- >>> - >>> Hello Pawel, >>> >>> Thanks for contributing to DPDK. >>> >>> >>> On Tue, Aug 4, 2020 at 7:52 PM Pawel Wodkowski ><pawelwod@gmail.com> >>> wrote: >>>> trace_mem is declared as 'void *' which triggers following error: >>>> '...invalid conversion from ‘void*’ to ‘__rte_trace_header*’ >>>> [-fpermissive]...' >>>> >>>> Fix this by changing void to struct __rte_trace_header >> trace_mem is intentionally kept as void * so that it can not be accessed by >application directly as it part of global header. >But this structure is well defined in this file anyway. It can be casted to 'struct >__rte_trace_header *' and used. >Isn't the double underscore prefix good enough warning that it is internal >datatype? > >But anyway, I'm not here to discuss the architecture of DPDK so lets go to the >next point. > >> If I understood the problem correctly, it is because of using >> trace_mem without typecasting and GCC does not report it as error due to >implicit typecast and G++ reports it as error as it does not do implicit >typecasting. >Actually it is because in C++ implicit cast from void pointer is not allowed. So >when it is used like this > > struct __rte_trace_header *trace = RTE_PER_LCORE(trace_mem); > >it triggers this type of error: > >include/rte_trace_point.h: In function ‘void* >__rte_trace_mem_get(uint64_t)’: >include/rte_per_lcore.h:44:46: error: invalid conversion from ‘void*’ to >‘__rte_trace_header*’ [-fpermissive] > #define RTE_PER_LCORE(name) (per_lcore_##name) > ^ >nclude/rte_trace_point.h:303:37: note: in expansion of macro >‘RTE_PER_LCORE’ > struct __rte_trace_header *trace = RTE_PER_LCORE(trace_mem); > ^ > >One can add '-fpermisive' to allow this type of casting but it is only a >workaround in C++ code. As you mentioned, other solution is typecast to >__rte_trace_header but this is not needed in C and it have "__" prefix this why >I decided to change 'void *' into 'struct __rte_trace_header *'. > But changing 'void *' to 'struct __rte_trace_header *' will change the interpretation of trace_mem from user perspective which is against the design. I would request you to go for the proposed solution. Although there is no need of this for GCC but if there is no harm. Also consider a use case where system is designed like 'structure is exposed to application as opaque pointer(void *) and typecasted by the underlying implementation before using it'. Then changing opaque pointer to structure type is not expected. >> >> >> If this is the case then, I think it is better to typecast the trace_mem where >ever it is being used. Anyways that will be safe for both GCC and G++. >> @Jerin Jacob Kollanukkaran Please suggest. If you have some thing mind. > >I'm fine any solution that make this code compile with C++. Please let me >know what is the decision then I can make V2. > >Paweł >> >> >> [snippet] >> -- >>
trace_mem is declared as 'void *' which triggers following error: '...invalid conversion from ‘void*’ to ‘__rte_trace_header*’ [-fpermissive]...' Fix this by adding proper typecast to 'struct __rte_trace_header *'. Signed-off-by: Pawel Wodkowski <pawelwod@gmail.com> Fixes: ebaee6409702 ("trace: simplify trace point headers") Cc: david.marchand@redhat.com --- lib/librte_eal/include/rte_trace_point.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/include/rte_trace_point.h b/lib/librte_eal/include/rte_trace_point.h index b45171275..875de195a 100644 --- a/lib/librte_eal/include/rte_trace_point.h +++ b/lib/librte_eal/include/rte_trace_point.h @@ -300,13 +300,13 @@ RTE_DECLARE_PER_LCORE(void *, trace_mem); static __rte_always_inline void * __rte_trace_mem_get(uint64_t in) { - struct __rte_trace_header *trace = RTE_PER_LCORE(trace_mem); + struct __rte_trace_header *trace = (struct __rte_trace_header *)RTE_PER_LCORE(trace_mem); const uint16_t sz = in & __RTE_TRACE_FIELD_SIZE_MASK; /* Trace memory is not initialized for this thread */ if (unlikely(trace == NULL)) { __rte_trace_mem_per_thread_alloc(); - trace = RTE_PER_LCORE(trace_mem); + trace = (struct __rte_trace_header *) RTE_PER_LCORE(trace_mem); if (unlikely(trace == NULL)) return NULL; } -- 2.17.1
Hello Pawel, Few suggestions: 1. use 'trace' instead of 'tracepoint' in subject line. i.e. "trace: fix compilation with C++" 1. Update change history. 2. Add Fixes tag. 3. Superseed the previous version of this fix. Reference: http://patches.dpdk.org/patch/66396/ Rest Looks okay. Please submit next version with above update. Regards Sunil Kumar Kori >-----Original Message----- >From: Pawel Wodkowski <pawelwod@gmail.com> >Sent: Tuesday, August 11, 2020 2:06 AM >To: dev@dpdk.org >Cc: Pawel Wodkowski <pawelwod@gmail.com>; >david.marchand@redhat.com; Jerin Jacob Kollanukkaran ><jerinj@marvell.com>; Sunil Kumar Kori <skori@marvell.com> >Subject: [EXT] [PATCH v2] tracepoint: fix compilation with C++ > >External Email > >---------------------------------------------------------------------- >trace_mem is declared as 'void *' which triggers following error: >'...invalid conversion from ‘void*’ to ‘__rte_trace_header*’ >[-fpermissive]...' > >Fix this by adding proper typecast to 'struct __rte_trace_header *'. > >Signed-off-by: Pawel Wodkowski <pawelwod@gmail.com> >Fixes: ebaee6409702 ("trace: simplify trace point headers") >Cc: david.marchand@redhat.com >--- > lib/librte_eal/include/rte_trace_point.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/lib/librte_eal/include/rte_trace_point.h >b/lib/librte_eal/include/rte_trace_point.h >index b45171275..875de195a 100644 >--- a/lib/librte_eal/include/rte_trace_point.h >+++ b/lib/librte_eal/include/rte_trace_point.h >@@ -300,13 +300,13 @@ RTE_DECLARE_PER_LCORE(void *, trace_mem); >static __rte_always_inline void * __rte_trace_mem_get(uint64_t in) { >- struct __rte_trace_header *trace = RTE_PER_LCORE(trace_mem); >+ struct __rte_trace_header *trace = (struct __rte_trace_header >+*)RTE_PER_LCORE(trace_mem); > const uint16_t sz = in & __RTE_TRACE_FIELD_SIZE_MASK; > > /* Trace memory is not initialized for this thread */ > if (unlikely(trace == NULL)) { > __rte_trace_mem_per_thread_alloc(); >- trace = RTE_PER_LCORE(trace_mem); >+ trace = (struct __rte_trace_header *) >RTE_PER_LCORE(trace_mem); > if (unlikely(trace == NULL)) > return NULL; > } >-- >2.17.1
Hi Sunil,
I finished porting app to DPDK 20.05 and I'm afraid that I can't
do anything more here as I don't have proper development
environment anymore nor the time for setting it up again. If you
find this change useful please take over it. Otherwise there will
be long time before I can send next version. Also, as DPDK is
deprecating Makefile build system, 20.05 might be last version
we are using.
Anyway, thanks for guidelines and wish you best.
Paweł
On 11.08.2020 11:29, Sunil Kumar Kori wrote:
> Hello Pawel,
>
> Few suggestions:
> 1. use 'trace' instead of 'tracepoint' in subject line. i.e. "trace: fix compilation with C++"
> 1. Update change history.
> 2. Add Fixes tag.
> 3. Superseed the previous version of this fix.
>
> Reference: http://patches.dpdk.org/patch/66396/
> Rest Looks okay. Please submit next version with above update.
>
> Regards
> Sunil Kumar Kori
>
>> -----Original Message-----
>> From: Pawel Wodkowski <pawelwod@gmail.com>
>> Sent: Tuesday, August 11, 2020 2:06 AM
>> To: dev@dpdk.org
>> Cc: Pawel Wodkowski <pawelwod@gmail.com>;
>> david.marchand@redhat.com; Jerin Jacob Kollanukkaran
>> <jerinj@marvell.com>; Sunil Kumar Kori <skori@marvell.com>
>> Subject: [EXT] [PATCH v2] tracepoint: fix compilation with C++
>>
>> External Email
>>
>> ----------------------------------------------------------------------
>> trace_mem is declared as 'void *' which triggers following error:
>> '...invalid conversion from ‘void*’ to ‘__rte_trace_header*’
>> [-fpermissive]...'
>>
>> Fix this by adding proper typecast to 'struct __rte_trace_header *'.
>>
>> Signed-off-by: Pawel Wodkowski <pawelwod@gmail.com>
>> Fixes: ebaee6409702 ("trace: simplify trace point headers")
>> Cc: david.marchand@redhat.com
>> ---
>> lib/librte_eal/include/rte_trace_point.h | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/librte_eal/include/rte_trace_point.h
>> b/lib/librte_eal/include/rte_trace_point.h
>> index b45171275..875de195a 100644
>> --- a/lib/librte_eal/include/rte_trace_point.h
>> +++ b/lib/librte_eal/include/rte_trace_point.h
>> @@ -300,13 +300,13 @@ RTE_DECLARE_PER_LCORE(void *, trace_mem);
>> static __rte_always_inline void * __rte_trace_mem_get(uint64_t in) {
>> - struct __rte_trace_header *trace = RTE_PER_LCORE(trace_mem);
>> + struct __rte_trace_header *trace = (struct __rte_trace_header
>> +*)RTE_PER_LCORE(trace_mem);
>> const uint16_t sz = in & __RTE_TRACE_FIELD_SIZE_MASK;
>>
>> /* Trace memory is not initialized for this thread */
>> if (unlikely(trace == NULL)) {
>> __rte_trace_mem_per_thread_alloc();
>> - trace = RTE_PER_LCORE(trace_mem);
>> + trace = (struct __rte_trace_header *)
>> RTE_PER_LCORE(trace_mem);
>> if (unlikely(trace == NULL))
>> return NULL;
>> }
>> --
>> 2.17.1
Hello Pawel,
No problem. I will take care of this and send next version with updated information.
Regards
Sunil Kumar Kori
>-----Original Message-----
>From: Pawel Wodkowski <pawelwod@gmail.com>
>Sent: Tuesday, August 11, 2020 7:04 PM
>To: Sunil Kumar Kori <skori@marvell.com>; dev@dpdk.org
>Cc: david.marchand@redhat.com; Jerin Jacob Kollanukkaran
><jerinj@marvell.com>
>Subject: Re: [EXT] [PATCH v2] tracepoint: fix compilation with C++
>
>Hi Sunil,
>
>I finished porting app to DPDK 20.05 and I'm afraid that I can't do anything
>more here as I don't have proper development environment anymore nor the
>time for setting it up again. If you find this change useful please take over it.
>Otherwise there will be long time before I can send next version. Also, as
>DPDK is deprecating Makefile build system, 20.05 might be last version we are
>using.
>
>Anyway, thanks for guidelines and wish you best.
>
>Paweł
>
>On 11.08.2020 11:29, Sunil Kumar Kori wrote:
>> Hello Pawel,
>>
>> Few suggestions:
>> 1. use 'trace' instead of 'tracepoint' in subject line. i.e. "trace: fix compilation
>with C++"
>> 1. Update change history.
>> 2. Add Fixes tag.
>> 3. Superseed the previous version of this fix.
>>
>> Reference:
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__patches.dpdk.org_p
>>
>atch_66396_&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=dXeXaAMkP5COg
>n1zxHMyaF
>>
>1_d9IIuq6vHQO6NrIPjaE&m=jmriYGtutfDqnB0UfW9ali2yisBvQVKQXWkNkDGx
>vgE&s=
>> teGvP5nM7eaYsOm69KvpblaGF5ct--schiCF74Mab_k&e=
>> Rest Looks okay. Please submit next version with above update.
>>
>> Regards
>> Sunil Kumar Kori
>>
>>> -----Original Message-----
>>> From: Pawel Wodkowski <pawelwod@gmail.com>
>>> Sent: Tuesday, August 11, 2020 2:06 AM
>>> To: dev@dpdk.org
>>> Cc: Pawel Wodkowski <pawelwod@gmail.com>;
>david.marchand@redhat.com;
>>> Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Sunil Kumar Kori
>>> <skori@marvell.com>
>>> Subject: [EXT] [PATCH v2] tracepoint: fix compilation with C++
>>>
>>> External Email
>>>
>>> ---------------------------------------------------------------------
>>> - trace_mem is declared as 'void *' which triggers following error:
>>> '...invalid conversion from ‘void*’ to ‘__rte_trace_header*’
>>> [-fpermissive]...'
>>>
>>> Fix this by adding proper typecast to 'struct __rte_trace_header *'.
>>>
>>> Signed-off-by: Pawel Wodkowski <pawelwod@gmail.com>
>>> Fixes: ebaee6409702 ("trace: simplify trace point headers")
>>> Cc: david.marchand@redhat.com
>>> ---
>>> lib/librte_eal/include/rte_trace_point.h | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/lib/librte_eal/include/rte_trace_point.h
>>> b/lib/librte_eal/include/rte_trace_point.h
>>> index b45171275..875de195a 100644
>>> --- a/lib/librte_eal/include/rte_trace_point.h
>>> +++ b/lib/librte_eal/include/rte_trace_point.h
>>> @@ -300,13 +300,13 @@ RTE_DECLARE_PER_LCORE(void *, trace_mem);
>>> static __rte_always_inline void * __rte_trace_mem_get(uint64_t in) {
>>> - struct __rte_trace_header *trace = RTE_PER_LCORE(trace_mem);
>>> + struct __rte_trace_header *trace = (struct __rte_trace_header
>>> +*)RTE_PER_LCORE(trace_mem);
>>> const uint16_t sz = in & __RTE_TRACE_FIELD_SIZE_MASK;
>>>
>>> /* Trace memory is not initialized for this thread */
>>> if (unlikely(trace == NULL)) {
>>> __rte_trace_mem_per_thread_alloc();
>>> - trace = RTE_PER_LCORE(trace_mem);
>>> + trace = (struct __rte_trace_header *)
>>> RTE_PER_LCORE(trace_mem);
>>> if (unlikely(trace == NULL))
>>> return NULL;
>>> }
>>> --
>>> 2.17.1
From: Pawel Wodkowski <pawelwod@gmail.com> trace_mem is declared as 'void *' which triggers following error: '...invalid conversion from ‘void*’ to ‘__rte_trace_header*’ [-fpermissive]...' Fix this by adding proper typecast to 'struct __rte_trace_header *'. Fixes: ebaee6409702 ("trace: simplify trace point headers") Signed-off-by: Pawel Wodkowski <pawelwod@gmail.com> --- v3: - fix subject. v2: - Update proper typecasting. lib/librte_eal/include/rte_trace_point.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/include/rte_trace_point.h b/lib/librte_eal/include/rte_trace_point.h index b03960277..6446f2f0f 100644 --- a/lib/librte_eal/include/rte_trace_point.h +++ b/lib/librte_eal/include/rte_trace_point.h @@ -298,13 +298,14 @@ RTE_DECLARE_PER_LCORE(void *, trace_mem); static __rte_always_inline void * __rte_trace_mem_get(uint64_t in) { - struct __rte_trace_header *trace = RTE_PER_LCORE(trace_mem); + struct __rte_trace_header *trace = + (struct __rte_trace_header *)(RTE_PER_LCORE(trace_mem)); const uint16_t sz = in & __RTE_TRACE_FIELD_SIZE_MASK; /* Trace memory is not initialized for this thread */ if (unlikely(trace == NULL)) { __rte_trace_mem_per_thread_alloc(); - trace = RTE_PER_LCORE(trace_mem); + trace = (struct __rte_trace_header *)(RTE_PER_LCORE(trace_mem)); if (unlikely(trace == NULL)) return NULL; } -- 2.25.1
Hi,
> -----Original Message-----
> From: skori@marvell.com
>
> trace_mem is declared as 'void *' which triggers following error:
> '...invalid conversion from ‘void*’ to ‘__rte_trace_header*’
> [-fpermissive]...'
>
> Fix this by adding proper typecast to 'struct __rte_trace_header *'.
>
> Fixes: ebaee6409702 ("trace: simplify trace point headers")
>
> Signed-off-by: Pawel Wodkowski <pawelwod@gmail.com>
> ---
> v3:
> - fix subject.
> v2:
> - Update proper typecasting.
>
> lib/librte_eal/include/rte_trace_point.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_eal/include/rte_trace_point.h
> b/lib/librte_eal/include/rte_trace_point.h
> index b03960277..6446f2f0f 100644
> --- a/lib/librte_eal/include/rte_trace_point.h
> +++ b/lib/librte_eal/include/rte_trace_point.h
> @@ -298,13 +298,14 @@ RTE_DECLARE_PER_LCORE(void *, trace_mem);
> static __rte_always_inline void * __rte_trace_mem_get(uint64_t in) {
> - struct __rte_trace_header *trace = RTE_PER_LCORE(trace_mem);
> + struct __rte_trace_header *trace =
> + (struct __rte_trace_header
> *)(RTE_PER_LCORE(trace_mem));
> const uint16_t sz = in & __RTE_TRACE_FIELD_SIZE_MASK;
>
> /* Trace memory is not initialized for this thread */
> if (unlikely(trace == NULL)) {
> __rte_trace_mem_per_thread_alloc();
> - trace = RTE_PER_LCORE(trace_mem);
> + trace = (struct __rte_trace_header
> *)(RTE_PER_LCORE(trace_mem));
> if (unlikely(trace == NULL))
> return NULL;
> }
> --
> 2.25.1
We have to do the same fix on our end to build properly.
Acked-by: Nicolas Chautru <nicolas.chautru@intel.com>
On Wed, Aug 12, 2020 at 11:52 AM <skori@marvell.com> wrote:
>
> From: Pawel Wodkowski <pawelwod@gmail.com>
>
> trace_mem is declared as 'void *' which triggers following error:
> '...invalid conversion from ‘void*’ to ‘__rte_trace_header*’
> [-fpermissive]...'
>
> Fix this by adding proper typecast to 'struct __rte_trace_header *'.
>
> Fixes: ebaee6409702 ("trace: simplify trace point headers")
>
> Signed-off-by: Pawel Wodkowski <pawelwod@gmail.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Nicolas Chautru <nicolas.chautru@intel.com>
Applied, thanks.
--
David Marchand