projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
daemon: Check if plugin actually loaded before reporting configuration issues
[collectd.git]
/
src
/
dpdkevents.c
diff --git
a/src/dpdkevents.c
b/src/dpdkevents.c
index
6fd642b
..
4c8196a
100644
(file)
--- a/
src/dpdkevents.c
+++ b/
src/dpdkevents.c
@@
-32,12
+32,12
@@
#include "collectd.h"
#include "collectd.h"
-#include "common.h"
#include "plugin.h"
#include "plugin.h"
+#include "utils/common/common.h"
#include "semaphore.h"
#include "sys/mman.h"
#include "semaphore.h"
#include "sys/mman.h"
-#include "utils
_
dpdk.h"
+#include "utils
/dpdk/
dpdk.h"
#include "utils_time.h"
#include <rte_config.h>
#include "utils_time.h"
#include <rte_config.h>
@@
-419,8
+419,12
@@
static int dpdk_events_config(oconfig_item_t *ci) {
static int dpdk_helper_link_status_get(dpdk_helper_ctx_t *phc) {
dpdk_events_ctx_t *ec = DPDK_EVENTS_CTX_GET(phc);
static int dpdk_helper_link_status_get(dpdk_helper_ctx_t *phc) {
dpdk_events_ctx_t *ec = DPDK_EVENTS_CTX_GET(phc);
- /* get Link Status values from DPDK */
+/* get Link Status values from DPDK */
+#if RTE_VERSION < RTE_VERSION_NUM(18, 05, 0, 0)
uint8_t nb_ports = rte_eth_dev_count();
uint8_t nb_ports = rte_eth_dev_count();
+#else
+ uint8_t nb_ports = rte_eth_dev_count_avail();
+#endif
if (nb_ports == 0) {
DPDK_CHILD_LOG("dpdkevent-helper: No DPDK ports available. "
"Check bound devices to DPDK driver.\n");
if (nb_ports == 0) {
DPDK_CHILD_LOG("dpdkevent-helper: No DPDK ports available. "
"Check bound devices to DPDK driver.\n");
@@
-428,7
+432,7
@@
static int dpdk_helper_link_status_get(dpdk_helper_ctx_t *phc) {
}
ec->nb_ports = nb_ports > RTE_MAX_ETHPORTS ? RTE_MAX_ETHPORTS : nb_ports;
}
ec->nb_ports = nb_ports > RTE_MAX_ETHPORTS ? RTE_MAX_ETHPORTS : nb_ports;
- for (int i = 0; i < ec->nb_ports; i++) {
+ for (
unsigned
int i = 0; i < ec->nb_ports; i++) {
if (ec->config.link_status.enabled_port_mask & (1 << i)) {
struct rte_eth_link link;
ec->link_info[i].read_time = cdtime();
if (ec->config.link_status.enabled_port_mask & (1 << i)) {
struct rte_eth_link link;
ec->link_info[i].read_time = cdtime();
@@
-497,7
+501,7
@@
static int dpdk_events_link_status_dispatch(dpdk_helper_ctx_t *phc) {
ec->nb_ports);
/* dispatch Link Status values to collectd */
ec->nb_ports);
/* dispatch Link Status values to collectd */
- for (int i = 0; i < ec->nb_ports; i++) {
+ for (
unsigned
int i = 0; i < ec->nb_ports; i++) {
if (ec->config.link_status.enabled_port_mask & (1 << i)) {
if (!ec->config.link_status.send_updated ||
ec->link_info[i].status_updated) {
if (ec->config.link_status.enabled_port_mask & (1 << i)) {
if (!ec->config.link_status.send_updated ||
ec->link_info[i].status_updated) {
@@
-507,17
+511,17
@@
static int dpdk_events_link_status_dispatch(dpdk_helper_ctx_t *phc) {
char dev_name[DATA_MAX_NAME_LEN];
if (ec->config.link_status.port_name[i][0] != 0) {
char dev_name[DATA_MAX_NAME_LEN];
if (ec->config.link_status.port_name[i][0] != 0) {
- snprintf(dev_name, sizeof(dev_name), "%s",
- ec->config.link_status.port_name[i]);
+ s
s
nprintf(dev_name, sizeof(dev_name), "%s",
+
ec->config.link_status.port_name[i]);
} else {
} else {
- snprintf(dev_name, sizeof(dev_name), "port.%d", i);
+ s
s
nprintf(dev_name, sizeof(dev_name), "port.%d", i);
}
if (ec->config.link_status.notify) {
int sev = ec->link_info[i].link_status ? NOTIF_OKAY : NOTIF_WARNING;
char msg[DATA_MAX_NAME_LEN];
}
if (ec->config.link_status.notify) {
int sev = ec->link_info[i].link_status ? NOTIF_OKAY : NOTIF_WARNING;
char msg[DATA_MAX_NAME_LEN];
- snprintf(msg, sizeof(msg), "Link Status: %s",
- ec->link_info[i].link_status ? "UP" : "DOWN");
+ s
s
nprintf(msg, sizeof(msg), "Link Status: %s",
+
ec->link_info[i].link_status ? "UP" : "DOWN");
dpdk_events_notification_dispatch(sev, dev_name,
ec->link_info[i].read_time, msg);
} else {
dpdk_events_notification_dispatch(sev, dev_name,
ec->link_info[i].read_time, msg);
} else {
@@
-553,7
+557,7
@@
static void dpdk_events_keep_alive_dispatch(dpdk_helper_ctx_t *phc) {
}
char core_name[DATA_MAX_NAME_LEN];
}
char core_name[DATA_MAX_NAME_LEN];
- snprintf(core_name, sizeof(core_name), "lcore%u", i);
+ s
s
nprintf(core_name, sizeof(core_name), "lcore%u", i);
if (!ec->config.keep_alive.send_updated ||
(ec->core_info[i].lcore_state !=
if (!ec->config.keep_alive.send_updated ||
(ec->core_info[i].lcore_state !=
@@
-568,34
+572,34
@@
static void dpdk_events_keep_alive_dispatch(dpdk_helper_ctx_t *phc) {
switch (ec->config.keep_alive.shm->core_state[i]) {
case RTE_KA_STATE_ALIVE:
sev = NOTIF_OKAY;
switch (ec->config.keep_alive.shm->core_state[i]) {
case RTE_KA_STATE_ALIVE:
sev = NOTIF_OKAY;
- snprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: ALIVE", i);
+ s
s
nprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: ALIVE", i);
break;
case RTE_KA_STATE_MISSING:
break;
case RTE_KA_STATE_MISSING:
- snprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: MISSING", i);
+ s
s
nprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: MISSING", i);
sev = NOTIF_WARNING;
break;
case RTE_KA_STATE_DEAD:
sev = NOTIF_WARNING;
break;
case RTE_KA_STATE_DEAD:
- snprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: DEAD", i);
+ s
s
nprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: DEAD", i);
sev = NOTIF_FAILURE;
break;
case RTE_KA_STATE_UNUSED:
sev = NOTIF_FAILURE;
break;
case RTE_KA_STATE_UNUSED:
- snprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: UNUSED", i);
+ s
s
nprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: UNUSED", i);
sev = NOTIF_OKAY;
break;
case RTE_KA_STATE_GONE:
sev = NOTIF_OKAY;
break;
case RTE_KA_STATE_GONE:
- snprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: GONE", i);
+ s
s
nprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: GONE", i);
sev = NOTIF_FAILURE;
break;
case RTE_KA_STATE_DOZING:
sev = NOTIF_FAILURE;
break;
case RTE_KA_STATE_DOZING:
- snprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: DOZING", i);
+ s
s
nprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: DOZING", i);
sev = NOTIF_OKAY;
break;
case RTE_KA_STATE_SLEEP:
sev = NOTIF_OKAY;
break;
case RTE_KA_STATE_SLEEP:
- snprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: SLEEP", i);
+ s
s
nprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: SLEEP", i);
sev = NOTIF_OKAY;
break;
default:
sev = NOTIF_OKAY;
break;
default:
- snprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: UNKNOWN", i);
+ s
s
nprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: UNKNOWN", i);
sev = NOTIF_FAILURE;
}
sev = NOTIF_FAILURE;
}