summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Croce <mcroce@redhat.com>2018-01-15 19:21:12 +0100
committerIan Stokes <ian.stokes@intel.com>2018-01-26 20:40:52 +0000
commit1de83cb01f5981058ad87f9bfe6ca59d6c8d5c92 (patch)
treeb15fae92a12416ccd254a4b62185e5bcabeb6dac
parentc7f98a77789ea1e7c9fb98b45506e439ba1d11a2 (diff)
downloadopenvswitch-1de83cb01f5981058ad87f9bfe6ca59d6c8d5c92.tar.gz
vswitchd: show DPDK version
Show DPDK version if Open vSwitch is compiled with DPDK support. Version can be retrieved with `ovs-vswitchd --version` or from OVS logs. Small change in ovs-ctl to avoid breakage on output change. Signed-off-by: Matteo Croce <mcroce@redhat.com> Acked-by: Kevin Traynor <ktraynor@redhat.com> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
-rw-r--r--lib/dpdk-stub.c5
-rw-r--r--lib/dpdk.c8
-rw-r--r--lib/dpdk.h1
-rwxr-xr-xutilities/ovs-ctl.in2
-rw-r--r--vswitchd/ovs-vswitchd.c1
5 files changed, 16 insertions, 1 deletions
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: