[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210129202019.2099259-7-elder@linaro.org>
Date: Fri, 29 Jan 2021 14:20:16 -0600
From: Alex Elder <elder@...aro.org>
To: davem@...emloft.net, kuba@...nel.org
Cc: elder@...nel.org, evgreen@...omium.org, bjorn.andersson@...aro.org,
cpratapa@...eaurora.org, subashab@...eaurora.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH net-next 6/9] net: ipa: move completion interrupt enable/disable
Move the calls to enable or disable IEOB interrupts out of
__gsi_channel_start() and __gsi_channel_stop() and into their
callers. This is a small step to make the next patch easier
to understand.
Signed-off-by: Alex Elder <elder@...aro.org>
---
drivers/net/ipa/gsi.c | 45 +++++++++++++++++++++++++++++++------------
1 file changed, 33 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c
index 1a02936b4db06..70647e8450845 100644
--- a/drivers/net/ipa/gsi.c
+++ b/drivers/net/ipa/gsi.c
@@ -860,17 +860,13 @@ static int __gsi_channel_start(struct gsi_channel *channel, bool start)
struct gsi *gsi = channel->gsi;
int ret;
- gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id);
-
mutex_lock(&gsi->mutex);
ret = start ? gsi_channel_start_command(channel) : 0;
mutex_unlock(&gsi->mutex);
- if (ret)
- gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id);
- else
+ if (!ret)
napi_enable(&channel->napi);
return ret;
@@ -880,8 +876,16 @@ 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;
- return __gsi_channel_start(channel, true);
+ /* Enable the completion interrupt */
+ gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id);
+
+ ret = __gsi_channel_start(channel, true);
+ if (ret)
+ gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id);
+
+ return ret;
}
static int gsi_channel_stop_retry(struct gsi_channel *channel)
@@ -906,7 +910,6 @@ 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;
gsi_channel_trans_quiesce(channel);
@@ -916,8 +919,6 @@ static int __gsi_channel_stop(struct gsi_channel *channel, bool stop)
if (ret)
napi_enable(&channel->napi);
- else
- gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id);
return ret;
}
@@ -926,8 +927,14 @@ 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)
+ gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id);
+
+ return ret;
}
/* Reset and reconfigure a channel, (possibly) enabling the doorbell engine */
@@ -952,16 +959,30 @@ void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool doorbell)
int gsi_channel_suspend(struct gsi *gsi, u32 channel_id, bool stop)
{
struct gsi_channel *channel = &gsi->channel[channel_id];
+ int ret;
- return __gsi_channel_stop(channel, stop);
+ /* No completions when suspended; disable interrupt if successful */
+ ret = __gsi_channel_stop(channel, stop);
+ if (!ret)
+ gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id);
+
+ return ret;
}
/* Resume a suspended channel (starting will be requested if STOPPED) */
int gsi_channel_resume(struct gsi *gsi, u32 channel_id, bool start)
{
struct gsi_channel *channel = &gsi->channel[channel_id];
+ int ret;
- return __gsi_channel_start(channel, start);
+ /* Re-enable the completion interrupt */
+ gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id);
+
+ ret = __gsi_channel_start(channel, start);
+ if (ret)
+ gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id);
+
+ return ret;
}
/**
--
2.27.0
Powered by blists - more mailing lists