-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Plugin for getting DPDK ports link status and keep alive events. #2157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Dpdkevents plugin collects and reports following events from DPDK based applications: - link status of network ports bound with DPDK - keep alive events related to DPDK logical cores In order to get link status plugin forks child process that attaches itself to DPDK application as secondary DPDK process and fetches link status data using DPDK API. This is the same approach like for dpdkstat plugin, also the same utils_dpdk.c helper is utilized. For getting keep alive events plugin communicates with DPDK application via shared memory area. This is possible only if keep alive feature is implemented in monitored application. More details can be found under link http://dpdk.org/doc/guides/sample_app_ug/keep_alive.html Minimal required version of DPDK is 16.07. Change-Id: Id820407ea933b1ecc31a72b6e344a6ec186ec780 Signed-off-by: Krzysztof Matczak <krzysztofx.matczak@intel.com>
Makefile.am
Outdated
pkglib_LTLIBRARIES += dpdkevents.la | ||
dpdkevents_la_SOURCES = src/dpdkevents.c src/utils_dpdk.c src/utils_dpdk.h | ||
dpdkevents_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBDPDK_CPPFLAGS) | ||
#dpdkevents_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_DPDK_CFLAGS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
configure.ac
Outdated
[with_libdpdk="yes"], | ||
[ | ||
with_libdpdk="yes" | ||
AC_RUN_IFELSE( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use AC_COMPILE_IFELSE here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment below
configure.ac
Outdated
[rte_version_major=0], | ||
[rte_version_major=$?] | ||
) | ||
AC_RUN_IFELSE( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use AC_COMPILE_IFELSE here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AC_COMPILE_IFELSE does only compilation, it doesn't run the AC_LANG_PROGRAM snippet. I need AC_RUN_IFELSE to extract RTE_VER_YEAR and RTE_VER_MONTH values from rte_version.h in runtime.
configure.ac
Outdated
@@ -2709,7 +2711,37 @@ then | |||
SAVE_CPPFLAGS="$CPPFLAGS" | |||
CPPFLAGS="$LIBDPDK_CPPFLAGS $CPPFLAGS" | |||
AC_CHECK_HEADERS([rte_config.h], | |||
[with_libdpdk="yes"], | |||
[ | |||
with_libdpdk="yes" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's with the indentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix it
configure.ac
Outdated
@@ -6231,6 +6264,14 @@ fi | |||
|
|||
if test "x$with_libdpdk" = "xyes" | |||
then | |||
plugin_dpdkevents="no (DPDK version < 16.07)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really dislike version checks. Is there no symbol in DPDK that you can check for existence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no single symbol that would determine if current DPDK instance supports keepalive feature, if that's what you mean. We have to check if version is >= 16.07 this way or other. It would be possible to simplify a bit this logic since DPDK header rte_version.h provides also compound macro RTE_VERSION with major and minor version numbers included, so I could apply it and related changes if you like it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes. The thing is, these runtime tests are slow, so perhaps you could abuse the preprocessor and do a compile time test like:
#if RTE_VERSION < RTE_VERSION_NUM(16,7,0,0)
#error "version too old"
#endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean applying it along with AC_COMPILE_IFELSE, right ? Seems reasonable, I'll do it. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes exactly. Thanks!
src/dpdkevents.c
Outdated
#include "sys/mman.h" | ||
#include "utils_dpdk.h" | ||
#include "utils_time.h" | ||
#include "collectd.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be the first include, separated by a blank line from the others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
if (nb_ports == 0) { | ||
DPDK_CHILD_LOG("dpdkevent-helper: No DPDK ports available. " | ||
"Check bound devices to DPDK driver.\n"); | ||
return -ENODEV; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just return -1, this is the only way this function can fail.
But looking further I see you never check the return value, so please fix that or make this return void.
} | ||
|
||
/* this function is called from helper context */ | ||
int dpdk_helper_command_handler(dpdk_helper_ctx_t *phc, enum DPDK_CMD cmd) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this handler being registered anywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is plugin specific implementation of handler interface declared in utils_dpdk.[ch]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, I missed that, sorry.
src/dpdkevents.c
Outdated
ec->core_info[i].lcore_state = ec->config.keep_alive.shm->core_state[i]; | ||
ec->core_info[i].read_time = cdtime(); | ||
|
||
#if RTE_VERSION >= RTE_VERSION_16_07 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./configure already checks that you have dpdk >= 16.07, so this is unneeded.
src/dpdkevents.c
Outdated
return 0; | ||
} | ||
|
||
static int dpdk_events_keep_alive_dispatch(dpdk_helper_ctx_t *phc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you never check the return value and this function always return 0, so please make this void.
src/dpdkevents.c
Outdated
|
||
if (g_hc == NULL) { | ||
ERROR(DPDK_EVENTS_PLUGIN ": plugin not initialized."); | ||
return -EINVAL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just return -1.
src/dpdkevents.c
Outdated
|
||
static int dpdk_events_shutdown(void) { | ||
DPDK_EVENTS_TRACE(); | ||
int ret = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to initialize ret here.
I left some comments inline, I'll see if I can do a more thorough review soon. |
Thanks for your comments. I'll address them as soon as possible. |
RTE version check changed to compile time. Adressing PR review comments. Minor format changes Change-Id: Ie345a6009a291490323f614183362dfce8e6a5e6
Dpdkevents plugin collects and reports following events from DPDK based
applications:
In order to get link status plugin forks child process that attaches itself to
DPDK application as secondary DPDK process and fetches link status data using
DPDK API. This is the same approach like for dpdkstat plugin, also the same
utils_dpdk.c helper is utilized.
For getting keep alive events plugin communicates with DPDK application
via shared memory area. This is possible only if keep alive feature
is implemented in monitored application.
More details can be found under link
http://dpdk.org/doc/guides/sample_app_ug/keep_alive.html
Minimal required version of DPDK is 16.07.
Change-Id: Id820407ea933b1ecc31a72b6e344a6ec186ec780
Signed-off-by: Krzysztof Matczak krzysztofx.matczak@intel.com