summaryrefslogtreecommitdiff
path: root/drivers/net/ipa/gsi.c
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2021-02-01 11:28:49 -0600
committerJakub Kicinski <kuba@kernel.org>2021-02-02 17:42:36 -0800
commita65c0288b355a8bb71f43cf9b4c33ada51e0ec26 (patch)
treee14301c2236225df86c285de2fcfa0973d3e3e6e /drivers/net/ipa/gsi.c
parent4fef691c9b6ab5ed92b874bc6ddfb14a34c650ab (diff)
net: ipa: don't disable interrupt on suspend
No completion interrupts will occur while an endpoint is suspended, nor when a channel has been stopped for suspend. So there's no need to disable the interrupt during suspend and re-enable it when resuming. Without any interrupts occurring, there is no need to disable/re-enable NAPI for channel suspend/resume either. We'll only enable NAPI and the interrupt when we first start the channel, and disable it again only when it's "really" stopped. To accomplish this, move the enable/disable calls out of __gsi_channel_start() and __gsi_channel_stop(), and into gsi_channel_start() and gsi_channel_stop() instead. Add a call to napi_synchronize() to gsi_channel_suspend(), to ensure NAPI polling is done before moving on. Signed-off-by: Alex Elder <elder@linaro.org> Acked-by: Willem de Bruijn <willemb@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ipa/gsi.c')
-rw-r--r--drivers/net/ipa/gsi.c44
1 files changed, 29 insertions, 15 deletions
diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c
index 9b3d5b639dac..dcc27b56102b 100644
--- a/drivers/net/ipa/gsi.c
+++ b/drivers/net/ipa/gsi.c
@@ -860,20 +860,15 @@ static int __gsi_channel_start(struct gsi_channel *channel, bool start)
struct gsi *gsi = channel->gsi;
int ret;
- napi_enable(&channel->napi);
- gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id);
+ if (!start)
+ return 0;
mutex_lock(&gsi->mutex);
- ret = start ? gsi_channel_start_command(channel) : 0;
+ ret = gsi_channel_start_command(channel);
mutex_unlock(&gsi->mutex);
- if (ret) {
- gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id);
- napi_disable(&channel->napi);
- }
-
return ret;
}
@@ -881,8 +876,19 @@ static int __gsi_channel_start(struct gsi_channel *channel, bool start)
int gsi_channel_start(struct gsi *gsi, u32 channel_id)
{
struct gsi_channel *channel = &gsi->channel[channel_id];
+ int ret;
+
+ /* Enable NAPI and the completion interrupt */
+ napi_enable(&channel->napi);
+ gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id);
- return __gsi_channel_start(channel, true);
+ ret = __gsi_channel_start(channel, true);
+ if (ret) {
+ gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id);
+ napi_disable(&channel->napi);
+ }
+
+ return ret;
}
static int gsi_channel_stop_retry(struct gsi_channel *channel)
@@ -907,16 +913,15 @@ static int gsi_channel_stop_retry(struct gsi_channel *channel)
static int __gsi_channel_stop(struct gsi_channel *channel, bool stop)
{
- struct gsi *gsi = channel->gsi;
int ret;
+ /* Wait for any underway transactions to complete before stopping. */
gsi_channel_trans_quiesce(channel);
ret = stop ? gsi_channel_stop_retry(channel) : 0;
- if (!ret) {
- gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id);
- napi_disable(&channel->napi);
- }
+ /* Finally, ensure NAPI polling has finished. */
+ if (!ret)
+ napi_synchronize(&channel->napi);
return ret;
}
@@ -925,8 +930,17 @@ static int __gsi_channel_stop(struct gsi_channel *channel, bool stop)
int gsi_channel_stop(struct gsi *gsi, u32 channel_id)
{
struct gsi_channel *channel = &gsi->channel[channel_id];
+ int ret;
- return __gsi_channel_stop(channel, true);
+ /* Only disable the completion interrupt if stop is successful */
+ ret = __gsi_channel_stop(channel, true);
+ if (ret)
+ return ret;
+
+ gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id);
+ napi_disable(&channel->napi);
+
+ return 0;
}
/* Reset and reconfigure a channel, (possibly) enabling the doorbell engine */