aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2023-03-22 15:30:51 +0200
committerMatias Elo <matias.elo@nokia.com>2023-04-13 10:44:33 +0300
commit1e90fc0268493238485b78d86c397b48dc118dc0 (patch)
tree75871ff1709e20881c6d9a8c7db668004c4d1c3d /platform
parent7065560a65b9da13798011918bd2ec43a8d116f0 (diff)
linux-gen: remove usage of odp_errno
Setting odp_errno has been removed from ODP APIs, so remove usage from the implementation. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Diffstat (limited to 'platform')
-rw-r--r--platform/linux-generic/odp_ishm.c1
-rw-r--r--platform/linux-generic/odp_packet.c11
-rw-r--r--platform/linux-generic/odp_packet_io.c12
-rw-r--r--platform/linux-generic/odp_timer.c18
-rw-r--r--platform/linux-generic/odp_traffic_mngr.c1
-rw-r--r--platform/linux-generic/pktio/ipc.c4
-rw-r--r--platform/linux-generic/pktio/loop.c6
-rw-r--r--platform/linux-generic/pktio/socket.c6
-rw-r--r--platform/linux-generic/pktio/socket_common.c11
-rw-r--r--platform/linux-generic/pktio/socket_mmap.c8
-rw-r--r--platform/linux-generic/pktio/stats/ethtool_stats.c9
-rw-r--r--platform/linux-generic/pktio/stats/sysfs_stats.c2
-rw-r--r--platform/linux-generic/pktio/tap.c18
13 files changed, 13 insertions, 94 deletions
diff --git a/platform/linux-generic/odp_ishm.c b/platform/linux-generic/odp_ishm.c
index 8bb558be2..926e20a8a 100644
--- a/platform/linux-generic/odp_ishm.c
+++ b/platform/linux-generic/odp_ishm.c
@@ -42,7 +42,6 @@
#include <odp/api/system_info.h>
#include <odp/api/debug.h>
#include <odp_init_internal.h>
-#include <odp_errno_define.h>
#include <odp_shm_internal.h>
#include <odp_debug_internal.h>
#include <odp_fdserver_internal.h>
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 639a74e0c..869713098 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -19,7 +19,6 @@
#include <odp_parse_internal.h>
#include <odp_chksum_internal.h>
#include <odp_debug_internal.h>
-#include <odp_errno_define.h>
#include <odp_event_internal.h>
#include <odp_event_validation_internal.h>
#include <odp_macros_internal.h>
@@ -655,10 +654,7 @@ odp_packet_t odp_packet_alloc(odp_pool_t pool_hdl, uint32_t len)
odp_packet_t pkt;
int num, num_seg;
- if (odp_unlikely(pool->type != ODP_POOL_PACKET)) {
- _odp_errno = EINVAL;
- return ODP_PACKET_INVALID;
- }
+ _ODP_ASSERT(pool->type == ODP_POOL_PACKET);
if (odp_unlikely(len > pool->max_len || len == 0))
return ODP_PACKET_INVALID;
@@ -678,10 +674,7 @@ int odp_packet_alloc_multi(odp_pool_t pool_hdl, uint32_t len,
pool_t *pool = _odp_pool_entry(pool_hdl);
int num, num_seg;
- if (odp_unlikely(pool->type != ODP_POOL_PACKET)) {
- _odp_errno = EINVAL;
- return -1;
- }
+ _ODP_ASSERT(pool->type == ODP_POOL_PACKET);
if (odp_unlikely(len > pool->max_len || len == 0))
return -1;
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c
index 5a6c0f460..78cd93885 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -25,7 +25,6 @@
#include <odp_classification_internal.h>
#include <odp_config_internal.h>
#include <odp_debug_internal.h>
-#include <odp_errno_define.h>
#include <odp_event_vector_internal.h>
#include <odp_init_internal.h>
#include <odp_libconfig_internal.h>
@@ -35,7 +34,6 @@
#include <odp_queue_if.h>
#include <odp_schedule_if.h>
-#include <errno.h>
#include <ifaddrs.h>
#include <inttypes.h>
#include <string.h>
@@ -405,8 +403,7 @@ odp_pktio_t odp_pktio_open(const char *name, odp_pool_t pool,
hdl = odp_pktio_lookup(name);
if (hdl != ODP_PKTIO_INVALID) {
- /* interface is already open */
- _odp_errno = EEXIST;
+ _ODP_ERR("pktio device %s already opened\n", name);
return ODP_PKTIO_INVALID;
}
@@ -2357,7 +2354,7 @@ int _odp_pktio_pktout_tm_config(odp_pktio_t pktio_hdl,
odp_pktout_mode_t mode;
pktio_entry_t *entry;
uint32_t i;
- int rc = 0;
+ int rc;
odp_pktout_queue_param_init(&param);
param.num_queues = 1;
@@ -2368,11 +2365,10 @@ int _odp_pktio_pktout_tm_config(odp_pktio_t pktio_hdl,
return -1;
}
- rc = -ENOTSUP;
mode = entry->param.out_mode;
/* Don't proceed further if mode is not TM */
if (mode != ODP_PKTOUT_MODE_TM)
- return rc;
+ return -1;
/* Don't reconfigure unless requested */
if (entry->num_out_queue && !reconf) {
@@ -3507,7 +3503,7 @@ odp_proto_stats_capability(odp_pktio_t pktio, odp_proto_stats_capability_t *capa
(void)pktio;
if (capa == NULL)
- return -EINVAL;
+ return -1;
memset(capa, 0, sizeof(*capa));
diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
index 400bb73fe..18e1a7e23 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -41,7 +41,6 @@
#include <odp_atomic_internal.h>
#include <odp_config_internal.h>
#include <odp_debug_internal.h>
-#include <odp_errno_define.h>
#include <odp_event_internal.h>
#include <odp_global_data.h>
#include <odp_init_internal.h>
@@ -409,7 +408,7 @@ static inline odp_timer_t timer_alloc(timer_pool_t *tp, odp_queue_t queue, const
/* Add timer to queue */
_odp_queue_fn->timer_add(queue);
} else {
- _odp_errno = ENFILE; /* Reusing file table overflow */
+ /* Reusing file table overflow */
hdl = ODP_TIMER_INVALID;
}
odp_spinlock_unlock(&tp->lock);
@@ -1401,23 +1400,14 @@ odp_timer_pool_t odp_timer_pool_create(const char *name,
return ODP_TIMER_POOL_INVALID;
}
- if ((param->res_ns && param->res_hz) ||
- (param->res_ns == 0 && param->res_hz == 0)) {
- _odp_errno = EINVAL;
+ if ((param->res_ns && param->res_hz) || (param->res_ns == 0 && param->res_hz == 0))
return ODP_TIMER_POOL_INVALID;
- }
- if (param->res_hz == 0 &&
- param->res_ns < timer_global->highest_res_ns) {
- _odp_errno = EINVAL;
+ if (param->res_hz == 0 && param->res_ns < timer_global->highest_res_ns)
return ODP_TIMER_POOL_INVALID;
- }
- if (param->res_ns == 0 &&
- param->res_hz > timer_global->highest_res_hz) {
- _odp_errno = EINVAL;
+ if (param->res_ns == 0 && param->res_hz > timer_global->highest_res_hz)
return ODP_TIMER_POOL_INVALID;
- }
return timer_pool_new(name, param);
}
diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c
index c8d8bc5c0..82339361d 100644
--- a/platform/linux-generic/odp_traffic_mngr.c
+++ b/platform/linux-generic/odp_traffic_mngr.c
@@ -23,7 +23,6 @@
#include <odp_traffic_mngr_internal.h>
#include <odp_macros_internal.h>
#include <odp_init_internal.h>
-#include <odp_errno_define.h>
#include <odp_global_data.h>
#include <odp_schedule_if.h>
#include <odp_event_internal.h>
diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c
index cdd040fe3..58b949402 100644
--- a/platform/linux-generic/pktio/ipc.c
+++ b/platform/linux-generic/pktio/ipc.c
@@ -10,13 +10,11 @@
#include <odp_debug_internal.h>
#include <odp_packet_io_internal.h>
#include <odp_pool_internal.h>
-#include <odp_errno_define.h>
#include <odp_macros_internal.h>
#include <odp_shm_internal.h>
#include <odp_ring_ptr_internal.h>
#include <odp_global_data.h>
-#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <sys/mman.h>
@@ -129,7 +127,6 @@ static ring_ptr_t *_ring_create(const char *name, uint32_t count,
/* count must be a power of 2 */
if (!_ODP_CHECK_IS_POWER2(count)) {
_ODP_ERR("Requested size is invalid, must be a power of 2\n");
- _odp_errno = EINVAL;
return NULL;
}
@@ -144,7 +141,6 @@ static ring_ptr_t *_ring_create(const char *name, uint32_t count,
ring_ptr_init(r);
} else {
- _odp_errno = ENOMEM;
_ODP_ERR("Cannot reserve memory\n");
}
diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c
index 849a63c55..f9c72db25 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -21,7 +21,6 @@
#include <odp_parse_internal.h>
#include <odp_classification_internal.h>
#include <odp_debug_internal.h>
-#include <odp_errno_define.h>
#include <odp_event_internal.h>
#include <odp_global_data.h>
#include <odp_ipsec_internal.h>
@@ -33,7 +32,6 @@
#include <protocols/eth.h>
#include <protocols/ip.h>
-#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <stdint.h>
@@ -527,10 +525,8 @@ static int loopback_send(pktio_entry_t *pktio_entry, int index, const odp_packet
uint32_t pkt_len = odp_packet_len(pkt_tbl[i]);
if (odp_unlikely(pkt_len > pkt_loop->mtu)) {
- if (nb_tx == 0) {
- _odp_errno = EMSGSIZE;
+ if (nb_tx == 0)
return -1;
- }
break;
}
diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c
index 97574186c..371831961 100644
--- a/platform/linux-generic/pktio/socket.c
+++ b/platform/linux-generic/pktio/socket.c
@@ -20,7 +20,6 @@
#include <odp_packet_io_internal.h>
#include <odp_packet_io_stats.h>
#include <odp_debug_internal.h>
-#include <odp_errno_define.h>
#include <odp_classification_internal.h>
#include <odp_macros_internal.h>
@@ -96,7 +95,6 @@ static int sock_close(pktio_entry_t *pktio_entry)
pkt_sock_t *pkt_sock = pkt_priv(pktio_entry);
if (pkt_sock->sockfd != -1 && close(pkt_sock->sockfd) != 0) {
- _odp_errno = errno;
_ODP_ERR("close(sockfd): %s\n", strerror(errno));
return -1;
}
@@ -128,7 +126,6 @@ static int sock_setup_pkt(pktio_entry_t *pktio_entry, const char *netdev,
sockfd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (sockfd == -1) {
- _odp_errno = errno;
_ODP_ERR("socket(): %s\n", strerror(errno));
goto error;
}
@@ -139,7 +136,6 @@ static int sock_setup_pkt(pktio_entry_t *pktio_entry, const char *netdev,
snprintf(ethreq.ifr_name, IF_NAMESIZE, "%s", netdev);
err = ioctl(sockfd, SIOCGIFINDEX, &ethreq);
if (err != 0) {
- _odp_errno = errno;
_ODP_ERR("ioctl(SIOCGIFINDEX): %s: \"%s\".\n", strerror(errno), ethreq.ifr_name);
goto error;
}
@@ -162,7 +158,6 @@ static int sock_setup_pkt(pktio_entry_t *pktio_entry, const char *netdev,
sa_ll.sll_ifindex = if_idx;
sa_ll.sll_protocol = htons(ETH_P_ALL);
if (bind(sockfd, (struct sockaddr *)&sa_ll, sizeof(sa_ll)) < 0) {
- _odp_errno = errno;
_ODP_ERR("bind(to IF): %s\n", strerror(errno));
goto error;
}
@@ -486,7 +481,6 @@ static int sock_mmsg_send(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
ret = sendmmsg(sockfd, &msgvec[i], num - i, MSG_DONTWAIT);
if (odp_unlikely(ret <= -1)) {
if (i == 0 && SOCK_ERR_REPORT(errno)) {
- _odp_errno = errno;
_ODP_ERR("sendmmsg(): %s\n", strerror(errno));
odp_ticketlock_unlock(&pkt_sock->tx_lock);
return -1;
diff --git a/platform/linux-generic/pktio/socket_common.c b/platform/linux-generic/pktio/socket_common.c
index d7c320a54..dabe86aa2 100644
--- a/platform/linux-generic/pktio/socket_common.c
+++ b/platform/linux-generic/pktio/socket_common.c
@@ -19,7 +19,6 @@
#include <linux/sockios.h>
#include <errno.h>
#include <odp_debug_internal.h>
-#include <odp_errno_define.h>
#include <odp_socket_common.h>
#include <protocols/eth.h>
@@ -56,7 +55,6 @@ int _odp_mac_addr_get_fd(int fd, const char *name, unsigned char mac_dst[])
snprintf(ethreq.ifr_name, IF_NAMESIZE, "%s", name);
ret = ioctl(fd, SIOCGIFHWADDR, &ethreq);
if (ret != 0) {
- _odp_errno = errno;
_ODP_ERR("ioctl(SIOCGIFHWADDR): %s: \"%s\".\n", strerror(errno), ethreq.ifr_name);
return -1;
}
@@ -79,7 +77,6 @@ uint32_t _odp_mtu_get_fd(int fd, const char *name)
snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", name);
ret = ioctl(fd, SIOCGIFMTU, &ifr);
if (ret < 0) {
- _odp_errno = errno;
_ODP_ERR("ioctl(SIOCGIFMTU): %s: \"%s\".\n", strerror(errno), ifr.ifr_name);
return 0;
}
@@ -101,7 +98,6 @@ int _odp_mtu_set_fd(int fd, const char *name, int mtu)
ret = ioctl(fd, SIOCSIFMTU, &ifr);
if (ret < 0) {
- _odp_errno = errno;
_ODP_ERR("ioctl(SIOCSIFMTU): %s: \"%s\".\n", strerror(errno), ifr.ifr_name);
return -1;
}
@@ -120,7 +116,6 @@ int _odp_promisc_mode_set_fd(int fd, const char *name, int enable)
snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", name);
ret = ioctl(fd, SIOCGIFFLAGS, &ifr);
if (ret < 0) {
- _odp_errno = errno;
_ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), ifr.ifr_name);
return -1;
}
@@ -132,7 +127,6 @@ int _odp_promisc_mode_set_fd(int fd, const char *name, int enable)
ret = ioctl(fd, SIOCSIFFLAGS, &ifr);
if (ret < 0) {
- _odp_errno = errno;
_ODP_DBG("ioctl(SIOCSIFFLAGS): %s: \"%s\".\n", strerror(errno), ifr.ifr_name);
return -1;
}
@@ -151,7 +145,6 @@ int _odp_promisc_mode_get_fd(int fd, const char *name)
snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", name);
ret = ioctl(fd, SIOCGIFFLAGS, &ifr);
if (ret < 0) {
- _odp_errno = errno;
_ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), ifr.ifr_name);
return -1;
}
@@ -167,7 +160,6 @@ int _odp_link_status_fd(int fd, const char *name)
snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", name);
ret = ioctl(fd, SIOCGIFFLAGS, &ifr);
if (ret < 0) {
- _odp_errno = errno;
_ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), ifr.ifr_name);
return ODP_PKTIO_LINK_STATUS_UNKNOWN;
}
@@ -194,7 +186,6 @@ int _odp_link_info_fd(int fd, const char *name, odp_pktio_link_info_t *info)
/* Link pause status */
ifr.ifr_data = (void *)&pcmd;
if (ioctl(fd, SIOCETHTOOL, &ifr) && errno != EOPNOTSUPP) {
- _odp_errno = errno;
_ODP_ERR("ioctl(SIOCETHTOOL): %s: \"%s\".\n", strerror(errno), ifr.ifr_name);
return -1;
}
@@ -206,7 +197,6 @@ int _odp_link_info_fd(int fd, const char *name, odp_pktio_link_info_t *info)
ifr.ifr_data = (void *)&ecmd_old;
if (ioctl(fd, SIOCETHTOOL, &ifr) < 0) {
- _odp_errno = errno;
_ODP_ERR("ioctl(SIOCETHTOOL): %s: \"%s\".\n", strerror(errno),
ifr.ifr_name);
return -1;
@@ -265,7 +255,6 @@ int _odp_link_info_fd(int fd, const char *name, odp_pktio_link_info_t *info)
*ecmd = hcmd;
ifr.ifr_data = (void *)ecmd;
if (ioctl(fd, SIOCETHTOOL, &ifr) < 0) {
- _odp_errno = errno;
_ODP_ERR("ioctl(SIOCETHTOOL): %s: \"%s\".\n", strerror(errno), ifr.ifr_name);
return -1;
}
diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c
index ea6c0b9b7..0c04acd03 100644
--- a/platform/linux-generic/pktio/socket_mmap.c
+++ b/platform/linux-generic/pktio/socket_mmap.c
@@ -21,7 +21,6 @@
#include <odp_packet_io_internal.h>
#include <odp_packet_io_stats.h>
#include <odp_debug_internal.h>
-#include <odp_errno_define.h>
#include <odp_classification_datamodel.h>
#include <odp_classification_internal.h>
#include <odp_global_data.h>
@@ -113,14 +112,12 @@ static int mmap_pkt_socket(void)
int ret, sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (sock == -1) {
- _odp_errno = errno;
_ODP_ERR("socket(SOCK_RAW): %s\n", strerror(errno));
return -1;
}
ret = setsockopt(sock, SOL_PACKET, PACKET_VERSION, &ver, sizeof(ver));
if (ret == -1) {
- _odp_errno = errno;
_ODP_ERR("setsockopt(PACKET_VERSION): %s\n", strerror(errno));
close(sock);
return -1;
@@ -483,7 +480,6 @@ static int mmap_setup_ring(pkt_sock_mmap_t *pkt_sock, struct ring *ring,
ret = setsockopt(sock, SOL_PACKET, type, &ring->req, sizeof(ring->req));
if (ret == -1) {
- _odp_errno = errno;
_ODP_ERR("setsockopt(pkt mmap): %s\n", strerror(errno));
return -1;
}
@@ -514,7 +510,6 @@ static int mmap_sock(pkt_sock_mmap_t *pkt_sock)
MAP_SHARED | MAP_LOCKED | MAP_POPULATE, sock, 0);
if (pkt_sock->mmap_base == MAP_FAILED) {
- _odp_errno = errno;
_ODP_ERR("mmap rx&tx buffer failed: %s\n", strerror(errno));
return -1;
}
@@ -570,7 +565,6 @@ static int mmap_bind_sock(pkt_sock_mmap_t *pkt_sock, const char *netdev)
ret = bind(pkt_sock->sockfd, (struct sockaddr *)&pkt_sock->ll,
sizeof(pkt_sock->ll));
if (ret == -1) {
- _odp_errno = errno;
_ODP_ERR("bind(to IF): %s\n", strerror(errno));
return -1;
}
@@ -590,7 +584,6 @@ static int sock_mmap_close(pktio_entry_t *entry)
}
if (pkt_sock->sockfd != -1 && close(pkt_sock->sockfd) != 0) {
- _odp_errno = errno;
_ODP_ERR("close(sockfd): %s\n", strerror(errno));
return -1;
}
@@ -664,7 +657,6 @@ static int sock_mmap_open(odp_pktio_t id ODP_UNUSED,
if_idx = if_nametoindex(netdev);
if (if_idx == 0) {
- _odp_errno = errno;
_ODP_ERR("if_nametoindex(): %s\n", strerror(errno));
goto error;
}
diff --git a/platform/linux-generic/pktio/stats/ethtool_stats.c b/platform/linux-generic/pktio/stats/ethtool_stats.c
index 678ec45ee..deb00bf59 100644
--- a/platform/linux-generic/pktio/stats/ethtool_stats.c
+++ b/platform/linux-generic/pktio/stats/ethtool_stats.c
@@ -10,7 +10,6 @@
#include <odp/api/packet_io_stats.h>
#include <odp_debug_internal.h>
-#include <odp_errno_define.h>
#include <odp_ethtool_stats.h>
#include <sys/ioctl.h>
@@ -50,13 +49,11 @@ static struct ethtool_gstrings *get_stringset(int fd, struct ifreq *ifr)
drvinfo.cmd = ETHTOOL_GDRVINFO;
ifr->ifr_data = (void *)&drvinfo;
if (ioctl(fd, SIOCETHTOOL, ifr)) {
- _odp_errno = errno;
- _ODP_ERR("Cannot get stats information\n");
+ _ODP_ERR("Cannot get stats information: %s\n", strerror(errno));
return NULL;
}
len = *(uint32_t *)(void *)((char *)&drvinfo + drvinfo_offset);
} else {
- _odp_errno = errno;
return NULL;
}
@@ -76,8 +73,7 @@ static struct ethtool_gstrings *get_stringset(int fd, struct ifreq *ifr)
strings->len = len;
ifr->ifr_data = (void *)strings;
if (ioctl(fd, SIOCETHTOOL, ifr)) {
- _odp_errno = errno;
- _ODP_ERR("Cannot get stats information\n");
+ _ODP_ERR("Cannot get stats information: %s\n", strerror(errno));
free(strings);
return NULL;
}
@@ -122,7 +118,6 @@ static int ethtool_stats_get(int fd, const char *name,
ifr.ifr_data = (void *)estats;
err = ioctl(fd, SIOCETHTOOL, &ifr);
if (err < 0) {
- _odp_errno = errno;
free(strings);
free(estats);
return -1;
diff --git a/platform/linux-generic/pktio/stats/sysfs_stats.c b/platform/linux-generic/pktio/stats/sysfs_stats.c
index d9fb0754c..2b47d4b83 100644
--- a/platform/linux-generic/pktio/stats/sysfs_stats.c
+++ b/platform/linux-generic/pktio/stats/sysfs_stats.c
@@ -8,7 +8,6 @@
#include <odp/api/packet_io_stats.h>
#include <odp_debug_internal.h>
-#include <odp_errno_define.h>
#include <odp_sysfs_stats.h>
#include <dirent.h>
@@ -27,7 +26,6 @@ static int sysfs_get_val(const char *fname, uint64_t *val)
file = fopen(fname, "rt");
if (file == NULL) {
- _odp_errno = errno;
/* do not print debug err if sysfs is not supported by
* kernel driver.
*/
diff --git a/platform/linux-generic/pktio/tap.c b/platform/linux-generic/pktio/tap.c
index 604e53170..5f5b081c5 100644
--- a/platform/linux-generic/pktio/tap.c
+++ b/platform/linux-generic/pktio/tap.c
@@ -44,7 +44,6 @@
#include <odp_packet_internal.h>
#include <odp_packet_io_internal.h>
#include <odp_classification_internal.h>
-#include <odp_errno_define.h>
#include <errno.h>
#include <fcntl.h>
@@ -98,7 +97,6 @@ static int mac_addr_set_fd(int fd, const char *name,
ret = ioctl(fd, SIOCSIFHWADDR, &ethreq);
if (ret != 0) {
- _odp_errno = errno;
_ODP_ERR("ioctl(SIOCSIFHWADDR): %s: \"%s\".\n", strerror(errno), ethreq.ifr_name);
return -1;
}
@@ -128,7 +126,6 @@ static int tap_pktio_open(odp_pktio_t id ODP_UNUSED,
fd = open("/dev/net/tun", O_RDWR);
if (fd < 0) {
- _odp_errno = errno;
_ODP_ERR("failed to open /dev/net/tun: %s\n", strerror(errno));
return -1;
}
@@ -143,7 +140,6 @@ static int tap_pktio_open(odp_pktio_t id ODP_UNUSED,
snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", devname + 4);
if (ioctl(fd, TUNSETIFF, (void *)&ifr) < 0) {
- _odp_errno = errno;
_ODP_ERR("%s: creating tap device failed: %s\n", ifr.ifr_name, strerror(errno));
goto tap_err;
}
@@ -151,13 +147,11 @@ static int tap_pktio_open(odp_pktio_t id ODP_UNUSED,
/* Set nonblocking mode on interface. */
flags = fcntl(fd, F_GETFL, 0);
if (flags < 0) {
- _odp_errno = errno;
_ODP_ERR("fcntl(F_GETFL) failed: %s\n", strerror(errno));
goto tap_err;
}
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
- _odp_errno = errno;
_ODP_ERR("fcntl(F_SETFL) failed: %s\n", strerror(errno));
goto tap_err;
}
@@ -168,14 +162,12 @@ static int tap_pktio_open(odp_pktio_t id ODP_UNUSED,
/* Create AF_INET socket for network interface related operations. */
skfd = socket(AF_INET, SOCK_DGRAM, 0);
if (skfd < 0) {
- _odp_errno = errno;
_ODP_ERR("socket creation failed: %s\n", strerror(errno));
goto tap_err;
}
mtu = _odp_mtu_get_fd(skfd, devname + 4);
if (mtu == 0) {
- _odp_errno = errno;
_ODP_ERR("_odp_mtu_get_fd failed: %s\n", strerror(errno));
goto sock_err;
}
@@ -207,7 +199,6 @@ static int tap_pktio_start(pktio_entry_t *pktio_entry)
/* Up interface by default. */
if (ioctl(tap->skfd, SIOCGIFFLAGS, &ifr) < 0) {
- _odp_errno = errno;
_ODP_ERR("ioctl(SIOCGIFFLAGS) failed: %s\n", strerror(errno));
goto sock_err;
}
@@ -216,7 +207,6 @@ static int tap_pktio_start(pktio_entry_t *pktio_entry)
ifr.ifr_flags |= IFF_RUNNING;
if (ioctl(tap->skfd, SIOCSIFFLAGS, &ifr) < 0) {
- _odp_errno = errno;
_ODP_ERR("failed to come up: %s\n", strerror(errno));
goto sock_err;
}
@@ -238,7 +228,6 @@ static int tap_pktio_stop(pktio_entry_t *pktio_entry)
/* Up interface by default. */
if (ioctl(tap->skfd, SIOCGIFFLAGS, &ifr) < 0) {
- _odp_errno = errno;
_ODP_ERR("ioctl(SIOCGIFFLAGS) failed: %s\n", strerror(errno));
goto sock_err;
}
@@ -247,7 +236,6 @@ static int tap_pktio_stop(pktio_entry_t *pktio_entry)
ifr.ifr_flags &= ~IFF_RUNNING;
if (ioctl(tap->skfd, SIOCSIFFLAGS, &ifr) < 0) {
- _odp_errno = errno;
_ODP_ERR("failed to come up: %s\n", strerror(errno));
goto sock_err;
}
@@ -264,13 +252,11 @@ static int tap_pktio_close(pktio_entry_t *pktio_entry)
pkt_tap_t *tap = pkt_priv(pktio_entry);
if (tap->fd != -1 && close(tap->fd) != 0) {
- _odp_errno = errno;
_ODP_ERR("close(tap->fd): %s\n", strerror(errno));
ret = -1;
}
if (tap->skfd != -1 && close(tap->skfd) != 0) {
- _odp_errno = errno;
_ODP_ERR("close(tap->skfd): %s\n", strerror(errno));
ret = -1;
}
@@ -361,7 +347,6 @@ static int tap_pktio_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
ts_val = odp_time_global();
if (retval < 0) {
- _odp_errno = errno;
break;
}
@@ -392,7 +377,6 @@ static int tap_pktio_send_lockless(pktio_entry_t *pktio_entry,
if (odp_unlikely(pkt_len > mtu)) {
if (i == 0) {
- _odp_errno = EMSGSIZE;
return -1;
}
break;
@@ -409,7 +393,6 @@ static int tap_pktio_send_lockless(pktio_entry_t *pktio_entry,
if (retval < 0) {
if (i == 0 && SOCK_ERR_REPORT(errno)) {
- _odp_errno = errno;
_ODP_ERR("write(): %s\n", strerror(errno));
return -1;
}
@@ -417,7 +400,6 @@ static int tap_pktio_send_lockless(pktio_entry_t *pktio_entry,
} else if ((uint32_t)retval != pkt_len) {
_ODP_ERR("sent partial ethernet packet\n");
if (i == 0) {
- _odp_errno = EMSGSIZE;
return -1;
}
break;