diff mbox series

[ovs-dev,v5,3/6] netdev-dpdk: skip init for existing mempools.

Message ID 1507737656-31627-4-git-send-email-antonio.fischetti@intel.com
State Superseded
Headers show
Series netdev-dpdk: Fix management of pre-existing mempools. | expand

Commit Message

Fischetti, Antonio Oct. 11, 2017, 4 p.m. UTC
Skip initialization of mempool packet areas if this was already
done in a previous call to dpdk_mp_create.

CC: Darrell Ball <dlu998@gmail.com>
CC: Ciara Loftus <ciara.loftus@intel.com>
CC: Kevin Traynor <ktraynor@redhat.com>
CC: Aaron Conole <aconole@redhat.com>
Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
---
 lib/netdev-dpdk.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Mark Kavanagh Oct. 13, 2017, 2:51 p.m. UTC | #1
>From: ovs-dev-bounces@openvswitch.org [mailto:ovs-dev-bounces@openvswitch.org]
>On Behalf Of antonio.fischetti@intel.com
>Sent: Wednesday, October 11, 2017 5:01 PM
>To: dev@openvswitch.org
>Subject: [ovs-dev] [PATCH v5 3/6] netdev-dpdk: skip init for existing
>mempools.
>
>Skip initialization of mempool packet areas if this was already
>done in a previous call to dpdk_mp_create.
>

Hi Antonio,

As per my previous comment, this should be squashed with the first patch in the series.

Apart from that, LGTM.

-Mark

>CC: Darrell Ball <dlu998@gmail.com>
>CC: Ciara Loftus <ciara.loftus@intel.com>
>CC: Kevin Traynor <ktraynor@redhat.com>
>CC: Aaron Conole <aconole@redhat.com>
>Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
>---
> lib/netdev-dpdk.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
>diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
>index e664931..2aa4a55 100644
>--- a/lib/netdev-dpdk.c
>+++ b/lib/netdev-dpdk.c
>@@ -550,6 +550,11 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool
>*mp_exists)
>         if (dmp->mp) {
>             VLOG_DBG("Allocated \"%s\" mempool with %u mbufs", mp_name,
>                      dmp->mp_size);
>+            /* rte_pktmbuf_pool_create has done some initialization of the
>+             * rte_mbuf part of each dp_packet. Some OvS specific fields
>+             * of the packet still need to be initialized by
>+             * ovs_rte_pktmbuf_init. */
>+            rte_mempool_obj_iter(dmp->mp, ovs_rte_pktmbuf_init, NULL);
>         } else if (rte_errno == EEXIST) {
>             /* A mempool with the same name already exists.  We just
>              * retrieve its pointer to be returned to the caller. */
>@@ -566,11 +571,6 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool
>*mp_exists)
>         }
>         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);
>             return dmp;
>         }
>     } while (!(*mp_exists) &&
>--
>2.4.11
>
>_______________________________________________
>dev mailing list
>dev@openvswitch.org
>https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff mbox series

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index e664931..2aa4a55 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -550,6 +550,11 @@  dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool *mp_exists)
         if (dmp->mp) {
             VLOG_DBG("Allocated \"%s\" mempool with %u mbufs", mp_name,
                      dmp->mp_size);
+            /* rte_pktmbuf_pool_create has done some initialization of the
+             * rte_mbuf part of each dp_packet. Some OvS specific fields
+             * of the packet still need to be initialized by
+             * ovs_rte_pktmbuf_init. */
+            rte_mempool_obj_iter(dmp->mp, ovs_rte_pktmbuf_init, NULL);
         } else if (rte_errno == EEXIST) {
             /* A mempool with the same name already exists.  We just
              * retrieve its pointer to be returned to the caller. */
@@ -566,11 +571,6 @@  dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool *mp_exists)
         }
         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);
             return dmp;
         }
     } while (!(*mp_exists) &&