From: Pavan Nikhilesh <pbhagavat...@marvell.com>

Use mempool cache for vector mempool as vectors are freed by the Tx
routine, also increase the minimum pool size to 512 to avoid resource
contention on Rx.

Signed-off-by: Pavan Nikhilesh <pbhagavat...@marvell.com>
---
 examples/ipsec-secgw/event_helper.c | 8 ++++----
 examples/l2fwd-event/main.c         | 4 +++-
 examples/l3fwd/main.c               | 4 +++-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/examples/ipsec-secgw/event_helper.c 
b/examples/ipsec-secgw/event_helper.c
index 172ab8e716..b36f20a3fd 100644
--- a/examples/ipsec-secgw/event_helper.c
+++ b/examples/ipsec-secgw/event_helper.c
@@ -820,12 +820,12 @@ eh_rx_adapter_configure(struct eventmode_conf *em_conf,
                                   em_conf->ext_params.vector_size) + 1;
                        if (per_port_pool)
                                nb_elem = nb_ports * nb_elem;
+                       nb_elem = RTE_MAX(512U, nb_elem);
                }
-
+               nb_elem += rte_lcore_count() * 32;
                vector_pool = rte_event_vector_pool_create(
-                       "vector_pool", nb_elem, 0,
-                       em_conf->ext_params.vector_size,
-                       socket_id);
+                       "vector_pool", nb_elem, 32,
+                       em_conf->ext_params.vector_size, socket_id);
                if (vector_pool == NULL) {
                        EH_LOG_ERR("failed to create event vector pool");
                        return -ENOMEM;
diff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c
index dcc72f3f1e..44303d10c2 100644
--- a/examples/l2fwd-event/main.c
+++ b/examples/l2fwd-event/main.c
@@ -678,8 +678,10 @@ main(int argc, char **argv)
 
                vec_size = rsrc->evt_vec.size;
                nb_vec = (nb_mbufs + vec_size - 1) / vec_size;
+               nb_vec = RTE_MAX(512U, nb_vec);
+               nb_vec += rte_lcore_count() * 32;
                rsrc->evt_vec_pool = rte_event_vector_pool_create(
-                       "vector_pool", nb_vec, 0, vec_size, rte_socket_id());
+                       "vector_pool", nb_vec, 32, vec_size, rte_socket_id());
                if (rsrc->evt_vec_pool == NULL)
                        rte_panic("Cannot init event vector pool\n");
        }
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index a629198223..896a347db3 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -1006,9 +1006,11 @@ init_mem(uint16_t portid, unsigned int nb_mbuf)
 
                        nb_vec = (nb_mbuf + evt_rsrc->vector_size - 1) /
                                 evt_rsrc->vector_size;
+                       nb_vec = RTE_MAX(512U, nb_vec);
+                       nb_vec += rte_lcore_count() * 32;
                        snprintf(s, sizeof(s), "vector_pool_%d", portid);
                        vector_pool[portid] = rte_event_vector_pool_create(
-                               s, nb_vec, 0, evt_rsrc->vector_size, socketid);
+                               s, nb_vec, 32, evt_rsrc->vector_size, socketid);
                        if (vector_pool[portid] == NULL)
                                rte_exit(EXIT_FAILURE,
                                         "Failed to create vector pool for port 
%d\n",
-- 
2.25.1

Reply via email to