[ovs-dev] [PATCH V7 10/18] dpif-netdev: Update offloaded flows statistics

Ilya Maximets i.maximets at ovn.org
Wed Jan 15 17:32:58 UTC 2020


On 09.01.2020 08:46, Eli Britstein wrote:
> From: Ophir Munk <ophirmu at mellanox.com>
> 
> In case a flow is HW offloaded, packets do not reach the SW, thus not
> counted for statistics. Use netdev flow get API in order to update the
> statistics of flows by the HW statistics.
> 
> Co-authored-by: Eli Britstein <elibr at mellanox.com>
> Signed-off-by: Ophir Munk <ophirmu at mellanox.com>
> Reviewed-by: Oz Shlomo <ozsh at mellanox.com>
> Signed-off-by: Eli Britstein <elibr at mellanox.com>
> ---
>  lib/dpif-netdev.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 66 insertions(+), 13 deletions(-)
> 
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index 24218210d..7ec217f39 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -3030,10 +3030,49 @@ dp_netdev_pmd_find_flow(const struct dp_netdev_pmd_thread *pmd,
>      return NULL;
>  }
>  
> +static bool
> +dpif_netdev_get_flow_offload_status(const struct dp_netdev *dp,
> +                                    const struct dp_netdev_flow *netdev_flow,
> +                                    struct dpif_flow_stats *stats,
> +                                    struct dpif_flow_attrs *attrs)
> +{
> +    struct nlattr *actions;
> +    struct ofpbuf wbuffer;
> +    struct netdev *netdev;
> +    struct match match;
> +
> +    int ret = 0;
> +
> +    if (!netdev_is_flow_api_enabled()) {
> +        return false;
> +    }
> +
> +    netdev = netdev_ports_get(netdev_flow->flow.in_port.odp_port, dp->class);
> +    if (!netdev) {
> +        return false;
> +    }
> +    /* Taking a global 'port_mutex' to fulfill thread safety
> +     * restrictions for the netdev-offload-dpdk module. */
> +    ovs_mutex_lock(&dp->port_mutex);

Found a bug with taking a mutex here.
Please, take a look at the fix: https://patchwork.ozlabs.org/patch/1223746/

Ian, I'd like to here your opinion on the fix too, if possible.

Best regards, Ilya Maximets.


More information about the dev mailing list