summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b9c8aea)
raw | patch | inline | side by side (parent: b9c8aea)
author | Kim Jones <kim-marie.jones@intel.com> | |
Thu, 9 Jun 2016 01:56:05 +0000 (02:56 +0100) | ||
committer | Kim Jones <kim-marie.jones@intel.com> | |
Thu, 28 Jul 2016 12:24:01 +0000 (13:24 +0100) |
Using the .conf files
They are optional arguments
Change-Id: Icc8dd0933f98c3ba05cc6bc3f338070d38b06a05
Signed-off-by: Kim Jones <kim-marie.jones@intel.com>
They are optional arguments
Change-Id: Icc8dd0933f98c3ba05cc6bc3f338070d38b06a05
Signed-off-by: Kim Jones <kim-marie.jones@intel.com>
src/collectd.conf.in | patch | blob | history | |
src/collectd.conf.pod | patch | blob | history | |
src/dpdkstat.c | patch | blob | history |
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index 790b24286cc2a402028f74355805d43be1a374b6..94b0c0dd3c8929e194c9480c600488848961f6a7 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
# Coremask "0xf"
# ProcessType "secondary"
# FilePrefix "rte"
+# EnabledPortMask 0xffff
+# PortName "interface1"
+# PortName "interface2"
#</Plugin>
#<Plugin email>
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index b154387101f5e29779c7cd9f0d627d00d6ba592f..d8d6c999ae6a2d0bd0dfaf8105c5fa80119ae0e1 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
MemoryChannels "4"
ProcessType "secondary"
FilePrefix "rte"
+ EnabledPortMask 0xffff
+ PortName "interface1"
+ PortName "interface2"
</Plugin>
B<Options:>
The prefix text used for hugepage filenames. The filename will be set to
/var/run/.<prefix>_config where prefix is what is passed in by the user.
+=item B<EnabledPortMask> I<Mask>
+
+A hexidecimal bit mask of the DPDK ports which should be enabled. A mask
+of 0x0 means that all ports will be disabled. A bitmask of all Fs means
+that all ports will be enabled. This is an optional argument - default
+is all ports enabled.
+
+=item B<PortName> I<Name>
+
+A string containing an optional name for the enabled DPDK ports. Each PortName
+option should contain only one port name; specify as many PortName options as
+desired. Default naming convention will be used if PortName is blank. If there
+are less PortName options than there are enabled ports, the default naming
+convention will be used for the additional ports.
+
=back
=head2 Plugin C<email>
diff --git a/src/dpdkstat.c b/src/dpdkstat.c
index e5aafdeb822930cb34373272c2fdc6e8558945e6..733bb0bbec584c389acdaf73508e15e3ceb140eb 100644 (file)
--- a/src/dpdkstat.c
+++ b/src/dpdkstat.c
cdtime_t interval;
uint32_t eal_initialized;
uint32_t enabled_port_mask;
+ char port_name[RTE_MAX_ETHPORTS][DATA_MAX_NAME_LEN];
uint32_t eal_argc;
/* Helper info */
int collectd_reinit_shm;
/* Write the default configuration to the g_configuration instances */
static void dpdk_config_init_default(void)
{
+ int i;
+
g_configuration->interval = plugin_get_interval();
WARNING("dpdkstat: No time interval was configured, default value %lu ms is set\n",
CDTIME_T_TO_MS(g_configuration->interval));
- g_configuration->enabled_port_mask = 0;
+ /* Default is all ports enabled */
+ g_configuration->enabled_port_mask = ~0;
g_configuration->eal_argc = 2;
g_configuration->eal_initialized = 0;
ssnprintf(g_configuration->coremask, DATA_MAX_NAME_LEN, "%s", "0xf");
ssnprintf(g_configuration->process_type, DATA_MAX_NAME_LEN, "%s", "secondary");
ssnprintf(g_configuration->file_prefix, DATA_MAX_NAME_LEN, "%s",
"/var/run/.rte_config");
+
+ for (i = 0; i < RTE_MAX_ETHPORTS; i++)
+ g_configuration->port_name[i][0] = 0;
}
static int dpdk_config(oconfig_item_t *ci)
{
- int i = 0;
+ int i = 0, port_counter = 0;
/* Initialize a POSIX SHared Memory (SHM) object. */
int err = dpdk_shm_init(sizeof(dpdk_config_t));
if (strcasecmp(g_configuration->file_prefix, "/var/run/.rte_config") != 0) {
g_configuration->eal_argc+=1;
}
+ } else if (strcasecmp("EnabledPortMask", child->key) == 0) {
+ g_configuration->enabled_port_mask = (uint32_t)child->values[0].value.number;
+ DEBUG("dpdkstat: Enabled Port Mask %u\n", g_configuration->enabled_port_mask);
+ } else if (strcasecmp("PortName", child->key) == 0) {
+ ssnprintf(g_configuration->port_name[port_counter], DATA_MAX_NAME_LEN, "%s",
+ child->values[0].value.string);
+ DEBUG("dpdkstat: Port %d Name: %s \n", port_counter,
+ g_configuration->port_name[port_counter]);
+ port_counter++;
} else {
WARNING ("dpdkstat: The config option \"%s\" is unknown.",
child->key);
if (nb_ports > RTE_MAX_ETHPORTS)
nb_ports = RTE_MAX_ETHPORTS;
- /* If no port mask was specified enable all ports*/
- if (g_configuration->enabled_port_mask == 0)
- g_configuration->enabled_port_mask = 0xffff;
int len = 0, enabled_port_count = 0, num_xstats = 0, i = 0;
for (; i < nb_ports; i++) {
}
/* Dispatch the stats.*/
- int count = 0, i = 0;
+ int count = 0, i = 0, port_num = 0;
for (; i < g_configuration->num_ports; i++) {
cdtime_t time = g_configuration->port_read_time[i];
char dev_name[64];
int len = g_configuration->num_stats_in_port[i];
- ssnprintf(dev_name, sizeof(dev_name), "port.%d", i);
+
+ while(!(g_configuration->enabled_port_mask & (1 << port_num)))
+ port_num++;
+
+ if (g_configuration->port_name[i][0] != 0)
+ ssnprintf(dev_name, sizeof(dev_name), "%s", g_configuration->port_name[i]);
+ else
+ ssnprintf(dev_name, sizeof(dev_name), "port.%d", port_num);
struct rte_eth_xstats *xstats = (&g_configuration->xstats);
xstats += count; /* pointer arithmetic to jump to each stats struct */
int j = 0;
plugin_dispatch_values (&dpdkstat_vl);
}
count += len;
+ port_num++;
} /* for each port */
return 0;
}