Remove support for zero length allocations which were never
required by the API specification or tested by the validation
suite.

Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com>
---
 platform/linux-generic/odp_packet.c | 28 ----------------------------
 1 file changed, 28 deletions(-)

diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index a5c6ff4..0d3fd05 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -478,7 +478,6 @@ odp_packet_t odp_packet_alloc(odp_pool_t pool_hdl, uint32_t 
len)
        pool_t *pool = pool_entry_from_hdl(pool_hdl);
        odp_packet_t pkt;
        int num, num_seg;
-       int zero_len = 0;
 
        if (odp_unlikely(pool->params.type != ODP_POOL_PACKET)) {
                __odp_errno = EINVAL;
@@ -488,23 +487,12 @@ odp_packet_t odp_packet_alloc(odp_pool_t pool_hdl, 
uint32_t len)
        if (odp_unlikely(len > pool->max_len))
                return ODP_PACKET_INVALID;
 
-       if (odp_unlikely(len == 0)) {
-               len = pool->data_size;
-               zero_len = 1;
-       }
-
        num_seg = num_segments(len);
        num     = packet_alloc(pool, len, 1, num_seg, &pkt, 0);
 
        if (odp_unlikely(num == 0))
                return ODP_PACKET_INVALID;
 
-       if (odp_unlikely(zero_len)) {
-               odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
-
-               pull_tail(pkt_hdr, len);
-       }
-
        return pkt;
 }
 
@@ -513,7 +501,6 @@ int odp_packet_alloc_multi(odp_pool_t pool_hdl, uint32_t 
len,
 {
        pool_t *pool = pool_entry_from_hdl(pool_hdl);
        int num, num_seg;
-       int zero_len = 0;
 
        if (odp_unlikely(pool->params.type != ODP_POOL_PACKET)) {
                __odp_errno = EINVAL;
@@ -523,24 +510,9 @@ int odp_packet_alloc_multi(odp_pool_t pool_hdl, uint32_t 
len,
        if (odp_unlikely(len > pool->max_len))
                return -1;
 
-       if (odp_unlikely(len == 0)) {
-               len = pool->data_size;
-               zero_len = 1;
-       }
-
        num_seg = num_segments(len);
        num     = packet_alloc(pool, len, max_num, num_seg, pkt, 0);
 
-       if (odp_unlikely(zero_len)) {
-               int i;
-
-               for (i = 0; i < num; i++) {
-                       odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt[i]);
-
-                       pull_tail(pkt_hdr, len);
-               }
-       }
-
        return num;
 }
 
-- 
2.8.1

Reply via email to