Skip to contentSkip to conversation

eal: fix querying DPDK version at runtime

PATCH Superseded Bruce Richardson 3 participants 9 messages Feb 5, 2021 – Mar 17, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal: fix querying DPDK version at runtime

For using a DPDK application, such as OVS, which is dynamically linked, the DPDK version in use should always report the actual version, not the version used at build time. This incorrect behaviour can be seen by building OVS against one version of DPDK and running it against a later one. Using "ovs-vsctl list Open_vSwitch" to query basic info, the dpdk_version returned will be the build version not the currently running one - which can be verified using the DPDK telemetry library client.

  $ sudo ovs-vsctl list Open_vSwitch | grep dpdk_version
  dpdk_version        : "DPDK 20.11.0-rc4"
  $ echo quit | sudo dpdk-telemetry.py
  Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
  {"version": "DPDK 21.02.0-rc2", "pid": 405659, "max_output_len": 16384}
  -->

To fix this, we need to convert the rte_version() function, and any other necessary parts of the rte_version.h, to be actual functions in EAL, not just inlines/macros. The only complication in doing so is that telemetry library cannot call rte_version() directly, and instead needs the version string passed in on init.

Fixes af75078fece3 ("first public release")

---
While new functions are technically supposed to be experimental, I don't believe it should apply in this case

---
 lib/librte_eal/common/meson.build    |  2 +
 lib/librte_eal/common/rte_version.c  | 46 ++++++++++++++++++++
 lib/librte_eal/freebsd/eal.c         |  1 +
 lib/librte_eal/include/rte_version.h | 63 ++++++++++++++++------------
 lib/librte_eal/linux/eal.c           |  1 +
 lib/librte_eal/version.map           |  7 ++++
 lib/librte_telemetry/rte_telemetry.h |  2 +-
 lib/librte_telemetry/telemetry.c     | 12 +++---
 8 files changed, 101 insertions(+), 33 deletions(-)
 create mode 100644 lib/librte_eal/common/rte_version.c
lib/librte_eal/common/meson.build +2 -0
index 39d4272976..70bd854fec 100644
@@ -36,6 +36,7 @@ if is_windows
 		'rte_random.c',
 		'rte_reciprocal.c',
 		'rte_service.c',
+		'rte_version.c',
 	)
 	subdir_done()
 endif
@@ -79,6 +80,7 @@ sources += files(
 	'rte_random.c',
 	'rte_reciprocal.c',
 	'rte_service.c',
+	'rte_version.c',
 )
 
 if is_linux
lib/librte_eal/common/rte_version.c new file +46 -0

46 lines not on this page · raw message

