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

Ben Pfaff blp at ovn.org
Wed Oct 12 19:45:12 UTC 2016


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 at samsung.com>
> Signed-off-by: Daniele Di Proietto <diproiettod at vmware.com>

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

Acked-by: Ben Pfaff <blp at 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;
 }




More information about the dev mailing list