Skip to content

Commit 4b67ecb

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 4b67ecb

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,6 @@ struct netdev_dpdk {
464464
bool attached;
465465
/* If true, rte_eth_dev_start() was successfully called */
466466
bool started;
467-
bool reset_needed;
468467
/* 1 pad byte here. */
469468
struct eth_addr hwaddr;
470469
int mtu;
@@ -1531,7 +1530,6 @@ common_construct(struct netdev *netdev, dpdk_port_t port_no,
15311530
dev->virtio_features_state = OVS_VIRTIO_F_CLEAN;
15321531
dev->attached = false;
15331532
dev->started = false;
1534-
dev->reset_needed = false;
15351533

15361534
ovsrcu_init(&dev->qos_conf, NULL);
15371535

@@ -2154,13 +2152,11 @@ netdev_dpdk_run(const struct netdev_class *netdev_class OVS_UNUSED)
21542152
if (!pending_reset) {
21552153
continue;
21562154
}
2157-
atomic_store_relaxed(&netdev_dpdk_pending_reset[port_id], false);
21582155

21592156
ovs_mutex_lock(&dpdk_mutex);
21602157
dev = netdev_dpdk_lookup_by_port_id(port_id);
21612158
if (dev) {
21622159
ovs_mutex_lock(&dev->mutex);
2163-
dev->reset_needed = true;
21642160
netdev_request_reconfigure(&dev->up);
21652161
VLOG_DBG_RL(&rl, "%s: Device reset requested.",
21662162
netdev_get_name(&dev->up));
@@ -6074,6 +6070,7 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
60746070
struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
60756071
bool try_rx_steer;
60766072
int err = 0;
6073+
bool pending_reset = false;
60776074

60786075
ovs_mutex_lock(&dev->mutex);
60796076

@@ -6083,6 +6080,9 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
60836080
dev->requested_n_rxq += 1;
60846081
}
60856082

6083+
atomic_read_relaxed(&netdev_dpdk_pending_reset[dev->port_id],
6084+
&pending_reset);
6085+
60866086
if (netdev->n_txq == dev->requested_n_txq
60876087
&& netdev->n_rxq == dev->requested_n_rxq
60886088
&& dev->rx_steer_flags == dev->requested_rx_steer_flags
@@ -6092,7 +6092,7 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
60926092
&& dev->txq_size == dev->requested_txq_size
60936093
&& eth_addr_equals(dev->hwaddr, dev->requested_hwaddr)
60946094
&& dev->socket_id == dev->requested_socket_id
6095-
&& dev->started && !dev->reset_needed) {
6095+
&& dev->started && !pending_reset) {
60966096
/* Reconfiguration is unnecessary */
60976097

60986098
goto out;
@@ -6101,10 +6101,11 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
61016101
retry:
61026102
dpdk_rx_steer_unconfigure(dev);
61036103

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

0 commit comments

Comments
 (0)