[ovs-dev] [PATCH v5 1/7] dpif-netdev: Remove support for DPIF_FP_ZERO_STATS flag

Ethan Jackson ethan at nicira.com
Fri Apr 3 00:55:43 UTC 2015


Acked-by: Ethan Jackson <ethan at nicira.com>


On Wed, Apr 1, 2015 at 9:20 AM, Daniele Di Proietto
<diproiettod at vmware.com> wrote:
> 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
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list