diff mbox

[ovs-dev,03/13] netdev-dpdk: Refactor dpdk_mp_get().

Message ID 20161012194512.GU7566@ovn.org
State Not Applicable
Headers show

Commit Message

Ben Pfaff Oct. 12, 2016, 7:45 p.m. UTC
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.maximets@samsung.com>
> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>

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

Acked-by: Ben Pfaff <blp@ovn.org>
diff mbox

Patch

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;
 }