diff options
author | Matias Elo <matias.elo@nokia.com> | 2021-06-15 09:13:01 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2021-07-12 15:15:55 +0300 |
commit | b9649f99b9e320cde8f8f254de55347cb79f7573 (patch) | |
tree | c3f8a7cb289df94fa2c24b3ceeb760e657d32948 | |
parent | 7b9828810c1f800b01aea50cfd181dce62e67a5f (diff) |
api: packet: add separate header for type definitions
Enable easier function inlining by moving type definitions into a separate
header file.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Tested-by: Ashwin Sekhar T K <asekhar@marvell.com>
22 files changed, 852 insertions, 674 deletions
diff --git a/include/Makefile.am b/include/Makefile.am index 3dc058cd6..c3aac5bd2 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -31,6 +31,7 @@ odpapiinclude_HEADERS = \ odp/api/init.h \ odp/api/ipsec.h \ odp/api/packet.h \ + odp/api/packet_types.h \ odp/api/packet_flags.h \ odp/api/packet_io.h \ odp/api/packet_io_stats.h \ @@ -83,6 +84,7 @@ odpapispecinclude_HEADERS = \ odp/api/spec/init.h \ odp/api/spec/ipsec.h \ odp/api/spec/packet.h \ + odp/api/spec/packet_types.h \ odp/api/spec/packet_flags.h \ odp/api/spec/packet_io.h \ odp/api/spec/packet_io_stats.h \ @@ -138,6 +140,7 @@ odpapiabidefaultinclude_HEADERS = \ odp/api/abi-default/init.h \ odp/api/abi-default/ipsec.h \ odp/api/abi-default/packet.h \ + odp/api/abi-default/packet_types.h \ odp/api/abi-default/packet_flags.h \ odp/api/abi-default/packet_io.h \ odp/api/abi-default/pool.h \ @@ -184,6 +187,7 @@ odpapiabiarchinclude_HEADERS = \ odp/arch/arm32-linux/odp/api/abi/init.h \ odp/arch/arm32-linux/odp/api/abi/ipsec.h \ odp/arch/arm32-linux/odp/api/abi/packet.h \ + odp/arch/arm32-linux/odp/api/abi/packet_types.h \ odp/arch/arm32-linux/odp/api/abi/packet_flags.h \ odp/arch/arm32-linux/odp/api/abi/packet_io.h \ odp/arch/arm32-linux/odp/api/abi/pool.h \ @@ -226,6 +230,7 @@ odpapiabiarchinclude_HEADERS = \ odp/arch/arm64-linux/odp/api/abi/init.h \ odp/arch/arm64-linux/odp/api/abi/ipsec.h \ odp/arch/arm64-linux/odp/api/abi/packet.h \ + odp/arch/arm64-linux/odp/api/abi/packet_types.h \ odp/arch/arm64-linux/odp/api/abi/packet_flags.h \ odp/arch/arm64-linux/odp/api/abi/packet_io.h \ odp/arch/arm64-linux/odp/api/abi/pool.h \ @@ -268,6 +273,7 @@ odpapiabiarchinclude_HEADERS = \ odp/arch/default-linux/odp/api/abi/init.h \ odp/arch/default-linux/odp/api/abi/ipsec.h \ odp/arch/default-linux/odp/api/abi/packet.h \ + odp/arch/default-linux/odp/api/abi/packet_types.h \ odp/arch/default-linux/odp/api/abi/packet_flags.h \ odp/arch/default-linux/odp/api/abi/packet_io.h \ odp/arch/default-linux/odp/api/abi/pool.h \ @@ -310,6 +316,7 @@ odpapiabiarchinclude_HEADERS = \ odp/arch/mips64-linux/odp/api/abi/init.h \ odp/arch/mips64-linux/odp/api/abi/ipsec.h \ odp/arch/mips64-linux/odp/api/abi/packet.h \ + odp/arch/mips64-linux/odp/api/abi/packet_types.h \ odp/arch/mips64-linux/odp/api/abi/packet_flags.h \ odp/arch/mips64-linux/odp/api/abi/packet_io.h \ odp/arch/mips64-linux/odp/api/abi/pool.h \ @@ -352,6 +359,7 @@ odpapiabiarchinclude_HEADERS = \ odp/arch/power64-linux/odp/api/abi/init.h \ odp/arch/power64-linux/odp/api/abi/ipsec.h \ odp/arch/power64-linux/odp/api/abi/packet.h \ + odp/arch/power64-linux/odp/api/abi/packet_types.h \ odp/arch/power64-linux/odp/api/abi/packet_flags.h \ odp/arch/power64-linux/odp/api/abi/packet_io.h \ odp/arch/power64-linux/odp/api/abi/pool.h \ @@ -394,6 +402,7 @@ odpapiabiarchinclude_HEADERS = \ odp/arch/x86_32-linux/odp/api/abi/init.h \ odp/arch/x86_32-linux/odp/api/abi/ipsec.h \ odp/arch/x86_32-linux/odp/api/abi/packet.h \ + odp/arch/x86_32-linux/odp/api/abi/packet_types.h \ odp/arch/x86_32-linux/odp/api/abi/packet_flags.h \ odp/arch/x86_32-linux/odp/api/abi/packet_io.h \ odp/arch/x86_32-linux/odp/api/abi/pool.h \ @@ -436,6 +445,7 @@ odpapiabiarchinclude_HEADERS = \ odp/arch/x86_64-linux/odp/api/abi/init.h \ odp/arch/x86_64-linux/odp/api/abi/ipsec.h \ odp/arch/x86_64-linux/odp/api/abi/packet.h \ + odp/arch/x86_64-linux/odp/api/abi/packet_types.h \ odp/arch/x86_64-linux/odp/api/abi/packet_flags.h \ odp/arch/x86_64-linux/odp/api/abi/packet_io.h \ odp/arch/x86_64-linux/odp/api/abi/pool.h \ diff --git a/include/odp/api/abi-default/packet.h b/include/odp/api/abi-default/packet.h index bbe42e55f..3f6e82c5c 100644 --- a/include/odp/api/abi-default/packet.h +++ b/include/odp/api/abi-default/packet.h @@ -11,153 +11,7 @@ extern "C" { #endif -#include <stdint.h> - -/** @internal Dummy type for strong typing */ -typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_packet_t; - -/** @internal Dummy type for strong typing */ -typedef struct { char dummy; /**< *internal Dummy */ } _odp_abi_packet_seg_t; - -/** @internal Dummy type for strong typing */ -typedef struct { char dummy; /**< *internal Dummy */ } _odp_abi_packet_buf_t; - -/** @internal Dummy type for strong typing */ -typedef struct { char dummy; /**< *internal Dummy */ } _odp_abi_packet_vector_t; - -/** @internal Dummy type for strong typing */ -typedef struct { char dummy; /**< *internal Dummy */ } _odp_abi_packet_tx_compl_t; - -/** @ingroup odp_packet - * @{ - */ - -typedef _odp_abi_packet_t *odp_packet_t; -typedef _odp_abi_packet_seg_t *odp_packet_seg_t; -typedef _odp_abi_packet_buf_t *odp_packet_buf_t; -typedef _odp_abi_packet_vector_t *odp_packet_vector_t; -typedef _odp_abi_packet_tx_compl_t *odp_packet_tx_compl_t; - -#define ODP_PACKET_INVALID ((odp_packet_t)0) -#define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)0) -#define ODP_PACKET_BUF_INVALID ((odp_packet_buf_t)0) -#define ODP_PACKET_OFFSET_INVALID 0xffff -#define ODP_PACKET_VECTOR_INVALID ((odp_packet_vector_t)0) -#define ODP_PACKET_TX_COMPL_INVALID ((odp_packet_tx_compl_t)0) - -typedef uint8_t odp_proto_l2_type_t; - -#define ODP_PROTO_L2_TYPE_NONE 0 -#define ODP_PROTO_L2_TYPE_ETH 1 - -typedef uint8_t odp_proto_l3_type_t; - -#define ODP_PROTO_L3_TYPE_NONE 0 -#define ODP_PROTO_L3_TYPE_ARP 1 -#define ODP_PROTO_L3_TYPE_RARP 2 -#define ODP_PROTO_L3_TYPE_MPLS 3 -#define ODP_PROTO_L3_TYPE_IPV4 4 -#define ODP_PROTO_L3_TYPE_IPV6 6 - -typedef uint8_t odp_proto_l4_type_t; - -/* Numbers from IANA Assigned Internet Protocol Numbers list */ -#define ODP_PROTO_L4_TYPE_NONE 0 -#define ODP_PROTO_L4_TYPE_ICMPV4 1 -#define ODP_PROTO_L4_TYPE_IGMP 2 -#define ODP_PROTO_L4_TYPE_IPV4 4 -#define ODP_PROTO_L4_TYPE_TCP 6 -#define ODP_PROTO_L4_TYPE_UDP 17 -#define ODP_PROTO_L4_TYPE_IPV6 41 -#define ODP_PROTO_L4_TYPE_GRE 47 -#define ODP_PROTO_L4_TYPE_ESP 50 -#define ODP_PROTO_L4_TYPE_AH 51 -#define ODP_PROTO_L4_TYPE_ICMPV6 58 -#define ODP_PROTO_L4_TYPE_NO_NEXT 59 -#define ODP_PROTO_L4_TYPE_IPCOMP 108 -#define ODP_PROTO_L4_TYPE_SCTP 132 -#define ODP_PROTO_L4_TYPE_ROHC 142 - -typedef enum { - ODP_PACKET_GREEN = 0, - ODP_PACKET_YELLOW = 1, - ODP_PACKET_RED = 2, - ODP_PACKET_ALL_COLORS = 3, -} odp_packet_color_t; - -typedef enum { - ODP_PACKET_CHKSUM_UNKNOWN = 0, - ODP_PACKET_CHKSUM_BAD, - ODP_PACKET_CHKSUM_OK -} odp_packet_chksum_status_t; - -/** Parse result flags */ -typedef struct odp_packet_parse_result_flag_t { - /** Flags union */ - union { - /** All flags as a 64 bit word */ - uint64_t all; - - /** Flags as a bitfield struct */ - struct { - /** @see odp_packet_has_error() */ - uint64_t has_error : 1; - /** @see odp_packet_has_l2_error() */ - uint64_t has_l2_error : 1; - /** @see odp_packet_has_l3_error() */ - uint64_t has_l3_error : 1; - /** @see odp_packet_has_l4_error() */ - uint64_t has_l4_error : 1; - /** @see odp_packet_has_l2() */ - uint64_t has_l2 : 1; - /** @see odp_packet_has_l3() */ - uint64_t has_l3 : 1; - /** @see odp_packet_has_l4() */ - uint64_t has_l4 : 1; - /** @see odp_packet_has_eth() */ - uint64_t has_eth : 1; - /** @see odp_packet_has_eth_bcast() */ - uint64_t has_eth_bcast : 1; - /** @see odp_packet_has_eth_mcast() */ - uint64_t has_eth_mcast : 1; - /** @see odp_packet_has_jumbo() */ - uint64_t has_jumbo : 1; - /** @see odp_packet_has_vlan() */ - uint64_t has_vlan : 1; - /** @see odp_packet_has_vlan_qinq() */ - uint64_t has_vlan_qinq : 1; - /** @see odp_packet_has_arp() */ - uint64_t has_arp : 1; - /** @see odp_packet_has_ipv4() */ - uint64_t has_ipv4 : 1; - /** @see odp_packet_has_ipv6() */ - uint64_t has_ipv6 : 1; - /** @see odp_packet_has_ip_bcast() */ - uint64_t has_ip_bcast : 1; - /** @see odp_packet_has_ip_mcast() */ - uint64_t has_ip_mcast : 1; - /** @see odp_packet_has_ipfrag() */ - uint64_t has_ipfrag : 1; - /** @see odp_packet_has_ipopt() */ - uint64_t has_ipopt : 1; - /** @see odp_packet_has_ipsec() */ - uint64_t has_ipsec : 1; - /** @see odp_packet_has_udp() */ - uint64_t has_udp : 1; - /** @see odp_packet_has_tcp() */ - uint64_t has_tcp : 1; - /** @see odp_packet_has_sctp() */ - uint64_t has_sctp : 1; - /** @see odp_packet_has_icmp() */ - uint64_t has_icmp : 1; - }; - }; - -} odp_packet_parse_result_flag_t; - -/** - * @} - */ +/* Empty header required due to the packet inline functions */ #ifdef __cplusplus } diff --git a/include/odp/api/abi-default/packet_types.h b/include/odp/api/abi-default/packet_types.h new file mode 100644 index 000000000..fa383c77e --- /dev/null +++ b/include/odp/api/abi-default/packet_types.h @@ -0,0 +1,167 @@ +/* Copyright (c) 2017-2018, Linaro Limited + * Copyright (c) 2021, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef ODP_ABI_PACKET_TYPES_H_ +#define ODP_ABI_PACKET_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +/** @internal Dummy type for strong typing */ +typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_packet_t; + +/** @internal Dummy type for strong typing */ +typedef struct { char dummy; /**< *internal Dummy */ } _odp_abi_packet_seg_t; + +/** @internal Dummy type for strong typing */ +typedef struct { char dummy; /**< *internal Dummy */ } _odp_abi_packet_buf_t; + +/** @internal Dummy type for strong typing */ +typedef struct { char dummy; /**< *internal Dummy */ } _odp_abi_packet_vector_t; + +/** @internal Dummy type for strong typing */ +typedef struct { char dummy; /**< *internal Dummy */ } _odp_abi_packet_tx_compl_t; + +/** @ingroup odp_packet + * @{ + */ + +typedef _odp_abi_packet_t *odp_packet_t; +typedef _odp_abi_packet_seg_t *odp_packet_seg_t; +typedef _odp_abi_packet_buf_t *odp_packet_buf_t; +typedef _odp_abi_packet_vector_t *odp_packet_vector_t; +typedef _odp_abi_packet_tx_compl_t *odp_packet_tx_compl_t; + +#define ODP_PACKET_INVALID ((odp_packet_t)0) +#define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)0) +#define ODP_PACKET_BUF_INVALID ((odp_packet_buf_t)0) +#define ODP_PACKET_OFFSET_INVALID 0xffff +#define ODP_PACKET_VECTOR_INVALID ((odp_packet_vector_t)0) +#define ODP_PACKET_TX_COMPL_INVALID ((odp_packet_tx_compl_t)0) + +typedef uint8_t odp_proto_l2_type_t; + +#define ODP_PROTO_L2_TYPE_NONE 0 +#define ODP_PROTO_L2_TYPE_ETH 1 + +typedef uint8_t odp_proto_l3_type_t; + +#define ODP_PROTO_L3_TYPE_NONE 0 +#define ODP_PROTO_L3_TYPE_ARP 1 +#define ODP_PROTO_L3_TYPE_RARP 2 +#define ODP_PROTO_L3_TYPE_MPLS 3 +#define ODP_PROTO_L3_TYPE_IPV4 4 +#define ODP_PROTO_L3_TYPE_IPV6 6 + +typedef uint8_t odp_proto_l4_type_t; + +/* Numbers from IANA Assigned Internet Protocol Numbers list */ +#define ODP_PROTO_L4_TYPE_NONE 0 +#define ODP_PROTO_L4_TYPE_ICMPV4 1 +#define ODP_PROTO_L4_TYPE_IGMP 2 +#define ODP_PROTO_L4_TYPE_IPV4 4 +#define ODP_PROTO_L4_TYPE_TCP 6 +#define ODP_PROTO_L4_TYPE_UDP 17 +#define ODP_PROTO_L4_TYPE_IPV6 41 +#define ODP_PROTO_L4_TYPE_GRE 47 +#define ODP_PROTO_L4_TYPE_ESP 50 +#define ODP_PROTO_L4_TYPE_AH 51 +#define ODP_PROTO_L4_TYPE_ICMPV6 58 +#define ODP_PROTO_L4_TYPE_NO_NEXT 59 +#define ODP_PROTO_L4_TYPE_IPCOMP 108 +#define ODP_PROTO_L4_TYPE_SCTP 132 +#define ODP_PROTO_L4_TYPE_ROHC 142 + +typedef enum { + ODP_PACKET_GREEN = 0, + ODP_PACKET_YELLOW = 1, + ODP_PACKET_RED = 2, + ODP_PACKET_ALL_COLORS = 3, +} odp_packet_color_t; + +typedef enum { + ODP_PACKET_CHKSUM_UNKNOWN = 0, + ODP_PACKET_CHKSUM_BAD, + ODP_PACKET_CHKSUM_OK +} odp_packet_chksum_status_t; + +/** Parse result flags */ +typedef struct odp_packet_parse_result_flag_t { + /** Flags union */ + union { + /** All flags as a 64 bit word */ + uint64_t all; + + /** Flags as a bitfield struct */ + struct { + /** @see odp_packet_has_error() */ + uint64_t has_error : 1; + /** @see odp_packet_has_l2_error() */ + uint64_t has_l2_error : 1; + /** @see odp_packet_has_l3_error() */ + uint64_t has_l3_error : 1; + /** @see odp_packet_has_l4_error() */ + uint64_t has_l4_error : 1; + /** @see odp_packet_has_l2() */ + uint64_t has_l2 : 1; + /** @see odp_packet_has_l3() */ + uint64_t has_l3 : 1; + /** @see odp_packet_has_l4() */ + uint64_t has_l4 : 1; + /** @see odp_packet_has_eth() */ + uint64_t has_eth : 1; + /** @see odp_packet_has_eth_bcast() */ + uint64_t has_eth_bcast : 1; + /** @see odp_packet_has_eth_mcast() */ + uint64_t has_eth_mcast : 1; + /** @see odp_packet_has_jumbo() */ + uint64_t has_jumbo : 1; + /** @see odp_packet_has_vlan() */ + uint64_t has_vlan : 1; + /** @see odp_packet_has_vlan_qinq() */ + uint64_t has_vlan_qinq : 1; + /** @see odp_packet_has_arp() */ + uint64_t has_arp : 1; + /** @see odp_packet_has_ipv4() */ + uint64_t has_ipv4 : 1; + /** @see odp_packet_has_ipv6() */ + uint64_t has_ipv6 : 1; + /** @see odp_packet_has_ip_bcast() */ + uint64_t has_ip_bcast : 1; + /** @see odp_packet_has_ip_mcast() */ + uint64_t has_ip_mcast : 1; + /** @see odp_packet_has_ipfrag() */ + uint64_t has_ipfrag : 1; + /** @see odp_packet_has_ipopt() */ + uint64_t has_ipopt : 1; + /** @see odp_packet_has_ipsec() */ + uint64_t has_ipsec : 1; + /** @see odp_packet_has_udp() */ + uint64_t has_udp : 1; + /** @see odp_packet_has_tcp() */ + uint64_t has_tcp : 1; + /** @see odp_packet_has_sctp() */ + uint64_t has_sctp : 1; + /** @see odp_packet_has_icmp() */ + uint64_t has_icmp : 1; + }; + }; + +} odp_packet_parse_result_flag_t; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h index 643033228..57026da45 100644 --- a/include/odp/api/classification.h +++ b/include/odp/api/classification.h @@ -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/abi/packet.h> +#include <odp/api/abi/packet_types.h> #include <odp/api/abi/packet_io.h> #include <odp/api/abi/queue.h> diff --git a/include/odp/api/crypto.h b/include/odp/api/crypto.h index 5f68e6701..77135f2ca 100644 --- a/include/odp/api/crypto.h +++ b/include/odp/api/crypto.h @@ -18,7 +18,7 @@ extern "C" { #endif #include <odp/api/std_types.h> -#include <odp/api/abi/packet.h> +#include <odp/api/abi/packet_types.h> #include <odp/api/abi/crypto.h> #include <odp/api/abi/buffer.h> #include <odp/api/abi/pool.h> diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h index e4b2427a0..61f1892fc 100644 --- a/include/odp/api/packet.h +++ b/include/odp/api/packet.h @@ -20,6 +20,7 @@ extern "C" { #include <odp/api/std_types.h> #include <odp/api/abi/event.h> #include <odp/api/abi/packet_io.h> +#include <odp/api/abi/packet_types.h> #include <odp/api/abi/packet.h> #include <odp/api/abi/queue.h> #include <odp/api/abi/buffer.h> diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h index a7edf17cb..dda56fd6c 100644 --- a/include/odp/api/packet_io.h +++ b/include/odp/api/packet_io.h @@ -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/abi/packet.h> +#include <odp/api/abi/packet_types.h> #include <odp/api/abi/packet_io.h> #include <odp/api/abi/queue.h> diff --git a/include/odp/api/packet_types.h b/include/odp/api/packet_types.h new file mode 100644 index 000000000..02ffe956b --- /dev/null +++ b/include/odp/api/packet_types.h @@ -0,0 +1,28 @@ +/* Copyright (c) 2021, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP packet + */ + +#ifndef ODP_API_PACKET_TYPES_H_ +#define ODP_API_PACKET_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <odp/api/abi/packet_types.h> + +#include <odp/api/spec/packet_types.h> + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 7bd705304..310002d3e 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -20,6 +20,7 @@ extern "C" { #endif #include <odp/api/time.h> +#include <odp/api/packet_types.h> /** @defgroup odp_packet ODP PACKET * Packet event metadata and operations. @@ -27,276 +28,6 @@ extern "C" { */ /** - * @typedef odp_packet_t - * ODP packet - */ - -/** - * @def ODP_PACKET_INVALID - * Invalid packet - */ - -/** - * @def ODP_PACKET_OFFSET_INVALID - * Invalid packet offset - */ - -/** - * @typedef odp_packet_seg_t - * ODP packet segment - * - * A packet segment refers to a contiguous part of packet data (in memory). Segments of a packet - * can be examined with odp_packet_seg_data(), odp_packet_seg_data_len() and other calls. - */ - -/** - * @def ODP_PACKET_SEG_INVALID - * Invalid packet segment - */ - -/** - * @typedef odp_packet_buf_t - * ODP packet buffer - * - * Packet buffers are not part of any packet, but they result from a previous - * odp_packet_disassemble() call. A new packet is formed from packet buffers with - * a odp_packet_reassemble() call. - */ - -/** - * @def ODP_PACKET_BUF_INVALID - * Invalid packet buffer - */ - -/** - * @enum odp_packet_color_t - * Color of packet for shaper/drop processing - * - * @var ODP_PACKET_GREEN - * Packet is green - * - * @var ODP_PACKET_YELLOW - * Packet is yellow - * - * @var ODP_PACKET_RED - * Packet is red - */ - -/** - * Maximum number of packet colors which accommodates ODP_PACKET_GREEN, ODP_PACKET_YELLOW and - * ODP_PACKET_RED. - */ -#define ODP_NUM_PACKET_COLORS 3 - -/** - * @typedef odp_proto_l2_type_t - * Layer 2 protocol type - */ - -/** - * @def ODP_PROTO_L2_TYPE_NONE - * Layer 2 protocol type not defined - * - * @def ODP_PROTO_L2_TYPE_ETH - * Layer 2 protocol is Ethernet - */ - -/** - * @typedef odp_proto_l3_type_t - * Layer 3 protocol type - */ - -/** - * @def ODP_PROTO_L3_TYPE_NONE - * Layer 3 protocol type not defined - * - * @def ODP_PROTO_L3_TYPE_ARP - * Layer 3 protocol is ARP - * - * @def ODP_PROTO_L3_TYPE_RARP - * Layer 3 protocol is RARP - * - * @def ODP_PROTO_L3_TYPE_MPLS - * Layer 3 protocol is MPLS - * - * @def ODP_PROTO_L3_TYPE_IPV4 - * Layer 3 protocol type is IPv4 - * - * @def ODP_PROTO_L3_TYPE_IPV6 - * Layer 3 protocol type is IPv6 - */ - -/** - * @typedef odp_proto_l4_type_t - * Layer 4 protocol type - */ - -/** - * @def ODP_PROTO_L4_TYPE_NONE - * Layer 4 protocol type not defined - * - * @def ODP_PROTO_L4_TYPE_ICMPV4 - * Layer 4 protocol type is ICMPv4 - * - * @def ODP_PROTO_L4_TYPE_IGMP - * Layer 4 protocol type is IGMP - * - * @def ODP_PROTO_L4_TYPE_IPV4 - * Layer 4 protocol type is IPv4 - * - * @def ODP_PROTO_L4_TYPE_TCP - * Layer 4 protocol type is TCP - * - * @def ODP_PROTO_L4_TYPE_UDP - * Layer 4 protocol type is UDP - * - * @def ODP_PROTO_L4_TYPE_IPV6 - * Layer 4 protocol type is IPv6 - * - * @def ODP_PROTO_L4_TYPE_GRE - * Layer 4 protocol type is GRE - * - * @def ODP_PROTO_L4_TYPE_ESP - * Layer 4 protocol type is IPSEC ESP - * - * @def ODP_PROTO_L4_TYPE_AH - * Layer 4 protocol type is IPSEC AH - * - * @def ODP_PROTO_L4_TYPE_ICMPV6 - * Layer 4 protocol type is ICMPv6 - * - * @def ODP_PROTO_L4_TYPE_NO_NEXT - * Layer 4 protocol type is "No Next Header". - * Protocol / next header number is 59. - * - * @def ODP_PROTO_L4_TYPE_IPCOMP - * Layer 4 protocol type is IP Payload Compression Protocol - * - * @def ODP_PROTO_L4_TYPE_SCTP - * Layer 4 protocol type is SCTP - * - * @def ODP_PROTO_L4_TYPE_ROHC - * Layer 4 protocol type is ROHC - */ - -/** - * @enum odp_packet_chksum_status_t - * Checksum check status in packet - * - * @var ODP_PACKET_CHKSUM_UNKNOWN - * Checksum was not checked. Checksum check was not - * attempted or the attempt failed. - * - * @var ODP_PACKET_CHKSUM_BAD - * Checksum was checked and it was not correct. - * - * @var ODP_PACKET_CHKSUM_OK - * Checksum was checked and it was correct. - */ - -/** - * @typedef odp_packet_vector_t - * ODP packet vector - */ - -/** - * @def ODP_PACKET_VECTOR_INVALID - * Invalid packet vector - */ - -/** - * @typedef odp_packet_tx_compl_t - * ODP Packet Tx completion - */ - -/** - * @def ODP_PACKET_TX_COMPL_INVALID - * Invalid packet Tx completion - */ - -/** - * Protocol - */ -typedef enum odp_proto_t { - /** No protocol defined */ - ODP_PROTO_NONE = 0, - - /** Ethernet (including VLAN) */ - ODP_PROTO_ETH, - - /** IP version 4 */ - ODP_PROTO_IPV4, - - /** IP version 6 */ - ODP_PROTO_IPV6 - -} odp_proto_t; - -/** - * Protocol layer - */ -typedef enum odp_proto_layer_t { - /** No layers */ - ODP_PROTO_LAYER_NONE = 0, - - /** Layer L2 protocols (Ethernet, VLAN, etc) */ - ODP_PROTO_LAYER_L2, - - /** Layer L3 protocols (IPv4, IPv6, ICMP, IPSEC, etc) */ - ODP_PROTO_LAYER_L3, - - /** Layer L4 protocols (UDP, TCP, SCTP) */ - ODP_PROTO_LAYER_L4, - - /** All layers */ - ODP_PROTO_LAYER_ALL - -} odp_proto_layer_t; - -/** - * Packet API data range specifier - */ -typedef struct odp_packet_data_range { - /** Offset from beginning of packet */ - uint32_t offset; - - /** Length of data to operate on */ - uint32_t length; - -} odp_packet_data_range_t; - -/** - * Reassembly status of a packet - */ -typedef enum odp_packet_reass_status_t { - /** Reassembly was not attempted */ - ODP_PACKET_REASS_NONE = 0, - - /** Reassembly was attempted but is incomplete. Partial reassembly - * result can be accessed using ``odp_packet_reass_partial_state()``. - * - * The packet does not contain valid packet data and cannot be used - * in normal packet operations. - */ - ODP_PACKET_REASS_INCOMPLETE, - - /** Reassembly was successfully done. The packet has been - * reassembled from multiple received fragments. */ - ODP_PACKET_REASS_COMPLETE, -} odp_packet_reass_status_t; - -/** - * Result from odp_packet_reass_partial_state() - */ -typedef struct odp_packet_reass_partial_state_t { - /** Number of fragments returned */ - uint16_t num_frags; - - /** Time, in ns, since the reception of the first received fragment */ - uint64_t elapsed_time; -} odp_packet_reass_partial_state_t; - -/** * Event subtype of a packet * * Returns the subtype of a packet event. Subtype tells if the packet contains @@ -1567,52 +1298,6 @@ int odp_packet_move_data(odp_packet_t pkt, uint32_t dst_offset, */ /** - * Flags to control packet data checksum checking - */ -typedef union odp_proto_chksums_t { - /** Individual checksum bits. */ - struct { - /** IPv4 header checksum */ - uint32_t ipv4 : 1; - - /** UDP checksum */ - uint32_t udp : 1; - - /** TCP checksum */ - uint32_t tcp : 1; - - /** SCTP checksum */ - uint32_t sctp : 1; - - } chksum; - - /** All checksum bits. This can be used to set/clear all flags. */ - uint32_t all_chksum; - -} odp_proto_chksums_t; - -/** - * Packet parse parameters - */ -typedef struct odp_packet_parse_param_t { - /** Protocol header at parse starting point. Valid values for this - * field are: ODP_PROTO_ETH, ODP_PROTO_IPV4, ODP_PROTO_IPV6. */ - odp_proto_t proto; - - /** Continue parsing until this layer. Must be the same or higher - * layer than the layer of 'proto'. */ - odp_proto_layer_t last_layer; - - /** Flags to control payload data checksums checks up to the selected - * parse layer. Checksum checking status can be queried for each packet - * with odp_packet_l3_chksum_status() and - * odp_packet_l4_chksum_status(). - */ - odp_proto_chksums_t chksums; - -} odp_packet_parse_param_t; - -/** * Parse packet * * Parse protocol headers in packet data and update layer/protocol specific @@ -1656,35 +1341,6 @@ int odp_packet_parse(odp_packet_t pkt, uint32_t offset, int odp_packet_parse_multi(const odp_packet_t pkt[], const uint32_t offset[], int num, const odp_packet_parse_param_t *param); -/** Packet parse results */ -typedef struct odp_packet_parse_result_t { - /** Parse result flags */ - odp_packet_parse_result_flag_t flag; - - /** @see odp_packet_len() */ - uint32_t packet_len; - - /** @see odp_packet_l2_offset() */ - uint32_t l2_offset; - /** @see odp_packet_l3_offset() */ - uint32_t l3_offset; - /** @see odp_packet_l4_offset() */ - uint32_t l4_offset; - - /** @see odp_packet_l3_chksum_status() */ - odp_packet_chksum_status_t l3_chksum_status; - /** @see odp_packet_l4_chksum_status() */ - odp_packet_chksum_status_t l4_chksum_status; - - /** @see odp_packet_l2_type() */ - odp_proto_l2_type_t l2_type; - /** @see odp_packet_l3_type() */ - odp_proto_l3_type_t l3_type; - /** @see odp_packet_l4_type() */ - odp_proto_l4_type_t l4_type; - -} odp_packet_parse_result_t; - /** * Read parse results * @@ -2247,42 +1903,6 @@ void odp_packet_shaper_len_adjust_set(odp_packet_t pkt, int8_t adj); uint64_t odp_packet_cls_mark(odp_packet_t pkt); /** - * LSO options - */ -typedef struct odp_packet_lso_opt_t { - /** LSO profile handle - * - * The selected LSO profile specifies details of the segmentation operation to be done. - * Depending on LSO profile options, additional metadata (e.g. L3/L4 protocol header - * offsets) may need to be set on the packet. See LSO documentation - * (e.g. odp_pktout_send_lso() and odp_lso_protocol_t) for additional metadata - * requirements. - */ - odp_lso_profile_t lso_profile; - - /** LSO payload offset - * - * LSO operation considers packet data before 'payload_offset' as - * protocol headers and copies those in front of every created segment. It will modify - * protocol headers according to the LSO profile before segment transmission. - * - * When stored into a packet, this offset can be read with odp_packet_payload_offset() and - * modified with odp_packet_payload_offset_set(). - */ - uint32_t payload_offset; - - /** Maximum payload length in an LSO segment - * - * Max_payload_len parameter defines the maximum number of payload bytes in each - * created segment. Depending on the implementation, segments with less payload may be - * created. However, this value is used typically to divide packet payload evenly over - * all segments except the last one, which contains the remaining payload bytes. - */ - uint32_t max_payload_len; - -} odp_packet_lso_opt_t; - -/** * Request Large Send Offload (LSO) for a packet * * Setup packet metadata which requests LSO segmentation to be performed during packet output. @@ -2380,32 +2000,6 @@ void odp_packet_aging_tmo_set(odp_packet_t pkt, uint64_t tmo_ns); */ uint64_t odp_packet_aging_tmo(odp_packet_t pkt); -/** Packet Tx completion mode */ -typedef enum odp_packet_tx_compl_mode_t { - /** Packet Tx completion event is disabled - * - * When mode is disabled, all other fields of odp_packet_tx_compl_opt_t are ignored. - */ - ODP_PACKET_TX_COMPL_DISABLED, - /** Packet Tx completion event is sent for all packets (both transmitted and dropped) */ - ODP_PACKET_TX_COMPL_ALL, -} odp_packet_tx_compl_mode_t; - -/** - * Tx completion request options - */ -typedef struct odp_packet_tx_compl_opt_t { - /** Queue handle - * - * Tx completion event will be posted to ODP queue identified by this handle. - */ - odp_queue_t queue; - - /** Packet Tx completion event mode */ - odp_packet_tx_compl_mode_t mode; - -} odp_packet_tx_compl_opt_t; - /** * Request Tx completion event. * diff --git a/include/odp/api/spec/packet_types.h b/include/odp/api/spec/packet_types.h new file mode 100644 index 000000000..47656dad4 --- /dev/null +++ b/include/odp/api/spec/packet_types.h @@ -0,0 +1,448 @@ +/* Copyright (c) 2013-2018, Linaro Limited + * Copyright (c) 2021, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP packet types + */ + +#ifndef ODP_API_SPEC_PACKET_TYPES_H_ +#define ODP_API_SPEC_PACKET_TYPES_H_ +#include <odp/visibility_begin.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#include <odp/api/queue.h> + +/** @addtogroup odp_packet + * @{ + */ + +/** + * @typedef odp_packet_t + * ODP packet + */ + +/** + * @def ODP_PACKET_INVALID + * Invalid packet + */ + +/** + * @def ODP_PACKET_OFFSET_INVALID + * Invalid packet offset + */ + +/** + * @typedef odp_packet_seg_t + * ODP packet segment + * + * A packet segment refers to a contiguous part of packet data (in memory). Segments of a packet + * can be examined with odp_packet_seg_data(), odp_packet_seg_data_len() and other calls. + */ + +/** + * @def ODP_PACKET_SEG_INVALID + * Invalid packet segment + */ + +/** + * @typedef odp_packet_buf_t + * ODP packet buffer + * + * Packet buffers are not part of any packet, but they result from a previous + * odp_packet_disassemble() call. A new packet is formed from packet buffers with + * a odp_packet_reassemble() call. + */ + +/** + * @def ODP_PACKET_BUF_INVALID + * Invalid packet buffer + */ + +/** + * @enum odp_packet_color_t + * Color of packet for shaper/drop processing + * + * @var ODP_PACKET_GREEN + * Packet is green + * + * @var ODP_PACKET_YELLOW + * Packet is yellow + * + * @var ODP_PACKET_RED + * Packet is red + */ + +/** + * Maximum number of packet colors which accommodates ODP_PACKET_GREEN, ODP_PACKET_YELLOW and + * ODP_PACKET_RED. + */ +#define ODP_NUM_PACKET_COLORS 3 + +/** + * @typedef odp_proto_l2_type_t + * Layer 2 protocol type + */ + +/** + * @def ODP_PROTO_L2_TYPE_NONE + * Layer 2 protocol type not defined + * + * @def ODP_PROTO_L2_TYPE_ETH + * Layer 2 protocol is Ethernet + */ + +/** + * @typedef odp_proto_l3_type_t + * Layer 3 protocol type + */ + +/** + * @def ODP_PROTO_L3_TYPE_NONE + * Layer 3 protocol type not defined + * + * @def ODP_PROTO_L3_TYPE_ARP + * Layer 3 protocol is ARP + * + * @def ODP_PROTO_L3_TYPE_RARP + * Layer 3 protocol is RARP + * + * @def ODP_PROTO_L3_TYPE_MPLS + * Layer 3 protocol is MPLS + * + * @def ODP_PROTO_L3_TYPE_IPV4 + * Layer 3 protocol type is IPv4 + * + * @def ODP_PROTO_L3_TYPE_IPV6 + * Layer 3 protocol type is IPv6 + */ + +/** + * @typedef odp_proto_l4_type_t + * Layer 4 protocol type + */ + +/** + * @def ODP_PROTO_L4_TYPE_NONE + * Layer 4 protocol type not defined + * + * @def ODP_PROTO_L4_TYPE_ICMPV4 + * Layer 4 protocol type is ICMPv4 + * + * @def ODP_PROTO_L4_TYPE_IGMP + * Layer 4 protocol type is IGMP + * + * @def ODP_PROTO_L4_TYPE_IPV4 + * Layer 4 protocol type is IPv4 + * + * @def ODP_PROTO_L4_TYPE_TCP + * Layer 4 protocol type is TCP + * + * @def ODP_PROTO_L4_TYPE_UDP + * Layer 4 protocol type is UDP + * + * @def ODP_PROTO_L4_TYPE_IPV6 + * Layer 4 protocol type is IPv6 + * + * @def ODP_PROTO_L4_TYPE_GRE + * Layer 4 protocol type is GRE + * + * @def ODP_PROTO_L4_TYPE_ESP + * Layer 4 protocol type is IPSEC ESP + * + * @def ODP_PROTO_L4_TYPE_AH + * Layer 4 protocol type is IPSEC AH + * + * @def ODP_PROTO_L4_TYPE_ICMPV6 + * Layer 4 protocol type is ICMPv6 + * + * @def ODP_PROTO_L4_TYPE_NO_NEXT + * Layer 4 protocol type is "No Next Header". + * Protocol / next header number is 59. + * + * @def ODP_PROTO_L4_TYPE_IPCOMP + * Layer 4 protocol type is IP Payload Compression Protocol + * + * @def ODP_PROTO_L4_TYPE_SCTP + * Layer 4 protocol type is SCTP + * + * @def ODP_PROTO_L4_TYPE_ROHC + * Layer 4 protocol type is ROHC + */ + +/** + * @enum odp_packet_chksum_status_t + * Checksum check status in packet + * + * @var ODP_PACKET_CHKSUM_UNKNOWN + * Checksum was not checked. Checksum check was not + * attempted or the attempt failed. + * + * @var ODP_PACKET_CHKSUM_BAD + * Checksum was checked and it was not correct. + * + * @var ODP_PACKET_CHKSUM_OK + * Checksum was checked and it was correct. + */ + +/** + * @typedef odp_packet_vector_t + * ODP packet vector + */ + +/** + * @def ODP_PACKET_VECTOR_INVALID + * Invalid packet vector + */ + +/** + * @typedef odp_packet_tx_compl_t + * ODP Packet Tx completion + */ + +/** + * @def ODP_PACKET_TX_COMPL_INVALID + * Invalid packet Tx completion + */ + +/** + * Protocol + */ +typedef enum odp_proto_t { + /** No protocol defined */ + ODP_PROTO_NONE = 0, + + /** Ethernet (including VLAN) */ + ODP_PROTO_ETH, + + /** IP version 4 */ + ODP_PROTO_IPV4, + + /** IP version 6 */ + ODP_PROTO_IPV6 + +} odp_proto_t; + +/** + * Protocol layer + */ +typedef enum odp_proto_layer_t { + /** No layers */ + ODP_PROTO_LAYER_NONE = 0, + + /** Layer L2 protocols (Ethernet, VLAN, etc) */ + ODP_PROTO_LAYER_L2, + + /** Layer L3 protocols (IPv4, IPv6, ICMP, IPSEC, etc) */ + ODP_PROTO_LAYER_L3, + + /** Layer L4 protocols (UDP, TCP, SCTP) */ + ODP_PROTO_LAYER_L4, + + /** All layers */ + ODP_PROTO_LAYER_ALL + +} odp_proto_layer_t; + +/** + * Packet API data range specifier + */ +typedef struct odp_packet_data_range { + /** Offset from beginning of packet */ + uint32_t offset; + + /** Length of data to operate on */ + uint32_t length; + +} odp_packet_data_range_t; + +/** + * Reassembly status of a packet + */ +typedef enum odp_packet_reass_status_t { + /** Reassembly was not attempted */ + ODP_PACKET_REASS_NONE = 0, + + /** Reassembly was attempted but is incomplete. Partial reassembly + * result can be accessed using ``odp_packet_reass_partial_state()``. + * + * The packet does not contain valid packet data and cannot be used + * in normal packet operations. + */ + ODP_PACKET_REASS_INCOMPLETE, + + /** Reassembly was successfully done. The packet has been + * reassembled from multiple received fragments. */ + ODP_PACKET_REASS_COMPLETE, +} odp_packet_reass_status_t; + +/** + * Result from odp_packet_reass_partial_state() + */ +typedef struct odp_packet_reass_partial_state_t { + /** Number of fragments returned */ + uint16_t num_frags; + + /** Time, in ns, since the reception of the first received fragment */ + uint64_t elapsed_time; +} odp_packet_reass_partial_state_t; + +/** + * Flags to control packet data checksum checking + */ +typedef union odp_proto_chksums_t { + /** Individual checksum bits. */ + struct { + /** IPv4 header checksum */ + uint32_t ipv4 : 1; + + /** UDP checksum */ + uint32_t udp : 1; + + /** TCP checksum */ + uint32_t tcp : 1; + + /** SCTP checksum */ + uint32_t sctp : 1; + + } chksum; + + /** All checksum bits. This can be used to set/clear all flags. */ + uint32_t all_chksum; + +} odp_proto_chksums_t; + +/** + * Packet parse parameters + */ +typedef struct odp_packet_parse_param_t { + /** Protocol header at parse starting point. Valid values for this + * field are: ODP_PROTO_ETH, ODP_PROTO_IPV4, ODP_PROTO_IPV6. */ + odp_proto_t proto; + + /** Continue parsing until this layer. Must be the same or higher + * layer than the layer of 'proto'. */ + odp_proto_layer_t last_layer; + + /** Flags to control payload data checksums checks up to the selected + * parse layer. Checksum checking status can be queried for each packet + * with odp_packet_l3_chksum_status() and + * odp_packet_l4_chksum_status(). + */ + odp_proto_chksums_t chksums; + +} odp_packet_parse_param_t; + +/** + * Packet parse results + */ +typedef struct odp_packet_parse_result_t { + /** Parse result flags */ + odp_packet_parse_result_flag_t flag; + + /** @see odp_packet_len() */ + uint32_t packet_len; + + /** @see odp_packet_l2_offset() */ + uint32_t l2_offset; + /** @see odp_packet_l3_offset() */ + uint32_t l3_offset; + /** @see odp_packet_l4_offset() */ + uint32_t l4_offset; + + /** @see odp_packet_l3_chksum_status() */ + odp_packet_chksum_status_t l3_chksum_status; + /** @see odp_packet_l4_chksum_status() */ + odp_packet_chksum_status_t l4_chksum_status; + + /** @see odp_packet_l2_type() */ + odp_proto_l2_type_t l2_type; + /** @see odp_packet_l3_type() */ + odp_proto_l3_type_t l3_type; + /** @see odp_packet_l4_type() */ + odp_proto_l4_type_t l4_type; + +} odp_packet_parse_result_t; + +/** + * LSO options + */ +typedef struct odp_packet_lso_opt_t { + /** LSO profile handle + * + * The selected LSO profile specifies details of the segmentation operation to be done. + * Depending on LSO profile options, additional metadata (e.g. L3/L4 protocol header + * offsets) may need to be set on the packet. See LSO documentation + * (e.g. odp_pktout_send_lso() and odp_lso_protocol_t) for additional metadata + * requirements. + */ + odp_lso_profile_t lso_profile; + + /** LSO payload offset + * + * LSO operation considers packet data before 'payload_offset' as + * protocol headers and copies those in front of every created segment. It will modify + * protocol headers according to the LSO profile before segment transmission. + * + * When stored into a packet, this offset can be read with odp_packet_payload_offset() and + * modified with odp_packet_payload_offset_set(). + */ + uint32_t payload_offset; + + /** Maximum payload length in an LSO segment + * + * Max_payload_len parameter defines the maximum number of payload bytes in each + * created segment. Depending on the implementation, segments with less payload may be + * created. However, this value is used typically to divide packet payload evenly over + * all segments except the last one, which contains the remaining payload bytes. + */ + uint32_t max_payload_len; + +} odp_packet_lso_opt_t; + +/** + * Packet Tx completion mode + */ +typedef enum odp_packet_tx_compl_mode_t { + /** Packet Tx completion event is disabled + * + * When mode is disabled, all other fields of odp_packet_tx_compl_opt_t are ignored. + */ + ODP_PACKET_TX_COMPL_DISABLED, + /** Packet Tx completion event is sent for all packets (both transmitted and dropped) */ + ODP_PACKET_TX_COMPL_ALL, +} odp_packet_tx_compl_mode_t; + +/** + * Tx completion request options + */ +typedef struct odp_packet_tx_compl_opt_t { + /** Queue handle + * + * Tx completion event will be posted to ODP queue identified by this handle. + */ + odp_queue_t queue; + + /** Packet Tx completion event mode */ + odp_packet_tx_compl_mode_t mode; + +} odp_packet_tx_compl_opt_t; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#include <odp/visibility_end.h> +#endif diff --git a/include/odp/arch/arm32-linux/odp/api/abi/packet_types.h b/include/odp/arch/arm32-linux/odp/api/abi/packet_types.h new file mode 100644 index 000000000..c92ffd684 --- /dev/null +++ b/include/odp/arch/arm32-linux/odp/api/abi/packet_types.h @@ -0,0 +1,7 @@ +/* Copyright (c) 2021, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <odp/api/abi-default/packet_types.h> diff --git a/include/odp/arch/arm64-linux/odp/api/abi/packet_types.h b/include/odp/arch/arm64-linux/odp/api/abi/packet_types.h new file mode 100644 index 000000000..c92ffd684 --- /dev/null +++ b/include/odp/arch/arm64-linux/odp/api/abi/packet_types.h @@ -0,0 +1,7 @@ +/* Copyright (c) 2021, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <odp/api/abi-default/packet_types.h> diff --git a/include/odp/arch/default-linux/odp/api/abi/packet_types.h b/include/odp/arch/default-linux/odp/api/abi/packet_types.h new file mode 100644 index 000000000..c92ffd684 --- /dev/null +++ b/include/odp/arch/default-linux/odp/api/abi/packet_types.h @@ -0,0 +1,7 @@ +/* Copyright (c) 2021, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <odp/api/abi-default/packet_types.h> diff --git a/include/odp/arch/mips64-linux/odp/api/abi/packet_types.h b/include/odp/arch/mips64-linux/odp/api/abi/packet_types.h new file mode 100644 index 000000000..c92ffd684 --- /dev/null +++ b/include/odp/arch/mips64-linux/odp/api/abi/packet_types.h @@ -0,0 +1,7 @@ +/* Copyright (c) 2021, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <odp/api/abi-default/packet_types.h> diff --git a/include/odp/arch/power64-linux/odp/api/abi/packet_types.h b/include/odp/arch/power64-linux/odp/api/abi/packet_types.h new file mode 100644 index 000000000..c92ffd684 --- /dev/null +++ b/include/odp/arch/power64-linux/odp/api/abi/packet_types.h @@ -0,0 +1,7 @@ +/* Copyright (c) 2021, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <odp/api/abi-default/packet_types.h> diff --git a/include/odp/arch/x86_32-linux/odp/api/abi/packet_types.h b/include/odp/arch/x86_32-linux/odp/api/abi/packet_types.h new file mode 100644 index 000000000..c92ffd684 --- /dev/null +++ b/include/odp/arch/x86_32-linux/odp/api/abi/packet_types.h @@ -0,0 +1,7 @@ +/* Copyright (c) 2021, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <odp/api/abi-default/packet_types.h> diff --git a/include/odp/arch/x86_64-linux/odp/api/abi/packet_types.h b/include/odp/arch/x86_64-linux/odp/api/abi/packet_types.h new file mode 100644 index 000000000..c92ffd684 --- /dev/null +++ b/include/odp/arch/x86_64-linux/odp/api/abi/packet_types.h @@ -0,0 +1,7 @@ +/* Copyright (c) 2021, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <odp/api/abi-default/packet_types.h> diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index b6721dce4..a1bba0f30 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -67,6 +67,7 @@ odpapiabiarchinclude_HEADERS += \ 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_types.h \ include-abi/odp/api/abi/packet_flags.h \ include-abi/odp/api/abi/packet_io.h \ include-abi/odp/api/abi/pool.h \ diff --git a/platform/linux-generic/include-abi/odp/api/abi/packet.h b/platform/linux-generic/include-abi/odp/api/abi/packet.h index 2bace6488..5703141d4 100644 --- a/platform/linux-generic/include-abi/odp/api/abi/packet.h +++ b/platform/linux-generic/include-abi/odp/api/abi/packet.h @@ -18,125 +18,9 @@ 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 ODP_HANDLE_T(odp_packet_seg_t); - -#define ODP_PACKET_SEG_INVALID _odp_cast_scalar(odp_packet_seg_t, 0) - -typedef ODP_HANDLE_T(odp_packet_buf_t); - -#define ODP_PACKET_BUF_INVALID _odp_cast_scalar(odp_packet_buf_t, 0) - -typedef ODP_HANDLE_T(odp_packet_vector_t); - -#define ODP_PACKET_VECTOR_INVALID _odp_cast_scalar(odp_packet_vector_t, 0) - -typedef ODP_HANDLE_T(odp_packet_tx_compl_t); - -#define ODP_PACKET_TX_COMPL_INVALID _odp_cast_scalar(odp_packet_tx_compl_t, 0) - -#define ODP_PACKET_OFFSET_INVALID 0xffff - -typedef uint8_t odp_proto_l2_type_t; - -#define ODP_PROTO_L2_TYPE_NONE 0 -#define ODP_PROTO_L2_TYPE_ETH 1 - -typedef uint8_t odp_proto_l3_type_t; - -#define ODP_PROTO_L3_TYPE_NONE 0 -#define ODP_PROTO_L3_TYPE_ARP 1 -#define ODP_PROTO_L3_TYPE_RARP 2 -#define ODP_PROTO_L3_TYPE_MPLS 3 -#define ODP_PROTO_L3_TYPE_IPV4 4 -#define ODP_PROTO_L3_TYPE_IPV6 6 - -typedef uint8_t odp_proto_l4_type_t; - -/* Numbers from IANA Assigned Internet Protocol Numbers list */ -#define ODP_PROTO_L4_TYPE_NONE 0 -#define ODP_PROTO_L4_TYPE_ICMPV4 1 -#define ODP_PROTO_L4_TYPE_IGMP 2 -#define ODP_PROTO_L4_TYPE_IPV4 4 -#define ODP_PROTO_L4_TYPE_TCP 6 -#define ODP_PROTO_L4_TYPE_UDP 17 -#define ODP_PROTO_L4_TYPE_IPV6 41 -#define ODP_PROTO_L4_TYPE_GRE 47 -#define ODP_PROTO_L4_TYPE_ESP 50 -#define ODP_PROTO_L4_TYPE_AH 51 -#define ODP_PROTO_L4_TYPE_ICMPV6 58 -#define ODP_PROTO_L4_TYPE_NO_NEXT 59 -#define ODP_PROTO_L4_TYPE_IPCOMP 108 -#define ODP_PROTO_L4_TYPE_SCTP 132 -#define ODP_PROTO_L4_TYPE_ROHC 142 - -typedef enum { - ODP_PACKET_GREEN = 0, - ODP_PACKET_YELLOW = 1, - ODP_PACKET_RED = 2, - ODP_PACKET_ALL_COLORS = 3, -} odp_packet_color_t; - -typedef enum { - ODP_PACKET_CHKSUM_UNKNOWN = 0, - ODP_PACKET_CHKSUM_BAD, - ODP_PACKET_CHKSUM_OK -} odp_packet_chksum_status_t; - -typedef struct odp_packet_parse_result_flag_t { - union { - uint64_t all; - - struct { - uint64_t has_error : 1; - uint64_t has_l2_error : 1; - uint64_t has_l3_error : 1; - uint64_t has_l4_error : 1; - uint64_t has_l2 : 1; - uint64_t has_l3 : 1; - uint64_t has_l4 : 1; - uint64_t has_eth : 1; - uint64_t has_eth_bcast : 1; - uint64_t has_eth_mcast : 1; - uint64_t has_jumbo : 1; - uint64_t has_vlan : 1; - uint64_t has_vlan_qinq : 1; - uint64_t has_arp : 1; - uint64_t has_ipv4 : 1; - uint64_t has_ipv6 : 1; - uint64_t has_ip_bcast : 1; - uint64_t has_ip_mcast : 1; - uint64_t has_ipfrag : 1; - uint64_t has_ipopt : 1; - uint64_t has_ipsec : 1; - uint64_t has_udp : 1; - uint64_t has_tcp : 1; - uint64_t has_sctp : 1; - uint64_t has_icmp : 1; - }; - }; - -} odp_packet_parse_result_flag_t; - #include <odp/api/plat/packet_inlines.h> #include <odp/api/plat/packet_vector_inlines.h> -/** - * @} - */ - #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/include-abi/odp/api/abi/packet_types.h b/platform/linux-generic/include-abi/odp/api/abi/packet_types.h new file mode 100644 index 000000000..be2cb9df6 --- /dev/null +++ b/platform/linux-generic/include-abi/odp/api/abi/packet_types.h @@ -0,0 +1,141 @@ +/* Copyright (c) 2015-2018, Linaro Limited + * Copyright (c) 2019-2021, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP packet descriptor + */ + +#ifndef ODP_API_ABI_PACKET_TYPES_H_ +#define ODP_API_ABI_PACKET_TYPES_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 ODP_HANDLE_T(odp_packet_seg_t); + +#define ODP_PACKET_SEG_INVALID _odp_cast_scalar(odp_packet_seg_t, 0) + +typedef ODP_HANDLE_T(odp_packet_buf_t); + +#define ODP_PACKET_BUF_INVALID _odp_cast_scalar(odp_packet_buf_t, 0) + +typedef ODP_HANDLE_T(odp_packet_vector_t); + +#define ODP_PACKET_VECTOR_INVALID _odp_cast_scalar(odp_packet_vector_t, 0) + +typedef ODP_HANDLE_T(odp_packet_tx_compl_t); + +#define ODP_PACKET_TX_COMPL_INVALID _odp_cast_scalar(odp_packet_tx_compl_t, 0) + +#define ODP_PACKET_OFFSET_INVALID 0xffff + +typedef uint8_t odp_proto_l2_type_t; + +#define ODP_PROTO_L2_TYPE_NONE 0 +#define ODP_PROTO_L2_TYPE_ETH 1 + +typedef uint8_t odp_proto_l3_type_t; + +#define ODP_PROTO_L3_TYPE_NONE 0 +#define ODP_PROTO_L3_TYPE_ARP 1 +#define ODP_PROTO_L3_TYPE_RARP 2 +#define ODP_PROTO_L3_TYPE_MPLS 3 +#define ODP_PROTO_L3_TYPE_IPV4 4 +#define ODP_PROTO_L3_TYPE_IPV6 6 + +typedef uint8_t odp_proto_l4_type_t; + +/* Numbers from IANA Assigned Internet Protocol Numbers list */ +#define ODP_PROTO_L4_TYPE_NONE 0 +#define ODP_PROTO_L4_TYPE_ICMPV4 1 +#define ODP_PROTO_L4_TYPE_IGMP 2 +#define ODP_PROTO_L4_TYPE_IPV4 4 +#define ODP_PROTO_L4_TYPE_TCP 6 +#define ODP_PROTO_L4_TYPE_UDP 17 +#define ODP_PROTO_L4_TYPE_IPV6 41 +#define ODP_PROTO_L4_TYPE_GRE 47 +#define ODP_PROTO_L4_TYPE_ESP 50 +#define ODP_PROTO_L4_TYPE_AH 51 +#define ODP_PROTO_L4_TYPE_ICMPV6 58 +#define ODP_PROTO_L4_TYPE_NO_NEXT 59 +#define ODP_PROTO_L4_TYPE_IPCOMP 108 +#define ODP_PROTO_L4_TYPE_SCTP 132 +#define ODP_PROTO_L4_TYPE_ROHC 142 + +typedef enum { + ODP_PACKET_GREEN = 0, + ODP_PACKET_YELLOW = 1, + ODP_PACKET_RED = 2, + ODP_PACKET_ALL_COLORS = 3, +} odp_packet_color_t; + +typedef enum { + ODP_PACKET_CHKSUM_UNKNOWN = 0, + ODP_PACKET_CHKSUM_BAD, + ODP_PACKET_CHKSUM_OK +} odp_packet_chksum_status_t; + +typedef struct odp_packet_parse_result_flag_t { + union { + uint64_t all; + + struct { + uint64_t has_error : 1; + uint64_t has_l2_error : 1; + uint64_t has_l3_error : 1; + uint64_t has_l4_error : 1; + uint64_t has_l2 : 1; + uint64_t has_l3 : 1; + uint64_t has_l4 : 1; + uint64_t has_eth : 1; + uint64_t has_eth_bcast : 1; + uint64_t has_eth_mcast : 1; + uint64_t has_jumbo : 1; + uint64_t has_vlan : 1; + uint64_t has_vlan_qinq : 1; + uint64_t has_arp : 1; + uint64_t has_ipv4 : 1; + uint64_t has_ipv6 : 1; + uint64_t has_ip_bcast : 1; + uint64_t has_ip_mcast : 1; + uint64_t has_ipfrag : 1; + uint64_t has_ipopt : 1; + uint64_t has_ipsec : 1; + uint64_t has_udp : 1; + uint64_t has_tcp : 1; + uint64_t has_sctp : 1; + uint64_t has_icmp : 1; + }; + }; + +} odp_packet_parse_result_flag_t; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/odp/api/plat/packet_flag_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_flag_inlines.h index 6f32b46c6..6eb34a39b 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_flag_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/packet_flag_inlines.h @@ -13,7 +13,7 @@ #ifndef _ODP_PLAT_PACKET_FLAG_INLINES_H_ #define _ODP_PLAT_PACKET_FLAG_INLINES_H_ -#include <odp/api/abi/packet.h> +#include <odp/api/abi/packet_types.h> #include <odp/api/plat/packet_inline_types.h> #include <odp/api/hints.h> diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_inlines.h index 08048a993..8a0f54134 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h @@ -15,6 +15,7 @@ #define _ODP_PLAT_PACKET_INLINES_H_ #include <odp/api/abi/packet.h> +#include <odp/api/packet_types.h> #include <odp/api/pool.h> #include <odp/api/abi/packet_io.h> #include <odp/api/hints.h> |