On 12 Oct 2022, at 13:55, Cian Ferriter wrote:

> From: Kumar Amber <[email protected]>
>
> The refactor allows us to use hash function accross
> multiple files which was earlier restricted to
> dpif-netdev.c only. This patch enables the use of
> the hash function in avx512 dpif.
>
> Signed-off-by: Kumar Amber <[email protected]>
> Signed-off-by: Cian Ferriter <[email protected]>
> Co-authored-by: Cian Ferriter <[email protected]>
> Acked-by: Sunil Pai G <[email protected]>
> ---
>  lib/dpif-netdev-private-dpcls.h | 23 +++++++++++++++++++++++
>  lib/dpif-netdev.c               | 22 ----------------------
>  2 files changed, 23 insertions(+), 22 deletions(-)
>
> diff --git a/lib/dpif-netdev-private-dpcls.h b/lib/dpif-netdev-private-dpcls.h
> index 2a9279437..1b37ecb16 100644
> --- a/lib/dpif-netdev-private-dpcls.h
> +++ b/lib/dpif-netdev-private-dpcls.h
> @@ -25,6 +25,7 @@
>
>  #include "cmap.h"
>  #include "openvswitch/thread.h"
> +#include "dpif-netdev-private-dpif.h"
>
>  #ifdef  __cplusplus
>  extern "C" {
> @@ -125,6 +126,28 @@ dpif_netdev_packet_get_rss_hash_orig_pkt(struct 
> dp_packet *packet,
>      return hash;
>  }
>
> +static inline uint32_t
> +dpif_netdev_packet_get_rss_hash(struct dp_packet *packet,
> +                                const struct miniflow *mf)
> +{
> +    uint32_t hash, recirc_depth;
> +
> +    if (OVS_LIKELY(dp_packet_rss_valid(packet))) {
> +        hash = dp_packet_get_rss_hash(packet);
> +    } else {
> +        hash = miniflow_hash_5tuple(mf, 0);
> +        dp_packet_set_rss_hash(packet, hash);
> +    }

This looks like a duplicate of the inline function just above this one. We 
should just include it here, or even better combine the two functions with an 
optional parameter (see also patch 4)?

> +
> +    /* The RSS hash must account for the recirculation depth to avoid
> +     * collisions in the exact match cache */

One small comment while your at it, please add a . at the end of the line.

> +    recirc_depth = *recirc_depth_get_unsafe();
> +    if (OVS_UNLIKELY(recirc_depth)) {
> +        hash = hash_finish(hash, recirc_depth);
> +    }
> +    return hash;

<SNIP>

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

Reply via email to