Skip initialization of mempool objects if this was already
done in a previous call to dpdk_mp_create.

CC: Ciara Loftus <[email protected]>
CC: Kevin Traynor <[email protected]>
CC: Aaron Conole <[email protected]>
Signed-off-by: Antonio Fischetti <[email protected]>
---
 lib/netdev-dpdk.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 2f5ec71..f3f42ee 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -566,12 +566,15 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu)
         }
         free(mp_name);
         if (dmp->mp) {
-            /* rte_pktmbuf_pool_create has done some initialization of the
-             * rte_mbuf part of each dp_packet, while ovs_rte_pktmbuf_init
-             * initializes some OVS specific fields of dp_packet.
-             */
-            rte_mempool_obj_iter(dmp->mp, ovs_rte_pktmbuf_init, NULL);
-
+            /* If the current mp was already created by a previous call
+             * we don't need to init again all its elements. */
+            if (!mp_exists) {
+                /* rte_pktmbuf_pool_create has done some initialization of the
+                 * rte_mbuf part of each dp_packet, while ovs_rte_pktmbuf_init
+                 * initializes some OVS specific fields of dp_packet.
+                 */
+                rte_mempool_obj_iter(dmp->mp, ovs_rte_pktmbuf_init, NULL);
+            }
             return dmp;
         }
     } while (!mp_exists &&
-- 
2.4.11

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

Reply via email to