@@ -75,10 +75,14 @@
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
-#include "odph_debug.h"
#include <odp/rwlock.h>
#include <odp/helper/pause.h>
#include <odp/helper/ring.h>
+#ifdef PLATFORM
+#include <odp_internal.h>
+#else
+#include "odph_debug.h"
+#endif
static TAILQ_HEAD(, odph_ring) odp_ring_list;
@@ -168,8 +172,12 @@ odph_ring_create(const char *name, unsigned count, unsigned flags)
/* count must be a power of 2 */
if (!RING_VAL_IS_POWER_2(count) || (count > ODPH_RING_SZ_MASK)) {
+#ifdef PLATFORM
+ __odp_errno = EINVAL;
+#else
ODPH_ERR("Requested size is invalid, must be power of 2, and do not exceed the size limit %u\n",
ODPH_RING_SZ_MASK);
+#endif
return NULL;
}
@@ -202,7 +210,11 @@ odph_ring_create(const char *name, unsigned count, unsigned flags)
if (!(flags & ODPH_RING_NO_LIST))
TAILQ_INSERT_TAIL(&odp_ring_list, r, next);
} else {
+#ifdef PLATFORM
+ __odp_errno = ENOMEM;
+#else
ODPH_ERR("Cannot reserve memory\n");
+#endif
}
odp_rwlock_write_unlock(&qlock);
@@ -537,6 +549,7 @@ unsigned odph_ring_free_count(const odph_ring_t *r)
return (cons_tail - prod_tail - 1) & r->prod.mask;
}
+#ifndef PLATFORM
/* dump the status of the ring on the console */
void odph_ring_dump(const odph_ring_t *r)
{
@@ -568,6 +581,7 @@ void odph_ring_list_dump(void)
odp_rwlock_read_unlock(&qlock);
}
+#endif
/* search a ring from its name */
odph_ring_t *odph_ring_lookup(const char *name)
Accodring to doxygen comment if right creation fails __odp_errno should be set. __odp_errno is implementation only variable. So just keep original code for helper and set correct __odp_errno for implementation. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- helper/ring.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)