[v5,12/17] net/virtio: add checks for max SIMD bitwidth

Message ID 20201013110437.309110-13-ciara.power@intel.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series add max SIMD bitwidth to EAL |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ciara Power Oct. 13, 2020, 11:04 a.m. UTC
  When choosing a vector path to take, an extra condition must be
satisfied to ensure the max SIMD bitwidth allows for the CPU enabled
path.

Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: Chenbo Xia <chenbo.xia@intel.com>
Cc: Zhihong Wang <zhihong.wang@intel.com>

Signed-off-by: Ciara Power <ciara.power@intel.com>

---
v4: Updated enum name.
v3: Moved max SIMD bitwidth check to configure function with other vec
    support checks.
---
 drivers/net/virtio/virtio_ethdev.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
  

Comments

Chenbo Xia Oct. 14, 2020, 2:02 a.m. UTC | #1
> -----Original Message-----
> From: Power, Ciara <ciara.power@intel.com>
> Sent: Tuesday, October 13, 2020 7:05 PM
> To: dev@dpdk.org
> Cc: viktorin@rehivetech.com; ruifeng.wang@arm.com; jerinj@marvell.com;
> drc@linux.vnet.ibm.com; Richardson, Bruce <bruce.richardson@intel.com>;
> Ananyev, Konstantin <konstantin.ananyev@intel.com>; Power, Ciara
> <ciara.power@intel.com>; Maxime Coquelin <maxime.coquelin@redhat.com>; Xia,
> Chenbo <chenbo.xia@intel.com>; Wang, Zhihong <zhihong.wang@intel.com>
> Subject: [PATCH v5 12/17] net/virtio: add checks for max SIMD bitwidth
> 
> When choosing a vector path to take, an extra condition must be
> satisfied to ensure the max SIMD bitwidth allows for the CPU enabled
> path.
> 
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> Cc: Chenbo Xia <chenbo.xia@intel.com>
> Cc: Zhihong Wang <zhihong.wang@intel.com>
> 
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> 
> ---
> v4: Updated enum name.
> v3: Moved max SIMD bitwidth check to configure function with other vec
>     support checks.
> ---
>  drivers/net/virtio/virtio_ethdev.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c
> b/drivers/net/virtio/virtio_ethdev.c
> index 0236c756dc..70955e5cc0 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -2313,7 +2313,8 @@ virtio_dev_configure(struct rte_eth_dev *dev)
>  		if ((hw->use_vec_rx || hw->use_vec_tx) &&
>  		    (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) ||
>  		     !vtpci_with_feature(hw, VIRTIO_F_IN_ORDER) ||
> -		     !vtpci_with_feature(hw, VIRTIO_F_VERSION_1))) {
> +		     !vtpci_with_feature(hw, VIRTIO_F_VERSION_1) ||
> +		     rte_get_max_simd_bitwidth() < RTE_SIMD_512)) {
>  			PMD_DRV_LOG(INFO,
>  				"disabled packed ring vectorized path for
> requirements not met");
>  			hw->use_vec_rx = 0;
> @@ -2366,6 +2367,12 @@ virtio_dev_configure(struct rte_eth_dev *dev)
>  					"disabled split ring vectorized rx for
> offloading enabled");
>  				hw->use_vec_rx = 0;
>  			}
> +
> +			if (rte_get_max_simd_bitwidth() < RTE_SIMD_128) {
> +				PMD_DRV_LOG(INFO,
> +					"disabled split ring vectorized rx, max SIMD
> bitwidth too low");
> +				hw->use_vec_rx = 0;
> +			}
>  		}
>  	}
> 
> --
> 2.22.0


Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
  

Patch

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 0236c756dc..70955e5cc0 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -2313,7 +2313,8 @@  virtio_dev_configure(struct rte_eth_dev *dev)
 		if ((hw->use_vec_rx || hw->use_vec_tx) &&
 		    (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) ||
 		     !vtpci_with_feature(hw, VIRTIO_F_IN_ORDER) ||
-		     !vtpci_with_feature(hw, VIRTIO_F_VERSION_1))) {
+		     !vtpci_with_feature(hw, VIRTIO_F_VERSION_1) ||
+		     rte_get_max_simd_bitwidth() < RTE_SIMD_512)) {
 			PMD_DRV_LOG(INFO,
 				"disabled packed ring vectorized path for requirements not met");
 			hw->use_vec_rx = 0;
@@ -2366,6 +2367,12 @@  virtio_dev_configure(struct rte_eth_dev *dev)
 					"disabled split ring vectorized rx for offloading enabled");
 				hw->use_vec_rx = 0;
 			}
+
+			if (rte_get_max_simd_bitwidth() < RTE_SIMD_128) {
+				PMD_DRV_LOG(INFO,
+					"disabled split ring vectorized rx, max SIMD bitwidth too low");
+				hw->use_vec_rx = 0;
+			}
 		}
 	}