From patchwork Fri Jan 29 20:20:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 373369 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp2522163jam; Fri, 29 Jan 2021 12:26:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxOJtQeifIcNHZ7H502aot/fgEk2S5o5b9sFolnlQFh0ShUtaTEAYEhVPZLXq05uR6HvJt9 X-Received: by 2002:a05:6402:3188:: with SMTP id di8mr7421206edb.318.1611951989059; Fri, 29 Jan 2021 12:26:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611951989; cv=none; d=google.com; s=arc-20160816; b=IJkXYCiEIAWNeV9h6g8sccu7VR6CJQkxzs+9REpHbwf8r9MAREpOY7nHQpLINtKJ9+ Ch+3eQ6TWYkrgJsH6mNeZEPXAcluuTFmC7iHEYj/Vmp8ecZ3/ld4uK9JXuju80jBzxEQ zrDbzE3P+AUVx6YqgBijt/WM8scGFPrd6XJ/gl0ZcdM7yc2oqG2RxGOmMiJyTOZavUt/ XiPYt+tgIdw5Ml7YAzCHufAamfz/uqrFaIXUfzPUx9OX3fldGA7UElYZlKxETS9u2+Oc U6vQRku2L1/TuNbhHiW3TlYdUjtgOFN344ducfqYQgUAw/zyohAU/WUWnetwBCCCibyg F/bA== 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=LCw8t3dNLb85N9LUx0CmQJolraUZfpfFkvo2+8sOa0o=; b=TZAJBoV7CB01sBiu4BEd6rUYVUgxzBDjzBeJvtoXCa/jkfdcVJax5yaMTJ3a+WjXAS dN0Y9g8I77Owme10GZSnGLHFuc5L9cdzic8ECBCF+YxFAJQ3oUHqNKeH2+zppnIfUPu0 jTsaOSdToQV2Td5zu8jQ6lmUCuJ1K7g1MEiaL39xCK4ilmz3alCMqpZNzN1od0lbJQKU ZxcceFwNGdjSriyeWkmJRRfIE4fVYqxSykjMVRv8Ic2Hx1WpnCq+e9nSGWPTDz4y3p/t NGye05IW8ZmtxIgAHGeaztUzTfTLANlEgnhiWhVKXQwH+KcK6RX8A0IvyBa35THVmYXa Un3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g2i4IwJ+; 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.28; Fri, 29 Jan 2021 12:26:29 -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=g2i4IwJ+; 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 S233404AbhA2U0N (ORCPT + 7 others); Fri, 29 Jan 2021 15:26:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233204AbhA2UVZ (ORCPT ); Fri, 29 Jan 2021 15:21:25 -0500 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF9E7C061788 for ; Fri, 29 Jan 2021 12:20:25 -0800 (PST) Received: by mail-io1-xd34.google.com with SMTP id h11so10606187ioh.11 for ; Fri, 29 Jan 2021 12:20:25 -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=LCw8t3dNLb85N9LUx0CmQJolraUZfpfFkvo2+8sOa0o=; b=g2i4IwJ+Kj8enui+8IT7o5h9xAiJjUactPE+pJmvcAY7VNWDwx/jQ2ubO5SGGU2Rmd l/fDq7rjrUXlJyU35nRapnL0exdNhPeD6v2WiVNScBZUf9o+F5VCCW5VmPvZxHxcIDB4 IQf65oz5qpCDZKu2dUBvfr0T6Iacjk8Qp2jsqgVvyhQmKPg0zbYXkX6x4eYq6KufgK4o Z8/67LJISEBEiSL5Nlsc0g5Vk88Mk68BVTxcz3CEz22Zr+b2OWuWJqmxL72b8UQxRuWf O4qcac3ZSCyWk9PtrVnpx3kgSev0bZe+Gn+e0G+MlAfhzJ8gle1AHSB3LBTB5NtD8jly aCbg== 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=LCw8t3dNLb85N9LUx0CmQJolraUZfpfFkvo2+8sOa0o=; b=XAEiZPpL5xvSUm06lwYJtSGpemwEv4lXXOxigI0Xp9AxlJJuU+bSSnvwQnHed1j6WM DhwF28fTISOwLqiMxBEHSjcr6IA2J1N2LJRIpEbZEr3KTP/gBJMPSjtdjECBbupMTLg/ W8cS9I6A93xhUT1oDJMC4lbFJ/N9ipoRZGRokj8IoVokWha5i4yi3g8EP00K5oO8lDwt xxBe1yCH3C/di1aClLScSNxx9M55iOKwbv1NzazsDQtvCNF4HRjiM7b9MaNa+ah4hFWO 001KdctrHNCwsK7MPC4pnw5HZnwlu9+oXBHGm6eQSKVL1nUQ1XzARXhZHvd/Cv0lYEvK 2w4w== X-Gm-Message-State: AOAM5304dOnWYF0H+wMbiRZKkAlTL7oCV6yFw52INL218HGoaZW/RPw6 1xpvG67Kmw4g2+ye5MwLfGE5rA== X-Received: by 2002:a05:6602:4b:: with SMTP id z11mr4864766ioz.47.1611951625315; Fri, 29 Jan 2021 12:20:25 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 12:20:24 -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/9] net: ipa: introduce gsi_channel_stop_retry() Date: Fri, 29 Jan 2021 14:20:12 -0600 Message-Id: <20210129202019.2099259-3-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 Create a new helper function that encapsulates issuing a set of channel stop commands, retrying if appropriate, with a short delay between attempts. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 4a3e125e898f6..bd1bf388d9892 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -892,15 +892,12 @@ int gsi_channel_start(struct gsi *gsi, u32 channel_id) return ret; } -/* Stop a started channel */ -int gsi_channel_stop(struct gsi *gsi, u32 channel_id) +static int gsi_channel_stop_retry(struct gsi_channel *channel) { - struct gsi_channel *channel = &gsi->channel[channel_id]; u32 retries = GSI_CHANNEL_STOP_RETRIES; + struct gsi *gsi = channel->gsi; int ret; - gsi_channel_freeze(channel); - mutex_lock(&gsi->mutex); do { @@ -912,6 +909,19 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id) mutex_unlock(&gsi->mutex); + return ret; +} + +/* Stop a started channel */ +int gsi_channel_stop(struct gsi *gsi, u32 channel_id) +{ + struct gsi_channel *channel = &gsi->channel[channel_id]; + int ret; + + gsi_channel_freeze(channel); + + ret = gsi_channel_stop_retry(channel); + /* Re-thaw the channel if an error occurred while stopping */ if (ret) gsi_channel_thaw(channel);