net: ipa: support retries on generic GSI commands
authorAlex Elder <elder@linaro.org>
Thu, 19 Nov 2020 22:49:27 +0000 (16:49 -0600)
committerJakub Kicinski <kuba@kernel.org>
Sat, 21 Nov 2020 02:45:52 +0000 (18:45 -0800)
commit1136145660f3116cb92794c1a7571bf49e4a1938
treea321e14bb7cbdb8a677ba2ae8cab8d8d14b2bb31
parentf849afcc8c3b27d7b50827e95b60557f24184df0
net: ipa: support retries on generic GSI commands

When stopping an AP RX channel, there can be a transient period
while the channel enters STOP_IN_PROC state before reaching the
final STOPPED state.  In that case we make another attempt to stop
the channel.

Similarly, when stopping a modem channel (using a GSI generic
command issued from the AP), it's possible that multiple attempts
will be required before the channel reaches STOPPED state.

Add a field to the GSI structure to record an errno representing the
result code provided when a generic command completes.  If the
result learned in gsi_isr_gp_int1() is RETRY, record -EAGAIN in the
result code, otherwise record 0 for success, or -EIO for any other
result.

If we time out nf gsi_generic_command() waiting for the command to
complete, return -ETIMEDOUT (as before).  Otherwise return the
result stashed by gsi_isr_gp_int1().

Add a loop in gsi_modem_channel_halt() to reissue the HALT command
if the result code indicates -EAGAIN.  Limit this to 10 retries
(after the initial attempt).

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ipa/gsi.c
drivers/net/ipa/gsi.h