[dpdk-dev] [PATCH 1/2] vhost: reference count fix for nb_started_ports
Yuanhan Liu
yuanhan.liu at linux.intel.com
Thu Dec 29 09:51:32 CET 2016
On Wed, Dec 28, 2016 at 04:10:51PM -0500, Charles (Chas) Williams wrote:
> From: Wen Chiu <wchiu at brocade.com>
>
> Only increment and decrement nb_started_ports on the first and last
> device start and stop. Otherwise, nb_started_ports can become negative
> if a device is stopped multiple times.
How could you be able to stop dev (precisely, invoke eth_dev_stop)
multiple times, judging that eth_dev_stop() will be invoked once
only?
void
rte_eth_dev_stop(uint8_t port_id)
{
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_RET(port_id);
dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
==> if (dev->data->dev_started == 0) {
RTE_PMD_DEBUG_TRACE("Device with port_id=%" PRIu8
" already stopped\n",
port_id);
return;
}
==> dev->data->dev_started = 0;
(*dev->dev_ops->dev_stop)(dev);
}
Multiple threads?
--yliu
More information about the dev
mailing list