diff options
author | Zoltan Kiss <zoltan.kiss@linaro.org> | 2015-11-04 17:11:03 +0000 |
---|---|---|
committer | Zoltan Kiss <zoltan.kiss@linaro.org> | 2015-11-04 17:34:57 +0000 |
commit | fd553bd19e82f680d2b7996ae1adffb7e4e6e840 (patch) | |
tree | 607348ba3e89e259e49c2665edb7af900a34daa2 /platform/linux-dpdk | |
parent | f0ca6415e7d438a0707e1f065e24751b10679e44 (diff) |
linux-dpdk: errno: use rte_errno instead of __odp_errno
It is DPDK's errno variable. odp_pktio_send() also makes sure that it is set
even if the PMD doesn't do that.
The macro in odp_buffer_inlines.h is a workaround to make sure linux-generic
timer implementation doesn't have a linking issue. It would be slightly
better to have it in a local copy of odp_internal.h, but having it in sync
with linux-generic is more important.
Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
Diffstat (limited to 'platform/linux-dpdk')
-rw-r--r-- | platform/linux-dpdk/include/odp_buffer_inlines.h | 3 | ||||
-rw-r--r-- | platform/linux-dpdk/odp_errno.c | 9 | ||||
-rw-r--r-- | platform/linux-dpdk/odp_packet_io.c | 10 |
3 files changed, 15 insertions, 7 deletions
diff --git a/platform/linux-dpdk/include/odp_buffer_inlines.h b/platform/linux-dpdk/include/odp_buffer_inlines.h index 254607a10..9259353ee 100644 --- a/platform/linux-dpdk/include/odp_buffer_inlines.h +++ b/platform/linux-dpdk/include/odp_buffer_inlines.h @@ -17,6 +17,9 @@ extern "C" { #endif +#include <rte_errno.h> +#define __odp_errno (rte_errno) + #include <odp_buffer_internal.h> static inline odp_buffer_t odp_hdr_to_buf(odp_buffer_hdr_t *hdr) diff --git a/platform/linux-dpdk/odp_errno.c b/platform/linux-dpdk/odp_errno.c index 1a76d4366..47423848a 100644 --- a/platform/linux-dpdk/odp_errno.c +++ b/platform/linux-dpdk/odp_errno.c @@ -9,17 +9,16 @@ #include <string.h> #include <stdio.h> #include <odp_debug_internal.h> - -__thread int __odp_errno; +#include <rte_errno.h> int odp_errno(void) { - return __odp_errno; + return rte_errno; } void odp_errno_zero(void) { - __odp_errno = 0; + rte_errno = 0; } void odp_errno_print(const char *str) @@ -27,7 +26,7 @@ void odp_errno_print(const char *str) if (str != NULL) printf("%s ", str); - ODP_PRINT("%s\n", strerror(__odp_errno)); + ODP_PRINT("%s\n", strerror(rte_errno)); } const char *odp_errno_str(int errnum) diff --git a/platform/linux-dpdk/odp_packet_io.c b/platform/linux-dpdk/odp_packet_io.c index 30332e891..4fc717d6b 100644 --- a/platform/linux-dpdk/odp_packet_io.c +++ b/platform/linux-dpdk/odp_packet_io.c @@ -197,7 +197,7 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t pool, id = odp_pktio_lookup(dev); if (id != ODP_PKTIO_INVALID) { /* interface is already open */ - __odp_errno = EEXIST; + rte_errno = EEXIST; return ODP_PKTIO_INVALID; } @@ -436,7 +436,13 @@ int odp_pktio_send(odp_pktio_t id, odp_packet_t pkt_table[], int len) pkts = enq_loopback(pktio_entry, pkt_table, len); odp_ticketlock_unlock(&pktio_entry->s.txl); - return pkts; + if (pkts) { + return pkts; + } else { + if (!rte_errno) + rte_errno = -1; + return -1; + } } int odp_pktio_inq_setdef(odp_pktio_t id, odp_queue_t queue) |