Currently number of tx queues is not configurable. Fix that by introducing of new option for PMD interfaces: 'n_txq', which specifies the maximum number of tx queues to be created for this interface.
Example: ovs-vsctl set Interface dpdk0 options:n_txq=64 Signed-off-by: Ilya Maximets <i.maxim...@samsung.com> --- INSTALL.DPDK.md | 11 ++++++++--- lib/netdev-dpdk.c | 26 +++++++++++++++++++------- lib/netdev-provider.h | 2 +- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/INSTALL.DPDK.md b/INSTALL.DPDK.md index 93f92e4..630c68d 100644 --- a/INSTALL.DPDK.md +++ b/INSTALL.DPDK.md @@ -355,11 +355,14 @@ Performance Tuning: ovs-appctl dpif-netdev/pmd-stats-show ``` - 3. DPDK port Rx Queues + 3. DPDK port Queues - `ovs-vsctl set Interface <DPDK interface> options:n_rxq=<integer>` + ``` + ovs-vsctl set Interface <DPDK interface> options:n_rxq=<integer> + ovs-vsctl set Interface <DPDK interface> options:n_txq=<integer> + ``` - The command above sets the number of rx queues for DPDK interface. + The commands above sets the number of rx and tx queues for DPDK interface. The rx queues are assigned to pmd threads on the same NUMA node in a round-robin fashion. For more information, please refer to the Open_vSwitch TABLE section in @@ -638,7 +641,9 @@ Follow the steps below to attach vhost-user port(s) to a VM. ``` ovs-vsctl set Interface vhost-user-2 options:n_rxq=<requested queues> + ovs-vsctl set Interface vhost-user-2 options:n_txq=<requested queues> ``` + Note: `n_rxq` should be equal to `n_txq`. QEMU needs to be configured as well. The $q below should match the queues requested in OVS (if $q is more, diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index c18bed2..d86926c 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -345,8 +345,9 @@ struct netdev_dpdk { struct rte_eth_link link; int link_reset_cnt; - /* The user might request more txqs than the NIC has. We remap those - * ('up.n_txq') on these ('real_n_txq'). + /* dpif-netdev might request more txqs than the NIC has, also, number of tx + * queues may be changed via database ('options:n_txq'). + * We remap requested by dpif-netdev number on 'real_n_txq'. * If the numbers match, 'txq_needs_locking' is false, otherwise it is * true and we will take a spinlock on transmission */ int real_n_txq; @@ -954,14 +955,27 @@ static int netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); - int new_n_rxq; + int new_n_rxq, new_n_txq; + bool reconfigure_needed = false; ovs_mutex_lock(&dev->mutex); + new_n_rxq = MAX(smap_get_int(args, "n_rxq", dev->requested_n_rxq), 1); if (new_n_rxq != dev->requested_n_rxq) { dev->requested_n_rxq = new_n_rxq; + reconfigure_needed = true; + } + + new_n_txq = MAX(smap_get_int(args, "n_txq", dev->requested_n_txq), 1); + if (new_n_txq != dev->requested_n_txq) { + dev->requested_n_txq = new_n_txq; + reconfigure_needed = true; + } + + if (reconfigure_needed) { netdev_request_reconfigure(netdev); } + ovs_mutex_unlock(&dev->mutex); return 0; @@ -2669,12 +2683,10 @@ netdev_dpdk_reconfigure(struct netdev *netdev) rte_free(dev->tx_q); err = dpdk_eth_dev_init(dev); + dev->txq_needs_locking = dev->real_n_txq < ovs_numa_get_n_cores() + 1; netdev_dpdk_alloc_txq(dev, dev->real_n_txq); - dev->txq_needs_locking = dev->real_n_txq != netdev->n_txq; - out: - ovs_mutex_unlock(&dev->mutex); ovs_mutex_unlock(&dpdk_mutex); @@ -2709,7 +2721,7 @@ netdev_dpdk_vhost_cuse_reconfigure(struct netdev *netdev) netdev->n_txq = dev->requested_n_txq; dev->real_n_txq = 1; netdev->n_rxq = 1; - dev->txq_needs_locking = dev->real_n_txq != netdev->n_txq; + dev->txq_needs_locking = true; ovs_mutex_unlock(&dev->mutex); ovs_mutex_unlock(&dpdk_mutex); diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h index be31e31..f71f8e4 100644 --- a/lib/netdev-provider.h +++ b/lib/netdev-provider.h @@ -53,7 +53,7 @@ struct netdev { uint64_t change_seq; /* A netdev provider might be unable to change some of the device's - * parameter (n_rxq, mtu) when the device is in use. In this case + * parameter (n_rxq, n_txq, mtu) when the device is in use. In this case * the provider can notify the upper layer by calling * netdev_request_reconfigure(). The upper layer will react by stopping * the operations on the device and calling netdev_reconfigure() to allow -- 2.5.0 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev