On Mon, 22 Apr 2019 15:32:53 -0700, Saeed Mahameed wrote:
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h 
> b/drivers/net/ethernet/mellanox/mlx5/core/en.h
> index 51e109fdeec1..6147be23a9b9 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
> @@ -50,6 +50,7 @@
>  #include <net/xdp.h>
>  #include <linux/net_dim.h>
>  #include <linux/bits.h>
> +#include <linux/prefetch.h>
>  #include "wq.h"
>  #include "mlx5_core.h"
>  #include "en_stats.h"
> @@ -986,6 +987,22 @@ static inline void mlx5e_cq_arm(struct mlx5e_cq *cq)
>       mlx5_cq_arm(mcq, MLX5_CQ_DB_REQ_NOT, mcq->uar->map, cq->wq.cc);
>  }
>  
> +static inline void mlx5e_prefetch(void *p)
> +{
> +     prefetch(p);
> +#if L1_CACHE_BYTES < 128
> +     prefetch(p + L1_CACHE_BYTES);
> +#endif
> +}
> +
> +static inline void mlx5e_prefetchw(void *p)
> +{
> +     prefetchw(p);
> +#if L1_CACHE_BYTES < 128
> +     prefetchw(p + L1_CACHE_BYTES);
> +#endif
> +}

All Intel drivers do the exact same thing, perhaps it's time to add a
helper fot this?

net_prefetch_headers()

or some such?

Reply via email to