sfc: commonise efx_fini_dmaq
Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
965470ee76
commit
d700fe014e
@ -3117,44 +3117,6 @@ fail:
|
|||||||
netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
|
netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int efx_ef10_fini_dmaq(struct efx_nic *efx)
|
|
||||||
{
|
|
||||||
struct efx_tx_queue *tx_queue;
|
|
||||||
struct efx_rx_queue *rx_queue;
|
|
||||||
struct efx_channel *channel;
|
|
||||||
int pending;
|
|
||||||
|
|
||||||
/* If the MC has just rebooted, the TX/RX queues will have already been
|
|
||||||
* torn down, but efx->active_queues needs to be set to zero.
|
|
||||||
*/
|
|
||||||
if (efx->must_realloc_vis) {
|
|
||||||
atomic_set(&efx->active_queues, 0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Do not attempt to write to the NIC during EEH recovery */
|
|
||||||
if (efx->state != STATE_RECOVERY) {
|
|
||||||
efx_for_each_channel(channel, efx) {
|
|
||||||
efx_for_each_channel_rx_queue(rx_queue, channel)
|
|
||||||
efx_mcdi_rx_fini(rx_queue);
|
|
||||||
efx_for_each_channel_tx_queue(tx_queue, channel)
|
|
||||||
efx_mcdi_tx_fini(tx_queue);
|
|
||||||
}
|
|
||||||
|
|
||||||
wait_event_timeout(efx->flush_wq,
|
|
||||||
atomic_read(&efx->active_queues) == 0,
|
|
||||||
msecs_to_jiffies(EFX_MAX_FLUSH_TIME));
|
|
||||||
pending = atomic_read(&efx->active_queues);
|
|
||||||
if (pending) {
|
|
||||||
netif_err(efx, hw, efx->net_dev, "failed to flush %d queues\n",
|
|
||||||
pending);
|
|
||||||
return -ETIMEDOUT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void efx_ef10_prepare_flr(struct efx_nic *efx)
|
static void efx_ef10_prepare_flr(struct efx_nic *efx)
|
||||||
{
|
{
|
||||||
atomic_set(&efx->active_queues, 0);
|
atomic_set(&efx->active_queues, 0);
|
||||||
@ -4026,7 +3988,7 @@ const struct efx_nic_type efx_hunt_a0_vf_nic_type = {
|
|||||||
.reset = efx_ef10_reset,
|
.reset = efx_ef10_reset,
|
||||||
.probe_port = efx_mcdi_port_probe,
|
.probe_port = efx_mcdi_port_probe,
|
||||||
.remove_port = efx_mcdi_port_remove,
|
.remove_port = efx_mcdi_port_remove,
|
||||||
.fini_dmaq = efx_ef10_fini_dmaq,
|
.fini_dmaq = efx_fini_dmaq,
|
||||||
.prepare_flr = efx_ef10_prepare_flr,
|
.prepare_flr = efx_ef10_prepare_flr,
|
||||||
.finish_flr = efx_port_dummy_op_void,
|
.finish_flr = efx_port_dummy_op_void,
|
||||||
.describe_stats = efx_ef10_describe_stats,
|
.describe_stats = efx_ef10_describe_stats,
|
||||||
@ -4134,7 +4096,7 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
|
|||||||
.reset = efx_ef10_reset,
|
.reset = efx_ef10_reset,
|
||||||
.probe_port = efx_mcdi_port_probe,
|
.probe_port = efx_mcdi_port_probe,
|
||||||
.remove_port = efx_mcdi_port_remove,
|
.remove_port = efx_mcdi_port_remove,
|
||||||
.fini_dmaq = efx_ef10_fini_dmaq,
|
.fini_dmaq = efx_fini_dmaq,
|
||||||
.prepare_flr = efx_ef10_prepare_flr,
|
.prepare_flr = efx_ef10_prepare_flr,
|
||||||
.finish_flr = efx_port_dummy_op_void,
|
.finish_flr = efx_port_dummy_op_void,
|
||||||
.describe_stats = efx_ef10_describe_stats,
|
.describe_stats = efx_ef10_describe_stats,
|
||||||
|
@ -341,6 +341,44 @@ fail:
|
|||||||
outbuf, outlen, rc);
|
outbuf, outlen, rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int efx_fini_dmaq(struct efx_nic *efx)
|
||||||
|
{
|
||||||
|
struct efx_tx_queue *tx_queue;
|
||||||
|
struct efx_rx_queue *rx_queue;
|
||||||
|
struct efx_channel *channel;
|
||||||
|
int pending;
|
||||||
|
|
||||||
|
/* If the MC has just rebooted, the TX/RX queues will have already been
|
||||||
|
* torn down, but efx->active_queues needs to be set to zero.
|
||||||
|
*/
|
||||||
|
if (efx->must_realloc_vis) {
|
||||||
|
atomic_set(&efx->active_queues, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Do not attempt to write to the NIC during EEH recovery */
|
||||||
|
if (efx->state != STATE_RECOVERY) {
|
||||||
|
efx_for_each_channel(channel, efx) {
|
||||||
|
efx_for_each_channel_rx_queue(rx_queue, channel)
|
||||||
|
efx_mcdi_rx_fini(rx_queue);
|
||||||
|
efx_for_each_channel_tx_queue(tx_queue, channel)
|
||||||
|
efx_mcdi_tx_fini(tx_queue);
|
||||||
|
}
|
||||||
|
|
||||||
|
wait_event_timeout(efx->flush_wq,
|
||||||
|
atomic_read(&efx->active_queues) == 0,
|
||||||
|
msecs_to_jiffies(EFX_MAX_FLUSH_TIME));
|
||||||
|
pending = atomic_read(&efx->active_queues);
|
||||||
|
if (pending) {
|
||||||
|
netif_err(efx, hw, efx->net_dev, "failed to flush %d queues\n",
|
||||||
|
pending);
|
||||||
|
return -ETIMEDOUT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int efx_mcdi_window_mode_to_stride(struct efx_nic *efx, u8 vi_window_mode)
|
int efx_mcdi_window_mode_to_stride(struct efx_nic *efx, u8 vi_window_mode)
|
||||||
{
|
{
|
||||||
switch (vi_window_mode) {
|
switch (vi_window_mode) {
|
||||||
|
@ -26,6 +26,7 @@ int efx_mcdi_rx_probe(struct efx_rx_queue *rx_queue);
|
|||||||
void efx_mcdi_rx_init(struct efx_rx_queue *rx_queue);
|
void efx_mcdi_rx_init(struct efx_rx_queue *rx_queue);
|
||||||
void efx_mcdi_rx_remove(struct efx_rx_queue *rx_queue);
|
void efx_mcdi_rx_remove(struct efx_rx_queue *rx_queue);
|
||||||
void efx_mcdi_rx_fini(struct efx_rx_queue *rx_queue);
|
void efx_mcdi_rx_fini(struct efx_rx_queue *rx_queue);
|
||||||
|
int efx_fini_dmaq(struct efx_nic *efx);
|
||||||
int efx_mcdi_window_mode_to_stride(struct efx_nic *efx, u8 vi_window_mode);
|
int efx_mcdi_window_mode_to_stride(struct efx_nic *efx, u8 vi_window_mode);
|
||||||
int efx_get_pf_index(struct efx_nic *efx, unsigned int *pf_index);
|
int efx_get_pf_index(struct efx_nic *efx, unsigned int *pf_index);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user