2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

netdev-dpdk: Don't use PMD driver if not configured successfully

When initialization of the DPDK PMD driver fails
(dpdk_eth_dev_init()), the reconfigure_datapath() function will remove
the port from dp_netdev, and the port is not used.

Now when bridge_reconfigure() is called again, no changes to the
previous failing netdev configuration are detected and therefore the
ports gets added to dp_netdev and used uninitialized. This is causing
exceptions...

The fix has two parts to it. First in netdev-dpdk.c we remember if the
DPDK port was started or not, and when calling
netdev_dpdk_reconfigure() we also try re-initialization if the port
was not already active. The second part of the change is in
dpif-netdev.c where it makes sure netdev_reconfigure() is called if
the port needs reconfiguration, as netdev_is_reconf_required() is only
true until netdev_reconfigure() is called (even if it fails).

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Tested-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
This commit is contained in:
Eelco Chaudron
2018-05-16 16:15:34 +02:00
committed by Ian Stokes
parent 1f84a2d5b5
commit 606f665072
2 changed files with 11 additions and 4 deletions

View File

@@ -366,6 +366,8 @@ struct netdev_dpdk {
/* If true, device was attached by rte_eth_dev_attach(). */
bool attached;
/* If true, rte_eth_dev_start() was successfully called */
bool started;
struct eth_addr hwaddr;
int mtu;
int socket_id;
@@ -911,6 +913,7 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev)
rte_strerror(-diag));
return -diag;
}
dev->started = true;
rte_eth_promiscuous_enable(dev->port_id);
rte_eth_allmulticast_enable(dev->port_id);
@@ -1194,6 +1197,7 @@ netdev_dpdk_destruct(struct netdev *netdev)
ovs_mutex_lock(&dpdk_mutex);
rte_eth_dev_stop(dev->port_id);
dev->started = false;
if (dev->attached) {
rte_eth_dev_close(dev->port_id);
@@ -3691,13 +3695,15 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
&& dev->lsc_interrupt_mode == dev->requested_lsc_interrupt_mode
&& dev->rxq_size == dev->requested_rxq_size
&& dev->txq_size == dev->requested_txq_size
&& dev->socket_id == dev->requested_socket_id) {
&& dev->socket_id == dev->requested_socket_id
&& dev->started) {
/* Reconfiguration is unnecessary */
goto out;
}
rte_eth_dev_stop(dev->port_id);
dev->started = false;
err = netdev_dpdk_mempool_configure(dev);
if (err && err != EEXIST) {