Skip to content

Commit

Permalink
net: ipa: disable interrupt and NAPI after channel stop
Browse files Browse the repository at this point in the history
Disable both the I/O completion interrupt and NAPI polling on a
channel *after* we successfully stop it rather than before.  This
ensures a completion occurring just before the channel is stopped
gets processed.

Enable NAPI polling and the interrupt *before* starting a channel
rather than after, to be symmetric.  A stopped channel won't
generate any completion interrupts anyway.

Enable NAPI before the interrupt and disable it afterward.

Signed-off-by: Alex Elder <elder@linaro.org>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Alex Elder authored and Jakub Kicinski committed Feb 3, 2021
1 parent bd1ea1e commit 4fef691
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions drivers/net/ipa/gsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,15 +860,18 @@ 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);

mutex_lock(&gsi->mutex);

ret = start ? gsi_channel_start_command(channel) : 0;

mutex_unlock(&gsi->mutex);

if (!ret) {
gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id);
napi_enable(&channel->napi);
if (ret) {
gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id);
napi_disable(&channel->napi);
}

return ret;
Expand Down Expand Up @@ -908,14 +911,11 @@ static int __gsi_channel_stop(struct gsi_channel *channel, bool stop)
int ret;

gsi_channel_trans_quiesce(channel);
napi_disable(&channel->napi);
gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id);

ret = stop ? gsi_channel_stop_retry(channel) : 0;

if (ret) {
gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id);
napi_enable(&channel->napi);
if (!ret) {
gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id);
napi_disable(&channel->napi);
}

return ret;
Expand Down

0 comments on commit 4fef691

Please sign in to comment.