On 12/18/2014 01:16 AM, Bill Fischofer wrote:
Enable segmentation in packet buffer pools by default
Signed-off-by: Bill Fischofer <[email protected]>
Both patches in the series have the same name.
They should be renamed to describe what each of them actually does.
Otherwise
Reviewed-by: Taras Kondratiuk <[email protected]>
---
platform/linux-generic/odp_buffer_pool.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/platform/linux-generic/odp_buffer_pool.c
b/platform/linux-generic/odp_buffer_pool.c
index 48be24f..6b0e34b 100644
--- a/platform/linux-generic/odp_buffer_pool.c
+++ b/platform/linux-generic/odp_buffer_pool.c
@@ -119,8 +119,8 @@ odp_buffer_pool_t odp_buffer_pool_create(const char *name,
if (params == NULL)
return ODP_BUFFER_POOL_INVALID;
- /* Restriction for v1.0: All buffers are unsegmented */
- const int unsegmented = 1;
+ /* Restriction for v1.0: All non-packet buffers are unsegmented */
+ int unsegmented = 1;
/* Restriction for v1.0: No zeroization support */
const int zeroized = 0;
@@ -163,14 +163,18 @@ odp_buffer_pool_t odp_buffer_pool_create(const char *name,
case ODP_BUFFER_TYPE_ANY:
headroom = ODP_CONFIG_PACKET_HEADROOM;
tailroom = ODP_CONFIG_PACKET_TAILROOM;
- if (unsegmented)
+ unsegmented = 0; /* Packets are segmented by default */
+ if (unsegmented) {
blk_size = ODP_ALIGN_ROUNDUP(
headroom + params->buf_size + tailroom,
buf_align);
- else
+ } else {
blk_size = ODP_ALIGN_ROUNDUP(
headroom + params->buf_size + tailroom,
ODP_CONFIG_PACKET_BUF_LEN_MIN);
+ if (blk_size > ODP_CONFIG_PACKET_BUF_LEN_MAX)
+ return ODP_BUFFER_POOL_INVALID;
+ }
buf_stride = params->buf_type == ODP_BUFFER_TYPE_PACKET ?
sizeof(odp_packet_hdr_stride) :
sizeof(odp_any_hdr_stride);
_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp