static int get_dp_stats(struct datapath *dp, struct odp_stats __user *statsp)
{
- struct tbl *table = get_table_protected(dp);
struct odp_stats stats;
int i;
- stats.n_flows = tbl_count(table);
- stats.cur_capacity = tbl_n_buckets(table);
- stats.max_capacity = TBL_MAX_BUCKETS;
stats.n_ports = dp->n_ports;
stats.max_ports = DP_MAX_PORTS;
stats.n_frags = stats.n_hit = stats.n_missed = stats.n_lost = 0;
#define ODP_SET_SFLOW_PROBABILITY _IOR('O', 19, int)
#define ODP_GET_SFLOW_PROBABILITY _IOW('O', 20, int)
-
struct odp_stats {
- /* Flows. */
- uint32_t n_flows; /* Number of flows in flow table. */
- uint32_t cur_capacity; /* Current flow table capacity. */
- uint32_t max_capacity; /* Maximum expansion of flow table capacity. */
-
/* Ports. */
uint32_t n_ports; /* Current number of ports. */
uint32_t max_ports; /* Maximum supported number of ports. */
{
struct dp_netdev *dp = get_dp_netdev(dpif);
memset(stats, 0, sizeof *stats);
- stats->n_flows = hmap_count(&dp->flow_table);
- stats->cur_capacity = hmap_capacity(&dp->flow_table);
- stats->max_capacity = MAX_FLOWS;
stats->n_ports = dp->n_ports;
stats->max_ports = MAX_PORTS;
stats->n_frags = dp->n_frags;
printf("%s:\n", dpif_name(dpif));
if (!dpif_get_dp_stats(dpif, &stats)) {
- printf("\tflows: cur:%"PRIu32", soft-max:%"PRIu32", "
- "hard-max:%"PRIu32"\n",
- stats.n_flows, stats.cur_capacity, stats.max_capacity);
printf("\tports: cur:%"PRIu32", max:%"PRIu32"\n",
stats.n_ports, stats.max_ports);
printf("\tlookups: frags:%llu, hit:%llu, missed:%llu, lost:%llu\n",