From patchwork Fri Jan 29 20:20:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 373368 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp2522147jam; Fri, 29 Jan 2021 12:26:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMjLzivRN2pPXlRjSGwQLFj8ds9X26AjoOLiVfE84Yq4gKLQI31PstzO0Ge31D2FKPA1e6 X-Received: by 2002:a05:6402:1455:: with SMTP id d21mr4733938edx.96.1611951987312; Fri, 29 Jan 2021 12:26:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611951987; cv=none; d=google.com; s=arc-20160816; b=DOJc1DOoY96COVIWC+kRlRunAwnKAJBnpo8358n3mBOaQLLupmPlCHnL+t907XxVru fdbKZ42GLg9Zq0sjdn4ggufYd2J2mp/QvMEWyLaSKCJQhHy2xT+y6BpDYGnm1Lroj95f CgvDxVh19/1IvoCD0Uq0Q4TFgp4DS2wy4FwBAUw1+EepIqAB/gPeQrKMpyGERE4ra/dB b8UNuVwZYTiLehacvYVnlxp8a3zyH4MIJpMerb/AJvB5iHm5/bSGrW3pzNGPVVvJFYY9 7k15VINF90IIkIi+QEk0aLnqTUy775IjFZG/O3CS0F9lSl//IhQIp8Jl0rJCDfZUSK5L BTOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xs7nwLsyXg7XVa6pclIbxwm44u118oon6gH7yricI1w=; b=ZiIBcSC0eA9R994C1NSnR7FhrqmyIQE81UdfFeTiNf3wO5RH4SMKe9sK+tJtmodFER OS/YNRtz8pajoLraptSDnD+1UszerdEswm6MGE6vagEP+PiCMf9xbPSQIDL8V3/hkr4f 9dNX/HfPcUn/XagkZO0XBHWc1OmiQkDtlr+qZd5Ex03X2EU3w43pePQZhisDXJz7Ocay IiJta8hkZ7aEejHLoTeF0hGhzn1qVUD/9A3y7dSLFB/fZVI1LrH2lmJZRIkb63XDwQ9l v6wEhkOv0pA7HBr7UOgLW+Tu4R3bLWE4/pmNbMxQVJdsPPUwqbsE1kpl06sGoPboaWzl L/zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i1920T7m; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bo9si6108047edb.435.2021.01.29.12.26.26; Fri, 29 Jan 2021 12:26:27 -0800 (PST) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i1920T7m; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233241AbhA2UZr (ORCPT + 7 others); Fri, 29 Jan 2021 15:25:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233267AbhA2UWy (ORCPT ); Fri, 29 Jan 2021 15:22:54 -0500 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 717F9C061355 for ; Fri, 29 Jan 2021 12:20:33 -0800 (PST) Received: by mail-il1-x133.google.com with SMTP id g7so8579661iln.2 for ; Fri, 29 Jan 2021 12:20:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xs7nwLsyXg7XVa6pclIbxwm44u118oon6gH7yricI1w=; b=i1920T7mfZTSl9wqKgNaG+Eqam2WWs+8OVhme/B74E3ozFb71n9IBLyXnTOTmkcqtA kNUaOPsnUuzMZNAM/2P7C8Rn2GqZkr5yLnrqvzCkGUGLRIIjn+WxSQ4ZsNqKN36tyXT4 aq1CaGvAvjHa1oaLJ8LvKtF/lRaQuh2ZhukqUYy246eBGawDknYPLO9JZlFYBvUSeW6P GEyUjEzbOknLWe9iO8AZOxqTpfmcdzr1U3RiSvWwqImN/iaKYVJ/W0GIPGba7xs62ABC XQT/+0y3WGxTwEfIskFCj7p6UcnrSMvYdIC88hZVGWsAUw3+DBhGRGZ9AdeSskJZYNSu ecMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xs7nwLsyXg7XVa6pclIbxwm44u118oon6gH7yricI1w=; b=XEALHgI1u5deoB+JU2ob1zBeXm07iFQ8/L1/Zvpzf/n6BEsUP9G5xmfX8Vs6GSX86z 7EjKU+z0+Qp9o7lFbOXrB1qwvfgSnaSFflgAsRRb37WGIIHXjlO47tgBw1tl3qdBC2EE TvqdwLYZQWh1N7HC5wxrPThG0pw3kDx8qziUlKP0YXmWVYF7cAF5uI1K4p1SFqTD7cV8 gjLski6gXICNaVSawMosx5OvTTTbRD6qhpBbIgr0R/m4yGvfyVk6B/IQBAmmf4YrfU2V l+VdyBa8AYi88saGMOyKaUt6+jd8woo9EqarhJxnJ1PPGTHbAwMqh8XcaxmPmt9HlzJC Y+nw== X-Gm-Message-State: AOAM530z+Ejqnjru5X/RHwHdRWU3Iy5LTJXmi3ElciAG4eT0kLXwnQf2 kTXrVDcQUoxzf4pGHGTK5OEvOg== X-Received: by 2002:a92:ce41:: with SMTP id a1mr4912576ilr.182.1611951632879; Fri, 29 Jan 2021 12:20:32 -0800 (PST) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id h23sm4645738ila.15.2021.01.29.12.20.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 12:20:32 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: elder@kernel.org, evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 9/9] net: ipa: don't disable NAPI in suspend Date: Fri, 29 Jan 2021 14:20:19 -0600 Message-Id: <20210129202019.2099259-10-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210129202019.2099259-1-elder@linaro.org> References: <20210129202019.2099259-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The channel stop and suspend paths both call __gsi_channel_stop(), which quiesces channel activity, disables NAPI, and (on other than SDM845) stops the channel. Similarly, the start and resume paths share __gsi_channel_start(), which starts the channel and re-enables NAPI again. Disabling NAPI should be done when stopping a channel, but this should *not* be done when suspending. It's not necessary in the suspend path anyway, because the stopped channel (or suspended endpoint on SDM845) will not cause interrupts to schedule NAPI, and gsi_channel_trans_quiesce() won't return until there are no more transactions to process in the NAPI polling loop. Instead, enable NAPI in gsi_channel_start(), when the completion interrupt is first enabled. Disable it again in gsi_channel_stop(), when finally disabling the interrupt. Add a call to napi_synchronize() to __gsi_channel_stop(), to ensure NAPI polling is done before moving on. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 217ca21bfe043..afc5c9ede01af 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -876,15 +876,15 @@ static int __gsi_channel_start(struct gsi_channel *channel, bool start) struct gsi *gsi = channel->gsi; int ret; + 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) - napi_enable(&channel->napi); - return ret; } @@ -894,12 +894,16 @@ int gsi_channel_start(struct gsi *gsi, u32 channel_id) struct gsi_channel *channel = &gsi->channel[channel_id]; int ret; - /* Enable the completion interrupt */ + /* Enable NAPI and the completion interrupt */ + napi_enable(&channel->napi); 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); + if (!ret) + return 0; + + gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id); + napi_disable(&channel->napi); return ret; } @@ -928,13 +932,13 @@ static int __gsi_channel_stop(struct gsi_channel *channel, bool stop) { int ret; + /* Wait for any underway transactions to complete before stopping. */ gsi_channel_trans_quiesce(channel); - napi_disable(&channel->napi); ret = stop ? gsi_channel_stop_retry(channel) : 0; - - if (ret) - napi_enable(&channel->napi); + /* Finally, ensure NAPI polling has finished. */ + if (!ret) + napi_synchronize(&channel->napi); return ret; } @@ -947,10 +951,13 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id) /* 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); + if (ret) + return 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 */