eventdev: introduce specialized enqueue new op variant
[dpdk.git] / examples / exception_path / main.c
index e5eedcc..fe30e07 100644 (file)
 #include <getopt.h>
 
 #include <netinet/in.h>
-#include <linux/if.h>
+#include <net/if.h>
+#ifdef RTE_EXEC_ENV_LINUXAPP
 #include <linux/if_tun.h>
+#endif
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
@@ -65,7 +67,6 @@
 #include <rte_debug.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
-#include <rte_ring.h>
 #include <rte_log.h>
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
@@ -115,7 +116,7 @@ static const struct rte_eth_conf port_conf = {
                .hw_ip_checksum = 0,    /* IP checksum offload disabled */
                .hw_vlan_filter = 0,    /* VLAN filtering disabled */
                .jumbo_frame = 0,       /* Jumbo Frame Support disabled */
-               .hw_strip_crc = 0,      /* CRC stripped by hardware */
+               .hw_strip_crc = 1,      /* CRC stripped by hardware */
        },
        .txmode = {
                .mq_mode = ETH_MQ_TX_NONE,
@@ -183,6 +184,7 @@ signal_handler(int signum)
        }
 }
 
+#ifdef RTE_EXEC_ENV_LINUXAPP
 /*
  * Create a tap network interface, or use existing one with same name.
  * If name[0]='\0' then a name is automatically assigned and returned in name.
@@ -215,6 +217,29 @@ static int tap_create(char *name)
 
        return fd;
 }
+#else
+/*
+ * Find a free tap network interface, or create a new one.
+ * The name is automatically assigned and returned in name.
+ */
+static int tap_create(char *name)
+{
+       int i, fd = -1;
+       char devname[PATH_MAX];
+
+       for (i = 0; i < 255; i++) {
+               snprintf(devname, sizeof(devname), "/dev/tap%d", i);
+               fd = open(devname, O_RDWR);
+               if (fd >= 0 || errno != EBUSY)
+                       break;
+       }
+
+       if (name)
+               snprintf(name, IFNAMSIZ, "tap%d", i);
+
+       return fd;
+}
+#endif
 
 /* Main processing loop */
 static int