[lng-odp] [PATCH] linux-generic: socket: set up __odp_errno on ioctl failures
Also debug output enhanced. Signed-off-by: Ilya Maximets --- platform/linux-generic/pktio/socket.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c index 5f5e0ae..ef2e031 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -126,7 +126,9 @@ int 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_DBG("ioctl SIOCGIFMTU error\n"); + __odp_errno = errno; + ODP_DBG("ioctl(SIOCGIFMTU): %s: \"%s\".\n", strerror(errno), + ifr.ifr_name); return -1; } return ifr.ifr_mtu; @@ -145,7 +147,9 @@ int 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_DBG("ioctl SIOCGIFFLAGS error\n"); + __odp_errno = errno; + ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), + ifr.ifr_name); return -1; } @@ -156,7 +160,9 @@ int promisc_mode_set_fd(int fd, const char *name, int enable) ret = ioctl(fd, SIOCSIFFLAGS, &ifr); if (ret < 0) { - ODP_DBG("ioctl SIOCSIFFLAGS error\n"); + __odp_errno = errno; + ODP_DBG("ioctl(SIOCSIFFLAGS): %s: \"%s\".\n", strerror(errno), + ifr.ifr_name); return -1; } return 0; @@ -175,7 +181,9 @@ int 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_DBG("ioctl SIOCGIFFLAGS error\n"); + __odp_errno = errno; + ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), + ifr.ifr_name); return -1; } -- 2.1.4 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] linux-generic: socket: set up __odp_errno on ioctl failures
On Mon, Dec 07, 2015 at 05:25:03PM +0300, Ilya Maximets wrote: > Also debug output enhanced. > > Signed-off-by: Ilya Maximets Reviewed-by: Stuart Haslam > --- > platform/linux-generic/pktio/socket.c | 16 > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/platform/linux-generic/pktio/socket.c > b/platform/linux-generic/pktio/socket.c > index 5f5e0ae..ef2e031 100644 > --- a/platform/linux-generic/pktio/socket.c > +++ b/platform/linux-generic/pktio/socket.c > @@ -126,7 +126,9 @@ int 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_DBG("ioctl SIOCGIFMTU error\n"); > + __odp_errno = errno; > + ODP_DBG("ioctl(SIOCGIFMTU): %s: \"%s\".\n", strerror(errno), > + ifr.ifr_name); > return -1; > } > return ifr.ifr_mtu; > @@ -145,7 +147,9 @@ int 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_DBG("ioctl SIOCGIFFLAGS error\n"); > + __odp_errno = errno; > + ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), > + ifr.ifr_name); > return -1; > } > > @@ -156,7 +160,9 @@ int promisc_mode_set_fd(int fd, const char *name, int > enable) > > ret = ioctl(fd, SIOCSIFFLAGS, &ifr); > if (ret < 0) { > - ODP_DBG("ioctl SIOCSIFFLAGS error\n"); > + __odp_errno = errno; > + ODP_DBG("ioctl(SIOCSIFFLAGS): %s: \"%s\".\n", strerror(errno), > + ifr.ifr_name); > return -1; > } > return 0; > @@ -175,7 +181,9 @@ int 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_DBG("ioctl SIOCGIFFLAGS error\n"); > + __odp_errno = errno; > + ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), > + ifr.ifr_name); > return -1; > } > > -- > 2.1.4 > -- Stuart. ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] linux-generic: socket: set up __odp_errno on ioctl failures
Merged, Thanks. On 12/08/2015 14:29, Stuart Haslam wrote: On Mon, Dec 07, 2015 at 05:25:03PM +0300, Ilya Maximets wrote: Also debug output enhanced. Signed-off-by: Ilya Maximets Reviewed-by: Stuart Haslam --- platform/linux-generic/pktio/socket.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c index 5f5e0ae..ef2e031 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -126,7 +126,9 @@ int 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_DBG("ioctl SIOCGIFMTU error\n"); + __odp_errno = errno; + ODP_DBG("ioctl(SIOCGIFMTU): %s: \"%s\".\n", strerror(errno), + ifr.ifr_name); return -1; } return ifr.ifr_mtu; @@ -145,7 +147,9 @@ int 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_DBG("ioctl SIOCGIFFLAGS error\n"); + __odp_errno = errno; + ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), + ifr.ifr_name); return -1; } @@ -156,7 +160,9 @@ int promisc_mode_set_fd(int fd, const char *name, int enable) ret = ioctl(fd, SIOCSIFFLAGS, &ifr); if (ret < 0) { - ODP_DBG("ioctl SIOCSIFFLAGS error\n"); + __odp_errno = errno; + ODP_DBG("ioctl(SIOCSIFFLAGS): %s: \"%s\".\n", strerror(errno), + ifr.ifr_name); return -1; } return 0; @@ -175,7 +181,9 @@ int 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_DBG("ioctl SIOCGIFFLAGS error\n"); + __odp_errno = errno; + ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), + ifr.ifr_name); return -1; } -- 2.1.4 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp