Skip to content

Commit b19305a

Browse files
committed
netdev-dpdk: Check pending reset when adding device.
When a device reset interrupt event (RTE_ETH_EVENT_INTR_RESET) is detected for a DPDK device added to OVS, a device reset is performed. If a device reset interrupt event is detected for a device before it is added to OVS, device reset is not called. If that device is later attempted to be added to OVS, it may fail while being configured as it is still pending a reset. This was observed with the DPDK iavf driver, by forcing a reset event from the ice driver and then adding the iavf device to OVS. $ echo 2 > /sys/class/net/ens3f0/device/sriov_numvfs $ ./devbind.py -b vfio-pci 0000:d8:01.1 $ ip link set ens3f0 vf 1 mac 26:ab:e6:6f:79:4d $ ovs-vsctl add-port br0 dpdk0 -- set Interface dpdk0 type=dpdk \ options:dpdk-devargs=0000:d8:01.1 |dpdk|ERR|Port1 dev_configure = -1 |netdev_dpdk|WARN|Interface dpdk0 eth_dev setup error Operation not permitted |netdev_dpdk|ERR|Interface dpdk0(rxq:1 txq:5 lsc interrupt mode:false) configure error: Operation not permitted |dpif_netdev|ERR|Failed to set interface dpdk0 new configuration Add a check if there was any previous device reset interrupt events when a device is added to OVS. If there was, perform the reset before continuing with the rest of the configuration. netdev_dpdk_pending_reset[] already tracks device reset interrupt events for all devices, so it can be used to check if there is a reset needed during configuration of newly added devices. By extending it's usage dev->reset_needed is no longer needed. Signed-off-by: Kevin Traynor <[email protected]>
1 parent 35e6470 commit b19305a

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/netdev-dpdk.c

+8-7
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ struct netdev_dpdk {
464464
bool attached;
465465
/* If true, rte_eth_dev_start() was successfully called */
466466
bool started;
467-
bool reset_needed;
467+
/* todo: check padding */
468468
/* 1 pad byte here. */
469469
struct eth_addr hwaddr;
470470
int mtu;
@@ -1531,7 +1531,6 @@ common_construct(struct netdev *netdev, dpdk_port_t port_no,
15311531
dev->virtio_features_state = OVS_VIRTIO_F_CLEAN;
15321532
dev->attached = false;
15331533
dev->started = false;
1534-
dev->reset_needed = false;
15351534

15361535
ovsrcu_init(&dev->qos_conf, NULL);
15371536

@@ -2154,13 +2153,11 @@ netdev_dpdk_run(const struct netdev_class *netdev_class OVS_UNUSED)
21542153
if (!pending_reset) {
21552154
continue;
21562155
}
2157-
atomic_store_relaxed(&netdev_dpdk_pending_reset[port_id], false);
21582156

21592157
ovs_mutex_lock(&dpdk_mutex);
21602158
dev = netdev_dpdk_lookup_by_port_id(port_id);
21612159
if (dev) {
21622160
ovs_mutex_lock(&dev->mutex);
2163-
dev->reset_needed = true;
21642161
netdev_request_reconfigure(&dev->up);
21652162
VLOG_DBG_RL(&rl, "%s: Device reset requested.",
21662163
netdev_get_name(&dev->up));
@@ -6074,6 +6071,7 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
60746071
struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
60756072
bool try_rx_steer;
60766073
int err = 0;
6074+
bool pending_reset = false;
60776075

60786076
ovs_mutex_lock(&dev->mutex);
60796077

@@ -6083,6 +6081,9 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
60836081
dev->requested_n_rxq += 1;
60846082
}
60856083

6084+
atomic_read_relaxed(&netdev_dpdk_pending_reset[dev->port_id],
6085+
&pending_reset);
6086+
60866087
if (netdev->n_txq == dev->requested_n_txq
60876088
&& netdev->n_rxq == dev->requested_n_rxq
60886089
&& dev->rx_steer_flags == dev->requested_rx_steer_flags
@@ -6092,7 +6093,7 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
60926093
&& dev->txq_size == dev->requested_txq_size
60936094
&& eth_addr_equals(dev->hwaddr, dev->requested_hwaddr)
60946095
&& dev->socket_id == dev->requested_socket_id
6095-
&& dev->started && !dev->reset_needed) {
6096+
&& dev->started && !pending_reset) {
60966097
/* Reconfiguration is unnecessary */
60976098

60986099
goto out;
@@ -6101,10 +6102,10 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
61016102
retry:
61026103
dpdk_rx_steer_unconfigure(dev);
61036104

6104-
if (dev->reset_needed) {
6105+
if (pending_reset) {
6106+
atomic_store_relaxed(&netdev_dpdk_pending_reset[dev->port_id], false);
61056107
rte_eth_dev_reset(dev->port_id);
61066108
if_notifier_manual_report();
6107-
dev->reset_needed = false;
61086109
} else {
61096110
rte_eth_dev_stop(dev->port_id);
61106111
}

0 commit comments

Comments
 (0)