8000 Plugin for getting DPDK ports link status and keep alive events. by krzysztofx · Pull Request #2157 · collectd/collectd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 2 commits into from
Feb 24, 2017

Conversation

krzysztofx
Copy link
Contributor

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

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>
@krzysztofx
Copy link
Contributor Author

@octo @rubenk
Please let me know if you'll find some time for reviewing proposed plugin.
Any comments appreciated.

Thanks
Krzysztof

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this line.

Copy link
Contributor Author

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(
Copy link
Contributor

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

Copy link
Contributor Author

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(
Copy link
Contributor

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

Copy link
Contributor Author

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"
Copy link
Contributor

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?

Copy link
Contributor Author

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)"
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

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"
Copy link
Contributor

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.

Copy link
Contributor Author

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;
Copy link
Contributor

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

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]

Copy link
Contributor

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
Copy link
Contributor

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) {
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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.

@rubenk
Copy link
Contributor
rubenk commented Feb 19, 2017

I left some comments inline, I'll see if I can do a more thorough review soon.

@krzysztofx
Copy link
Contributor Author

@rubenk

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
@rubenk rubenk merged commit 9fdcbb6 into collectd:master Feb 24, 2017
@krzysztofx krzysztofx deleted the dpdkevents_upstream branch February 28, 2017 15:24
@octo octo added this to the 5.8 m 8471 ilestone Oct 11, 2017
@maryamtahhan maryamtahhan mentioned this pull request Oct 12, 2017
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0