Skip to content

Commit

Permalink
netdev-dpdk: Don't use PMD driver if not configured successfully
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
chaudron authored and istokes committed May 24, 2018
1 parent 97b0c7e commit ff00305
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/dpif-netdev.c
Expand Up @@ -3146,8 +3146,6 @@ port_reconfigure(struct dp_netdev_port *port)
struct netdev *netdev = port->netdev;
int i, err;

port->need_reconfigure = false;

/* Closes the existing 'rxq's. */
for (i = 0; i < port->n_rxq; i++) {
netdev_rxq_close(port->rxqs[i].rx);
Expand All @@ -3156,7 +3154,7 @@ port_reconfigure(struct dp_netdev_port *port)
port->n_rxq = 0;

/* Allows 'netdev' to apply the pending configuration changes. */
if (netdev_is_reconf_required(netdev)) {
if (netdev_is_reconf_required(netdev) || port->need_reconfigure) {
err = netdev_reconfigure(netdev);
if (err && (err != EOPNOTSUPP)) {
VLOG_ERR("Failed to set interface %s new configuration",
Expand All @@ -3183,6 +3181,9 @@ port_reconfigure(struct dp_netdev_port *port)
/* Parse affinity list to apply configuration for new queues. */
dpif_netdev_port_set_rxq_affinity(port, port->rxq_affinity_list);

/* If reconfiguration was successful mark it as such, so we can use it */
port->need_reconfigure = false;

return 0;
}

Expand Down
9 changes: 8 additions & 1 deletion lib/netdev-dpdk.c
Expand Up @@ -390,6 +390,9 @@ 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;

/* In dpdk_list. */
struct ovs_list list_node OVS_GUARDED_BY(dpdk_mutex);

Expand Down Expand Up @@ -847,6 +850,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);
Expand Down Expand Up @@ -1124,6 +1128,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);
Expand Down Expand Up @@ -3243,13 +3248,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;

if (dev->mtu != dev->requested_mtu
|| dev->socket_id != dev->requested_socket_id) {
Expand Down

0 comments on commit ff00305

Please sign in to comment.