diff options
author | Dave Barach <dave@barachs.net> | 2016-06-27 09:25:13 -0400 |
---|---|---|
committer | Keith Burns (alagalah) <alagalah@gmail.com> | 2016-06-27 06:54:32 -0700 |
commit | aa6920e0a80d8271be1dda59f613a1d2b0e1d3e6 (patch) | |
tree | 473efa376151e0b7bce525b97f627e6c67ac6efb /vpp | |
parent | 20c90f765dd0350892421e1dea544752108f4ce9 (diff) |
More janitorial work
Install vpp api header files in /usr/include/vpp-api, instead of
/usr/include/api. Someone will eventually complain if we continue with
the status quo.
Generate /usr/bin/vpp_plugin_configure, to correctly configure
standalone plugin compilation against header files installed from the
dev package.
If a plugin's CFLAGS don't precisely match the installed vpp engine
binary, subtle misbehavior can and will occur. Example: the ip4/ip6
main_t structure size / member offsets depend on DPDK=[0|1]. Screw
that one up, and your brand-new configurable ip feature will
mysteriously fail to appear, even though the plugin loads perfectly.
Change-Id: I20c97fe1042808a79935863209d995c31953b98c
Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vpp')
-rw-r--r-- | vpp/Makefile.am | 50 | ||||
-rw-r--r-- | vpp/api/n1k_harness.c | 66 | ||||
-rw-r--r-- | vpp/stats/stats.c | 8 | ||||
-rw-r--r-- | vpp/vnet/main.c | 2 | ||||
-rw-r--r-- | vpp/vpp-api/api.c (renamed from vpp/api/api.c) | 10 | ||||
-rw-r--r-- | vpp/vpp-api/custom_dump.c (renamed from vpp/api/custom_dump.c) | 6 | ||||
-rw-r--r-- | vpp/vpp-api/gmon.c (renamed from vpp/api/gmon.c) | 0 | ||||
-rw-r--r-- | vpp/vpp-api/summary_stats_client.c (renamed from vpp/api/summary_stats_client.c) | 8 | ||||
-rw-r--r-- | vpp/vpp-api/test_client.c (renamed from vpp/api/test_client.c) | 10 | ||||
-rw-r--r-- | vpp/vpp-api/test_ha.c (renamed from vpp/api/test_ha.c) | 8 | ||||
-rw-r--r-- | vpp/vpp-api/vpe.api (renamed from vpp/api/vpe.api) | 0 | ||||
-rw-r--r-- | vpp/vpp-api/vpe_all_api_h.h (renamed from vpp/api/vpe_all_api_h.h) | 2 | ||||
-rw-r--r-- | vpp/vpp-api/vpe_msg_enum.h (renamed from vpp/api/vpe_msg_enum.h) | 2 |
13 files changed, 66 insertions, 106 deletions
diff --git a/vpp/Makefile.am b/vpp/Makefile.am index 4c28fb79..5577c075 100644 --- a/vpp/Makefile.am +++ b/vpp/Makefile.am @@ -30,25 +30,25 @@ vpp_SOURCES = \ stats/stats.c vpp_SOURCES += \ - api/api.c \ - api/custom_dump.c + vpp-api/api.c \ + vpp-api/custom_dump.c # comment out to disable stats upload to gmond vpp_SOURCES += \ - api/gmon.c + vpp-api/gmon.c nobase_include_HEADERS = \ - api/vpe_all_api_h.h \ - api/vpe_msg_enum.h \ - api/vpe.api.h + vpp-api/vpe_all_api_h.h \ + vpp-api/vpe_msg_enum.h \ + vpp-api/vpe.api.h # install the API definition, so we can produce java bindings, etc. -apidir = $(prefix)/api -api_DATA = api/vpe.api +apidir = $(prefix)/vpp-api +api_DATA = vpp-api/vpe.api -BUILT_SOURCES += api/vpe.api.h app/version.h +BUILT_SOURCES += vpp-api/vpe.api.h app/version.h app/version.o: app/version.h @@ -62,6 +62,32 @@ app/version.h: @echo "#define VPP_BUILD_TOPDIR \"$$(git rev-parse --show-toplevel)\"" >> $@ @echo "#define VPP_BUILD_VER \"$$(../../scripts/version)\"" >> $@ +# Generate a plugin configuration script. Misconfiguring a +# plugin can cause very subtle problems. + +bin_SCRIPTS = vpp_plugin_configure + +BUILT_SOURCES += vpp_plugin_configure + +.PHONY: vpp_plugin_configure + +vpp_plugin_configure: + @echo "PLUGIN CONFIGURE " $@ + @echo "#!/bin/bash" > $@ + @echo " " >> $@ + @echo "set +eu" >> $@ + @echo " " >> $@ + @echo "if [ -f ./configure ] ; then" >> $@ + @echo " CFLAGS='$(CFLAGS) $(AM_CFLAGS) -I/usr/include/vpp-dpdk' ./configure --with-plugin-toolkit" >> $@ + @echo "else" >> $@ + @echo " if [ -f ../configure ] ; then" >> $@ + @echo " CFLAGS='$(CFLAGS) $(AM_CFLAGS) -I/usr/include/vpp-dpdk' ../configure --with-plugin-toolkit" >> $@ + @echo " else" >> $@ + @echo " echo Couldnt find ./configure or ../configure " >> $@ + @echo " exit 1" >> $@ + @echo " fi" >> $@ + @echo "fi" >> $@ + vpp_LDADD = -lvlibapi -lvlibmemory -lvlib_unix -lvlib vpp_LDADD += -lvnet @@ -97,13 +123,13 @@ SUFFIXES = .api.h .api noinst_PROGRAMS += test_client -test_client_SOURCES = api/test_client.c +test_client_SOURCES = vpp-api/test_client.c test_client_LDADD = -lvlibmemoryclient -lvlibapi -lsvm -lvppinfra \ -lpthread -lm -lrt noinst_PROGRAMS += test_client test_ha -test_ha_SOURCES = api/test_ha.c +test_ha_SOURCES = vpp-api/test_ha.c test_ha_LDADD = -lvlibmemoryclient -lvlibapi -lsvmdb -lsvm -lvppinfra \ -lpthread -lm -lrt @@ -111,6 +137,6 @@ test_ha_LDADD = -lvlibmemoryclient -lvlibapi -lsvmdb -lsvm -lvppinfra \ noinst_PROGRAMS += summary_stats_client -summary_stats_client_SOURCES = api/summary_stats_client.c +summary_stats_client_SOURCES = vpp-api/summary_stats_client.c summary_stats_client_LDADD = -lvlibmemoryclient -lvlibapi -lsvm -lvppinfra \ -lpthread -lm -lrt diff --git a/vpp/api/n1k_harness.c b/vpp/api/n1k_harness.c deleted file mode 100644 index 4a5df4bd..00000000 --- a/vpp/api/n1k_harness.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2015 Cisco and/or its affiliates. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include <dlfcn.h> -#include <vppinfra/format.h> - -void vlib_cli_output (void * vm, char * fmt, ...) -{ clib_warning ("%s", fmt); } - -/* - * build system finesse hack - * since we can't build everything in one build system, this - * hack exists to make sure that the invoked program runs against - * the right libraries. - */ - -int main (int argc, char ** argv) -{ - void *handle, *main_handle; - int (*fp)(int argc, char **argv); - int rv; - - /* n1k_harness <plugin-name> <plugin args> */ - - if (argc < 2) { - fformat (stderr, "usage: %s <plugin-name> [<plugin-args>...]\n", - argv[0]); - exit (1); - } - - handle = dlopen (argv[1], RTLD_LAZY); - - /* - * Note: this can happen if the plugin has an undefined symbol reference, - * so print a warning. Otherwise, the poor slob won't know what happened. - * Ask me how I know that... - */ - if (handle == 0) - { - clib_warning ("%s", dlerror()); - exit(1); - } - - main_handle = dlsym (handle, "plugin_main"); - if (main_handle == 0) { - clib_warning ("plugin_main(int argc, char **argv) missing...\n"); - exit(1); - } - - fp = main_handle; - - rv = (*fp)(argc-2, argv+2); - - return rv; -} diff --git a/vpp/stats/stats.c b/vpp/stats/stats.c index 566655d2..2d366fa5 100644 --- a/vpp/stats/stats.c +++ b/vpp/stats/stats.c @@ -22,23 +22,23 @@ stats_main_t stats_main; #include <vnet/ip/ip.h> -#include <api/vpe_msg_enum.h> +#include <vpp-api/vpe_msg_enum.h> #define f64_endian(a) #define f64_print(a,b) #define vl_typedefs /* define message structures */ -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> #undef vl_typedefs #define vl_endianfun /* define message structures */ -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> #undef vl_endianfun /* instantiate all the print functions we know about */ #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) #define vl_printfun -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> #undef vl_printfun #define foreach_stats_msg \ diff --git a/vpp/vnet/main.c b/vpp/vnet/main.c index a1c5427f..67954074 100644 --- a/vpp/vnet/main.c +++ b/vpp/vnet/main.c @@ -19,7 +19,7 @@ #include <vnet/plugin/plugin.h> #include <vnet/ethernet/ethernet.h> -#include <api/vpe_msg_enum.h> +#include <vpp-api/vpe_msg_enum.h> #if DPDK #include <vnet/devices/dpdk/dpdk.h> diff --git a/vpp/api/api.c b/vpp/vpp-api/api.c index 302b7d4e..2ea92df0 100644 --- a/vpp/api/api.c +++ b/vpp/vpp-api/api.c @@ -101,23 +101,23 @@ #include <vnet/l2/l2_fib.h> #include <vnet/l2/l2_bd.h> -#include <api/vpe_msg_enum.h> +#include <vpp-api/vpe_msg_enum.h> #define f64_endian(a) #define f64_print(a,b) #define vl_typedefs /* define message structures */ -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> #undef vl_typedefs #define vl_endianfun /* define message structures */ -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> #undef vl_endianfun /* instantiate all the print functions we know about */ #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) #define vl_printfun -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> #undef vl_printfun #define REPLY_MACRO(t) \ @@ -7059,7 +7059,7 @@ void * get_unformat_vnet_sw_interface (void) #undef vl_api_version #define vl_api_version(n,v) static u32 vpe_api_version = v; -#include <api/vpe.api.h> +#include <vpp-api/vpe.api.h> #undef vl_api_version int vl_msg_api_version_check (vl_api_memclnt_create_t * mp) diff --git a/vpp/api/custom_dump.c b/vpp/vpp-api/custom_dump.c index 123883fb..ac90a56f 100644 --- a/vpp/api/custom_dump.c +++ b/vpp/vpp-api/custom_dump.c @@ -38,14 +38,14 @@ #include <vnet/ethernet/ethernet.h> #include <vnet/l2/l2_vtr.h> -#include <api/vpe_msg_enum.h> +#include <vpp-api/vpe_msg_enum.h> #define vl_typedefs /* define message structures */ -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> #undef vl_typedefs #define vl_endianfun /* define message structures */ -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> #undef vl_endianfun #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) diff --git a/vpp/api/gmon.c b/vpp/vpp-api/gmon.c index 9d37155f..9d37155f 100644 --- a/vpp/api/gmon.c +++ b/vpp/vpp-api/gmon.c diff --git a/vpp/api/summary_stats_client.c b/vpp/vpp-api/summary_stats_client.c index 90b99f65..97e9f9d1 100644 --- a/vpp/api/summary_stats_client.c +++ b/vpp/vpp-api/summary_stats_client.c @@ -49,7 +49,7 @@ #include <vlibapi/api.h> #include <vlibmemory/api.h> -#include <api/vpe_msg_enum.h> +#include <vpp-api/vpe_msg_enum.h> #include <vnet/ip/ip.h> @@ -57,17 +57,17 @@ #define f64_print(a,b) #define vl_typedefs /* define message structures */ -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> #undef vl_typedefs #define vl_endianfun /* define message structures */ -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> #undef vl_endianfun /* instantiate all the print functions we know about */ #define vl_print(handle, ...) #define vl_printfun -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> #undef vl_printfun vl_shmem_hdr_t *shmem_hdr; diff --git a/vpp/api/test_client.c b/vpp/vpp-api/test_client.c index b3bf02ea..92cf4531 100644 --- a/vpp/api/test_client.c +++ b/vpp/vpp-api/test_client.c @@ -47,7 +47,7 @@ #include <vlibapi/api.h> #include <vlibmemory/api.h> -#include <api/vpe_msg_enum.h> +#include <vpp-api/vpe_msg_enum.h> #include <vnet/ip/ip.h> #include <vnet/interface.h> @@ -56,17 +56,17 @@ #define f64_print(a,b) #define vl_typedefs /* define message structures */ -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> #undef vl_typedefs #define vl_endianfun /* define message structures */ -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> #undef vl_endianfun /* instantiate all the print functions we know about */ #define vl_print(handle, ...) #define vl_printfun -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> #undef vl_printfun vl_shmem_hdr_t *shmem_hdr; @@ -1523,7 +1523,7 @@ int main (int argc, char ** argv) #undef vl_api_version #define vl_api_version(n,v) static u32 vpe_api_version = v; -#include <api/vpe.api.h> +#include <vpp-api/vpe.api.h> #undef vl_api_version void vl_client_add_api_signatures (vl_api_memclnt_create_t *mp) diff --git a/vpp/api/test_ha.c b/vpp/vpp-api/test_ha.c index 0c66394b..b3b39fea 100644 --- a/vpp/api/test_ha.c +++ b/vpp/vpp-api/test_ha.c @@ -49,7 +49,7 @@ #include <svm.h> #include <svmdb.h> -#include <api/vpe_msg_enum.h> +#include <vpp-api/vpe_msg_enum.h> #include <vnet/ip/ip.h> @@ -57,17 +57,17 @@ #define f64_print(a,b) #define vl_typedefs /* define message structures */ -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> #undef vl_typedefs #define vl_endianfun /* define message structures */ -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> #undef vl_endianfun /* instantiate all the print functions we know about */ #define vl_print(handle, ...) #define vl_printfun -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> #undef vl_printfun vl_shmem_hdr_t *shmem_hdr; diff --git a/vpp/api/vpe.api b/vpp/vpp-api/vpe.api index a1ea1b2f..a1ea1b2f 100644 --- a/vpp/api/vpe.api +++ b/vpp/vpp-api/vpe.api diff --git a/vpp/api/vpe_all_api_h.h b/vpp/vpp-api/vpe_all_api_h.h index a5be7b58..ca6776c6 100644 --- a/vpp/api/vpe_all_api_h.h +++ b/vpp/vpp-api/vpe_all_api_h.h @@ -21,4 +21,4 @@ #include <vlibmemory/vl_memory_api_h.h> /* Here are the vpe forwarder specific API definitions */ -#include <api/vpe.api.h> +#include <vpp-api/vpe.api.h> diff --git a/vpp/api/vpe_msg_enum.h b/vpp/vpp-api/vpe_msg_enum.h index 79616a1b..fa194ee0 100644 --- a/vpp/api/vpe_msg_enum.h +++ b/vpp/vpp-api/vpe_msg_enum.h @@ -20,7 +20,7 @@ #define vl_msg_id(n,h) n, typedef enum { VL_ILLEGAL_MESSAGE_ID=0, -#include <api/vpe_all_api_h.h> +#include <vpp-api/vpe_all_api_h.h> VL_MSG_FIRST_AVAILABLE, } vl_msg_id_t; #undef vl_msg_id |