Both linux/if.h and net/if.h were used but they are not
necesseraly compatible and it is not possible to include
both in the same file.

Signed-off-by: Nicolas Morey-Chaisemartin <[email protected]>
---
 platform/linux-generic/include/odp_packet_io_internal.h |  4 ++--
 platform/linux-generic/odp_packet_io.c                  | 14 +++++++-------
 platform/linux-generic/odp_packet_socket.c              |  6 +++---
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
b/platform/linux-generic/include/odp_packet_io_internal.h
index 18b59ef..b3e29bf 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -26,7 +26,7 @@ extern "C" {
 
 #include <odp/config.h>
 #include <odp/hints.h>
-#include <linux/if.h>
+#include <net/if.h>
 
 /**
  * Packet IO types
@@ -50,7 +50,7 @@ struct pktio_entry {
        pkt_sock_t pkt_sock;            /**< using socket API for IO */
        pkt_sock_mmap_t pkt_sock_mmap;  /**< using socket mmap API for IO */
        classifier_t cls;               /**< classifier linked with this pktio*/
-       char name[IFNAMSIZ];            /**< name of pktio provided to
+       char name[IF_NAMESIZE];         /**< name of pktio provided to
                                           pktio_open() */
        odp_bool_t promisc;             /**< promiscuous mode state */
 };
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index 5ae24b9..afda1b8 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -245,10 +245,10 @@ static odp_pktio_t setup_pktio_entry(const char *dev, 
odp_pool_t pool)
        pktio_entry_t *pktio_entry;
        int ret;
 
-       if (strlen(dev) >= IFNAMSIZ) {
+       if (strlen(dev) >= IF_NAMESIZE) {
                /* ioctl names limitation */
                ODP_ERR("pktio name %s is too big, limit is %d bytes\n",
-                       dev, IFNAMSIZ);
+                       dev, IF_NAMESIZE);
                return ODP_PKTIO_INVALID;
        }
 
@@ -274,7 +274,7 @@ static odp_pktio_t setup_pktio_entry(const char *dev, 
odp_pool_t pool)
                id = ODP_PKTIO_INVALID;
                ODP_ERR("Unable to init any I/O type.\n");
        } else {
-               snprintf(pktio_entry->s.name, IFNAMSIZ, "%s", dev);
+               snprintf(pktio_entry->s.name, IF_NAMESIZE, "%s", dev);
                unlock_entry_classifier(pktio_entry);
        }
 
@@ -352,7 +352,7 @@ odp_pktio_t odp_pktio_lookup(const char *dev)
                lock_entry(entry);
 
                if (!is_free(entry) &&
-                   strncmp(entry->s.name, dev, IFNAMSIZ) == 0)
+                   strncmp(entry->s.name, dev, IF_NAMESIZE) == 0)
                        id = _odp_cast_scalar(odp_pktio_t, i);
 
                unlock_entry(entry);
@@ -762,7 +762,7 @@ int odp_pktio_mtu(odp_pktio_t id)
        }
 
        sockfd = sockfd_from_pktio_entry(entry);
-       snprintf(ifr.ifr_name, IFNAMSIZ, "%s", entry->s.name);
+       snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", entry->s.name);
 
        ret = ioctl(sockfd, SIOCGIFMTU, &ifr);
        if (ret < 0) {
@@ -804,7 +804,7 @@ int odp_pktio_promisc_mode_set(odp_pktio_t id, odp_bool_t 
enable)
        }
 
        sockfd = sockfd_from_pktio_entry(entry);
-       snprintf(ifr.ifr_name, IFNAMSIZ, "%s", entry->s.name);
+       snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", entry->s.name);
 
        ret = ioctl(sockfd, SIOCGIFFLAGS, &ifr);
        if (ret < 0) {
@@ -856,7 +856,7 @@ int odp_pktio_promisc_mode(odp_pktio_t id)
        }
 
        sockfd = sockfd_from_pktio_entry(entry);
-       snprintf(ifr.ifr_name, IFNAMSIZ, "%s", entry->s.name);
+       snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", entry->s.name);
 
        ret = ioctl(sockfd, SIOCGIFFLAGS, &ifr);
        if (ret < 0) {
diff --git a/platform/linux-generic/odp_packet_socket.c 
b/platform/linux-generic/odp_packet_socket.c
index 0526166..a41291d 100644
--- a/platform/linux-generic/odp_packet_socket.c
+++ b/platform/linux-generic/odp_packet_socket.c
@@ -153,7 +153,7 @@ int setup_pkt_sock(pkt_sock_t *const pkt_sock, const char 
*netdev,
 
        /* get if index */
        memset(&ethreq, 0, sizeof(struct ifreq));
-       snprintf(ethreq.ifr_name, IFNAMSIZ, "%s", netdev);
+       snprintf(ethreq.ifr_name, IF_NAMESIZE, "%s", netdev);
        err = ioctl(sockfd, SIOCGIFINDEX, &ethreq);
        if (err != 0) {
                ODP_ERR("ioctl(SIOCGIFINDEX): %s: \"%s\".\n", strerror(errno),
@@ -164,7 +164,7 @@ int setup_pkt_sock(pkt_sock_t *const pkt_sock, const char 
*netdev,
 
        /* get MAC address */
        memset(&ethreq, 0, sizeof(ethreq));
-       snprintf(ethreq.ifr_name, IFNAMSIZ, "%s", netdev);
+       snprintf(ethreq.ifr_name, IF_NAMESIZE, "%s", netdev);
        err = ioctl(sockfd, SIOCGIFHWADDR, &ethreq);
        if (err != 0) {
                ODP_ERR("ioctl(SIOCGIFHWADDR): %s\n", strerror(errno));
@@ -755,7 +755,7 @@ static int mmap_store_hw_addr(pkt_sock_mmap_t *const 
pkt_sock,
 
        /* get MAC address */
        memset(&ethreq, 0, sizeof(ethreq));
-       snprintf(ethreq.ifr_name, IFNAMSIZ, "%s", netdev);
+       snprintf(ethreq.ifr_name, IF_NAMESIZE, "%s", netdev);
        ret = ioctl(pkt_sock->sockfd, SIOCGIFHWADDR, &ethreq);
        if (ret != 0) {
                __odp_errno = errno;
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to