[PATCH] net/ice: support IOVA as PA mode

Morten Brørup mb at smartsharesystems.com
Mon Dec 12 09:05:16 CET 2022


> From: Qi Zhang [mailto:qi.z.zhang at intel.com]
> Sent: Monday, 12 December 2022 16.45
> Subject: [PATCH] net/ice: support IOVA as PA mode

Typo:

"IOVA as PA mode" -> "IOVA as VA mode"

> 
> Claim pmd_supports_disable_iova_as_pa. Remove buf_iova access when
> RTE_IOVA_AS_PA is not defined.
> 
> The patch simply replace buf_iova with buf_addr at no IOVA as PA mode.

Please use "IOVA as VA mode" instead of "no IOVA as PA mode".

Also in the other PMD patches.

> Some SIMD instructions in data path may be over used, further
> optimization is expected.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang at intel.com>
> ---

[...]

> @@ -868,16 +867,12 @@ ice_vtx(volatile struct ice_tx_desc *txdp,
> 
>  		__m256i desc2_3 =
>  			_mm256_set_epi64x
> -				(hi_qw3,
> -				 pkt[3]->buf_iova + pkt[3]->data_off,
> -				 hi_qw2,
> -				 pkt[2]->buf_iova + pkt[2]->data_off);
> +				(hi_qw3, _PKT_DATA_OFF_AS_U64(pkt[3]),
> +				 hi_qw2, _PKT_DATA_OFF_AS_U64(pkt[2]));
>  		__m256i desc0_1 =
>  			_mm256_set_epi64x
> -				(hi_qw1,
> -				 pkt[1]->buf_iova + pkt[1]->data_off,
> -				 hi_qw0,
> -				 pkt[0]->buf_iova + pkt[0]->data_off);
> +				(hi_qw1, _PKT_DATA_OFF_AS_U64(pkt[1]),
> +				 hi_qw0, _PKT_DATA_OFF_AS_U64(pkt[0]));
>  		_mm256_store_si256((void *)(txdp + 2), desc2_3);
>  		_mm256_store_si256((void *)txdp, desc0_1);
>  	}
> diff --git a/drivers/net/ice/ice_rxtx_vec_avx512.c
> b/drivers/net/ice/ice_rxtx_vec_avx512.c
> index 5bfd5152df..e76ba1a245 100644
> --- a/drivers/net/ice/ice_rxtx_vec_avx512.c
> +++ b/drivers/net/ice/ice_rxtx_vec_avx512.c
> @@ -55,9 +55,13 @@ ice_rxq_rearm(struct ice_rx_queue *rxq)
>  			return;
>  		}
>  	}
> -
> +#if RTE_IOVA_AS_PA
>  	const __m512i iova_offsets =  _mm512_set1_epi64
>  		(offsetof(struct rte_mbuf, buf_iova));
> +#else
> +	const __m512i iova_offsets =  _mm512_set1_epi64
> +		(offsetof(struct rte_mbuf, buf_addr));
> +#endif
>  	const __m512i headroom = _mm512_set1_epi64(RTE_PKTMBUF_HEADROOM);
> 
>  #ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC
> @@ -1092,8 +1096,7 @@ ice_vtx1(volatile struct ice_tx_desc *txdp,
>  	if (do_offload)
>  		ice_txd_enable_offload(pkt, &high_qw);
> 
> -	__m128i descriptor = _mm_set_epi64x(high_qw,
> -				pkt->buf_iova + pkt->data_off);
> +	__m128i descriptor = _mm_set_epi64x(high_qw,
> _PKT_DATA_OFF_AS_U64(pkt));
>  	_mm_store_si128((__m128i *)txdp, descriptor);
>  }
> 
> @@ -1132,14 +1135,10 @@ ice_vtx(volatile struct ice_tx_desc *txdp,
> struct rte_mbuf **pkt,
> 
>  		__m512i desc0_3 =
>  			_mm512_set_epi64
> -				(hi_qw3,
> -				 pkt[3]->buf_iova + pkt[3]->data_off,
> -				 hi_qw2,
> -				 pkt[2]->buf_iova + pkt[2]->data_off,
> -				 hi_qw1,
> -				 pkt[1]->buf_iova + pkt[1]->data_off,
> -				 hi_qw0,
> -				 pkt[0]->buf_iova + pkt[0]->data_off);
> +				(hi_qw3, _PKT_DATA_OFF_AS_U64(pkt[3]),
> +				 hi_qw2, _PKT_DATA_OFF_AS_U64(pkt[2]),
> +				 hi_qw1, _PKT_DATA_OFF_AS_U64(pkt[1]),
> +				 hi_qw0, _PKT_DATA_OFF_AS_U64(pkt[0]));
>  		_mm512_storeu_si512((void *)txdp, desc0_3);
>  	}
> 
> diff --git a/drivers/net/ice/ice_rxtx_vec_common.h
> b/drivers/net/ice/ice_rxtx_vec_common.h
> index eec6ea2134..ff530324ba 100644
> --- a/drivers/net/ice/ice_rxtx_vec_common.h
> +++ b/drivers/net/ice/ice_rxtx_vec_common.h
> @@ -11,6 +11,12 @@
>  #pragma GCC diagnostic ignored "-Wcast-qual"
>  #endif
> 
> +#if RTE_IOVA_AS_PA
> +#define _PKT_DATA_OFF_AS_U64(pkt) ((pkt)->buf_iova + (pkt)->data_off)
> +#else
> +#define _PKT_DATA_OFF_AS_U64(pkt) ((u64)(pkt)->buf_addr + (pkt)-
> >data_off)
> +#endif
> +

You should use rte_pktmbuf_iova(m) instead of defining this macro. It does the same.

Excellent, thank you.

Acked-by: Morten Brørup <mb at smartsharesystems.com>



More information about the dev mailing list