diff mbox

[v2,3/3] api: config: Renamed ODP_CONFIG_PACKET_BUF_LEN_MIN

Message ID 1422968368-14340-3-git-send-email-petri.savolainen@linaro.org
State Superseded
Headers show

Commit Message

Petri Savolainen Feb. 3, 2015, 12:59 p.m. UTC
Renamed ODP_CONFIG_PACKET_BUF_LEN_MIN to ODP_CONFIG_PACKET_SEG_LEN_MIN.
The packet pool parameter pkt.seg_len is rounded up into this value.

Added ODP_CONFIG_PACKET_SEG_LEN_MAX to define the maximum segment
length supported by the implementation. This is the maximum valid
value for pkt.seg_len.

If ODP_CONFIG_PACKET_SEG_LEN_MIN equals _SEG_LEN_MAX, the
implementation supports only one segment length value.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
---
 include/odp/api/config.h                             | 20 +++++++++++++++-----
 platform/linux-generic/include/odp_buffer_internal.h | 12 ++++++------
 platform/linux-generic/odp_buffer_pool.c             |  4 ++--
 test/validation/buffer/odp_packet_test.c             |  2 +-
 4 files changed, 24 insertions(+), 14 deletions(-)
diff mbox

Patch

diff --git a/include/odp/api/config.h b/include/odp/api/config.h
index 3529fca..339b7b5 100644
--- a/include/odp/api/config.h
+++ b/include/odp/api/config.h
@@ -92,9 +92,9 @@  extern "C" {
 /**
  * Minimum packet segment length
  *
- * This defines the minimum packet segment length in bytes. The user defined
- * buffer size (in odp_buffer_pool_param_t) in buffer pool creation will be
- * rounded up into this value.
+ * This defines the minimum packet segment buffer length in bytes. The user
+ * defined segment length (seg_len in odp_pool_param_t) will be rounded up into
+ * this value.
  *
  * @internal In linux-generic implementation:
  * - The value MUST be a multiple of 8.
@@ -103,7 +103,17 @@  extern "C" {
  *   with the default headroom shown above and is a multiple of both 64 and 128,
  *   which are the most common cache line sizes.
  */
-#define ODP_CONFIG_PACKET_BUF_LEN_MIN (1664)
+#define ODP_CONFIG_PACKET_SEG_LEN_MIN (1664)
+
+/**
+ * Maximum packet segment length
+ *
+ * This defines the maximum packet segment buffer length in bytes. The user
+ * defined segment length (seg_len in odp_pool_param_t) must not be larger than
+ * this.
+ *
+ */
+#define ODP_CONFIG_PACKET_SEG_LEN_MAX ODP_CONFIG_PACKET_SEG_LEN_MIN
 
 /**
  * Maximum packet buffer length
@@ -117,7 +127,7 @@  extern "C" {
  * - The value MUST be an integral number of segments
  * - The value SHOULD be large enough to accommodate jumbo packets (9K)
  */
-#define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_BUF_LEN_MIN*6)
+#define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_SEG_LEN_MIN*6)
 
 /**
  * @}
diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h
index b3137a7..b38ade6 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -50,18 +50,18 @@  extern "C" {
 	((x) <= 65536 ? 16 : \
 	 (0/0)))))))))))))))))
 
-_ODP_STATIC_ASSERT(ODP_CONFIG_PACKET_BUF_LEN_MIN >= 256,
-		  "ODP Segment size must be a minimum of 256 bytes");
+_ODP_STATIC_ASSERT(ODP_CONFIG_PACKET_SEG_LEN_MIN >= 256,
+		   "ODP Segment size must be a minimum of 256 bytes");
 
-_ODP_STATIC_ASSERT((ODP_CONFIG_PACKET_BUF_LEN_MIN % ODP_CACHE_LINE_SIZE) == 0,
-		  "ODP Segment size must be a multiple of cache line size");
+_ODP_STATIC_ASSERT((ODP_CONFIG_PACKET_SEG_LEN_MIN % ODP_CACHE_LINE_SIZE) == 0,
+		   "ODP Segment size must be a multiple of cache line size");
 
 _ODP_STATIC_ASSERT((ODP_CONFIG_PACKET_BUF_LEN_MAX %
-		   ODP_CONFIG_PACKET_BUF_LEN_MIN) == 0,
+		   ODP_CONFIG_PACKET_SEG_LEN_MIN) == 0,
 		  "Packet max size must be a multiple of segment size");
 
 #define ODP_BUFFER_MAX_SEG \
-	(ODP_CONFIG_PACKET_BUF_LEN_MAX / ODP_CONFIG_PACKET_BUF_LEN_MIN)
+	(ODP_CONFIG_PACKET_BUF_LEN_MAX / ODP_CONFIG_PACKET_SEG_LEN_MIN)
 
 /* We can optimize storage of small raw buffers within metadata area */
 #define ODP_MAX_INLINE_BUF     ((sizeof(void *)) * (ODP_BUFFER_MAX_SEG - 1))
diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c
index 6f2f79e..ffbfb6e 100644
--- a/platform/linux-generic/odp_buffer_pool.c
+++ b/platform/linux-generic/odp_buffer_pool.c
@@ -182,7 +182,7 @@  odp_pool_t odp_pool_create(const char *name,
 		else
 			blk_size = ODP_ALIGN_ROUNDUP(
 				headroom + params->pkt.seg_len + tailroom,
-				ODP_CONFIG_PACKET_BUF_LEN_MIN);
+				ODP_CONFIG_PACKET_SEG_LEN_MIN);
 
 		buf_stride = params->type == ODP_POOL_PACKET ?
 			sizeof(odp_packet_hdr_stride) :
@@ -284,7 +284,7 @@  odp_pool_t odp_pool_create(const char *name,
 		pool->s.flags.unsegmented = unseg;
 		pool->s.flags.zeroized = zeroized;
 		pool->s.seg_size = unseg ?
-			blk_size : ODP_CONFIG_PACKET_BUF_LEN_MIN;
+			blk_size : ODP_CONFIG_PACKET_SEG_LEN_MIN;
 
 
 		uint8_t *block_base_addr = pool->s.pool_base_addr;
diff --git a/test/validation/buffer/odp_packet_test.c b/test/validation/buffer/odp_packet_test.c
index 218d07a..930bde7 100644
--- a/test/validation/buffer/odp_packet_test.c
+++ b/test/validation/buffer/odp_packet_test.c
@@ -7,7 +7,7 @@ 
 #include "odp_buffer_tests.h"
 #include <stdlib.h>
 
-#define PACKET_BUF_LEN	ODP_CONFIG_PACKET_BUF_LEN_MIN
+#define PACKET_BUF_LEN	ODP_CONFIG_PACKET_SEG_LEN_MIN
 /* Reserve some tailroom for tests */
 #define PACKET_TAILROOM_RESERVE  4