}
static int
-dpif_linux_get_stats(const struct dpif *dpif_, struct ovs_dp_stats *stats)
+dpif_linux_get_stats(const struct dpif *dpif_, struct dpif_dp_stats *stats)
{
struct dpif_linux_dp dp;
struct ofpbuf *buf;
error = dpif_linux_dp_get(dpif_, &dp, &buf);
if (!error) {
- *stats = dp.stats;
+ stats->n_frags = dp.stats.n_frags;
+ stats->n_hit = dp.stats.n_hit;
+ stats->n_missed = dp.stats.n_missed;
+ stats->n_lost = dp.stats.n_lost;
+ stats->n_flows = dp.stats.n_flows;
ofpbuf_delete(buf);
}
return error;
}
static int
-dpif_netdev_get_stats(const struct dpif *dpif, struct ovs_dp_stats *stats)
+dpif_netdev_get_stats(const struct dpif *dpif, struct dpif_dp_stats *stats)
{
struct dp_netdev *dp = get_dp_netdev(dpif);
- memset(stats, 0, sizeof *stats);
stats->n_flows = hmap_count(&dp->flow_table);
stats->n_frags = dp->n_frags;
stats->n_hit = dp->n_hit;
void (*wait)(struct dpif *dpif);
/* Retrieves statistics for 'dpif' into 'stats'. */
- int (*get_stats)(const struct dpif *dpif, struct ovs_dp_stats *stats);
+ int (*get_stats)(const struct dpif *dpif, struct dpif_dp_stats *stats);
/* Retrieves 'dpif''s current treatment of IP fragments into '*drop_frags':
* true indicates that fragments are dropped, false indicates that
/* Retrieves statistics for 'dpif' into 'stats'. Returns 0 if successful,
* otherwise a positive errno value. */
int
-dpif_get_dp_stats(const struct dpif *dpif, struct ovs_dp_stats *stats)
+dpif_get_dp_stats(const struct dpif *dpif, struct dpif_dp_stats *stats)
{
int error = dpif->dpif_class->get_stats(dpif, stats);
if (error) {
int dpif_delete(struct dpif *);
-int dpif_get_dp_stats(const struct dpif *, struct ovs_dp_stats *);
+/* Statisticss for a dpif as a whole. */
+struct dpif_dp_stats {
+ uint64_t n_frags; /* Number of dropped IP fragments. */
+ uint64_t n_hit; /* Number of flow table matches. */
+ uint64_t n_missed; /* Number of flow table misses. */
+ uint64_t n_lost; /* Number of misses not sent to userspace. */
+ uint64_t n_flows; /* Number of flows present. */
+};
+int dpif_get_dp_stats(const struct dpif *, struct dpif_dp_stats *);
+
int dpif_get_drop_frags(const struct dpif *, bool *drop_frags);
int dpif_set_drop_frags(struct dpif *, bool drop_frags);
get_tables(struct ofproto *ofproto_, struct ofp_table_stats *ots)
{
struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_);
- struct ovs_dp_stats s;
+ struct dpif_dp_stats s;
strcpy(ots->name, "classifier");
{
struct dpif_port_dump dump;
struct dpif_port dpif_port;
- struct ovs_dp_stats stats;
+ struct dpif_dp_stats stats;
struct netdev *netdev;
printf("%s:\n", dpif_name(dpif));
if (!dpif_get_dp_stats(dpif, &stats)) {
- printf("\tlookups: frags:%llu, hit:%llu, missed:%llu, lost:%llu\n",
- (unsigned long long int) stats.n_frags,
- (unsigned long long int) stats.n_hit,
- (unsigned long long int) stats.n_missed,
- (unsigned long long int) stats.n_lost);
- printf("\tflows: %llu\n", (unsigned long long int)stats.n_flows);
+ printf("\tlookups: frags:%"PRIu64, stats.n_frags);
+ printf(" hit:%"PRIu64, stats.n_hit);
+ printf(" missed:%"PRIu64, stats.n_missed);
+ printf(" lost:%"PRIu64"\n", stats.n_lost);
+
+ printf("\tflows: %"PRIu64"\n", stats.n_flows);
}
DPIF_PORT_FOR_EACH (&dpif_port, &dump, dpif) {
printf("\tport %u: %s", dpif_port.port_no, dpif_port.name);