I thought you were using ODP in an application.  This sounds like you're
creating your own ODP implementation, in which case the result is that you
have a properly typed definition of ODP_QUEUE_INVALID of type odp_queue_t.
In this case the assignment works so I guess I'm now confused what the
issue is.

An ODP application should never reference the internals of an ODP
implementation, but of course an ODP implementation must do so.  If your
implementation wishes to borrow constructs from linux-generic like
_odp_cast_scalar() that's perfectly fine. That's why we provide reference
implementations of ODP--to enable other implementations to use the code as
scaffolding for their own implementations.

Have I misunderstood what the root issue is here?

On Mon, Feb 29, 2016 at 5:39 AM, José Pekkarinen <[email protected]>
wrote:

> > >
>
> > > In practice, this yields errors when working with an odp_queue_t
> defined
>
> > > as an union, unless you define ODP_QUEUE_INVALID as an
>
> > > _odp_cast_scalar(<value>) which was not recommended.
>
> >
>
> > ODP_QUEUE_INVALID is of type odp_queue_t, so however an implementation
>
> > chooses to define that type, two variables of the same type are type
>
> > compatible for comparison and assignment. Which specific implementation
>
> > are you having problems with and how is that type defined there? You may
>
> > have uncovered an omission in one of the validation tests if what you say
>
> > is true, in which case this should be a bug report.
>
> >
>
>
>
> Hi,
>
>
>
> The definition is as the following:
>
>
>
> typedef union {
>
> uint64_t u64;
>
> struct {
>
> #ifdef __BIG_ENDIAN_BITFIELD
>
> uint64_t magic:16; /* OCT_QUEUE_MAGIC */
>
> uint64_t res:32; /* reserved */
>
> uint64_t sch_poll:1; /* 0: schedule 1: pool */
>
> uint64_t in_out:1; /* 0: inq 1: outq */
>
> uint64_t tag_type:2; /* tag type (only for inq)*/
>
> uint64_t node:2; /* node */
>
> uint64_t index:10; /* 7:0 sso_grp(inq) 9:0 DQ(ouq) */
>
> #else
>
> uint64_t index:10; /* 7:0 sso_grp(inq) 9:0 DQ(ouq) */
>
> uint64_t node:2; /* node */
>
> uint64_t tag_type:2; /* tag type (only for inq)*/
>
> uint64_t in_out:1; /* 0: inq 1: outq */
>
> uint64_t sch_poll:1; /* 0: schedule 1: pool */
>
> uint64_t res:32; /* reserved */
>
> uint64_t magic:16; /* OCT_QUEUE_MAGIC */
>
> #endif
>
> } s;
>
> } oct_queue_t;
>
>
>
> typedef oct_queue_t odp_queue_t;
>
>
>
> If you define ODP_QUEUE_INVALID like:
>
>
>
> #define ODP_QUEUE_INVALID _odp_cast_scalar(odp_queue_t, ~(unsigned)0)
>
>
>
> The comparison you said can be performed. For any other definition of
> ODP_QUEUE_INVALID I tried, the comparison is failing because of
> incompatible types.
>
>
>
> Let me know if there is something I'm missing here.
>
>
>
> Best regards.
>
>
>
> José.
>
>
>
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to