From patchwork Tue Jun 30 12:44:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 192068 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp3782085ilg; Tue, 30 Jun 2020 05:45:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkbq0/qH3lzYpbX7+iXIG8bze1CKRTfuTSM5UblsSbQPchXz5wuwrsJuBOH4fArp1D1eaW X-Received: by 2002:a17:906:c7c3:: with SMTP id dc3mr2842321ejb.376.1593521108337; Tue, 30 Jun 2020 05:45:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593521108; cv=none; d=google.com; s=arc-20160816; b=VYO0BUEksdnQEEI4FQ/wzS4CqGLQ2Py1jeyWVLgZjFQY++sNJnsekcqIedwlRFOtV7 HmzjbJkPz9hiVo6aESG1K6zm3QvfcXGwjeP6OWJiJL4aZyDd8NJp/ut4Kw5+3K0b2CTm S9mGYnr2VMD7oaQJnKjonRWwHKiegLP5YXfUtakfeursbqxhIowaQj6vdCmze73t0t+r KNntYC8YJTo+WiP5CYhNjMCXozdhWTgh53F41FrMgnfF8MMo5oseAqZjdRArI7eiSg52 COdaUoV0IOIaseuTpO+sc/zqT3fc0B0qHfurBR7q8Em8U6QB1cVsLX1Broe4LJv6nLuH Uqgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9XdXmEjc3ZwKGIQrLtpyxFD/vzTwMpcwaLUBfSuIMks=; b=M574SAiiZ7vtpunLdQotZqSuPpUrTxPCtzbitHx+JhwHtP2h7V6kyYABnxg1bXjdae dY4KfnHkEjbjoUxW0iH+58XQWAcRMMF3U+bsH+InHkpYATtJIqErP6DWpbDUQKWzP/Zd yzvPDr1l9AjC1yGen2DEQBUBP+gKLSruD5x/SH893H1ABIBIetpI8A9lr3O00sA3qYyL NhdB7EghibMIKwSNFmTGyB1+ZyACLaz7WXiefMbRB7ksBNk2oWG/p6wwIof9OMHPOFR1 LPAyW+Y3bdC4WdxTe7ajv/WD1854Yj/Vh9+S7OO0t7GCuZLQvWHHUIskq4XuDmBy2F72 QmmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="To/SEc0b"; 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 w18si1577601ejk.216.2020.06.30.05.45.08; Tue, 30 Jun 2020 05:45:08 -0700 (PDT) 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="To/SEc0b"; 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 S2387900AbgF3MpF (ORCPT + 9 others); Tue, 30 Jun 2020 08:45:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387853AbgF3Mov (ORCPT ); Tue, 30 Jun 2020 08:44:51 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6909C03E97B for ; Tue, 30 Jun 2020 05:44:50 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id y2so20819514ioy.3 for ; Tue, 30 Jun 2020 05:44:50 -0700 (PDT) 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=9XdXmEjc3ZwKGIQrLtpyxFD/vzTwMpcwaLUBfSuIMks=; b=To/SEc0bC6K5+5p1yxkI48vyuR9vyavYUd62qJak98IF5Cj2h4nl0ExdB4WrvzeHvq biXJNGpar5EZMpHnAVLlHdMofF3GgW6C88xEU013SGCPXEbsQu/2dY6rEnYrntMHpoCx ir2/jmSRJD4r4olvYJUOCeq2y31mCJw4EnyEkkDslgAsfxV/bPGDbgJV5iv6x2ld08Ux vF/HL0hG/uTv741vc1hwBA757qU2ppmmISgFnjdL/PwEm2N5ZATx9WjWIP2kbILGZlVT 4NaV86nAxp0C3MceWBtIu3bit/GL0M0hI6d9lRetlGzlth5NxUHmmw6DAAKDkoqpgIRR IaaQ== 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=9XdXmEjc3ZwKGIQrLtpyxFD/vzTwMpcwaLUBfSuIMks=; b=Lj98PFTxhXDl54oh+9P67AFEYmtY2msyRSbyQvuB6HAItWQ3ooohRNuTUq7hXIBsyI Wq7IQWH4JYDoUxQ73O6Iknb3nV7uGlItsmLnONM1yzAU6KZQo6mI/oC+2UiODnIhuR0U 1TUoE188E/8v0gSGdGfJCBFTlGFXfvOCmlcwFH0JOflnpStkm6epH1GxFPgZ2xLuO+dx qih7cigx3adqEU5lkZIkwYlyaDKyM/PlOJaaLXeVFDApYRRghiqvc+AUD/FWk1B9zyev hDeTXLmV8aKFBXv0W5y0g/WP+Qc54h/s7VJawDFA5IBDn7bWgeBGfDw6qGtezzJVuSaw gkZg== X-Gm-Message-State: AOAM530WdBDSm0aWu01ZElQUumTzYoNQii9VRAnIDq42AjUCYQI6etfU x19vsR64eGRNaNiemhAV0kIQTg== X-Received: by 2002:a02:cb92:: with SMTP id u18mr351945jap.143.1593521088996; Tue, 30 Jun 2020 05:44:48 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id t83sm1697536ilb.47.2020.06.30.05.44.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 05:44:48 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net v2 1/3] net: ipa: always check for stopped channel Date: Tue, 30 Jun 2020 07:44:42 -0500 Message-Id: <20200630124444.1240107-2-elder@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200630124444.1240107-1-elder@linaro.org> References: <20200630124444.1240107-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In gsi_channel_stop(), there's a check to see if the channel might have entered STOPPED state since a previous call, which might have timed out before stopping completed. That check actually belongs in gsi_channel_stop_command(), which is called repeatedly by gsi_channel_stop() for RX channels. Fixes: 650d1603825d ("soc: qcom: ipa: the generic software interface") Signed-off-by: Alex Elder --- v2: Added "Fixes" tag. drivers/net/ipa/gsi.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) -- 2.25.1 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 55226b264e3c..ac7e5a04c8ac 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -500,6 +500,13 @@ static int gsi_channel_stop_command(struct gsi_channel *channel) int ret; state = gsi_channel_state(channel); + + /* Channel could have entered STOPPED state since last call + * if it timed out. If so, we're done. + */ + if (state == GSI_CHANNEL_STATE_STOPPED) + return 0; + if (state != GSI_CHANNEL_STATE_STARTED && state != GSI_CHANNEL_STATE_STOP_IN_PROC) return -EINVAL; @@ -789,20 +796,11 @@ int gsi_channel_start(struct gsi *gsi, u32 channel_id) int gsi_channel_stop(struct gsi *gsi, u32 channel_id) { struct gsi_channel *channel = &gsi->channel[channel_id]; - enum gsi_channel_state state; u32 retries; int ret; gsi_channel_freeze(channel); - /* Channel could have entered STOPPED state since last call if the - * STOP command timed out. We won't stop a channel if stopping it - * was successful previously (so we still want the freeze above). - */ - state = gsi_channel_state(channel); - if (state == GSI_CHANNEL_STATE_STOPPED) - return 0; - /* RX channels might require a little time to enter STOPPED state */ retries = channel->toward_ipa ? 0 : GSI_CHANNEL_STOP_RX_RETRIES;