diff mbox series

[ovs-dev,dpdk-latest] netdev-dpdk: Set Vhost port maximum number of queue pairs

Message ID 20241107155434.3192596-1-maxime.coquelin@redhat.com
State Superseded
Headers show
Series [ovs-dev,dpdk-latest] netdev-dpdk: Set Vhost port maximum number of queue pairs | expand

Checks

Context Check Description
ovsrobot/apply-robot warning apply and check: warning
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Maxime Coquelin Nov. 7, 2024, 3:54 p.m. UTC
This patch uses the new rte_vhost_driver_set_max_queue_num
API to set the maximum number of queue pairs supported by
the Vhost-user port.

This is required for VDUSE which needs to specify the
maximum number of queue pairs at creation time. Without it
128 queue pairs metadata would be allocated.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/netdev-dpdk.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Eelco Chaudron Nov. 14, 2024, 12:41 p.m. UTC | #1
On 7 Nov 2024, at 16:54, Maxime Coquelin wrote:

> This patch uses the new rte_vhost_driver_set_max_queue_num
> API to set the maximum number of queue pairs supported by
> the Vhost-user port.
>
> This is required for VDUSE which needs to specify the
> maximum number of queue pairs at creation time. Without it
> 128 queue pairs metadata would be allocated.
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks Maxime. This change looks good to me; all my vhost traffic tests are passing as usual.

//Eelco

> ---
>  lib/netdev-dpdk.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index e454a4a5d..c508f254e 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -2506,6 +2506,9 @@ netdev_dpdk_vhost_client_set_config(struct netdev *netdev,
>          VLOG_INFO("Max Tx retries for vhost device '%s' set to %d",
>                    netdev_get_name(netdev), max_tx_retries);
>      }
> +
> +    dpdk_set_rxq_config(dev, args);
> +
>      ovs_mutex_unlock(&dev->mutex);
>
>      return 0;
> @@ -6298,6 +6301,7 @@ netdev_dpdk_vhost_client_reconfigure(struct netdev *netdev)
>          uint64_t virtio_unsup_features = 0;
>          uint64_t vhost_flags = 0;
>          bool enable_tso;
> +        int nr_qp;
>
>          enable_tso = userspace_tso_enabled()
>                       && dev->virtio_features_state & OVS_VIRTIO_F_CLEAN;
> @@ -6371,6 +6375,14 @@ netdev_dpdk_vhost_client_reconfigure(struct netdev *netdev)
>              goto unlock;
>          }
>
> +        nr_qp = MAX(dev->requested_n_rxq, dev->requested_n_txq);
> +        err = rte_vhost_driver_set_max_queue_num(dev->vhost_id, nr_qp);
> +        if (err) {
> +            VLOG_ERR("rte_vhost_driver_set_max_queue_num failed for vhost-user "
> +                    "client port: %s\n", dev->up.name);
> +            goto unlock;
> +        }
> +
>          err = rte_vhost_driver_start(dev->vhost_id);
>          if (err) {
>              VLOG_ERR("rte_vhost_driver_start failed for vhost user "
> -- 
> 2.46.2
diff mbox series

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index e454a4a5d..c508f254e 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2506,6 +2506,9 @@  netdev_dpdk_vhost_client_set_config(struct netdev *netdev,
         VLOG_INFO("Max Tx retries for vhost device '%s' set to %d",
                   netdev_get_name(netdev), max_tx_retries);
     }
+
+    dpdk_set_rxq_config(dev, args);
+
     ovs_mutex_unlock(&dev->mutex);
 
     return 0;
@@ -6298,6 +6301,7 @@  netdev_dpdk_vhost_client_reconfigure(struct netdev *netdev)
         uint64_t virtio_unsup_features = 0;
         uint64_t vhost_flags = 0;
         bool enable_tso;
+        int nr_qp;
 
         enable_tso = userspace_tso_enabled()
                      && dev->virtio_features_state & OVS_VIRTIO_F_CLEAN;
@@ -6371,6 +6375,14 @@  netdev_dpdk_vhost_client_reconfigure(struct netdev *netdev)
             goto unlock;
         }
 
+        nr_qp = MAX(dev->requested_n_rxq, dev->requested_n_txq);
+        err = rte_vhost_driver_set_max_queue_num(dev->vhost_id, nr_qp);
+        if (err) {
+            VLOG_ERR("rte_vhost_driver_set_max_queue_num failed for vhost-user "
+                    "client port: %s\n", dev->up.name);
+            goto unlock;
+        }
+
         err = rte_vhost_driver_start(dev->vhost_id);
         if (err) {
             VLOG_ERR("rte_vhost_driver_start failed for vhost user "