On Tue, Oct 04, 2016 at 06:22:14PM -0700, Daniele Di Proietto wrote:
> The error handling path in dpdk_mp_get() is getting complicated, it
> even requires a boolean variable.
> 
> Simplify it by extracting the function dpdk_mp_create().
> 
> CC: Ilya Maximets <i.maxim...@samsung.com>
> Signed-off-by: Daniele Di Proietto <diproiet...@vmware.com>

Here's a suggested additional incremental to fold in.  Completely
untested.

Acked-by: Ben Pfaff <b...@ovn.org>

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 15250dc..6af3ee3 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -504,15 +504,10 @@ dpdk_mp_create(int socket_id, int mtu)
                      mp_name, mp_size);
         }
         free(mp_name);
-    } while (!dmp->mp && rte_errno == ENOMEM && (mp_size /= 2) >= MIN_NB_MBUF);
-
-    if (dmp->mp == NULL) {
-        goto out;
-    }
-
-    return dmp;
-
-out:
+        if (dmp->mp) {
+            return dmp;
+        }
+    } while (rte_errno == ENOMEM && (mp_size /= 2) >= MIN_NB_MBUF);
     rte_free(dmp);
     return NULL;
 }

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to