Show DPDK version if Open vSwitch is compiled with DPDK support. Version can be retrieved with `ovs-switchd --version` or from OVS logs. Small change in ovs-ctl to avoid breakage on output change.
Signed-off-by: Matteo Croce <[email protected]> --- v3: print version in OVS logs too don't save the version in the DB use dpdk-stub.c instead of #ifdef v4: fix only patch subject, I left ovs-vsctl from the older v1/v2, sorry lib/dpdk-stub.c | 5 +++++ lib/dpdk.c | 8 ++++++++ lib/dpdk.h | 1 + utilities/ovs-ctl.in | 2 +- vswitchd/ovs-vswitchd.c | 1 + 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/dpdk-stub.c b/lib/dpdk-stub.c index 36021807c..041cd0cbb 100644 --- a/lib/dpdk-stub.c +++ b/lib/dpdk-stub.c @@ -54,3 +54,8 @@ dpdk_vhost_iommu_enabled(void) { return false; } + +void +print_dpdk_version(void) +{ +} diff --git a/lib/dpdk.c b/lib/dpdk.c index 6710d10fc..3f5a55fc1 100644 --- a/lib/dpdk.c +++ b/lib/dpdk.c @@ -24,6 +24,7 @@ #include <rte_log.h> #include <rte_memzone.h> +#include <rte_version.h> #ifdef DPDK_PDUMP #include <rte_mempool.h> #include <rte_pdump.h> @@ -471,6 +472,7 @@ dpdk_init(const struct smap *ovs_other_config) static struct ovsthread_once once_enable = OVSTHREAD_ONCE_INITIALIZER; if (ovsthread_once_start(&once_enable)) { + VLOG_INFO("Using %s", rte_version()); VLOG_INFO("DPDK Enabled - initializing..."); dpdk_init__(ovs_other_config); enabled = true; @@ -501,3 +503,9 @@ dpdk_set_lcore_id(unsigned cpu) ovs_assert(cpu != NON_PMD_CORE_ID); RTE_PER_LCORE(_lcore_id) = cpu; } + +void +print_dpdk_version(void) +{ + puts(rte_version()); +} diff --git a/lib/dpdk.h b/lib/dpdk.h index dc58d968a..b04153591 100644 --- a/lib/dpdk.h +++ b/lib/dpdk.h @@ -38,5 +38,6 @@ void dpdk_init(const struct smap *ovs_other_config); void dpdk_set_lcore_id(unsigned cpu); const char *dpdk_get_vhost_sock_dir(void); bool dpdk_vhost_iommu_enabled(void); +void print_dpdk_version(void); #endif /* dpdk.h */ diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index 1df56c4a5..ef06dd967 100755 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -72,7 +72,7 @@ set_hostname () { set_system_ids () { set ovs_vsctl set Open_vSwitch . - OVS_VERSION=`ovs-vswitchd --version | sed 's/.*) //;1q'` + OVS_VERSION=`ovs-vswitchd --version | awk '/Open vSwitch/{print $NF}'` set "$@" ovs-version="$OVS_VERSION" case $SYSTEM_ID in diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c index d5e07c037..a5e8f4d39 100644 --- a/vswitchd/ovs-vswitchd.c +++ b/vswitchd/ovs-vswitchd.c @@ -187,6 +187,7 @@ parse_options(int argc, char *argv[], char **unixctl_pathp) case 'V': ovs_print_version(0, 0); + print_dpdk_version(); exit(EXIT_SUCCESS); case OPT_MLOCKALL: -- 2.14.3 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
