On Wed, Dec 28, 2016 at 04:10:51PM -0500, Charles (Chas) Williams wrote:
> From: Wen Chiu <[email protected]>
>
> 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