diff mbox

linux-generic: byteorder: avoid bitfield order doxygen omissions

Message ID 1467854864-565-1-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer July 7, 2016, 1:27 a.m. UTC
Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2402 by assigning
explicit values to ODP_LITTLE_ENDIAN_BITFIELD and ODP_BIT_ENDIAN_BITFIELD
to avoid Doxygen warnings. This makes these consistent with the usage for
ODP_BIG_ENDIAN and ODP_LITTLE_ENDIAN.

Note that this requires tests of these fields to change from #ifdef to #if.

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

---
 helper/include/odp/helper/tcp.h                               | 4 ++--
 platform/linux-generic/include/odp/api/plat/byteorder_types.h | 6 ++++--
 platform/linux-generic/include/protocols/tcp.h                | 4 ++--
 3 files changed, 8 insertions(+), 6 deletions(-)

-- 
2.7.4

Comments

Bill Fischofer July 7, 2016, 11:41 a.m. UTC | #1
On Thu, Jul 7, 2016 at 2:46 AM, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolainen@nokia-bell-labs.com> wrote:

> I'm OK with the change, but didn't do it as part of my patch set since

> it's an API change. I think the change is not a big deal and should be done

> to align the usage of byte/bitfield defines. The patch should be tagged

> with api: prefix and go through api-next.

>

> Also, API spec could be more explicit about the byte/bitfield defines and

> how application should use/test those. I think bitfield defines should work

> the same way as the current byte order defines.

>

> #if (ODP_BYTE_ORDER == ODP_BIG_ENDIAN)

> // big endian byte order

> #else

> // little endian byte order

> #endif

>

>

> -Petri

>


Not making an API change was the reason I did this change this way. This is
now an implementation change only.  The change that would involve an API
change would have been to define an ODP_BITFIELD_ORDER variable to mirror
the ODP_BYTE_ORDER variable and set that to either
ODP_LITTLE_ENDIAN_BITFIELD or ODP_BIG_ENDIAN_BITFIELD as needed.


>

>

> > -----Original Message-----

> > From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of

> Bill

> > Fischofer

> > Sent: Thursday, July 07, 2016 4:28 AM

> > To: lng-odp@lists.linaro.org

> > Subject: [lng-odp] [PATCH] linux-generic: byteorder: avoid bitfield order

> > doxygen omissions

> >

> > Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2402 by assigning

> > explicit values to ODP_LITTLE_ENDIAN_BITFIELD and ODP_BIT_ENDIAN_BITFIELD

> > to avoid Doxygen warnings. This makes these consistent with the usage for

> > ODP_BIG_ENDIAN and ODP_LITTLE_ENDIAN.

> >

> > Note that this requires tests of these fields to change from #ifdef to

> > #if.

> >

> > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

> > ---

> >  helper/include/odp/helper/tcp.h                               | 4 ++--

> >  platform/linux-generic/include/odp/api/plat/byteorder_types.h | 6 ++++--

> >  platform/linux-generic/include/protocols/tcp.h                | 4 ++--

> >  3 files changed, 8 insertions(+), 6 deletions(-)

> >

> > diff --git a/helper/include/odp/helper/tcp.h

> > b/helper/include/odp/helper/tcp.h

> > index cabef90..fd234e5 100644

> > --- a/helper/include/odp/helper/tcp.h

> > +++ b/helper/include/odp/helper/tcp.h

