[v2,13/17] net/virtio: add checks for max SIMD bitwidth
Checks
Commit Message
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>
---
drivers/net/virtio/virtio_ethdev.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
Comments
Hi Ciara,
Sorry for late response and thanks for working on this! Currently virtio
driver puts all vector-related conditions in dev_configure (virtio_dev_configure).
Do you think it's ok to put all below code logic to dev_configure?
Thanks!
Chenbo
> -----Original Message-----
> From: Power, Ciara <ciara.power@intel.com>
> Sent: Friday, August 28, 2020 12:13 AM
> To: dev@dpdk.org
> Cc: 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 v2 13/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>
> ---
> drivers/net/virtio/virtio_ethdev.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/virtio/virtio_ethdev.c
> b/drivers/net/virtio/virtio_ethdev.c
> index dc0093bdf0..f779ce8396 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1517,9 +1517,11 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev)
> if (vtpci_packed_queue(hw)) {
> PMD_INIT_LOG(INFO,
> "virtio: using packed ring %s Tx path on port %u",
> - hw->use_vec_tx ? "vectorized" : "standard",
> + (hw->use_vec_tx && rte_get_max_simd_bitwidth()
> + > RTE_MAX_256_SIMD) ? "vectorized" : "standard",
> eth_dev->data->port_id);
> - if (hw->use_vec_tx)
> + if (hw->use_vec_tx && rte_get_max_simd_bitwidth()
> + > RTE_MAX_256_SIMD)
> eth_dev->tx_pkt_burst = virtio_xmit_pkts_packed_vec;
> else
> eth_dev->tx_pkt_burst = virtio_xmit_pkts_packed;
> @@ -1536,7 +1538,8 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev)
> }
>
> if (vtpci_packed_queue(hw)) {
> - if (hw->use_vec_rx) {
> + if (hw->use_vec_rx && rte_get_max_simd_bitwidth()
> + > RTE_MAX_256_SIMD) {
> PMD_INIT_LOG(INFO,
> "virtio: using packed ring vectorized Rx path on
> port %u",
> eth_dev->data->port_id);
> @@ -1555,7 +1558,8 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev)
> eth_dev->rx_pkt_burst = &virtio_recv_pkts_packed;
> }
> } else {
> - if (hw->use_vec_rx) {
> + if (hw->use_vec_rx && rte_get_max_simd_bitwidth()
> + >= RTE_MAX_128_SIMD) {
> PMD_INIT_LOG(INFO, "virtio: using vectorized Rx path on
> port %u",
> eth_dev->data->port_id);
> eth_dev->rx_pkt_burst = virtio_recv_pkts_vec;
> --
> 2.17.1
@@ -1517,9 +1517,11 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev)
if (vtpci_packed_queue(hw)) {
PMD_INIT_LOG(INFO,
"virtio: using packed ring %s Tx path on port %u",
- hw->use_vec_tx ? "vectorized" : "standard",
+ (hw->use_vec_tx && rte_get_max_simd_bitwidth()
+ > RTE_MAX_256_SIMD) ? "vectorized" : "standard",
eth_dev->data->port_id);
- if (hw->use_vec_tx)
+ if (hw->use_vec_tx && rte_get_max_simd_bitwidth()
+ > RTE_MAX_256_SIMD)
eth_dev->tx_pkt_burst = virtio_xmit_pkts_packed_vec;
else
eth_dev->tx_pkt_burst = virtio_xmit_pkts_packed;
@@ -1536,7 +1538,8 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev)
}
if (vtpci_packed_queue(hw)) {
- if (hw->use_vec_rx) {
+ if (hw->use_vec_rx && rte_get_max_simd_bitwidth()
+ > RTE_MAX_256_SIMD) {
PMD_INIT_LOG(INFO,
"virtio: using packed ring vectorized Rx path on port %u",
eth_dev->data->port_id);
@@ -1555,7 +1558,8 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev)
eth_dev->rx_pkt_burst = &virtio_recv_pkts_packed;
}
} else {
- if (hw->use_vec_rx) {
+ if (hw->use_vec_rx && rte_get_max_simd_bitwidth()
+ >= RTE_MAX_128_SIMD) {
PMD_INIT_LOG(INFO, "virtio: using vectorized Rx path on port %u",
eth_dev->data->port_id);
eth_dev->rx_pkt_burst = virtio_recv_pkts_vec;