examples/ip_pipeline: fix build on BSD
authorJasvinder Singh <jasvinder.singh@intel.com>
Mon, 17 Oct 2016 15:48:57 +0000 (16:48 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 25 Oct 2016 14:29:33 +0000 (16:29 +0200)
Error log:
 CC init.o
 examples/ip_pipeline/init.c:38:22: fatal error: linux/if.h: No such file or directory
 #include <linux/if.h>

Fixes: 3f2c9f3bb6c6 ("examples/ip_pipeline: add TAP port")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
examples/ip_pipeline/init.c

index 4fed474..3b36b53 100644 (file)
 #include <stdio.h>
 #include <string.h>
 #include <netinet/in.h>
+#ifdef RTE_EXEC_ENV_LINUXAPP
 #include <linux/if.h>
 #include <linux/if_tun.h>
+#endif
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
@@ -1160,6 +1162,15 @@ app_init_tm(struct app_params *app)
        }
 }
 
+#ifndef RTE_EXEC_ENV_LINUXAPP
+static void
+app_init_tap(struct app_params *app) {
+       if (app->n_pktq_tap == 0)
+               return;
+
+       rte_panic("TAP device not supported.\n");
+}
+#else
 static void
 app_init_tap(struct app_params *app)
 {
@@ -1187,6 +1198,7 @@ app_init_tap(struct app_params *app)
                app->tap[i] = fd;
        }
 }
+#endif
 
 #ifdef RTE_LIBRTE_KNI
 static int
@@ -1404,6 +1416,7 @@ void app_pipeline_params_get(struct app_params *app,
                        out->burst_size = app->tm_params[in->id].burst_read;
                        break;
                }
+#ifdef RTE_EXEC_ENV_LINUXAPP
                case APP_PKTQ_IN_TAP:
                {
                        struct app_pktq_tap_params *tap_params =
@@ -1420,6 +1433,7 @@ void app_pipeline_params_get(struct app_params *app,
                        out->burst_size = app->tap_params[in->id].burst_read;
                        break;
                }
+#endif
 #ifdef RTE_LIBRTE_KNI
                case APP_PKTQ_IN_KNI:
                {
@@ -1564,6 +1578,7 @@ void app_pipeline_params_get(struct app_params *app,
                                app->tm_params[in->id].burst_write;
                        break;
                }
+#ifdef RTE_EXEC_ENV_LINUXAPP
                case APP_PKTQ_OUT_TAP:
                {
                        struct rte_port_fd_writer_params *params =
@@ -1575,6 +1590,7 @@ void app_pipeline_params_get(struct app_params *app,
                                app->tap_params[in->id].burst_write;
                        break;
                }
+#endif
 #ifdef RTE_LIBRTE_KNI
                case APP_PKTQ_OUT_KNI:
                {