diff mbox series

[ovs-dev,v2] netdev-dpdk: make sure the mempool has enough mbufs for rxq

Message ID 2022120715062096939211@chinatelecom.cn
State Superseded
Headers show
Series [ovs-dev,v2] netdev-dpdk: make sure the mempool has enough mbufs for rxq | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test fail github build: failed
ovsrobot/intel-ovs-compilation fail test: fail

Commit Message

yangchang Dec. 7, 2022, 7:06 a.m. UTC
For eth dev, dpdk X_rx_queue_start fuction will pre alloc mbuf
for rxq, if n_mbufs < n_rxq * rxq_size, dev will start error
becuse of it cannot allocate memory. If n_mbufs are not enough,
the mempool is not necessary to create.

Signed-off-by: yangchang <yangchang@chinatelecom.cn>
---
 lib/netdev-dpdk.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

--
1.8.3.1


yangchang@chinatelecom.cn
diff mbox series

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 72e7a32..9f29c86 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -757,6 +757,19 @@  dpdk_mp_create(struct netdev_dpdk *dev, int mtu)
     n_mbufs = dpdk_calculate_mbufs(dev, mtu);

     do {
+        /* For eth dev, dpdk X_rx_queue_start fuction will pre alloc mbuf
+         * for rxq, if n_mbufs < n_rxq * rxq_size, dev will start error
+         * becuse of it cannot allocate memory.
+         */
+        if ((!per_port_mp) && (dev->type == DPDK_DEV_ETH) &&
+            (n_mbufs < dev->requested_n_rxq * dev->requested_rxq_size)) {
+            VLOG_ERR("Port %s: a mempool of %u mbuffs is not enough "
+                     "for %d Rx queues and %d queue size",
+                     netdev_name, n_mbufs, dev->requested_n_rxq,
+                     dev->requested_rxq_size);
+             break;
+        }
+
         /* Full DPDK memory pool name must be unique and cannot be
          * longer than RTE_MEMPOOL_NAMESIZE. Note that for the shared
          * mempool case this can result in one device using a mempool