summaryrefslogtreecommitdiff
path: root/utilities/ovs-dpctl.c
diff options
context:
space:
mode:
authorFrancesco Fusco <ffusco@redhat.com>2013-12-17 20:18:18 +0100
committerBen Pfaff <blp@nicira.com>2013-12-17 13:20:28 -0800
commit1ce3fa06fc82210e2ed70b36e2842fe39d91b995 (patch)
treeecf7e2599920284ca446810bb70ba4008064e8e2 /utilities/ovs-dpctl.c
parent428b2eddc9c47d8306252f0fc5218839d2ff017c (diff)
downloadopenvswitch-1ce3fa06fc82210e2ed70b36e2842fe39d91b995.tar.gz
dpif-linux: fix the size of n_masks
The command ovs-dpctl can wrongly output the masks even if the datapath does not implement mega flows. In this case the output will be similar to the following: system@ovs-system: lookups: hit:14 missed:41 lost:0 flows: 0 masks: hit:18446744073709551615 total:4294967295 hit/pkt:335395346794719104.00 port 0: ovs-system (internal) port 1: gre_system (gre: df_default=false, ttl=0) port 2: ots-br0 (internal) port 3: int0 (internal) port 4: vnet0 port 5: vnet1 The problem depends on the fact that n_masks stats is stored as a uint32 in the struct ovs_dp_megaflow_stats and as a uint64 in the struct dpif_dp_stats. UINT32_MAX instead of UINT64_MAX should be used to detect if the datapath supports megaflows or not. Signed-off-by: Francesco Fusco <ffusco@redhat.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'utilities/ovs-dpctl.c')
-rw-r--r--utilities/ovs-dpctl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/utilities/ovs-dpctl.c b/utilities/ovs-dpctl.c
index bd9983475..09db084c4 100644
--- a/utilities/ovs-dpctl.c
+++ b/utilities/ovs-dpctl.c
@@ -561,11 +561,11 @@ show_dpif(struct dpif *dpif)
printf("\tlookups: hit:%"PRIu64" missed:%"PRIu64" lost:%"PRIu64"\n"
"\tflows: %"PRIu64"\n",
stats.n_hit, stats.n_missed, stats.n_lost, stats.n_flows);
- if (stats.n_masks != UINT64_MAX) {
+ if (stats.n_masks != UINT32_MAX) {
uint64_t n_pkts = stats.n_hit + stats.n_missed;
double avg = n_pkts ? (double) stats.n_mask_hit / n_pkts : 0.0;
- printf("\tmasks: hit:%"PRIu64" total:%"PRIu64" hit/pkt:%.2f\n",
+ printf("\tmasks: hit:%"PRIu64" total:%"PRIu32" hit/pkt:%.2f\n",
stats.n_mask_hit, stats.n_masks, avg);
}
}