By default OVS configures 2048 descriptors for tx and rx queues
on DPDK devices. It also allows the user to configure those values.

If the values used are not acceptable to the device than queue setup
will fail.

The device exposes it's max/min/alignment requirements, so use those
to ensure that an acceptable value is used during queue setup.

If the default or user value is not acceptable, adjust to a suitable
value.

Reported-at: https://bugzilla.redhat.com/2119876
Signed-off-by: Kevin Traynor <[email protected]>
---
 lib/netdev-dpdk.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index fb0dd43f7..e901f857e 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1008,4 +1008,13 @@ dpdk_watchdog(void *dummy OVS_UNUSED)
 }
 
+static int
+dpdk_limit_desc_size(int desc_size, struct rte_eth_desc_lim *lim)
+{
+    desc_size = ROUND_UP(desc_size, lim->nb_align);
+    desc_size = MIN(desc_size, lim->nb_max);
+    desc_size = MAX(desc_size, lim->nb_min);
+    return desc_size;
+}
+
 static int
 dpdk_eth_dev_port_config(struct netdev_dpdk *dev, int n_rxq, int n_txq)
@@ -1056,4 +1065,7 @@ dpdk_eth_dev_port_config(struct netdev_dpdk *dev, int 
n_rxq, int n_txq)
     }
 
+    dev->rxq_size = dpdk_limit_desc_size(dev->rxq_size, &info.rx_desc_lim);
+    dev->txq_size = dpdk_limit_desc_size(dev->txq_size, &info.tx_desc_lim);
+
     /* A device may report more queues than it makes available (this has
      * been observed for Intel xl710, which reserves some of them for
-- 
2.39.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to