lib/librte_eal/freebsd/eal.c +1 -0
index 51478358c7..3f4dde6f85 100644
@@ -943,6 +943,7 @@ rte_eal_init(int argc, char **argv)
 	if (!internal_conf->no_telemetry) {
 		const char *error_str = NULL;
 		if (rte_telemetry_init(rte_eal_get_runtime_dir(),
+				rte_version(),
 				&internal_conf->ctrl_cpuset, &error_str)
 				!= 0) {
 			rte_eal_init_alert(error_str);
lib/librte_eal/include/rte_version.h +36 -27

74 lines not on this page · raw message

lib/librte_eal/linux/eal.c +1 -0
index 32b48c3de9..3492926117 100644
@@ -1316,6 +1316,7 @@ rte_eal_init(int argc, char **argv)
 	if (!internal_conf->no_telemetry) {
 		const char *error_str = NULL;
 		if (rte_telemetry_init(rte_eal_get_runtime_dir(),
+				rte_version(),
 				&internal_conf->ctrl_cpuset, &error_str)
 				!= 0) {
 			rte_eal_init_alert(error_str);
lib/librte_eal/version.map +7 -0
index fce90a112f..756c60ed1d 100644
@@ -199,6 +199,13 @@ DPDK_21 {
 	rte_uuid_is_null;
 	rte_uuid_parse;
 	rte_uuid_unparse;
+	rte_version;
+	rte_version_minor;
+	rte_version_month;
+	rte_version_prefix;
+	rte_version_release;
+	rte_version_suffix;
+	rte_version_year;
 	rte_vfio_clear_group;
 	rte_vfio_container_create;
 	rte_vfio_container_destroy;
lib/librte_telemetry/rte_telemetry.h +1 -1
index 76172222c9..f6c3992a9c 100644
@@ -311,7 +311,7 @@ rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help);
  */
 __rte_experimental
 int
-rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset,
+rte_telemetry_init(const char *runtime_dir, const char *rte_version, rte_cpuset_t *cpuset,
 		const char **err_str);
 
 /**
lib/librte_telemetry/telemetry.c +7 -5
index b142729da4..14b4ff5ea7 100644
@@ -15,7 +15,6 @@
 #include <rte_string_fns.h>
 #include <rte_common.h>
 #include <rte_spinlock.h>
-#include <rte_version.h>
 
 #include "rte_telemetry.h"
 #include "telemetry_json.h"
@@ -48,6 +47,8 @@ struct socket {
 static struct socket v2_socket; /* socket for v2 telemetry */
 static struct socket v1_socket; /* socket for v1 telemetry */
 #endif /* !RTE_EXEC_ENV_WINDOWS */
+
+static const char *telemetry_version; /* save rte_version */
 static char telemetry_log_error[1024]; /* Will contain error on init failure */
 /* list of command callbacks, with one command registered by default */
 static struct cmd_callback callbacks[TELEMETRY_MAX_CALLBACKS];
@@ -105,7 +106,7 @@ json_info(const char *cmd __rte_unused, const char *params __rte_unused,
 		struct rte_tel_data *d)
 {
 	rte_tel_data_start_dict(d);
-	rte_tel_data_add_dict_string(d, "version", rte_version());
+	rte_tel_data_add_dict_string(d, "version", telemetry_version);
 	rte_tel_data_add_dict_int(d, "pid", getpid());
 	rte_tel_data_add_dict_int(d, "max_output_len", MAX_OUTPUT_LEN);
 	return 0;
@@ -303,7 +304,7 @@ client_handler(void *sock_id)
 	char info_str[1024];
 	snprintf(info_str, sizeof(info_str),
 			"{\"version\":\"%s\",\"pid\":%d,\"max_output_len\":%d}",
-			rte_version(), getpid(), MAX_OUTPUT_LEN);
+			telemetry_version, getpid(), MAX_OUTPUT_LEN);
 	if (write(s, info_str, strlen(info_str)) < 0) {
 		close(s);
 		return NULL;
@@ -481,9 +482,10 @@ telemetry_v2_init(const char *runtime_dir, rte_cpuset_t *cpuset)
 #endif /* !RTE_EXEC_ENV_WINDOWS */
 
 int32_t
-rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset,
-		const char **err_str)
+rte_telemetry_init(const char *runtime_dir, const char *rte_version,
+		rte_cpuset_t *cpuset, const char **err_str)
 {
+	telemetry_version = rte_version;
 #ifndef RTE_EXEC_ENV_WINDOWS
 	if (telemetry_v2_init(runtime_dir, cpuset) != 0) {
 		*err_str = telemetry_log_error;

--
2.27.0

#1 lore raw

05/02/2021 20:39, Bruce Richardson:

Quoted 8 lines

For using a DPDK application, such as OVS, which is dynamically linked, the DPDK version in use should always report the actual version, not the version used at build time. This incorrect behaviour can be seen by building OVS against one version of DPDK and running it against a later one. Using "ovs-vsctl list Open_vSwitch" to query basic info, the dpdk_version returned will be the build version not the currently running one - which can be verified using the DPDK telemetry library client.

Quoted 6 lines
  $ sudo ovs-vsctl list Open_vSwitch | grep dpdk_version
  dpdk_version        : "DPDK 20.11.0-rc4"
  $ echo quit | sudo dpdk-telemetry.py
  Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
  {"version": "DPDK 21.02.0-rc2", "pid": 405659, "max_output_len": 16384}

Nice demonstration.

lib/librte_telemetry/rte_telemetry.h rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help); · line 315

Quoted 5 lines

__rte_experimental
int

lib/librte_telemetry/rte_telemetry.h +1 -1
-rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset,
+rte_telemetry_init(const char *runtime_dir, const char *rte_version, rte_cpuset_t *cpuset,
 		const char **err_str);

It is changing the API.
As it is experimental, you just need to mention it in the release notes.

It is the fix. Do you think it should be merged quickly? Or wait for 21.05?

#2 lore raw
Quoted 18 lines · Thomas Monjalon

05/02/2021 20:39, Bruce Richardson:

Quoted 8 lines

For using a DPDK application, such as OVS, which is dynamically linked, the DPDK version in use should always report the actual version, not the version used at build time. This incorrect behaviour can be seen by building OVS against one version of DPDK and running it against a later one. Using "ovs-vsctl list Open_vSwitch" to query basic info, the dpdk_version returned will be the build version not the currently running one - which can be verified using the DPDK telemetry library client.

Quoted 6 lines
  $ sudo ovs-vsctl list Open_vSwitch | grep dpdk_version
  dpdk_version        : "DPDK 20.11.0-rc4"
  $ echo quit | sudo dpdk-telemetry.py
  Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
  {"version": "DPDK 21.02.0-rc2", "pid": 405659, "max_output_len": 16384}

Nice demonstration.

Quoted 8 lines

lib/librte_telemetry/rte_telemetry.h rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help); · line 315

Quoted 5 lines

__rte_experimental
int

lib/librte_telemetry/rte_telemetry.h +1 -1
-rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset,
+rte_telemetry_init(const char *runtime_dir, const char *rte_version, rte_cpuset_t *cpuset,
 		const char **err_str);

It is changing the API.
As it is experimental, you just need to mention it in the release notes.

I don't think I actually need to mention it there, because this API is more "INTERNAL" than "EXPERIMENTAL". It's called automatically from rte_eal_init(). I've done up patch http://patches.dpdk.org/patch/87806/
to correct this, including a RN addition. That should remove the need for a doc update for this patch.

Quoted 4 lines

It is the fix. Do you think it should be merged quickly? Or wait for 21.05?

I'm not sure either way to be honest. Given the bug has been around so long, it's not exactly urgent. On the other hand, to get the fix the user needs to rebuild their app, so having it sooner is nicer, and will mean it would make the next LTS point release. Overall, though, I'm fine whichever you decide.

/Bruce

#3 lore raw

05/02/2021 22:26, Bruce Richardson:

Quoted 39 lines · Thomas Monjalon
Quoted 18 lines

05/02/2021 20:39, Bruce Richardson:

Quoted 8 lines

For using a DPDK application, such as OVS, which is dynamically linked, the DPDK version in use should always report the actual version, not the version used at build time. This incorrect behaviour can be seen by building OVS against one version of DPDK and running it against a later one. Using "ovs-vsctl list Open_vSwitch" to query basic info, the dpdk_version returned will be the build version not the currently running one - which can be verified using the DPDK telemetry library client.

Quoted 6 lines
  $ sudo ovs-vsctl list Open_vSwitch | grep dpdk_version
  dpdk_version        : "DPDK 20.11.0-rc4"
  $ echo quit | sudo dpdk-telemetry.py
  Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
  {"version": "DPDK 21.02.0-rc2", "pid": 405659, "max_output_len": 16384}

Nice demonstration.

Quoted 8 lines

lib/librte_telemetry/rte_telemetry.h rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help); · line 315

Quoted 5 lines

__rte_experimental
int

lib/librte_telemetry/rte_telemetry.h +1 -1
-rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset,
+rte_telemetry_init(const char *runtime_dir, const char *rte_version, rte_cpuset_t *cpuset,
 		const char **err_str);

It is changing the API.
As it is experimental, you just need to mention it in the release notes.

I don't think I actually need to mention it there, because this API is more "INTERNAL" than "EXPERIMENTAL". It's called automatically from rte_eal_init(). I've done up patch http://patches.dpdk.org/patch/87806/
to correct this, including a RN addition. That should remove the need for a doc update for this patch.

Quoted 4 lines

It is the fix. Do you think it should be merged quickly? Or wait for 21.05?

Quoted 5 lines

I'm not sure either way to be honest. Given the bug has been around so long, it's not exactly urgent. On the other hand, to get the fix the user needs to rebuild their app, so having it sooner is nicer, and will mean it would make the next LTS point release. Overall, though, I'm fine whichever you decide.

There is not much help available to close 21.02, so I won't take any risk. I'll merge this fix in 21.05.

#4 lore raw
Quoted 47 lines · Thomas Monjalon

05/02/2021 22:26, Bruce Richardson:

Quoted 39 lines · Thomas Monjalon
Quoted 18 lines

05/02/2021 20:39, Bruce Richardson:

Quoted 8 lines

For using a DPDK application, such as OVS, which is dynamically linked, the DPDK version in use should always report the actual version, not the version used at build time. This incorrect behaviour can be seen by building OVS against one version of DPDK and running it against a later one. Using "ovs-vsctl list Open_vSwitch" to query basic info, the dpdk_version returned will be the build version not the currently running one - which can be verified using the DPDK telemetry library client.

Quoted 6 lines
  $ sudo ovs-vsctl list Open_vSwitch | grep dpdk_version
  dpdk_version        : "DPDK 20.11.0-rc4"
  $ echo quit | sudo dpdk-telemetry.py
  Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
  {"version": "DPDK 21.02.0-rc2", "pid": 405659, "max_output_len": 16384}

Nice demonstration.

Quoted 8 lines

lib/librte_telemetry/rte_telemetry.h rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help); · line 315

Quoted 5 lines

__rte_experimental
int

lib/librte_telemetry/rte_telemetry.h +1 -1
-rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset,
+rte_telemetry_init(const char *runtime_dir, const char *rte_version, rte_cpuset_t *cpuset,
 		const char **err_str);

It is changing the API.
As it is experimental, you just need to mention it in the release notes.

I don't think I actually need to mention it there, because this API is more "INTERNAL" than "EXPERIMENTAL". It's called automatically from rte_eal_init(). I've done up patch http://patches.dpdk.org/patch/87806/
to correct this, including a RN addition. That should remove the need for a doc update for this patch.

Quoted 4 lines

It is the fix. Do you think it should be merged quickly? Or wait for 21.05?

Quoted 5 lines

I'm not sure either way to be honest. Given the bug has been around so long, it's not exactly urgent. On the other hand, to get the fix the user needs to rebuild their app, so having it sooner is nicer, and will mean it would make the next LTS point release. Overall, though, I'm fine whichever you decide.

Quoted 4 lines

There is not much help available to close 21.02, so I won't take any risk. I'll merge this fix in 21.05.

I agree that it's not urgent enough to risk taking in 21.02. Taking it in 21.05 is fine, thanks.

#5 lore raw

PATCH v2 1/1 eal: fix querying DPDK version at runtime

In reply to Bruce Richardson

For using a DPDK application, such as OVS, which is dynamically linked, the DPDK version in use should always report the actual version, not the version used at build time. This incorrect behaviour can be seen by building OVS against one version of DPDK and running it against a later one. Using "ovs-vsctl list Open_vSwitch" to query basic info, the dpdk_version returned will be the build version not the currently running one - which can be verified using the DPDK telemetry library client.

  $ sudo ovs-vsctl list Open_vSwitch | grep dpdk_version
  dpdk_version        : "DPDK 20.11.0-rc4"
  $ echo quit | sudo dpdk-telemetry.py
  Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
  {"version": "DPDK 21.02.0-rc2", "pid": 405659, "max_output_len": 16384}
  -->

To fix this, we need to convert the rte_version() function, and any other necessary parts of the rte_version.h, to be actual functions in EAL, not just inlines/macros. The only complication in doing so is that telemetry library cannot call rte_version() directly, and instead needs the version string passed in on init.

Fixes af75078fece3 ("first public release")

---
v2:
rebased on top of main for 21.05 consideration.

---
 lib/librte_eal/common/meson.build    |  2 +
 lib/librte_eal/common/rte_version.c  | 46 ++++++++++++++++++++
 lib/librte_eal/freebsd/eal.c         |  1 +
 lib/librte_eal/include/rte_version.h | 63 ++++++++++++++++------------
 lib/librte_eal/linux/eal.c           |  1 +
 lib/librte_eal/version.map           |  7 ++++
 lib/librte_telemetry/rte_telemetry.h |  2 +-
 lib/librte_telemetry/telemetry.c     | 12 +++---
 8 files changed, 101 insertions(+), 33 deletions(-)
 create mode 100644 lib/librte_eal/common/rte_version.c
lib/librte_eal/common/meson.build +2 -0
index 39d427297..70bd854fe 100644
@@ -36,6 +36,7 @@ if is_windows
 		'rte_random.c',
 		'rte_reciprocal.c',
 		'rte_service.c',
+		'rte_version.c',
 	)
 	subdir_done()
 endif
@@ -79,6 +80,7 @@ sources += files(
 	'rte_random.c',
 	'rte_reciprocal.c',
 	'rte_service.c',
+	'rte_version.c',
 )
 
 if is_linux
lib/librte_eal/common/rte_version.c new file +46 -0

46 lines not on this page · raw message

lib/librte_eal/freebsd/eal.c +1 -0
index 51478358c..3f4dde6f8 100644
@@ -943,6 +943,7 @@ rte_eal_init(int argc, char **argv)
 	if (!internal_conf->no_telemetry) {
 		const char *error_str = NULL;
 		if (rte_telemetry_init(rte_eal_get_runtime_dir(),
+				rte_version(),
 				&internal_conf->ctrl_cpuset, &error_str)
 				!= 0) {
 			rte_eal_init_alert(error_str);
lib/librte_eal/include/rte_version.h +36 -27

74 lines not on this page · raw message

lib/librte_eal/linux/eal.c +1 -0
index 32b48c3de..349292611 100644
@@ -1316,6 +1316,7 @@ rte_eal_init(int argc, char **argv)
 	if (!internal_conf->no_telemetry) {
 		const char *error_str = NULL;
 		if (rte_telemetry_init(rte_eal_get_runtime_dir(),
+				rte_version(),
 				&internal_conf->ctrl_cpuset, &error_str)
 				!= 0) {
 			rte_eal_init_alert(error_str);
lib/librte_eal/version.map +7 -0
index fce90a112..756c60ed1 100644
@@ -199,6 +199,13 @@ DPDK_21 {
 	rte_uuid_is_null;
 	rte_uuid_parse;
 	rte_uuid_unparse;
+	rte_version;
+	rte_version_minor;
+	rte_version_month;
+	rte_version_prefix;
+	rte_version_release;
+	rte_version_suffix;
+	rte_version_year;
 	rte_vfio_clear_group;
 	rte_vfio_container_create;
 	rte_vfio_container_destroy;
lib/librte_telemetry/rte_telemetry.h +1 -1
index f8e54dc68..f7c8534b8 100644
@@ -311,7 +311,7 @@ rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help);
  */
 __rte_internal
 int
-rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset,
+rte_telemetry_init(const char *runtime_dir, const char *rte_version, rte_cpuset_t *cpuset,
 		const char **err_str);
 
 /**
lib/librte_telemetry/telemetry.c +7 -5
index b142729da..14b4ff5ea 100644
@@ -15,7 +15,6 @@
 #include <rte_string_fns.h>
 #include <rte_common.h>
 #include <rte_spinlock.h>
-#include <rte_version.h>
 
 #include "rte_telemetry.h"
 #include "telemetry_json.h"
@@ -48,6 +47,8 @@ struct socket {
 static struct socket v2_socket; /* socket for v2 telemetry */
 static struct socket v1_socket; /* socket for v1 telemetry */
 #endif /* !RTE_EXEC_ENV_WINDOWS */
+
+static const char *telemetry_version; /* save rte_version */
 static char telemetry_log_error[1024]; /* Will contain error on init failure */
 /* list of command callbacks, with one command registered by default */
 static struct cmd_callback callbacks[TELEMETRY_MAX_CALLBACKS];
@@ -105,7 +106,7 @@ json_info(const char *cmd __rte_unused, const char *params __rte_unused,
 		struct rte_tel_data *d)
 {
 	rte_tel_data_start_dict(d);
-	rte_tel_data_add_dict_string(d, "version", rte_version());
+	rte_tel_data_add_dict_string(d, "version", telemetry_version);
 	rte_tel_data_add_dict_int(d, "pid", getpid());
 	rte_tel_data_add_dict_int(d, "max_output_len", MAX_OUTPUT_LEN);
 	return 0;
@@ -303,7 +304,7 @@ client_handler(void *sock_id)
 	char info_str[1024];
 	snprintf(info_str, sizeof(info_str),
 			"{\"version\":\"%s\",\"pid\":%d,\"max_output_len\":%d}",
-			rte_version(), getpid(), MAX_OUTPUT_LEN);
+			telemetry_version, getpid(), MAX_OUTPUT_LEN);
 	if (write(s, info_str, strlen(info_str)) < 0) {
 		close(s);
 		return NULL;
@@ -481,9 +482,10 @@ telemetry_v2_init(const char *runtime_dir, rte_cpuset_t *cpuset)
 #endif /* !RTE_EXEC_ENV_WINDOWS */
 
 int32_t
-rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset,
-		const char **err_str)
+rte_telemetry_init(const char *runtime_dir, const char *rte_version,
+		rte_cpuset_t *cpuset, const char **err_str)
 {
+	telemetry_version = rte_version;
 #ifndef RTE_EXEC_ENV_WINDOWS
 	if (telemetry_v2_init(runtime_dir, cpuset) != 0) {
 		*err_str = telemetry_log_error;

--
2.27.0

#6 lore raw

16/02/2021 16:13, Bruce Richardson:

Quoted 22 lines

For using a DPDK application, such as OVS, which is dynamically linked, the DPDK version in use should always report the actual version, not the version used at build time. This incorrect behaviour can be seen by building OVS against one version of DPDK and running it against a later one. Using "ovs-vsctl list Open_vSwitch" to query basic info, the dpdk_version returned will be the build version not the currently running one - which can be verified using the DPDK telemetry library client.

  $ sudo ovs-vsctl list Open_vSwitch | grep dpdk_version
  dpdk_version        : "DPDK 20.11.0-rc4"
  $ echo quit | sudo dpdk-telemetry.py
  Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
  {"version": "DPDK 21.02.0-rc2", "pid": 405659, "max_output_len": 16384}
  -->

To fix this, we need to convert the rte_version() function, and any other necessary parts of the rte_version.h, to be actual functions in EAL, not just inlines/macros. The only complication in doing so is that telemetry library cannot call rte_version() directly, and instead needs the version string passed in on init.

Quoted 7 lines
Fixes af75078fece3 ("first public release")

---
v2:
rebased on top of main for 21.05 consideration.

Applied, thanks

#7 lore raw
In reply to Bruce Richardson
Quoted 33 lines · Bruce Richardson

For using a DPDK application, such as OVS, which is dynamically linked, the DPDK version in use should always report the actual version, not the version used at build time. This incorrect behaviour can be seen by building OVS against one version of DPDK and running it against a later one. Using "ovs-vsctl list Open_vSwitch" to query basic info, the dpdk_version returned will be the build version not the currently running one - which can be verified using the DPDK telemetry library client.

  $ sudo ovs-vsctl list Open_vSwitch | grep dpdk_version
  dpdk_version        : "DPDK 20.11.0-rc4"
  $ echo quit | sudo dpdk-telemetry.py
  Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
  {"version": "DPDK 21.02.0-rc2", "pid": 405659, "max_output_len": 16384}
  -->

To fix this, we need to convert the rte_version() function, and any other necessary parts of the rte_version.h, to be actual functions in EAL, not just inlines/macros. The only complication in doing so is that telemetry library cannot call rte_version() directly, and instead needs the version string passed in on init.

Fixes af75078fece3 ("first public release")
lib/librte_eal/include/rte_version.h +0 -0
index f7a3a1ebc..2f3f727b4 100644
@@ -28,38 +28,47 @@ extern "C" {
  * All version numbers in one to compare with RTE_VERSION_NUM()

lib/librte_eal/include/rte_version.h extern "C" { · line 34

Quoted 10 lines
lib/librte_eal/include/rte_version.h +4 -4
  */
 #define RTE_VERSION RTE_VERSION_NUM( \
-                       RTE_VER_YEAR, \
-                       RTE_VER_MONTH, \
-                       RTE_VER_MINOR, \
-                       RTE_VER_RELEASE)
+                       rte_version_year(), \
+                       rte_version_month(), \
+                       rte_version_minor(), \
+                       rte_version_release())

It breaks SPDK and applications relying on RTE_VERSION in preprocessor directives.
RTE_VERSION* macros should be left alone, and applications that need the runtime value should call rte_version().

See logs in https://lab.dpdk.org/results/dashboard/results/results-uploads/test_runs/2f636aaf4ce244eba20844f9ff006033/log_upload_file/2021/3/dpdk_6857cb635821_2021-03-17_06-34-34_NA.zip

CC lib/env_dpdk/pci_virtio.o
CC lib/env_dpdk/pci_vmd.o
CC lib/env_dpdk/pci_idxd.o
In file included from env_internal.h:42:0,

                 from pci_vmd.c:34:
/dpdk/build/include/rte_version.h:31:20: error: missing binary
operator before token "("
    rte_version_year(), \
                    ^
/dpdk/build/include/rte_version.h:25:36: note: in definition of macro
'RTE_VERSION_NUM'
 #define RTE_VERSION_NUM(a,b,c,d) ((a) << 24 | (b) << 16 | (c) << 8 | (d))
                                    ^
env_internal.h:49:5: note: in expansion of macro 'RTE_VERSION'
 #if RTE_VERSION < RTE_VERSION_NUM(19, 11, 0, 0)
     ^~~~~~~~~~~
In file included from env_internal.h:42:0,
                 from pci.c:34:
/dpdk/build/include/rte_version.h:31:20: error: missing binary
operator before token "("
    rte_version_year(), \
                    ^
Signature · 1 line
David Marchand
#8 lore raw

17/03/2021 09:40, David Marchand:

Quoted 42 lines
Quoted 40 lines · Bruce Richardson

For using a DPDK application, such as OVS, which is dynamically linked, the DPDK version in use should always report the actual version, not the version used at build time. This incorrect behaviour can be seen by building OVS against one version of DPDK and running it against a later one. Using "ovs-vsctl list Open_vSwitch" to query basic info, the dpdk_version returned will be the build version not the currently running one - which can be verified using the DPDK telemetry library client.

  $ sudo ovs-vsctl list Open_vSwitch | grep dpdk_version
  dpdk_version        : "DPDK 20.11.0-rc4"
  $ echo quit | sudo dpdk-telemetry.py
  Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
  {"version": "DPDK 21.02.0-rc2", "pid": 405659, "max_output_len": 16384}
  -->

To fix this, we need to convert the rte_version() function, and any other necessary parts of the rte_version.h, to be actual functions in EAL, not just inlines/macros. The only complication in doing so is that telemetry library cannot call rte_version() directly, and instead needs the version string passed in on init.

Fixes af75078fece3 ("first public release")
lib/librte_eal/include/rte_version.h +1 -4
index f7a3a1ebc..2f3f727b4 100644
@@ -28,38 +28,47 @@ extern "C" {
  * All version numbers in one to compare with RTE_VERSION_NUM()
  */
 #define RTE_VERSION RTE_VERSION_NUM( \
-                       RTE_VER_YEAR, \
-                       RTE_VER_MONTH, \
-                       RTE_VER_MINOR, \
-                       RTE_VER_RELEASE)
+                       rte_version_year(), \
Quoted 8 lines

lib/librte_eal/include/rte_version.h extern "C" { · line 34

Quoted 3 lines
lib/librte_eal/include/rte_version.h +3 -0
+                       rte_version_month(), \
+                       rte_version_minor(), \
+                       rte_version_release())

It breaks SPDK and applications relying on RTE_VERSION in preprocessor directives.
RTE_VERSION* macros should be left alone, and applications that need the runtime value should call rte_version().

Yes, sorry for not catching it before merge.

Quoted 1 line

See logs in https://lab.dpdk.org/results/dashboard/results/results-uploads/test_runs/2f636aaf4ce244eba20844f9ff006033/log_upload_file/2021/3/dpdk_6857cb635821_2021-03-17_06-34-34_NA.zip

My bad ignoring SPDK build, probably because of other issues there were.

I've sent a fix:
https://patches.dpdk.org/project/dpdk/patch/[email protected]/