On 5/11/2020 3:47 PM, Maxime Coquelin wrote:
> The AVX512 packed ring datapath selection was only done
> at build time, but it should also be checked at runtime
> that the CPU supports it.
> 
> This patch add a CPU flags check so that non-vectorized
> path is selected at runtime if AVX512 is not supported.
> 
> Fixes: ccb10995c2ad ("net/virtio: add election for vectorized path")
> 
> Signed-off-by: Maxime Coquelin <maxime.coque...@redhat.com>
> ---
>  drivers/net/virtio/virtio_ethdev.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c 
> b/drivers/net/virtio/virtio_ethdev.c
> index 312871cb48..49ccef12c7 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1965,8 +1965,10 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
>                       PMD_DRV_LOG(INFO,
>                               "building environment do not support packed 
> ring vectorized");
>  #else
> -                     hw->use_vec_rx = 1;
> -                     hw->use_vec_tx = 1;
> +                     if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F)) {
> +                             hw->use_vec_rx = 1;
> +                             hw->use_vec_tx = 1;
> +                     }
>  #endif
>               }
>       }
> 

Bruce & Radu also highlighted that the in meson, instead of updating 'cflags',
which is for all driver, the cflags for 'virtio_rxtx_packed_avx.c' should be
updated.

Reply via email to