Regards
_Sugesh


> -----Original Message-----
> From: Yuanhan Liu [mailto:[email protected]]
> Sent: Tuesday, September 26, 2017 6:37 AM
> To: [email protected]
> Cc: Finn Christensen <[email protected]>; Darrell Ball <[email protected]>;
> Chandran, Sugesh <[email protected]>; Simon Horman
> <[email protected]>; Yuanhan Liu <[email protected]>
> Subject: [PATCH v3 1/9] dpif-netdev: associate flow with a mark id
> 
> This patch associate a flow with a mark id (a uint32_t number) by a direct 
> array.
> The array is initiated with 1024 slots at the begninning, and it will be 
> enlarged
> when it's not big enough.  The mark id is allocated with the help of id-pool.
> 
> It re-uses the flow API (more precisely, the ->flow_put method) to setup the 
> hw
> flow. The flow_put implementation then is supposed to create a flow with
> MARK action for current stage, which is, only partial offload is supported.
> 
> Co-authored-by: Finn Christensen <[email protected]>
> Signed-off-by: Yuanhan Liu <[email protected]>
> Signed-off-by: Finn Christensen <[email protected]>
> ---
>  lib/dpif-netdev.c | 140
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  lib/netdev.h      |   6 +++
>  2 files changed, 146 insertions(+)
> 
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 071ec14..f417b25 
> 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -453,6 +453,9 @@ struct dp_netdev_flow {
>      struct ovs_refcount ref_cnt;
> 
>      bool dead;
> +    bool has_mark;               /* A flag to tell whether this flow has a
> +                                    valid mark asscoiated with it. */
> +    uint32_t mark;               /* Unique flow mark assiged to a flow */
> 
>      /* Statistics. */
>      struct dp_netdev_flow_stats stats;
> @@ -1833,6 +1836,82 @@ dp_netdev_pmd_find_dpcls(struct
> dp_netdev_pmd_thread *pmd,
>      return cls;
>  }
> 
> +/*
> + * An array to map from the flow mark (the index) to dp netdev flow.
> + * Initial size is set to 1024, it will be resized when it's not
> + * big enough.
> + */
> +struct flow_mark_map {
> +    size_t max;
> +    struct ovs_mutex mutex;
> +    struct id_pool *mark_pool;
> +    struct dp_netdev_flow **flows;
> +};
[Sugesh] Is it good to make this map is for per port/device.?
The reason being, any access to this map should be mutex protected.
I feel there will be contention if multiple PMD threads trying to program the 
flows, even
though the flows are in different devices. It can also happen with revalidator 
threads on flow delete.

> +
> +static struct flow_mark_map flow_mark_map = {
> +    .max = 1024,
> +    .mutex = OVS_MUTEX_INITIALIZER,
> +};
> +

[snip]
> --
> 2.7.4

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to