2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

netdev: Custom statistics.

- New get_custom_stats interface function is added to netdev. It
  allows particular netdev implementation to expose custom
  counters in dictionary format (counter name/counter value).
- New statistics are retrieved using experimenter code and
  are printed as a result to ofctl dump-ports.
- New counters are available for OpenFlow 1.4+.
- New statistics are printed to output via ofctl only if those
  are present in reply message.
- New statistics definition is added to include/openflow/intel-ext.h.
- Custom statistics are implemented only for dpdk-physical
  port type.
- DPDK-physical implementation uses xstats to collect statistics.
  Only dropped and error counters are exposed.

Co-authored-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Michal Weglicki <michalx.weglicki@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Michal Weglicki
2018-01-09 07:55:37 +00:00
committed by Ben Pfaff
parent cd32509e4a
commit 971f4b394c
19 changed files with 498 additions and 18 deletions

View File

@@ -1421,6 +1421,21 @@ netdev_get_stats(const struct netdev *netdev, struct netdev_stats *stats)
return error;
}
/* Retrieves current device custom stats for 'netdev'. */
int
netdev_get_custom_stats(const struct netdev *netdev,
struct netdev_custom_stats *custom_stats)
{
int error;
memset(custom_stats, 0, sizeof *custom_stats);
error = (netdev->netdev_class->get_custom_stats
? netdev->netdev_class->get_custom_stats(netdev, custom_stats)
: EOPNOTSUPP);
return error;
}
/* Attempts to set input rate limiting (policing) policy, such that up to
* 'kbits_rate' kbps of traffic is accepted, with a maximum accumulative burst
* size of 'kbits' kb. */
@@ -2376,6 +2391,18 @@ netdev_ports_flow_get(const struct dpif_class *dpif_class, struct match *match,
return ENOENT;
}
void
netdev_free_custom_stats_counters(struct netdev_custom_stats *custom_stats)
{
if (custom_stats) {
if (custom_stats->counters) {
free(custom_stats->counters);
custom_stats->counters = NULL;
custom_stats->size = 0;
}
}
}
#ifdef __linux__
static void
netdev_ports_flow_init(void)