> > @@ -34,7 +34,7 @@ typedef struct ODP_PACKED {

> >       odp_u32be_t ack_no;   /**< Acknowledgment number */

> >       union {

> >               odp_u16be_t doffset_flags;

> > -#if defined(ODP_BIG_ENDIAN_BITFIELD)

> > +#if ODP_BIG_ENDIAN_BITFIELD

> >               struct {

> >                       odp_u16be_t rsvd1:8;

> >                       odp_u16be_t flags:8; /**< TCP flags as a byte */

> > @@ -51,7 +51,7 @@ typedef struct ODP_PACKED {

> >                       odp_u16be_t syn:1;

> >                       odp_u16be_t fin:1;

> >               };

> > -#elif defined(ODP_LITTLE_ENDIAN_BITFIELD)

> > +#elif ODP_LITTLE_ENDIAN_BITFIELD

> >               struct {

> >                       odp_u16be_t flags:8;

> >                       odp_u16be_t rsvd1:8; /**< TCP flags as a byte */

> > diff --git

> a/platform/linux-generic/include/odp/api/plat/byteorder_types.h

> > b/platform/linux-generic/include/odp/api/plat/byteorder_types.h

> > index 679d4cf..acc899a 100644

> > --- a/platform/linux-generic/include/odp/api/plat/byteorder_types.h

> > +++ b/platform/linux-generic/include/odp/api/plat/byteorder_types.h

> > @@ -52,12 +52,14 @@ extern "C" {

> >       #define ODP_LITTLE_ENDIAN           1

> >       #define ODP_BIG_ENDIAN              0

> >       #define ODP_BYTE_ORDER              ODP_LITTLE_ENDIAN

> > -     #define ODP_LITTLE_ENDIAN_BITFIELD

> > +     #define ODP_LITTLE_ENDIAN_BITFIELD  1

> > +     #define ODP_BIG_ENDIAN_BITFIELD     0

> >  #else

> >       #define ODP_LITTLE_ENDIAN           0

> >       #define ODP_BIG_ENDIAN              1

> >       #define ODP_BYTE_ORDER              ODP_BIG_ENDIAN

> > -     #define ODP_BIG_ENDIAN_BITFIELD

> > +     #define ODP_LITTLE_ENDIAN_BITFIELD  0

> > +     #define ODP_BIG_ENDIAN_BITFIELD     1

> >  #endif

> >

> >  typedef uint16_t __odp_bitwise       odp_u16le_t;

> > diff --git a/platform/linux-generic/include/protocols/tcp.h

> > b/platform/linux-generic/include/protocols/tcp.h

> > index 4e92e4b..114262e 100644

> > --- a/platform/linux-generic/include/protocols/tcp.h

> > +++ b/platform/linux-generic/include/protocols/tcp.h

> > @@ -34,7 +34,7 @@ typedef struct ODP_PACKED {

> >       odp_u32be_t ack_no;   /**< Acknowledgment number */

> >       union {

> >               odp_u16be_t doffset_flags;

> > -#if defined(ODP_BIG_ENDIAN_BITFIELD)

> > +#if ODP_BIG_ENDIAN_BITFIELD

> >               struct {

> >                       odp_u16be_t rsvd1:8;

> >                       odp_u16be_t flags:8; /**< TCP flags as a byte */

> > @@ -51,7 +51,7 @@ typedef struct ODP_PACKED {

> >                       odp_u16be_t syn:1;

> >                       odp_u16be_t fin:1;

> >               };

> > -#elif defined(ODP_LITTLE_ENDIAN_BITFIELD)

> > +#elif ODP_LITTLE_ENDIAN_BITFIELD

> >               struct {

> >                       odp_u16be_t flags:8;

> >                       odp_u16be_t rsvd1:8; /**< TCP flags as a byte */

> > --

> > 2.7.4

>

>
Bill Fischofer July 7, 2016, 12:01 p.m. UTC | #2
On Thu, Jul 7, 2016 at 6:57 AM, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolainen@nokia-bell-labs.com> wrote:

>

>

> From: Bill Fischofer [mailto:bill.fischofer@linaro.org]

> Sent: Thursday, July 07, 2016 2:42 PM

> To: Savolainen, Petri (Nokia - FI/Espoo) <

> petri.savolainen@nokia-bell-labs.com>

> Cc: lng-odp@lists.linaro.org

> Subject: Re: [lng-odp] [PATCH] linux-generic: byteorder: avoid bitfield

> order doxygen omissions

>

>

> On Thu, Jul 7, 2016 at 2:46 AM, Savolainen, Petri (Nokia - FI/Espoo) <

> petri.savolainen@nokia-bell-labs.com> wrote:

> I'm OK with the change, but didn't do it as part of my patch set since

> it's an API change. I think the change is not a big deal and should be done

> to align the usage of byte/bitfield defines. The patch should be tagged

> with api: prefix and go through api-next.

>

> Also, API spec could be more explicit about the byte/bitfield defines and

> how application should use/test those. I think bitfield defines should work

> the same way as the current byte order defines.

>

> #if (ODP_BYTE_ORDER == ODP_BIG_ENDIAN)

> // big endian byte order

> #else

> // little endian byte order

> #endif

>

>

> -Petri

>

> Not making an API change was the reason I did this change this way. This

> is now an implementation change only.  The change that would involve an API

> change would have been to define an ODP_BITFIELD_ORDER variable to mirror

> the ODP_BYTE_ORDER variable and set that to either

> ODP_LITTLE_ENDIAN_BITFIELD or ODP_BIG_ENDIAN_BITFIELD as needed.

>

>

> > --- a/platform/linux-generic/include/protocols/tcp.h

> > +++ b/platform/linux-generic/include/protocols/tcp.h

> > @@ -34,7 +34,7 @@ typedef struct ODP_PACKED {

> >       odp_u32be_t ack_no;   /**< Acknowledgment number */

> >       union {

> >               odp_u16be_t doffset_flags;

> > -#if defined(ODP_BIG_ENDIAN_BITFIELD)

> > +#if ODP_BIG_ENDIAN_BITFIELD

>

>

> The change is non-backward, API change for application code. Tcp helper is

> also application code.

>

> Today, application may do this half of the time ...

>

> #if defined(ODP_BIG_ENDIAN_BITFIELD)

> // foo

> #else

> // bar

> #endif

>

> ... and this the other half ...

>

> #if defined(ODP_LITTLE_ENDIAN_BITFIELD)

> // foo

> #else

> // bar

> #endif

>

>

> After the change, application would break since both

> ODP_LITTLE_ENDIAN_BITFIELD and ODP_BIG_ENDIAN_BITFIELD are defined always.

>

>

Yes, which is why the patch includes an update to both copies of tcp.h,
which are currently the only files that reference those #defines.

The issue is that the recent change seems to have broken doxygen, so the
question is what's the best way to fix that?


> -Petri

>

>

>
Bill Fischofer July 7, 2016, 1:48 p.m. UTC | #3
On Thu, Jul 7, 2016 at 8:38 AM, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolainen@nokia-bell-labs.com> wrote:

>

>

> From: Bill Fischofer [mailto:bill.fischofer@linaro.org]

> Sent: Thursday, July 07, 2016 3:01 PM

> To: Savolainen, Petri (Nokia - FI/Espoo) <

> petri.savolainen@nokia-bell-labs.com>

> Cc: lng-odp@lists.linaro.org

> Subject: Re: [lng-odp] [PATCH] linux-generic: byteorder: avoid bitfield

> order doxygen omissions

>

>

>

> On Thu, Jul 7, 2016 at 6:57 AM, Savolainen, Petri (Nokia - FI/Espoo) <

> petri.savolainen@nokia-bell-labs.com> wrote:

>

>

> From: Bill Fischofer [mailto:bill.fischofer@linaro.org]

> Sent: Thursday, July 07, 2016 2:42 PM

> To: Savolainen, Petri (Nokia - FI/Espoo) <

> petri.savolainen@nokia-bell-labs.com>

> Cc: lng-odp@lists.linaro.org

> Subject: Re: [lng-odp] [PATCH] linux-generic: byteorder: avoid bitfield

> order doxygen omissions

>

>

> On Thu, Jul 7, 2016 at 2:46 AM, Savolainen, Petri (Nokia - FI/Espoo) <

> petri.savolainen@nokia-bell-labs.com> wrote:

> I'm OK with the change, but didn't do it as part of my patch set since

> it's an API change. I think the change is not a big deal and should be done

> to align the usage of byte/bitfield defines. The patch should be tagged

> with api: prefix and go through api-next.

>

> Also, API spec could be more explicit about the byte/bitfield defines and

> how application should use/test those. I think bitfield defines should work

> the same way as the current byte order defines.

>

> #if (ODP_BYTE_ORDER == ODP_BIG_ENDIAN)

> // big endian byte order

> #else

> // little endian byte order

> #endif

>

>

> -Petri

>

> Not making an API change was the reason I did this change this way. This

> is now an implementation change only.  The change that would involve an API

> change would have been to define an ODP_BITFIELD_ORDER variable to mirror

> the ODP_BYTE_ORDER variable and set that to either

> ODP_LITTLE_ENDIAN_BITFIELD or ODP_BIG_ENDIAN_BITFIELD as needed.

>

>

> > --- a/platform/linux-generic/include/protocols/tcp.h

> > +++ b/platform/linux-generic/include/protocols/tcp.h

> > @@ -34,7 +34,7 @@ typedef struct ODP_PACKED {

> >       odp_u32be_t ack_no;   /**< Acknowledgment number */

> >       union {

> >               odp_u16be_t doffset_flags;

> > -#if defined(ODP_BIG_ENDIAN_BITFIELD)

> > +#if ODP_BIG_ENDIAN_BITFIELD

>

>

> The change is non-backward, API change for application code. Tcp helper is

> also application code.

>

> Today, application may do this half of the time ...

>

> #if defined(ODP_BIG_ENDIAN_BITFIELD)

> // foo

> #else

> // bar

> #endif

>

> ... and this the other half ...

>

> #if defined(ODP_LITTLE_ENDIAN_BITFIELD)

> // foo

> #else

> // bar

> #endif

>

>

> After the change, application would break since both

> ODP_LITTLE_ENDIAN_BITFIELD and ODP_BIG_ENDIAN_BITFIELD are defined always.

>

> Yes, which is why the patch includes an update to both copies of tcp.h,

> which are currently the only files that reference those #defines.

>

> The issue is that the recent change seems to have broken doxygen, so the

> question is what's the best way to fix that?

>

>

> << Reply to HTML mail>>

> You must consider helpers as part of application code. There may be other

> application code out there which does exactly the same thing (the #if

> defined example above). This change would break *any* application code that

> uses the defines.

>


So short of reverting your latest header restructure patch, how would you
suggest fixing this?


>

> -Petri

>

>

>

>

>

>

>

>
Mike Holmes July 7, 2016, 2:05 p.m. UTC | #4
If it can't be done in a backwards compatible way this has to go to
TigerMoth.

Do we patch in Monarch and fix properly there ?

Mike

On 7 July 2016 at 09:48, Bill Fischofer <bill.fischofer@linaro.org> wrote:

> On Thu, Jul 7, 2016 at 8:38 AM, Savolainen, Petri (Nokia - FI/Espoo) <

> petri.savolainen@nokia-bell-labs.com> wrote:

>

> >

> >

> > From: Bill Fischofer [mailto:bill.fischofer@linaro.org]

> > Sent: Thursday, July 07, 2016 3:01 PM

> > To: Savolainen, Petri (Nokia - FI/Espoo) <

> > petri.savolainen@nokia-bell-labs.com>

> > Cc: lng-odp@lists.linaro.org

> > Subject: Re: [lng-odp] [PATCH] linux-generic: byteorder: avoid bitfield

> > order doxygen omissions

> >

> >

> >

> > On Thu, Jul 7, 2016 at 6:57 AM, Savolainen, Petri (Nokia - FI/Espoo) <

> > petri.savolainen@nokia-bell-labs.com> wrote:

> >

> >

> > From: Bill Fischofer [mailto:bill.fischofer@linaro.org]

> > Sent: Thursday, July 07, 2016 2:42 PM

> > To: Savolainen, Petri (Nokia - FI/Espoo) <

> > petri.savolainen@nokia-bell-labs.com>

> > Cc: lng-odp@lists.linaro.org

> > Subject: Re: [lng-odp] [PATCH] linux-generic: byteorder: avoid bitfield

> > order doxygen omissions

> >

> >

> > On Thu, Jul 7, 2016 at 2:46 AM, Savolainen, Petri (Nokia - FI/Espoo) <

> > petri.savolainen@nokia-bell-labs.com> wrote:

> > I'm OK with the change, but didn't do it as part of my patch set since

> > it's an API change. I think the change is not a big deal and should be

> done

> > to align the usage of byte/bitfield defines. The patch should be tagged

> > with api: prefix and go through api-next.

> >

> > Also, API spec could be more explicit about the byte/bitfield defines and

> > how application should use/test those. I think bitfield defines should

> work

> > the same way as the current byte order defines.

> >

> > #if (ODP_BYTE_ORDER == ODP_BIG_ENDIAN)

> > // big endian byte order

> > #else

> > // little endian byte order

> > #endif

> >

> >

> > -Petri

> >

> > Not making an API change was the reason I did this change this way. This

> > is now an implementation change only.  The change that would involve an

> API

> > change would have been to define an ODP_BITFIELD_ORDER variable to mirror

> > the ODP_BYTE_ORDER variable and set that to either

> > ODP_LITTLE_ENDIAN_BITFIELD or ODP_BIG_ENDIAN_BITFIELD as needed.

> >

> >

> > > --- a/platform/linux-generic/include/protocols/tcp.h

> > > +++ b/platform/linux-generic/include/protocols/tcp.h

> > > @@ -34,7 +34,7 @@ typedef struct ODP_PACKED {

> > >       odp_u32be_t ack_no;   /**< Acknowledgment number */

> > >       union {

> > >               odp_u16be_t doffset_flags;

> > > -#if defined(ODP_BIG_ENDIAN_BITFIELD)

> > > +#if ODP_BIG_ENDIAN_BITFIELD

> >

> >

> > The change is non-backward, API change for application code. Tcp helper

> is

> > also application code.

> >

> > Today, application may do this half of the time ...

> >

> > #if defined(ODP_BIG_ENDIAN_BITFIELD)

> > // foo

> > #else

> > // bar

> > #endif

> >

> > ... and this the other half ...

> >

> > #if defined(ODP_LITTLE_ENDIAN_BITFIELD)

> > // foo

> > #else

> > // bar

> > #endif

> >

> >

> > After the change, application would break since both

> > ODP_LITTLE_ENDIAN_BITFIELD and ODP_BIG_ENDIAN_BITFIELD are defined

> always.

> >

> > Yes, which is why the patch includes an update to both copies of tcp.h,

> > which are currently the only files that reference those #defines.

> >

> > The issue is that the recent change seems to have broken doxygen, so the

> > question is what's the best way to fix that?

> >

> >

> > << Reply to HTML mail>>

> > You must consider helpers as part of application code. There may be other

> > application code out there which does exactly the same thing (the #if

> > defined example above). This change would break *any* application code

> that

> > uses the defines.

> >

>

> So short of reverting your latest header restructure patch, how would you

> suggest fixing this?

>

>

> >

> > -Petri

> >

> >

> >

> >

> >

> >

> >

> >

>




-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"
Bill Fischofer July 7, 2016, 2:08 p.m. UTC | #5
On Thu, Jul 7, 2016 at 9:05 AM, Mike Holmes <mike.holmes@linaro.org> wrote:

> If it can't be done in a backwards compatible way this has to go to

> TigerMoth.

>

> Do we patch in Monarch and fix properly there ?

>


This should be fixed in Monarch. I'd prefer to fix this without reverting
Petri's header restructure patch series, but that's what introduced this
problem.


>

> Mike

>

> On 7 July 2016 at 09:48, Bill Fischofer <bill.fischofer@linaro.org> wrote:

>

>> On Thu, Jul 7, 2016 at 8:38 AM, Savolainen, Petri (Nokia - FI/Espoo) <

>> petri.savolainen@nokia-bell-labs.com> wrote:

>>

>> >

>> >

>> > From: Bill Fischofer [mailto:bill.fischofer@linaro.org]

>> > Sent: Thursday, July 07, 2016 3:01 PM

>> > To: Savolainen, Petri (Nokia - FI/Espoo) <

>> > petri.savolainen@nokia-bell-labs.com>

>> > Cc: lng-odp@lists.linaro.org

>> > Subject: Re: [lng-odp] [PATCH] linux-generic: byteorder: avoid bitfield

>> > order doxygen omissions

>> >

>> >

>> >

>> > On Thu, Jul 7, 2016 at 6:57 AM, Savolainen, Petri (Nokia - FI/Espoo) <

>> > petri.savolainen@nokia-bell-labs.com> wrote:

>> >

>> >

>> > From: Bill Fischofer [mailto:bill.fischofer@linaro.org]

>> > Sent: Thursday, July 07, 2016 2:42 PM

>> > To: Savolainen, Petri (Nokia - FI/Espoo) <

>> > petri.savolainen@nokia-bell-labs.com>

>> > Cc: lng-odp@lists.linaro.org

>> > Subject: Re: [lng-odp] [PATCH] linux-generic: byteorder: avoid bitfield

>> > order doxygen omissions

>> >

>> >

>> > On Thu, Jul 7, 2016 at 2:46 AM, Savolainen, Petri (Nokia - FI/Espoo) <

>> > petri.savolainen@nokia-bell-labs.com> wrote:

>> > I'm OK with the change, but didn't do it as part of my patch set since

>> > it's an API change. I think the change is not a big deal and should be

>> done

>> > to align the usage of byte/bitfield defines. The patch should be tagged

>> > with api: prefix and go through api-next.

>> >

>> > Also, API spec could be more explicit about the byte/bitfield defines

>> and

>> > how application should use/test those. I think bitfield defines should

>> work

>> > the same way as the current byte order defines.

>> >

>> > #if (ODP_BYTE_ORDER == ODP_BIG_ENDIAN)

>> > // big endian byte order

>> > #else

>> > // little endian byte order

>> > #endif

>> >

>> >

>> > -Petri

>> >

>> > Not making an API change was the reason I did this change this way. This

>> > is now an implementation change only.  The change that would involve an

>> API

>> > change would have been to define an ODP_BITFIELD_ORDER variable to

>> mirror

>> > the ODP_BYTE_ORDER variable and set that to either

>> > ODP_LITTLE_ENDIAN_BITFIELD or ODP_BIG_ENDIAN_BITFIELD as needed.

>> >

>> >

>> > > --- a/platform/linux-generic/include/protocols/tcp.h

>> > > +++ b/platform/linux-generic/include/protocols/tcp.h

>> > > @@ -34,7 +34,7 @@ typedef struct ODP_PACKED {

>> > >       odp_u32be_t ack_no;   /**< Acknowledgment number */

>> > >       union {

>> > >               odp_u16be_t doffset_flags;

>> > > -#if defined(ODP_BIG_ENDIAN_BITFIELD)

>> > > +#if ODP_BIG_ENDIAN_BITFIELD

>> >

>> >

>> > The change is non-backward, API change for application code. Tcp helper

>> is

>> > also application code.

>> >

>> > Today, application may do this half of the time ...

>> >

>> > #if defined(ODP_BIG_ENDIAN_BITFIELD)

>> > // foo

>> > #else

>> > // bar

>> > #endif

>> >

>> > ... and this the other half ...

>> >

>> > #if defined(ODP_LITTLE_ENDIAN_BITFIELD)

>> > // foo

>> > #else

>> > // bar

>> > #endif

>> >

>> >

>> > After the change, application would break since both

>> > ODP_LITTLE_ENDIAN_BITFIELD and ODP_BIG_ENDIAN_BITFIELD are defined

>> always.

>> >

>> > Yes, which is why the patch includes an update to both copies of tcp.h,

>> > which are currently the only files that reference those #defines.

>> >

>> > The issue is that the recent change seems to have broken doxygen, so the

>> > question is what's the best way to fix that?

>> >

>> >

>> > << Reply to HTML mail>>

>> > You must consider helpers as part of application code. There may be

>> other

>> > application code out there which does exactly the same thing (the #if

>> > defined example above). This change would break *any* application code

>> that

>> > uses the defines.

>> >

>>

>> So short of reverting your latest header restructure patch, how would you

>> suggest fixing this?

>>

>>

>> >

>> > -Petri

>> >

>> >

>> >

>> >

>> >

>> >

>> >

>> >

>>

>

>

>

> --

> Mike Holmes

> Technical Manager - Linaro Networking Group

> Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs

> "Work should be fun and collaborative, the rest follows"

>

>

>
diff mbox

Patch

diff --git a/helper/include/odp/helper/tcp.h b/helper/include/odp/helper/tcp.h
index cabef90..fd234e5 100644
--- a/helper/include/odp/helper/tcp.h
+++ b/helper/include/odp/helper/tcp.h
@@ -34,7 +34,7 @@  typedef struct ODP_PACKED {
 	odp_u32be_t ack_no;   /**< Acknowledgment number */
 	union {
 		odp_u16be_t doffset_flags;
-#if defined(ODP_BIG_ENDIAN_BITFIELD)
+#if ODP_BIG_ENDIAN_BITFIELD
 		struct {
 			odp_u16be_t rsvd1:8;
 			odp_u16be_t flags:8; /**< TCP flags as a byte */
@@ -51,7 +51,7 @@  typedef struct ODP_PACKED {
 			odp_u16be_t syn:1;
 			odp_u16be_t fin:1;
 		};
-#elif defined(ODP_LITTLE_ENDIAN_BITFIELD)
+#elif ODP_LITTLE_ENDIAN_BITFIELD
 		struct {
 			odp_u16be_t flags:8;
 			odp_u16be_t rsvd1:8; /**< TCP flags as a byte */
diff --git a/platform/linux-generic/include/odp/api/plat/byteorder_types.h b/platform/linux-generic/include/odp/api/plat/byteorder_types.h
index 679d4cf..acc899a 100644
--- a/platform/linux-generic/include/odp/api/plat/byteorder_types.h
+++ b/platform/linux-generic/include/odp/api/plat/byteorder_types.h
@@ -52,12 +52,14 @@  extern "C" {
 	#define ODP_LITTLE_ENDIAN           1
 	#define ODP_BIG_ENDIAN              0
 	#define ODP_BYTE_ORDER              ODP_LITTLE_ENDIAN
-	#define ODP_LITTLE_ENDIAN_BITFIELD
+	#define ODP_LITTLE_ENDIAN_BITFIELD  1
+	#define ODP_BIG_ENDIAN_BITFIELD     0
 #else
 	#define ODP_LITTLE_ENDIAN           0
 	#define ODP_BIG_ENDIAN              1
 	#define	ODP_BYTE_ORDER              ODP_BIG_ENDIAN
-	#define ODP_BIG_ENDIAN_BITFIELD
+	#define ODP_LITTLE_ENDIAN_BITFIELD  0
+	#define ODP_BIG_ENDIAN_BITFIELD     1
 #endif
 
 typedef uint16_t __odp_bitwise	odp_u16le_t;
diff --git a/platform/linux-generic/include/protocols/tcp.h b/platform/linux-generic/include/protocols/tcp.h
index 4e92e4b..114262e 100644
--- a/platform/linux-generic/include/protocols/tcp.h
+++ b/platform/linux-generic/include/protocols/tcp.h
@@ -34,7 +34,7 @@  typedef struct ODP_PACKED {
 	odp_u32be_t ack_no;   /**< Acknowledgment number */
 	union {
 		odp_u16be_t doffset_flags;
-#if defined(ODP_BIG_ENDIAN_BITFIELD)
+#if ODP_BIG_ENDIAN_BITFIELD
 		struct {
 			odp_u16be_t rsvd1:8;
 			odp_u16be_t flags:8; /**< TCP flags as a byte */
@@ -51,7 +51,7 @@  typedef struct ODP_PACKED {
 			odp_u16be_t syn:1;
 			odp_u16be_t fin:1;
 		};
-#elif defined(ODP_LITTLE_ENDIAN_BITFIELD)
+#elif ODP_LITTLE_ENDIAN_BITFIELD
 		struct {
 			odp_u16be_t flags:8;
 			odp_u16be_t rsvd1:8; /**< TCP flags as a byte */