Skip to content

Commit

Permalink
linux-gen, include: switch packet headers to api+abi
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
  • Loading branch information
Dmitry Eremin-Solenikov committed Oct 22, 2017
1 parent 90db1d0 commit dfb3cea
Show file tree
Hide file tree
Showing 15 changed files with 136 additions and 116 deletions.
6 changes: 6 additions & 0 deletions include/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ odpapiinclude_HEADERS = \
odp/api/buffer.h \
odp/api/byteorder.h \
odp/api/chksum.h \
odp/api/classification.h \
odp/api/compiler.h \
odp/api/cpumask.h \
odp/api/crypto.h \
odp/api/deprecated.h \
odp/api/errno.h \
odp/api/event.h \
Expand All @@ -20,6 +22,10 @@ odpapiinclude_HEADERS = \
odp/api/hints.h \
odp/api/init.h \
odp/api/ipsec.h \
odp/api/packet.h \
odp/api/packet_flags.h \
odp/api/packet_io.h \
odp/api/packet_io_stats.h \
odp/api/pool.h \
odp/api/queue.h \
odp/api/random.h \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extern "C" {
#include <odp/api/std_types.h>
#include <odp/api/abi/pool.h>
#include <odp/api/abi/classification.h>
#include <odp/api/plat/packet_types.h>
#include <odp/api/abi/packet.h>
#include <odp/api/abi/packet_io.h>
#include <odp/api/abi/queue.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extern "C" {
#endif

#include <odp/api/std_types.h>
#include <odp/api/plat/packet_types.h>
#include <odp/api/abi/packet.h>
#include <odp/api/abi/crypto.h>
#include <odp/api/abi/buffer.h>
#include <odp/api/abi/pool.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* ODP packet descriptor
*/

#ifndef ODP_PLAT_PACKET_H_
#define ODP_PLAT_PACKET_H_
#ifndef ODP_API_PACKET_H_
#define ODP_API_PACKET_H_

#ifdef __cplusplus
extern "C" {
Expand All @@ -20,15 +20,10 @@ extern "C" {
#include <odp/api/std_types.h>
#include <odp/api/abi/event.h>
#include <odp/api/abi/packet_io.h>
#include <odp/api/plat/packet_types.h>
#include <odp/api/abi/packet.h>
#include <odp/api/abi/buffer.h>
#include <odp/api/abi/pool.h>

#include <odp/api/plat/static_inline.h>
#if ODP_ABI_COMPAT == 0
#include <odp/api/plat/packet_inlines.h>
#endif

#include <odp/api/spec/packet.h>

#ifdef __cplusplus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@
* ODP packet flags
*/

#ifndef ODP_PLAT_PACKET_FLAGS_H_
#define ODP_PLAT_PACKET_FLAGS_H_
#ifndef ODP_API_PACKET_FLAGS_H_
#define ODP_API_PACKET_FLAGS_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <odp/api/plat/static_inline.h>
#if ODP_ABI_COMPAT == 0
#include <odp/api/plat/packet_flag_inlines.h>
#endif
#include <odp/api/abi/packet_flags.h>

#include <odp/api/spec/packet_flags.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* ODP Packet IO
*/

#ifndef ODP_PLAT_PACKET_IO_H_
#define ODP_PLAT_PACKET_IO_H_
#ifndef ODP_API_PACKET_IO_H_
#define ODP_API_PACKET_IO_H_

#ifdef __cplusplus
extern "C" {
Expand All @@ -20,7 +20,7 @@ extern "C" {
#include <odp/api/std_types.h>
#include <odp/api/abi/pool.h>
#include <odp/api/abi/classification.h>
#include <odp/api/plat/packet_types.h>
#include <odp/api/abi/packet.h>
#include <odp/api/abi/packet_io.h>
#include <odp/api/abi/queue.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* ODP packet IO stats
*/

#ifndef ODP_PLAT_PACKET_IO_STATS_H_
#define ODP_PLAT_PACKET_IO_STATS_H_
#ifndef ODP_API_PACKET_IO_STATS_H_
#define ODP_API_PACKET_IO_STATS_H_

#ifdef __cplusplus
extern "C" {
Expand Down
12 changes: 4 additions & 8 deletions platform/linux-generic/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,18 @@ odpinclude_HEADERS = \
odpapiincludedir= $(includedir)/odp/api
odpapiinclude_HEADERS = \
include/odp/api/align.h \
include/odp/api/classification.h \
include/odp/api/cpu.h \
include/odp/api/crypto.h \
include/odp/api/debug.h \
include/odp/api/packet_flags.h \
include/odp/api/packet.h \
include/odp/api/packet_io.h \
include/odp/api/packet_io_stats.h
include/odp/api/debug.h

odpapiplatincludedir= $(includedir)/odp/api/plat
odpapiplatinclude_HEADERS = \
include/odp/api/plat/atomic_inlines.h \
include/odp/api/plat/byteorder_inlines.h \
include/odp/api/plat/packet_flag_inlines.h \
include/odp/api/plat/packet_flag_inlines_api.h \
include/odp/api/plat/packet_inline_types.h \
include/odp/api/plat/packet_inlines.h \
include/odp/api/plat/packet_inlines_api.h \
include/odp/api/plat/packet_types.h \
include/odp/api/plat/std_clib_inlines.h \
include/odp/api/plat/strong_types.h \
include/odp/api/plat/sync_inlines.h \
Expand All @@ -60,6 +54,8 @@ odpapiabiarchinclude_HEADERS = \
include-abi/odp/api/abi/event.h \
include-abi/odp/api/abi/init.h \
include-abi/odp/api/abi/ipsec.h \
include-abi/odp/api/abi/packet.h \
include-abi/odp/api/abi/packet_flags.h \
include-abi/odp/api/abi/packet_io.h \
include-abi/odp/api/abi/pool.h \
include-abi/odp/api/abi/queue.h \
Expand Down
69 changes: 69 additions & 0 deletions platform/linux-generic/include-abi/odp/api/abi/packet.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/* Copyright (c) 2015, Linaro Limited
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/


/**
* @file
*
* ODP packet descriptor
*/

#ifndef ODP_API_ABI_PACKET_H_
#define ODP_API_ABI_PACKET_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <odp/api/std_types.h>
#include <odp/api/plat/strong_types.h>

/** @ingroup odp_packet
* @{
*/

typedef ODP_HANDLE_T(odp_packet_t);

#define ODP_PACKET_INVALID _odp_cast_scalar(odp_packet_t, 0)

#define ODP_PACKET_OFFSET_INVALID 0xffff

typedef uint8_t odp_packet_seg_t;

static inline uint8_t _odp_packet_seg_to_ndx(odp_packet_seg_t seg)
{
return (uint8_t)seg;
}

static inline odp_packet_seg_t _odp_packet_seg_from_ndx(uint8_t ndx)
{
return (odp_packet_seg_t)ndx;
}

#define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)-1)

typedef enum {
ODP_PACKET_GREEN = 0,
ODP_PACKET_YELLOW = 1,
ODP_PACKET_RED = 2,
ODP_PACKET_ALL_COLORS = 3,
} odp_packet_color_t;

#define ODP_NUM_PACKET_COLORS 3

#include <odp/api/plat/static_inline.h>
#include <odp/api/plat/packet_inlines.h>
#include <odp/api/plat/packet_inlines_api.h>

/**
* @}
*/

#ifdef __cplusplus
}
#endif

#endif
28 changes: 28 additions & 0 deletions platform/linux-generic/include-abi/odp/api/abi/packet_flags.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* Copyright (c) 2015, Linaro Limited
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/


/**
* @file
*
* ODP packet descriptor
*/

#ifndef ODP_API_ABI_PACKET_FLAGS_H_
#define ODP_API_ABI_PACKET_FLAGS_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <odp/api/plat/packet_flag_inlines.h>
#include <odp/api/plat/packet_flag_inlines_api.h>

#ifdef __cplusplus
}
#endif

#endif
19 changes: 2 additions & 17 deletions platform/linux-generic/include/odp/api/plat/packet_flag_inlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
#ifndef _ODP_PLAT_PACKET_FLAG_INLINES_H_
#define _ODP_PLAT_PACKET_FLAG_INLINES_H_

#include <odp/api/plat/packet_types.h>
#include <odp/api/abi/packet.h>
#include <odp/api/plat/packet_inlines.h>
#include <odp/api/hints.h>

/** @internal Inline function offsets */
Expand Down Expand Up @@ -70,20 +71,4 @@ static inline int _odp_packet_has_ts(odp_packet_t pkt)
return flags.timestamp;
}

/* Include inlined versions of API functions */
#include <odp/api/plat/static_inline.h>
#if ODP_ABI_COMPAT == 0

/** @ingroup odp_packet
* @{
*/

#include <odp/api/plat/packet_flag_inlines_api.h>

/**
* @}
*/

#endif

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -11,61 +11,14 @@
* ODP packet descriptor
*/

#ifndef ODP_PACKET_TYPES_H_
#define ODP_PACKET_TYPES_H_
#ifndef ODP_PACKET_INLINE_TYPES_H_
#define ODP_PACKET_INLINE_TYPES_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <stddef.h>

#include <odp/api/plat/static_inline.h>
#if ODP_ABI_COMPAT == 1
#include <odp/api/abi/packet.h>
#else

#include <odp/api/std_types.h>
#include <odp/api/plat/strong_types.h>

/** @ingroup odp_packet
* @{
*/

typedef ODP_HANDLE_T(odp_packet_t);

#define ODP_PACKET_INVALID _odp_cast_scalar(odp_packet_t, 0)

#define ODP_PACKET_OFFSET_INVALID 0xffff

typedef uint8_t odp_packet_seg_t;

static inline uint8_t _odp_packet_seg_to_ndx(odp_packet_seg_t seg)
{
return (uint8_t)seg;
}

static inline odp_packet_seg_t _odp_packet_seg_from_ndx(uint8_t ndx)
{
return (odp_packet_seg_t)ndx;
}

#define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)-1)

typedef enum {
ODP_PACKET_GREEN = 0,
ODP_PACKET_YELLOW = 1,
ODP_PACKET_RED = 2,
ODP_PACKET_ALL_COLORS = 3,
} odp_packet_color_t;

#define ODP_NUM_PACKET_COLORS 3

/**
* @}
*/

#endif
#include <stdint.h>

/** @internal Packet field accessor */
#define _odp_pkt_get(pkt, cast, field) \
Expand Down
27 changes: 8 additions & 19 deletions platform/linux-generic/include/odp/api/plat/packet_inlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,21 @@
#ifndef _ODP_PLAT_PACKET_INLINES_H_
#define _ODP_PLAT_PACKET_INLINES_H_

#include <odp/api/plat/strong_types.h>
#include <odp/api/plat/packet_types.h>
#include <odp/api/abi/packet.h>
#include <odp/api/pool.h>
#include <odp/api/packet_io.h>
#include <odp/api/abi/packet_io.h>
#include <odp/api/hints.h>
#include <odp/api/time.h>
#include <odp/api/abi/buffer.h>

#include <odp/api/plat/packet_inline_types.h>

/** @internal Inline function offsets */
extern const _odp_packet_inline_offset_t _odp_packet_inline;

#include <odp/api/plat/static_inline.h>
#if ODP_ABI_COMPAT == 1
#include <odp/api/plat/strong_types.h>
/** @internal Inline function @param seg @return */
static inline uint32_t _odp_packet_seg_to_ndx(odp_packet_seg_t seg)
{
Expand Down Expand Up @@ -164,20 +169,4 @@ static inline odp_buffer_t packet_to_buffer(odp_packet_t pkt)
return (odp_buffer_t)pkt;
}

/* Include inlined versions of API functions */
#include <odp/api/plat/static_inline.h>
#if ODP_ABI_COMPAT == 0

/** @ingroup odp_packet
* @{
*/

#include <odp/api/plat/packet_inlines_api.h>

/**
* @}
*/

#endif

#endif

0 comments on commit dfb3cea

Please sign in to comment.