From patchwork Fri Feb 5 22:10:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 377639 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp2813369jah; Fri, 5 Feb 2021 18:40:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJwK8Qs/XXUMWgx2qkmcVH4IvkejIuuYrv89KMux5piw0bx2NuMKVrFJSiODG50INesZjkBW X-Received: by 2002:a17:906:c1c1:: with SMTP id bw1mr7011921ejb.86.1612579226019; Fri, 05 Feb 2021 18:40:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612579226; cv=none; d=google.com; s=arc-20160816; b=ovOnk3R2hLzTwzyLNV0t8R1Zy1zJb0Q4jLlBc8aBunv7+Axp4DO7CtoNICz78knQGm 1CAEgQCenbGBdRDTHj4ELDeYoHYV72f8fdYpGCchYv2HCixa0uQFFYYvp38mS3Wb4FFB /uO+yFmArIaWipPDTknPrHr/p+SpyqME8ZawipYVqqM8xLEWRWlLmn99mBdajVIInOiN hT8hlsPMY6+WLqv9q5jhQZJ72xAZ2sNEw0s5FKE0vHKfcMvkn3Dah0rNsYl0gy0VSn7h WKLc2QeVVT1xegV7zIJBW86TVe8t/nBi9TP35Dc3nAo6E0+7NxHGczWlAXNsjEZnfH5N g/zw== 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=kxUeKVVNjUYZDEFlDXz16lYFbO6uGbZz83MJ+yrq+To=; b=KZZzaNbSbUYWmhspYK7E00mcMBNYTyMXfY0Hc+o2KS1qGJdLVGXdc3CgebgNaIH0ba SIqAMOsFo5t3IngI7Nrqra39grPjO6ai+BP0VFo60RrdWGAF4qcH1rZlhDyIIqx4RuYN P5nDzu7CLXaB7Am9hKMD+gMzfPWeLE7Ijx5WqKt/tILaRQ69A46shMg5gH8wTxfo2g// CUXwyq+VHJ29ZVrtO9xkg0l6sTrlx7w0gIjzITZPNad366CMnwAwLiE7kojB4AXxwGDY 4O3JVnLzz9x0ccECklQH2ammgSrZ4blvtfX+rGS2JzChHILYPd4yz57tdfqjN2931VP4 Q4rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HPiOVeky; 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 v12si6346472ejy.529.2021.02.05.18.40.25; Fri, 05 Feb 2021 18:40:26 -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=HPiOVeky; 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 S231440AbhBFCj1 (ORCPT + 7 others); Fri, 5 Feb 2021 21:39:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230342AbhBFCgR (ORCPT ); Fri, 5 Feb 2021 21:36:17 -0500 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF291C061A2B for ; Fri, 5 Feb 2021 14:11:09 -0800 (PST) Received: by mail-il1-x12d.google.com with SMTP id z18so7232256ile.9 for ; Fri, 05 Feb 2021 14:11:09 -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=kxUeKVVNjUYZDEFlDXz16lYFbO6uGbZz83MJ+yrq+To=; b=HPiOVeky7a2Uf27cS5sPHL8+U0ndFwwub2ApiF9duyiJFjOaYTOYAEfwtIqRWLKw1K 43B0TJDKV4K6tNuG+VpwSBmicQOi1SjnL671emiWlarpWVgpHIdjWuFxsSHvoc2qw/GW fNd7Bgr05JZpnJMECyfDjpVecPFohd0ZTMzOgwAozoX/rKoOAYaYDmwHMYw2z/k4X9yi PK8173e+xuPO2hoKz8ZUdl0WKl+M0ff2SLbEflw2T3bI7htu0dSzMxWCzaQAhkfON8Ie HpcLG4AL4/9eemfMGqs5rbEAk23SCgkftpyupT2D3y8I9WP2jocHyfKk2eX4EOl+fLvZ 2EWg== 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=kxUeKVVNjUYZDEFlDXz16lYFbO6uGbZz83MJ+yrq+To=; b=KSeunPhkhDptD/iDHnUUzoheMly+7qKAb2bYct1VLldTBjeI1IKrgO70dvQps5T8+7 ygCQJx8GdjXx2Eg36bclXpZyixSgnFxR/NrW11dduZKze06sdFpslOzkIPJ241EAvl7a G2aLdgW/F4JrL2NpNzN9Lrp0CTj7TQYmIaHuXsdqWhlWyeDcrBbtJ0q3MZFox63/trpw 5++l4tn4UkB/k27AWQgfEzkVglJ/hOo6dQNushCw+lRd9O1ulTwZufspQcKVWERy1C9i 4W5dBWe4Yr0hQ6L606EGv8oqv/P1zsHCRa6RHF+DkCBquMPnH+B1HMrSkB0wBuhry+HP Dl6g== X-Gm-Message-State: AOAM533NQaLB8LJ1JA3vj6Ptape9fKPxYe7fshJpT9hbfejk5nF8onN/ mBznA/O2yzE1FZWR5vJA8wIUrw== X-Received: by 2002:a05:6e02:20e8:: with SMTP id q8mr5572337ilv.205.1612563069287; Fri, 05 Feb 2021 14:11:09 -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 m15sm4647171ilh.6.2021.02.05.14.11.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 14:11:08 -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 v2 2/7] net: ipa: synchronize NAPI only for suspend Date: Fri, 5 Feb 2021 16:10:55 -0600 Message-Id: <20210205221100.1738-3-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210205221100.1738-1-elder@linaro.org> References: <20210205221100.1738-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.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 --- v2: - Return early to avoid blocks of indented code drivers/net/ipa/gsi.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index f0432c965168c..60eb765c53647 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -939,13 +939,7 @@ static int __gsi_channel_stop(struct gsi_channel *channel, bool stop) mutex_unlock(&gsi->mutex); - if (ret) - return ret; - - /* Ensure NAPI polling has finished. */ - napi_synchronize(&channel->napi); - - return 0; + return ret; } /* Stop a started channel */ @@ -987,8 +981,16 @@ 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); + ret = __gsi_channel_stop(channel, stop); + if (ret) + return ret; + + /* Ensure NAPI polling has finished. */ + napi_synchronize(&channel->napi); + + return 0; } /* Resume a suspended channel (starting will be requested if STOPPED) */