aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/odp/api/abi-default/align.h3
-rw-r--r--include/odp/api/spec/align.h13
-rw-r--r--include/odp/api/spec/packet.h16
-rw-r--r--include/odp/api/spec/pool.h19
-rw-r--r--include/odp/api/spec/version.h.in18
5 files changed, 61 insertions, 8 deletions
diff --git a/include/odp/api/abi-default/align.h b/include/odp/api/abi-default/align.h
index c1150febe..b3bbed199 100644
--- a/include/odp/api/abi-default/align.h
+++ b/include/odp/api/abi-default/align.h
@@ -45,6 +45,9 @@ extern "C" {
#define ODP_ALIGNED_PAGE ODP_ALIGNED(ODP_PAGE_SIZE)
+#define ODP_CACHE_LINE_ROUNDUP(x) \
+((ODP_CACHE_LINE_SIZE) * (((x) + (ODP_CACHE_LINE_SIZE) - 1) / (ODP_CACHE_LINE_SIZE)))
+
/**
* @}
*/
diff --git a/include/odp/api/spec/align.h b/include/odp/api/spec/align.h
index 6e4ef0cd2..99f8f1db0 100644
--- a/include/odp/api/spec/align.h
+++ b/include/odp/api/spec/align.h
@@ -48,12 +48,12 @@ extern "C" {
/**
* @def ODP_CACHE_LINE_SIZE
- * Cache line size
+ * Cache line size in bytes
*/
/**
* @def ODP_PAGE_SIZE
- * Page size
+ * Page size in bytes
*/
/**
@@ -67,6 +67,15 @@ extern "C" {
*/
/**
+ * @def ODP_CACHE_LINE_ROUNDUP
+ * Round up to cache line size
+ *
+ * Rounds up the passed value to the next multiple of cache line size
+ * (ODP_CACHE_LINE_SIZE). Returns the original value if it is already
+ * a multiple of cache line size or zero.
+ */
+
+/**
* @}
*/
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index cbc3c2cbd..ec20371b2 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -318,11 +318,10 @@ void odp_packet_free_sp(const odp_packet_t pkt[], int num);
*
* Resets all packet metadata to their default values. Packet length is used
* to initialize pointers and lengths. It must be less than the total buffer
- * length of the packet minus the default headroom length. Packet is not
- * modified on failure.
+ * length of the packet. Packet is not modified on failure.
*
* @param pkt Packet handle
- * @param len Packet data length
+ * @param len Packet data length (1 ... odp_packet_buf_len())
*
* @retval 0 on success
* @retval <0 on failure
@@ -724,7 +723,8 @@ int odp_packet_extend_head(odp_packet_t *pkt, uint32_t len, void **data_ptr,
*
* @param[in, out] pkt Pointer to packet handle. A successful operation outputs
* the new packet handle.
- * @param len Number of bytes to truncate the head (0 ... packet_len)
+ * @param len Number of bytes to truncate the head
+ * (0 ... packet_len - 1)
* @param[out] data_ptr Pointer to output the new data pointer.
* Ignored when NULL.
* @param[out] seg_len Pointer to output segment length at 'data_ptr' above.
@@ -797,7 +797,8 @@ int odp_packet_extend_tail(odp_packet_t *pkt, uint32_t len, void **data_ptr,
*
* @param[in, out] pkt Pointer to packet handle. A successful operation outputs
* the new packet handle.
- * @param len Number of bytes to truncate the tail (0 ... packet_len)
+ * @param len Number of bytes to truncate the tail
+ * (0 ... packet_len - 1)
* @param[out] tail_ptr Pointer to output the new tail pointer.
* Ignored when NULL.
* @param[out] tailroom Pointer to output the new tailroom. Ignored when NULL.
@@ -861,7 +862,9 @@ int odp_packet_add_data(odp_packet_t *pkt, uint32_t offset, uint32_t len);
* @param[in, out] pkt Pointer to packet handle. A successful operation outputs
* the new packet handle.
* @param offset Byte offset into the packet
- * @param len Number of bytes to remove from the offset
+ * @param len Number of bytes to remove from the offset. When offset
+ * is zero: 0 ... packet_len - 1 bytes, otherwise
+ * 0 ... packet_len - offset bytes.
*
* @retval 0 Operation successful, old pointers remain valid
* @retval >0 Operation successful, old pointers need to be updated
@@ -1064,6 +1067,7 @@ int odp_packet_concat(odp_packet_t *dst, odp_packet_t src);
* @param[in, out] pkt Pointer to packet handle. A successful operation
* outputs a new packet handle for the head packet.
* @param len Data length remaining in the head packet
+ * (1 ... packet_len - 1)
* @param tail Pointer to output the tail packet handle
*
* @retval 0 Operation successful, old pointers remain valid
diff --git a/include/odp/api/spec/pool.h b/include/odp/api/spec/pool.h
index 69e99605c..754e2cc04 100644
--- a/include/odp/api/spec/pool.h
+++ b/include/odp/api/spec/pool.h
@@ -92,6 +92,12 @@ typedef struct odp_pool_capability_t {
* memory size for the pool. */
uint32_t max_num;
+ /** Maximum packet data alignment in bytes
+ *
+ * This is the maximum value of packet pool alignment
+ * (pkt.align) parameter. */
+ uint32_t max_align;
+
/** Minimum packet level headroom length in bytes
*
* The minimum number of headroom bytes that newly created
@@ -248,6 +254,19 @@ typedef struct odp_pool_param_t {
*/
uint32_t max_len;
+ /** Minimum packet data alignment in bytes.
+ *
+ * Valid values are powers of two. User allocated packets have
+ * start of data (@see odp_packet_data()) aligned to this or
+ * a higher alignment (power of two value). This parameter
+ * does not apply to packets that ODP allocates internally
+ * (e.g. packets from packet input).
+ *
+ * The maximum value is defined by pool capability
+ * pkt.max_align. Use 0 for default alignment.
+ */
+ uint32_t align;
+
/** Minimum number of packet data bytes that are stored in the
* first segment of a packet. The maximum value is defined by
* pool capability pkt.max_seg_len. Use 0 for default.
diff --git a/include/odp/api/spec/version.h.in b/include/odp/api/spec/version.h.in
index 4c3cbfee8..21a5f9a77 100644
--- a/include/odp/api/spec/version.h.in
+++ b/include/odp/api/spec/version.h.in
@@ -1,4 +1,5 @@
/* Copyright (c) 2013-2018, Linaro Limited
+ * Copyright (c) 2020, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -56,6 +57,23 @@ extern "C" {
#define ODP_VERSION_API_MINOR @ODP_VERSION_API_MINOR@
/**
+ * ODP API version number macro
+ *
+ * Macro to build a version number for comparisons
+ */
+#define ODP_VERSION_API_NUM(gen, ma, mi) ((gen) << 24 | (ma) << 16 | (mi) << 8)
+
+/**
+ * ODP API version number
+ *
+ * API version number for comparisons against ODP_VERSION_API_NUM()
+ * macro output.
+ */
+#define ODP_VERSION_API ODP_VERSION_API_NUM(ODP_VERSION_API_GENERATION, \
+ ODP_VERSION_API_MAJOR, \
+ ODP_VERSION_API_MINOR)
+
+/**
* ODP API version string
*
* The API version string defines ODP API version in this format: