sfc: Refactor queue teardown sequence to allow for EF10 flush behaviour
Currently efx_stop_datapath() will try to flush our DMA queues (if DMA is enabled), then finalise software and hardware state for each queue. However, for EF10 we must ask the MC to finalise each queue, which implicitly starts flushing it, and then wait for the flush events. We therefore need to delegate more of this to the NIC type. Combine all the hardware operations into a new NIC-type operation efx_nic_type::fini_dmaq, and call this before tearing down the software state and buffers for all the DMA queues. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
This commit is contained in:
@@ -721,7 +721,7 @@ static bool efx_check_tx_flush_complete(struct efx_nic *efx)
|
||||
/* Flush all the transmit queues, and continue flushing receive queues until
|
||||
* they're all flushed. Wait for the DRAIN events to be recieved so that there
|
||||
* are no more RX and TX events left on any channel. */
|
||||
int efx_nic_flush_queues(struct efx_nic *efx)
|
||||
static int efx_farch_do_flush(struct efx_nic *efx)
|
||||
{
|
||||
unsigned timeout = msecs_to_jiffies(5000); /* 5s for all flushes and drains */
|
||||
struct efx_channel *channel;
|
||||
@@ -729,8 +729,6 @@ int efx_nic_flush_queues(struct efx_nic *efx)
|
||||
struct efx_tx_queue *tx_queue;
|
||||
int rc = 0;
|
||||
|
||||
efx->type->prepare_flush(efx);
|
||||
|
||||
efx_for_each_channel(channel, efx) {
|
||||
efx_for_each_channel_tx_queue(tx_queue, channel) {
|
||||
atomic_inc(&efx->drain_pending);
|
||||
@@ -791,7 +789,32 @@ int efx_nic_flush_queues(struct efx_nic *efx)
|
||||
atomic_set(&efx->rxq_flush_outstanding, 0);
|
||||
}
|
||||
|
||||
efx->type->finish_flush(efx);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int efx_farch_fini_dmaq(struct efx_nic *efx)
|
||||
{
|
||||
struct efx_channel *channel;
|
||||
struct efx_tx_queue *tx_queue;
|
||||
struct efx_rx_queue *rx_queue;
|
||||
int rc = 0;
|
||||
|
||||
/* Do not attempt to write to the NIC during EEH recovery */
|
||||
if (efx->state != STATE_RECOVERY) {
|
||||
/* Only perform flush if DMA is enabled */
|
||||
if (efx->pci_dev->is_busmaster) {
|
||||
efx->type->prepare_flush(efx);
|
||||
rc = efx_farch_do_flush(efx);
|
||||
efx->type->finish_flush(efx);
|
||||
}
|
||||
|
||||
efx_for_each_channel(channel, efx) {
|
||||
efx_for_each_channel_rx_queue(rx_queue, channel)
|
||||
efx_nic_fini_rx(rx_queue);
|
||||
efx_for_each_channel_tx_queue(tx_queue, channel)
|
||||
efx_nic_fini_tx(tx_queue);
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
Reference in New Issue
Block a user