If rte_eal_init() fails, we do not register the DPDK netdev classes, therefore it's impossible to reach the classes construct functions.
Signed-off-by: Daniele Di Proietto <diproiet...@vmware.com> --- lib/netdev-dpdk.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 15250dc..b0ecdb6 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -181,8 +181,6 @@ enum dpdk_dev_type { DPDK_DEV_VHOST = 1, }; -static int rte_eal_init_ret = ENODEV; - /* Quality of Service */ /* An instance of a QoS configuration. Always associated with a particular @@ -782,12 +780,11 @@ netdev_dpdk_alloc(void) { struct netdev_dpdk *dev; - if (!rte_eal_init_ret) { /* Only after successful initialization */ - dev = dpdk_rte_mzalloc(sizeof *dev); - if (dev) { - return &dev->up; - } + dev = dpdk_rte_mzalloc(sizeof *dev); + if (dev) { + return &dev->up; } + return NULL; } @@ -926,10 +923,6 @@ netdev_dpdk_vhost_construct(struct netdev *netdev) return EINVAL; } - if (rte_eal_init_ret) { - return rte_eal_init_ret; - } - ovs_mutex_lock(&dpdk_mutex); /* Take the name of the vhost-user port and append it to the location where * the socket is to be created, then register the socket. @@ -958,10 +951,6 @@ netdev_dpdk_vhost_client_construct(struct netdev *netdev) { int err; - if (rte_eal_init_ret) { - return rte_eal_init_ret; - } - ovs_mutex_lock(&dpdk_mutex); err = netdev_dpdk_init(netdev, -1, DPDK_DEV_VHOST); ovs_mutex_unlock(&dpdk_mutex); @@ -974,10 +963,6 @@ netdev_dpdk_construct(struct netdev *netdev) unsigned int port_no; int err; - if (rte_eal_init_ret) { - return rte_eal_init_ret; - } - /* Names always start with "dpdk" */ err = dpdk_dev_parse_name(netdev->name, "dpdk", &port_no); if (err) { @@ -2709,10 +2694,6 @@ netdev_dpdk_ring_construct(struct netdev *netdev) unsigned int port_no = 0; int err = 0; - if (rte_eal_init_ret) { - return rte_eal_init_ret; - } - ovs_mutex_lock(&dpdk_mutex); err = dpdk_ring_open(netdev->name, &port_no); @@ -3474,7 +3455,6 @@ dpdk_init__(const struct smap *ovs_other_config) atexit(deferred_argv_release); rte_memzone_dump(stdout); - rte_eal_init_ret = 0; /* We are called from the main thread here */ RTE_PER_LCORE(_lcore_id) = NON_PMD_CORE_ID; -- 2.9.3 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev