[ovs-dev] [PATCH v5 1/7] dpif-netdev: Remove support for DPIF_FP_ZERO_STATS flag
Daniele Di Proietto
diproiettod at vmware.com
Wed Apr 1 16:20:57 UTC 2015
Since flow statistics are thread local and updated without any lock,
it is not correct to do a memset from another thread.
This commit simply removes the support for the flag. It is not needed
by ofproto-dpif, it is only exposed by dpctl commands.
Signed-off-by: Daniele Di Proietto <diproiettod at vmware.com>
---
lib/dpif-netdev.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 6b61db4..15bc7f9 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -1842,7 +1842,16 @@ dpif_netdev_flow_put(struct dpif *dpif, const struct dpif_flow_put *put)
get_dpif_flow_stats(netdev_flow, put->stats);
}
if (put->flags & DPIF_FP_ZERO_STATS) {
- memset(&netdev_flow->stats, 0, sizeof netdev_flow->stats);
+ /* XXX: The userspace datapath uses thread local statistics
+ * (for flows), which should be updated only by the owning
+ * thread. Since we cannot write on stats memory here,
+ * we choose not to support this flag. Please note:
+ * - This feature is currently used only by dpctl commands with
+ * option --clear.
+ * - Should the need arise, this operation can be implemented
+ * by keeping a base value (to be update here) for each
+ * counter, and subtracting it before outputting the stats */
+ error = EOPNOTSUPP;
}
ovsrcu_postpone(dp_netdev_actions_free, old_actions);
--
2.1.4
More information about the dev
mailing list