[dpdk-dev] [PATCH v4] net/iavf: enable AVX2 for iavf

Ferruh Yigit ferruh.yigit at intel.com
Mon Sep 30 15:08:32 CEST 2019


On 9/23/2019 7:02 AM, Leyi Rong wrote:
> This patch enables AVX data path for iavf PMD.
> 
> Signed-off-by: Leyi Rong <leyi.rong at intel.com>

<...>

> @@ -1741,26 +1720,43 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
>  {
>  	struct iavf_adapter *adapter =
>  		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> +#ifdef RTE_ARCH_X86
>  	struct iavf_rx_queue *rxq;
>  	int i;
> +	bool use_avx2 = false;
>  
> -	if (adapter->rx_vec_allowed) {
> -		if (dev->data->scattered_rx) {
> -			PMD_DRV_LOG(DEBUG, "Using Vector Scattered Rx callback"
> -				    " (port=%d).", dev->data->port_id);
> -			dev->rx_pkt_burst = iavf_recv_scattered_pkts_vec;
> -		} else {
> -			PMD_DRV_LOG(DEBUG, "Using Vector Rx callback"
> -				    " (port=%d).", dev->data->port_id);
> -			dev->rx_pkt_burst = iavf_recv_pkts_vec;
> -		}
> +	if (!iavf_rx_vec_dev_check(dev)) {
>  		for (i = 0; i < dev->data->nb_rx_queues; i++) {
>  			rxq = dev->data->rx_queues[i];
> -			if (!rxq)
> -				continue;
> -			iavf_rxq_vec_setup(rxq);
> +			(void)iavf_rxq_vec_setup(rxq);
>  		}
> -	} else if (dev->data->scattered_rx) {
> +
> +		if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1 ||
> +		    rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1)
> +			use_avx2 = true;
> +
> +		if (dev->data->scattered_rx) {
> +			PMD_DRV_LOG(DEBUG,
> +				    "Using %sVector Scattered Rx (port %d).",
> +				    use_avx2 ? "avx2 " : "",
> +				    dev->data->port_id);
> +			dev->rx_pkt_burst = use_avx2 ?
> +					    iavf_recv_scattered_pkts_vec_avx2 :
> +					    iavf_recv_scattered_pkts_vec;

Hi Leyi,

Will this build if config option 'CONFIG_RTE_LIBRTE_IAVF_INC_VECTOR' is disabled?
And indeed why not eliminate 'CONFIG_RTE_LIBRTE_IAVF_INC_VECTOR' at all? Please
check ice for the sample.

And another thing is to remove the __rte_weak, for the consistency, since it has
been removed from the i40e.


More information about the dev mailing list