[PATCH net-next 0/9] net: ipa: don't disable NAPI in suspend

From: Alex Elder
Date: Fri Jan 29 2021 - 15:21:45 EST


A few weeks ago I suggested a change that added a flag to determine
whether NAPI should be re-enabled on a channel when we're done
polling. That change was questioned, and upon further investigation
I realized the IPA suspend path was "doing it wrong."

Currently (for newer hardware) the IPA driver suspends channels by
issuing a STOP command. Part of the stop processing includes a
"freeze" operation, which quiesces activity, disables the I/O
completion interrupt, and disables NAPI. But disabling NAPI is
only meant to be done when shutting down the channel; there is
no need to disable it when a channel is being stopped for suspend.

This series reworks the way channels are stopped, with the end
result being that neither NAPI nor the I/O completion interrupt is
disabled when a channel is suspended.

The first patch fixes an error handling bug in the channel starting
path. The second patch creates a helper function to encpasulate
retrying channel stop commands. The third also creates helper
functions, but in doing so it makes channel stop and start handling
be consistent for both "regular" stop and suspend.

The fourth patch open-codes the freeze and thaw functions as a first
step toward reworking what they do (reordering and eliminating steps).

The fifth patch makes the I/O completion interrupt get disabled
*after* a channel is stopped. This eliminates a small race in which
the interrupt condition could occur between disabling the interrupt
and stopping the channel. Once stopped, the channel will generate
no more I/O completion interrupts.

The sixth and seventh patches arrange for the completion interrupt
to be disabled only stopping a channel "for good", not when
suspending. (The sixth patch just makes a small step to facilitate
review; these two could be squashed together.)

The 8th patch ensures a TX request--if initiated just before
stopping the TX queue--is included when determining whether a
a channel is quiesced for stop or suspend.

And finally the last patch implements the ultimate objective,
disabling NAPI *only* when "really" stopping a channel (not for
suspend). Instead of disabling NAPI, a call to napi_synchronize()
ensures everything's done before we suspend.

-Alex

Alex Elder (9):
net: ipa: don't thaw channel if error starting
net: ipa: introduce gsi_channel_stop_retry()
net: ipa: introduce __gsi_channel_start()
net: ipa: kill gsi_channel_freeze() and gsi_channel_thaw()
net: ipa: disable IEOB interrupt after channel stop
net: ipa: move completion interrupt enable/disable
net: ipa: don't disable IEOB interrupt during suspend
net: ipa: expand last transaction check
net: ipa: don't disable NAPI in suspend

drivers/net/ipa/gsi.c | 137 ++++++++++++++++++++++++++----------------
1 file changed, 85 insertions(+), 52 deletions(-)

--
2.27.0