From patchwork Wed Feb 3 15:28:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12064597 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BA0BC433E6 for ; Wed, 3 Feb 2021 15:30:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD61364F87 for ; Wed, 3 Feb 2021 15:30:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234288AbhBCPaO (ORCPT ); Wed, 3 Feb 2021 10:30:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233759AbhBCP3n (ORCPT ); Wed, 3 Feb 2021 10:29:43 -0500 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C374FC06178C for ; Wed, 3 Feb 2021 07:29:02 -0800 (PST) Received: by mail-il1-x131.google.com with SMTP id e7so22709907ile.7 for ; Wed, 03 Feb 2021 07:29:02 -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=ctT+U1JJRhDXj7a+ZLi4WV5LisqIA2NCLe0Qt/Ic+HU=; b=w4NU4U+T6kwNtRNLwO2PhEjVIJpUWoCZdrNhJkXG6jTKXAZA2QT0nwZxAk/1+31fWS NzOl4SYTARW47iFwlmdHWZ2e+Q4ffQjjoqcgGPTQuT3L/TrcdnpNX1RrNZ3dPrfi1lmw E+OpX2/5sR3oLCMVGWxshmrZGyQ81XzfbWdiTjey1HlJVGkP5eWGGBB9bGxmMtd0ti+Z w1GPtnPhrye+PAjKQwZdiUx3+XIZLwVqBsTaE4nosvkrycVdWgpq+VcDaAlFU44jC/uS ezxsxgmJ0MXd+GWkNCppGwInHOxhePem8JifJPKdijnu+A5DggAwuivh8OxMqBKw1GjN HNcw== 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=ctT+U1JJRhDXj7a+ZLi4WV5LisqIA2NCLe0Qt/Ic+HU=; b=BKrajuHEyVS/9kuQptxX0rjf8xPe2ds4D6uAz5/Iss8MzAA8LqCk0W0O4Zyxm73HAd Ci659PsokSHCMOj+zR6NYm8Ih5z7ESSEjMMd9Gg7P5wVNKMFvIce8k7fmfhIPCShf3Cd bkhJbmsNhX4Y9VkokFYGS5dZN5SF6OHxD3cBY19SwMPpfFGX4vGR+Alx+p94AL2s5TTE rRy3w/HDUIEi3mzGXQfvDDXAFVoDQzy8nHnlZv/a6OgCNBEjwT1fCdWgafz4CxZ7RWvb jPDnadvcbQGCgwhIc+HNG6pfA3Dgtm3VCDro4aKz3oGSX0/WgCfHOLSA2/CsY4SVRY65 d+Tw== X-Gm-Message-State: AOAM5331JEmAZk91HNt0FruecNdiVq33bT0rAy1o0AbNGFzssY+G+1aP TLiP+nRsbgcX+vfJFUqDoudcOw== X-Google-Smtp-Source: ABdhPJxGvCtURGbq+GzBlj/wFb12OSJjqReQ8q0iD91ySxaLC5KvmjIJCwIsz3znrow4SLH5APAuJA== X-Received: by 2002:a05:6e02:1407:: with SMTP id n7mr3030056ilo.242.1612366142266; Wed, 03 Feb 2021 07:29:02 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id a15sm1119774ilb.11.2021.02.03.07.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 07:29:01 -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 2/7] net: ipa: synchronize NAPI only for suspend Date: Wed, 3 Feb 2021 09:28:50 -0600 Message-Id: <20210203152855.11866-3-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210203152855.11866-1-elder@linaro.org> References: <20210203152855.11866-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org When stopping a channel, gsi_channel_stop() will ensure NAPI polling is complete when it calls napi_disable(). So there is no need to call napi_synchronize() in that case. Move the call to napi_synchronize() out of __gsi_channel_stop() and into gsi_channel_suspend(), so it's only used where needed. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 2671b76ebcfe3..420d0f3bfae9a 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -939,10 +939,6 @@ static int __gsi_channel_stop(struct gsi_channel *channel, bool stop) mutex_unlock(&gsi->mutex); } - /* Finally, ensure NAPI polling has finished. */ - if (!ret) - napi_synchronize(&channel->napi); - return ret; } @@ -984,8 +980,14 @@ 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); + /* Synchronize NAPI if successful, to ensure polling has finished. */ + ret = __gsi_channel_stop(channel, stop); + if (!ret) + napi_synchronize(&channel->napi); + + return ret; } /* Resume a suspended channel (starting will be requested if STOPPED) */