From patchwork Fri Jan 29 20:20:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 373356 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp2520443jam; Fri, 29 Jan 2021 12:23:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5tcAD9zkYsx+cfveSb02dRd1wEh4IZ1YtNJK4mw8Yqyb7hYHQgpF+bHwDqFAs2XKJ7/JB X-Received: by 2002:a17:906:3899:: with SMTP id q25mr6283789ejd.173.1611951801639; Fri, 29 Jan 2021 12:23:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611951801; cv=none; d=google.com; s=arc-20160816; b=gn3yaBVnFOacP2+xD5HgoNv58Z1UTbCF5BTws9leJZ1I8mI4ArVC3TkdiBTYRFeVpE JUE4Ui4C8jzMFjVXSpTAr9s9577+crb0nvWKeh86lBY2Wga+EzesZ49ohY/AOgYUHovp knxjdQy9aEVp49rZjuWMIAY9okoQDcBROGqqAPoFpssit5rsfVIdrdNMyt8AxhCfTM94 +MR+58R++p9mfDq4BQCPb35cdOhcJKWrdOkNewDWGOwi4mckNAilNsnSsiA/qb+uKzEt RQsgovmcMnhuibWEKYcFemyLtkN4D7W2pvC6mEn8cIVSxJfuUxUSvgT02OzulK1HXrVi 3QwQ== 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=KTuHAn9OfqeY3lac31rjWWvnuONhCRgNtLqnNnrmMyE=; b=eAvACNCxPz4A0nnNbBYP4jAN4Xnm6yyHCno+TpKAZt6rrMuPerEeG4l3pc7RS61wAu 89KFtfWGFfu52knM+TtEYmnatvojmgwZqR6PuVIE1O3q8h1v38eTtB0jGiV+fn6z+170 w5f1BeKjmP/ap3C5VUStf/ECqe5vgbRKHVsxYuVzYZFeCrKnGy205vZWGbB7JBH6dIjF dkGNUVRAgYjuSpyeintVFq6QJo9ZbnHsCCBAuzORxvDjwZBiCisBir3iJMU6thDeHRQ7 qK8eoZcUK05w1vLF4iQFSBdskCYQr0RMqO6joLkWq9YsruX5QP82fYTtRaPNCgsxzIzJ nlxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="b09q/t9c"; 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 a4si6007595edv.410.2021.01.29.12.23.21; Fri, 29 Jan 2021 12:23:21 -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="b09q/t9c"; 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 S233281AbhA2UWK (ORCPT + 7 others); Fri, 29 Jan 2021 15:22:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233055AbhA2UVZ (ORCPT ); Fri, 29 Jan 2021 15:21:25 -0500 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D40C3C0613ED for ; Fri, 29 Jan 2021 12:20:24 -0800 (PST) Received: by mail-io1-xd31.google.com with SMTP id 16so10662580ioz.5 for ; Fri, 29 Jan 2021 12:20:24 -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=KTuHAn9OfqeY3lac31rjWWvnuONhCRgNtLqnNnrmMyE=; b=b09q/t9cXwHgn7gEz1ttOt0SKrpalrnMta/O+XS2r+PGF8M+qlHiFlxmrR5nMKCaBl yDIpYLL+7ArJQAOTQ2o8o3YB766fkqL6XyZcWu6/63/ALThIKdAj0zUJa3ErrgFY692t lO5kDXekRAlBZcLQtsgtIZH4ejgngrn2Hp0BtKJBbca7Zq6/wB82hp3IdA5iDl/jc4dP fP8kUtcSTVr2coltsP6uqyfwtayE6GxlIhd36tiN1neHslxACPjtBKVZ9xQLAl3ORdA/ GL6/cjiP4rmANwegY/UhElaZNdhxaVJUY0kC7peRjXwhDuTuXhQwE1C0zq9mFlM3QP0I ZcHg== 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=KTuHAn9OfqeY3lac31rjWWvnuONhCRgNtLqnNnrmMyE=; b=lZyuOjH25AwHE3+WayPP7C95iLGt/zgl3rosApMdw7O8I7Dt9yK/saffasu93T3THo zAmx0daBEyobzsCkzqMDaxotlJ3ctDZEMKt64xvg1Pni5AeMcX+LsZM+77qwxumHgAy5 Cth6WGU/B+QqowjmCxzkFtHsCRVi9i5UeG7UdZDh3MxxXljBmzkhxKNOkQV063qBGHS/ +g3Qa7uDm/WgMQjuj6LgeglyOiwICw0NRWQ8RgR6EaK0kMk7mSfmPeCLZsqV4TFHA7xW 3dEK7Eu2BkCBUGJpAdDwSca6Z+3IQP+EQs/nNJaCU0gYwijhaHNp97ohT9wafeqq9NPN nxlw== X-Gm-Message-State: AOAM532KxjhHtHuAnvuHMOuLExBO8FIVZL8c5XlN+1RK4TRp1XicMdFf uK7AN2K0xxdEEvmIFFz9vlBH2A== X-Received: by 2002:a02:cead:: with SMTP id z13mr5219880jaq.62.1611951624296; Fri, 29 Jan 2021 12:20:24 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 12:20:23 -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 1/9] net: ipa: don't thaw channel if error starting Date: Fri, 29 Jan 2021 14:20:11 -0600 Message-Id: <20210129202019.2099259-2-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 If an error occurs starting a channel, don't "thaw" it. We should assume the channel remains in a non-started state. Update the comment in gsi_channel_stop(); calls to this function are no longer retried. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index f79cf3c327c1c..4a3e125e898f6 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -885,7 +885,9 @@ int gsi_channel_start(struct gsi *gsi, u32 channel_id) mutex_unlock(&gsi->mutex); - gsi_channel_thaw(channel); + /* Thaw the channel if successful */ + if (!ret) + gsi_channel_thaw(channel); return ret; } @@ -910,7 +912,7 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id) mutex_unlock(&gsi->mutex); - /* Thaw the channel if we need to retry (or on error) */ + /* Re-thaw the channel if an error occurred while stopping */ if (ret) gsi_channel_thaw(channel); 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); From patchwork Fri Jan 29 20:20:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 373357 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp2520460jam; Fri, 29 Jan 2021 12:23:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJzOvat1NknPZGohKtgAmZQj/QEzqGfi4dOFPtF4+GwkjWrQ//FQ0NxTIK/QYSna1AaW0ZYG X-Received: by 2002:a17:906:1c17:: with SMTP id k23mr6209642ejg.255.1611951803077; Fri, 29 Jan 2021 12:23:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611951803; cv=none; d=google.com; s=arc-20160816; b=gs59itLSsIuVqDizMneAlz7kz9pquASpCyFGyXau7k15n3Z6zG8ySzc/QcX5MzdmYj eZ3q8BW2PuJ4YWUGGyyIStmvy2rTrXxplSqSrSbiFwNpIWV5Ot/Cprq/MXBRjxMyGXUs BWwb059k1cGVMjXhI6i2Ozt023x3nRI5avB3XWkC2mIXmovjDF8XpnvCHInZLwEsg1Um Y/qo9Dnqn7NbHwcTYSiwX8C1Rfb0fvcit6ywQXZTXe16JbUHCG2QwXRsE6PK+wgNvRG3 zFkbtB4RxkOBwzsl1D/ca3xYWMMF6YhC73p3O6CVrioN782JE+A3Vm0doxLjb2yntzM7 P80A== 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=OBqftNk7KK/hgwXMe4abpMIUsX1N08dKF58CvJahdXQ=; b=Oy+T5qqB4NSMrNufFJVWYrZO35/x81Tl60TYtM+UmB6WQHP1edkCr2ykZq10u0Fa0P ztqxWOuxKtvcS65QTXRqvRqKoh63+S1jEmvWijKuexewszqvjFCpyxXYh/phJNUJEJ+M qC1Wm3FjjmNJXV2sBXLCs2mXOgBNqyQZ7DIyR0qJZOTOR/hENTqooAISZZC+mmX03kIX o32y7sHCJ5Vb58vt+7mwZf58gW5BZk/Qf6fjJbaT98cWdbPNFppfKws11+xpuS2F3Eru LXShzMQd206Y8NPtNIbXWenUoff+pkK7f2UvFCAPtPWdU11gpGBCUAB+B9la5e6ZEs0g guNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k9O4EaUT; 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 a4si6007595edv.410.2021.01.29.12.23.22; Fri, 29 Jan 2021 12:23:23 -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=k9O4EaUT; 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 S233301AbhA2UWe (ORCPT + 7 others); Fri, 29 Jan 2021 15:22:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233232AbhA2UVZ (ORCPT ); Fri, 29 Jan 2021 15:21:25 -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 E17F0C06178C for ; Fri, 29 Jan 2021 12:20:26 -0800 (PST) Received: by mail-il1-x133.google.com with SMTP id p8so9678574ilg.3 for ; Fri, 29 Jan 2021 12:20:26 -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=OBqftNk7KK/hgwXMe4abpMIUsX1N08dKF58CvJahdXQ=; b=k9O4EaUTX7WtWmva4k0QkyOiAhETxyKXeh5mb9sltSN1n6LTdpYOhl5FwQCOJhz0sp srYl2moLMR0caSuxHIeXlCWYb+fxfYf3CaBsVtf0McuVYbf7QvcM7GGat+0oTJiDR2EM k1Av/2OUYhbGpkhk28dgHa6/T+gxPVNfJP7PwzEb8jXQswb8PeGGUomkIzds9+AhoWFY vEH6P33o2ENptCtw+dLRUjZtiv7Ihlq1azo2rH3m7LlonGqPI1QeUISgTzU2GzVBcbab 5Z5MlyL9/jsWjMLzWISzjrjSB7P1GzgQDYeM7fJnllvFXuKwSfVP3vglnxPeuo8y/OMS l4+g== 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=OBqftNk7KK/hgwXMe4abpMIUsX1N08dKF58CvJahdXQ=; b=lGHo9qolshaWWlVST9IGtEN3uUtO/8yE5QqDUhjyg6LdmVXso3OkaKds9n68OKGhyw sGXMiv12rJtZ/AqS6bOHSf7Y+ah9T36YrtpPkOxkHuP/fZ2KCX43NaGtgrg6vk2fz5TJ WpOvN2sPBM+fJ8KuSNLfRa0h6evtpUQBp+/zTRAUgTKmm6u93Kplsu5VSsAJcsYV1x5a 7D1v410t7YnAhwvUnOanRoF5hfZPHQadjwGk01mC4Is6ncO3FdHKPK5JqmxDasYHzLGp 6WNUyDRYjDysgGEwIEqIefsdjUdPckEVc545yMqbSjl+cptaVVA9TM1GJk0bQiU6py2p kZRA== X-Gm-Message-State: AOAM5337K7urDxSyaS7RyQwiRfi78blX4cO6p0gH3NVTZDY5ew+sK/QY aXDPzEznMtOomp4u2RFK2bajEg== X-Received: by 2002:a05:6e02:1bcb:: with SMTP id x11mr4452038ilv.226.1611951626374; Fri, 29 Jan 2021 12:20:26 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 12:20:25 -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 3/9] net: ipa: introduce __gsi_channel_start() Date: Fri, 29 Jan 2021 14:20:13 -0600 Message-Id: <20210129202019.2099259-4-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 function that does most of the work of starting a channel. What's different is that it takes a flag indicating whether the channel should really be stopped or not. When doing a "normal" channel start, the flag is true. Create another new function __gsi_channel_stop() that behaves similarly. IPA v3.5.1 implements suspend using a special SUSPEND endpoint setting. If the endpoint is suspended when an I/O completes on the underlying GSI channel, a SUSPEND interrupt is generated. Newer versions of IPA do not implement the SUSPEND endpoint mode. Instead, endpoint suspend is implemented by simply stopping the underlying GSI channel. In this case, an I/O completion on a *stopped* channel causes the SUSPEND interrupt condition. These new functions put all activity related to starting or stopping a channel (including "thawing/freezing" the channel) in one place, whether or not the channel is actually started or stopped. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 71 ++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 34 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index bd1bf388d9892..bba64887fe969 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -873,23 +873,30 @@ static void gsi_channel_deprogram(struct gsi_channel *channel) /* Nothing to do */ } +static int __gsi_channel_start(struct gsi_channel *channel, bool start) +{ + struct gsi *gsi = channel->gsi; + int ret; + + mutex_lock(&gsi->mutex); + + ret = start ? gsi_channel_start_command(channel) : 0; + + mutex_unlock(&gsi->mutex); + + /* Thaw the channel if successful */ + if (!ret) + gsi_channel_thaw(channel); + + return ret; +} + /* Start an allocated GSI channel */ int gsi_channel_start(struct gsi *gsi, u32 channel_id) { struct gsi_channel *channel = &gsi->channel[channel_id]; - int ret; - mutex_lock(&gsi->mutex); - - ret = gsi_channel_start_command(channel); - - mutex_unlock(&gsi->mutex); - - /* Thaw the channel if successful */ - if (!ret) - gsi_channel_thaw(channel); - - return ret; + return __gsi_channel_start(channel, true); } static int gsi_channel_stop_retry(struct gsi_channel *channel) @@ -912,21 +919,27 @@ static int gsi_channel_stop_retry(struct gsi_channel *channel) return ret; } +static int __gsi_channel_stop(struct gsi_channel *channel, bool stop) +{ + int ret; + + gsi_channel_freeze(channel); + + ret = stop ? gsi_channel_stop_retry(channel) : 0; + + /* Re-thaw the channel if an error occurred while stopping */ + if (ret) + gsi_channel_thaw(channel); + + 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); - - return ret; + return __gsi_channel_stop(channel, true); } /* Reset and reconfigure a channel, (possibly) enabling the doorbell engine */ @@ -952,12 +965,7 @@ int gsi_channel_suspend(struct gsi *gsi, u32 channel_id, bool stop) { struct gsi_channel *channel = &gsi->channel[channel_id]; - if (stop) - return gsi_channel_stop(gsi, channel_id); - - gsi_channel_freeze(channel); - - return 0; + return __gsi_channel_stop(channel, stop); } /* Resume a suspended channel (starting will be requested if STOPPED) */ @@ -965,12 +973,7 @@ int gsi_channel_resume(struct gsi *gsi, u32 channel_id, bool start) { struct gsi_channel *channel = &gsi->channel[channel_id]; - if (start) - return gsi_channel_start(gsi, channel_id); - - gsi_channel_thaw(channel); - - return 0; + return __gsi_channel_start(channel, start); } /** From patchwork Fri Jan 29 20:20:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 373359 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp2520482jam; Fri, 29 Jan 2021 12:23:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzpzhw9GyaOlYYYaBbRZ7iznRh+QjY3jVhEB8J57amMqjLJOKXxUgDDGjMASWYslgptPGzz X-Received: by 2002:a17:906:e28a:: with SMTP id gg10mr6299865ejb.11.1611951804644; Fri, 29 Jan 2021 12:23:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611951804; cv=none; d=google.com; s=arc-20160816; b=DymSPVAy+HOo2X27NEEEh8gv4a6NKgZHrZUxL+K3f60pR+wvNEjhMkX3wNk7SHpjbd 8qw03zIAJY/Xom5mxLAF+om82rhAX2hAN5Vz8fX6aA7KRRxP52TsvZSH4INM50uny13o yuRBCoTDDfCrLMAFi44XxBlNl/VlgYRgZujf65KZr/f4GnH0oYy85iFeNRUIWmsbRMwm KTZcdJOTG5uTu0XsUJ26j/7jtCbgKncw9K1go6dM4Tl95nnIclZmN1pZsH3M2plDXWPi wL504sP0eUWiiMiH1sbpSbJy15Uj8lZAVZJI+DHoc/hLGg7283VQLrRzA44bIJpPqv8Y vl/Q== 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=DlCW8F0szf7ZcEm2ZEhTbHkqGMJz2nWWOYmbZKt8Dqw=; b=V4JgBBDLai6Kk4CX7lKX9kDk5yzYjSK4QMsgp+0owXYMs1RmGOV2WkPwH5aIUp61qD Hmc4jEIUViTbRIcXmpemuA6wIMcQL3xWZHhnJ4N4KUzO6UC6nkbsjKwjzEfA33jcMCOe dZRte5leLHh9FAbs3KTy95PMHdyn6xQPENxyWCgkwxmP3rfX+cpfwrgxoi2ExHnoVN+n BxUaRm/Rg3mM2cERIg94SxSFcH9M9dHZLdXnMm7l38mj8tYDtgvkYrM3BWPUyY2XiarA 18ppvyU/faZ0DdRCECBrWkSX82z2dnXNhXhYF2XyXiKPQrEcWyQ8Co2F+fB5Eemp/XZT R83w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aaQJw63j; 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 a4si6007595edv.410.2021.01.29.12.23.24; Fri, 29 Jan 2021 12:23:24 -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=aaQJw63j; 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 S233319AbhA2UXH (ORCPT + 7 others); Fri, 29 Jan 2021 15:23:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233272AbhA2UVy (ORCPT ); Fri, 29 Jan 2021 15:21:54 -0500 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F8C1C061794 for ; Fri, 29 Jan 2021 12:20:28 -0800 (PST) Received: by mail-io1-xd2a.google.com with SMTP id u8so5548435ior.13 for ; Fri, 29 Jan 2021 12:20:28 -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=DlCW8F0szf7ZcEm2ZEhTbHkqGMJz2nWWOYmbZKt8Dqw=; b=aaQJw63j+v5Mf3M1169h/bqRGX0yIu3UppnOZifSqHHBn+FDqmMT8NKZXuYXklhj0m zIFWUwfWNk1Vioc2DTO2+reSsuTs5DUcVNrpjop7FN/iUkq/Nt5XCTxH43Kmqa/3Uasi fk6WqgG0ihlVgAXUiSPmdzh5UgNh4nUJhTH1ePrT+0X9npLfFhLAAZtn/SNraxGX8uT4 A6l9bpniux8idbwKfSo8aAUDiLGtQcsRqLbAUdXjOi5+rKk17s+Rt9SVLi7T/V3rVljW 7Ha4u6jzVXwyFEsJ5eNB78gn5eS0E6bv5PqGGJ6htXJ5ttcT52t5AMmDHKMcduz/C2sR NA/Q== 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=DlCW8F0szf7ZcEm2ZEhTbHkqGMJz2nWWOYmbZKt8Dqw=; b=HI5TfyT4iRw3F1LTvUsxEawQXtC4IM7+qTyqQq0NdkMAYIhSy45L32op43PxnabwZv rgZtSDAR1r30pEJ7uQ/qiTMJLinKRW51nhU6MqhpLLAZeT8BTK4VlwDEu2SC/yoxJiRM JKGPhVd1jVXG9xkuDBOB6ofGQcoH79DsBqUb7OtpxSGA2fTdg6g//1HCGe7LUk2BEzyK P8H9JLiejrxZMmf8+JDqWQl0cdjXy3lZJfHWdbQdm0tTgyRH9BCiQNMOPxL/atW4/T/t uWzFf85PjPrywMMx/DUCHNP9+U4r1abNklhmNZWDYprNfer3rlaO57kTYUWLu5zs9/Lj YoHQ== X-Gm-Message-State: AOAM530SdYEzfzHto30ZsfYx9gJ9Vv0mBDoRUW2tYH2+WDakDTESNj+I n/BXRVmgRMP6BIxCIxVgtWFKPw== X-Received: by 2002:a6b:700e:: with SMTP id l14mr4732380ioc.148.1611951627512; Fri, 29 Jan 2021 12:20:27 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 12:20:26 -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 4/9] net: ipa: kill gsi_channel_freeze() and gsi_channel_thaw() Date: Fri, 29 Jan 2021 14:20:14 -0600 Message-Id: <20210129202019.2099259-5-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 Open-code gsi_channel_freeze() and gsi_channel_thaw() in all callers and get rid of these two functions. This is part of reworking the sequence of things done during channel suspend/resume and start/stop. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index bba64887fe969..565c785e33a25 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -764,24 +764,6 @@ static void gsi_channel_trans_quiesce(struct gsi_channel *channel) } } -/* Stop channel activity. Transactions may not be allocated until thawed. */ -static void gsi_channel_freeze(struct gsi_channel *channel) -{ - gsi_channel_trans_quiesce(channel); - - napi_disable(&channel->napi); - - gsi_irq_ieob_disable_one(channel->gsi, channel->evt_ring_id); -} - -/* Allow transactions to be used on the channel again. */ -static void gsi_channel_thaw(struct gsi_channel *channel) -{ - gsi_irq_ieob_enable_one(channel->gsi, channel->evt_ring_id); - - napi_enable(&channel->napi); -} - /* Program a channel for use */ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell) { @@ -884,9 +866,10 @@ static int __gsi_channel_start(struct gsi_channel *channel, bool start) mutex_unlock(&gsi->mutex); - /* Thaw the channel if successful */ - if (!ret) - gsi_channel_thaw(channel); + if (!ret) { + gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id); + napi_enable(&channel->napi); + } return ret; } @@ -921,15 +904,19 @@ static int gsi_channel_stop_retry(struct gsi_channel *channel) static int __gsi_channel_stop(struct gsi_channel *channel, bool stop) { + struct gsi *gsi = channel->gsi; int ret; - gsi_channel_freeze(channel); + gsi_channel_trans_quiesce(channel); + napi_disable(&channel->napi); + gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id); ret = stop ? gsi_channel_stop_retry(channel) : 0; - /* Re-thaw the channel if an error occurred while stopping */ - if (ret) - gsi_channel_thaw(channel); + if (ret) { + gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id); + napi_enable(&channel->napi); + } return ret; } From patchwork Fri Jan 29 20:20:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 373366 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp2522128jam; Fri, 29 Jan 2021 12:26:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwOLpNaywi08A6BJsqTGNn+S61AphZ1NT830jo8bjye9GJEF/hg2A8k/9citcBDu/6aEYxL X-Received: by 2002:aa7:cb8a:: with SMTP id r10mr7237709edt.152.1611951985847; Fri, 29 Jan 2021 12:26:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611951985; cv=none; d=google.com; s=arc-20160816; b=CPOx/IcZXA7FIh7WR2KvrWKOmcVvwL5FIS3+UZPC8kiUqrSOduwN8ITnLG9pmQmcZG FbS77WlHMYVioY/cmQMkiQjMHZUAOYUZ7KRiTCtuTB1qX5n7vklrrQOe9XfwCABTzQxz poCw7FmlFdCfIeaAW0XJRJU3oPFKqdbWdG98zi4ojFRJ2pQqoSvrZuxWKI4dlv0//55Z ssLMDJjj9I8d3pvGtuuC4+YL5wLFcNVGwRHLSw0yO0R+1sW4aC9W178gjnqY1HbE7Zp1 pjjxhHamR7RIx3RaYWfO1j6sQ5/GX4dCG9SZY8MsZdbGqZ5bFUXrwctf6Vk4Y+rjT3kJ A1Bw== 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=qBeIWIoL4lPuHMIewwlmHC2HR0MCP9P0drFvCV7BbtI=; b=xW2eOxLrK+Ydv/3pZaZIlAIoyP1Wy3c+hajgu1yB6QPw9CvfTe0mq1d3tByV50EZdt No/UfU7ekWqKj5V82xw6tCmLS8glxJ8qWIWndy/XoRICKf4IsaBOKfb7HdckvZKSPUaV Y3+jD5joqNSwQD9oJBYr2VkmqyvxUBwzFVW1Y3cf4G6BZFHEguDvzH/FzefoTq8O2kUB wtXiOnaY3EGD7rHI+Vuv25JJsog9Shd5U2dzJuMCCmokzrw4eX/EMK2IbJJvDBAZhCkN lK/jhrDAiVNiENTB8NnRriEt4XhaiXay8lQxrqL5N/TnvFfUN5Yt5PGZI15P7bEB20de yYyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="M/Ac5Mur"; 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.25; Fri, 29 Jan 2021 12:26:25 -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="M/Ac5Mur"; 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 S233390AbhA2UZJ (ORCPT + 7 others); Fri, 29 Jan 2021 15:25:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233208AbhA2UWD (ORCPT ); Fri, 29 Jan 2021 15:22:03 -0500 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B1DCC0617A7 for ; Fri, 29 Jan 2021 12:20:29 -0800 (PST) Received: by mail-io1-xd2c.google.com with SMTP id q129so10656188iod.0 for ; Fri, 29 Jan 2021 12:20:29 -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=qBeIWIoL4lPuHMIewwlmHC2HR0MCP9P0drFvCV7BbtI=; b=M/Ac5MurdUC/9plj3pZACJ+JA8zznucmWbj1AaldW7yCA9ngrjrkzXzJzEvC5KtarH YzVQUuEyIxHvy4AfU+DmcgW7y957rDp2Ny/yc1r53wNwtK7bGTwKpabKM4uJPM3Ahg08 BRm+3pvP2LOp8HIG3etB69TmMoNeiH4H1oLeoaJjtJl/nOq8bIOnsSJFiC93pnJTwUTC Eyot0H9zGfWFkE5A/RWF7YnmQtwyusKuDtSy4JYOTkA6dfvI+3DL+3hLPM9PUqfsNj6p 1WvwcbNpn7NKnRXtV1itl8mDeyVRzYNIaq61ETfAIu4hFb8lKa9okO4qYZDV5GULaQPn rZhA== 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=qBeIWIoL4lPuHMIewwlmHC2HR0MCP9P0drFvCV7BbtI=; b=ZSzWX0LhrFIdACJn1tqaX8mG7fUMjJnL+HXPb/jlDQ1XbbSckPHCLkq0o08ZweTPZf p+M3DEhUPR3PLz++WOcHu24FxkX9ewL7UmlH9sB0jsC0uOoqvfL3VOGTDKleLZtAj1wo x5tqgqrcdVu3YVznBTRLixh03Efrk4w26OBl7LNLyd/CwaqN3fduZ5wNZAw/K2c4EhLn lswqiZWZjIlrOJKzn5jvgXM/6Joz4RDhYFbjBoHwyIfLgJV9NKUaO1W3cuancIdWFSbs /mFYJiphAYArsH+8XH8BHT9PbepcZYPrMl4ivVj7wsaWPI/xq1jL6uzvqw6dyq6jao9i B7gg== X-Gm-Message-State: AOAM531r6sSSKS2hOwxvvzFY2hMbZ/wTYjyXnN77gun32IHNp6sjJuYG +JZnPTREH+WledrsVlfYBCyQJg== X-Received: by 2002:a02:ca17:: with SMTP id i23mr5513738jak.25.1611951628546; Fri, 29 Jan 2021 12:20:28 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 12:20:28 -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 5/9] net: ipa: disable IEOB interrupt after channel stop Date: Fri, 29 Jan 2021 14:20:15 -0600 Message-Id: <20210129202019.2099259-6-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 Disable the I/O completion interrupt on a channel *after* we successfully stop it rather than before. This ensures a completion occurring just before the channel is stopped triggers an interrupt. Enable the interrupt *before* starting a channel rather than after, to be symmetric. A stopped channel won't generate any completion interrupts anyway. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 565c785e33a25..1a02936b4db06 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -860,16 +860,18 @@ static int __gsi_channel_start(struct gsi_channel *channel, bool start) struct gsi *gsi = channel->gsi; int ret; + gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id); + mutex_lock(&gsi->mutex); ret = start ? gsi_channel_start_command(channel) : 0; mutex_unlock(&gsi->mutex); - if (!ret) { - gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id); + if (ret) + gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id); + else napi_enable(&channel->napi); - } return ret; } @@ -909,14 +911,13 @@ static int __gsi_channel_stop(struct gsi_channel *channel, bool stop) gsi_channel_trans_quiesce(channel); napi_disable(&channel->napi); - gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id); ret = stop ? gsi_channel_stop_retry(channel) : 0; - if (ret) { - gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id); + if (ret) napi_enable(&channel->napi); - } + else + gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id); return ret; } From patchwork Fri Jan 29 20:20:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 373361 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp2521379jam; Fri, 29 Jan 2021 12:24:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzER6mMr4zEa/a2b7b8Vs3h4uIy/9srqBOp3NlzHhm5swyyqtG5DGZDUHd5MlQJD++Ou9Qv X-Received: by 2002:a17:906:1a0c:: with SMTP id i12mr6421707ejf.325.1611951898872; Fri, 29 Jan 2021 12:24:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611951898; cv=none; d=google.com; s=arc-20160816; b=UBQggeLBD42XZPpDT0uCWICN6N51a4XA35T12ZyA768EoaXk8OponKudO8eADvpRwL t1Zwsy8P9Nv4d2pR+xGcYKdglvXiS51Pio0Yg1J87aTSEs3AZOxObg5eAxyd3Zq++sQB 5YMghhEWlguPQ0boYnvo+NbYxcsDbmZRLpHsrVYtubBHgNDiHkjDXmi+R2dIJCKMuk1J oDjjXcWRJSnmwVcDj0eX3GwXSeCZ+tSe3jtL5pnkpiFDWmnHcCKby1fv/yZUA8qvsRQn 90sNktDq4k787PrZT99OIqDf1HX8jZC86isZ9O7tzwuASc4du7N7h+oVA75oyUz4eHgY fu8g== 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=dckDUrUnoDH+LwVUXQzomAtKdVp8ub5VC5ncTRfi83U=; b=t+GwLGh8+bh23ddh3B9eAgHXhi176Ix9+hwc8Ll44wfJCcBLZWDY3DmduFK6MbgWjk 9lQRmgd8Rf4R/RtRBp5dfPRs8xsBA1Y4zu9p2m5o6zkZ4J6T6owKb7/V5PxpVKbhENsf fvXT7fFBjgEBanOPsAcw8QevWas/QdURcvxfxiNiEhiCqD9JOeeOXExpx51jBqN7P/Rs SZxmBfABy1p6PGFw/McnuNmrF5QVCBcVW/b5aw7JatwbK+eYYrDfRz+zlQ7JT8z1xvbW P7uU0tKO4IgW94r2goQoETyjzcpFhfGtUc3pZrawivv2O0tUBbGuIl+kGRL8uSncfhvl TD+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OxLIExw0; 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 pj26si5206683ejb.261.2021.01.29.12.24.58; Fri, 29 Jan 2021 12:24:58 -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=OxLIExw0; 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 S232555AbhA2UXW (ORCPT + 7 others); Fri, 29 Jan 2021 15:23:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233273AbhA2UV4 (ORCPT ); Fri, 29 Jan 2021 15:21:56 -0500 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43FE4C0617A9 for ; Fri, 29 Jan 2021 12:20:30 -0800 (PST) Received: by mail-io1-xd29.google.com with SMTP id d81so10649670iof.3 for ; Fri, 29 Jan 2021 12:20:30 -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=dckDUrUnoDH+LwVUXQzomAtKdVp8ub5VC5ncTRfi83U=; b=OxLIExw065dW18xdMJZEUF1uluq1FcKZQbi/lts06z7tN4jmjuoOKMoUtNzqk0H1VV D2onKN2Xs6wWr+XgRU+jzt0m2TjQQSgpQa/FAH5AqklTrLk86SAyuHntLAdVd1j2wjhE IobhNcWiOPeyiWTQIb1YIsZ4jTsPpVTJnH3dYKvsX2Vn3H/mDaxp7hrZdaCs+VV/KYR2 CkHJP6piH7i5ljMlIzkykEr5FQf175Taz9LuCy0seve9yfmRTdSjkWHC/ZfU1TlsysSi lCal5G7xZr2R9CkO8u2cw+YTgOQqtm6X1N2kcLWzk+PAd3hWW16EGcJcWUbYzzSxL1v7 LshQ== 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=dckDUrUnoDH+LwVUXQzomAtKdVp8ub5VC5ncTRfi83U=; b=FBD4hrvLf40gNiDZc+Nymgd0yIPJWBy+xX3SLZdNRUyinh4g9V+xB2H1qHLRRHqrNo Q13aQS4VDtWv8gOS3VNsZsVRFVyKV7AkuNLK1wAqpkNoLA7e7YzUxg2vYJ3ZmwpCOoFZ l0wpr2gskdqhu/KeHEbZvxORjidZi6mFWXNpmx4lCDBU2sGk5YwDqAVIouqHSswYLP3b 9FkdIwLT/wLK2mAC0+UDZGyy21EOuyMZe9lEmPhwdCOzG2xTvNX/9n0eOQ1E04dJnolK c4/R3ZU+ddoqtbwJjCn/sA2KqNSh6bvu4hglwvbusyHi5o3C/GPBabJ6O0Ye+JTlIWiT ZNNQ== X-Gm-Message-State: AOAM533pWIm5bmV5bFKYeYahQvNkfFnZhbwGPgPlYi6CLbAmRH7D/5+l LcrqlshSZ13IXqQpyFW0XviDBQ== X-Received: by 2002:a5d:9bc5:: with SMTP id d5mr5380657ion.119.1611951629744; Fri, 29 Jan 2021 12:20:29 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 12:20:29 -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 6/9] net: ipa: move completion interrupt enable/disable Date: Fri, 29 Jan 2021 14:20:16 -0600 Message-Id: <20210129202019.2099259-7-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 Move the calls to enable or disable IEOB interrupts out of __gsi_channel_start() and __gsi_channel_stop() and into their callers. This is a small step to make the next patch easier to understand. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 45 +++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 1a02936b4db06..70647e8450845 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -860,17 +860,13 @@ static int __gsi_channel_start(struct gsi_channel *channel, bool start) struct gsi *gsi = channel->gsi; int ret; - gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id); - mutex_lock(&gsi->mutex); ret = start ? gsi_channel_start_command(channel) : 0; mutex_unlock(&gsi->mutex); - if (ret) - gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id); - else + if (!ret) napi_enable(&channel->napi); return ret; @@ -880,8 +876,16 @@ static int __gsi_channel_start(struct gsi_channel *channel, bool start) int gsi_channel_start(struct gsi *gsi, u32 channel_id) { struct gsi_channel *channel = &gsi->channel[channel_id]; + int ret; - return __gsi_channel_start(channel, true); + /* Enable the completion interrupt */ + 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); + + return ret; } static int gsi_channel_stop_retry(struct gsi_channel *channel) @@ -906,7 +910,6 @@ static int gsi_channel_stop_retry(struct gsi_channel *channel) static int __gsi_channel_stop(struct gsi_channel *channel, bool stop) { - struct gsi *gsi = channel->gsi; int ret; gsi_channel_trans_quiesce(channel); @@ -916,8 +919,6 @@ static int __gsi_channel_stop(struct gsi_channel *channel, bool stop) if (ret) napi_enable(&channel->napi); - else - gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id); return ret; } @@ -926,8 +927,14 @@ static int __gsi_channel_stop(struct gsi_channel *channel, bool stop) int gsi_channel_stop(struct gsi *gsi, u32 channel_id) { struct gsi_channel *channel = &gsi->channel[channel_id]; + int ret; - return __gsi_channel_stop(channel, true); + /* 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); + + return ret; } /* Reset and reconfigure a channel, (possibly) enabling the doorbell engine */ @@ -952,16 +959,30 @@ 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); + /* No completions when suspended; disable interrupt if successful */ + ret = __gsi_channel_stop(channel, stop); + if (!ret) + gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id); + + return ret; } /* Resume a suspended channel (starting will be requested if STOPPED) */ int gsi_channel_resume(struct gsi *gsi, u32 channel_id, bool start) { struct gsi_channel *channel = &gsi->channel[channel_id]; + int ret; - return __gsi_channel_start(channel, start); + /* Re-enable the completion interrupt */ + gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id); + + ret = __gsi_channel_start(channel, start); + if (ret) + gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id); + + return ret; } /** From patchwork Fri Jan 29 20:20:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 373365 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp2522102jam; Fri, 29 Jan 2021 12:26:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzVMqPPwoC2DgLGacVHZ5eb6ilSuq8acxsKcUEkSK1ykx55j0g2yKm6SXV1JEQ7PuRuO47A X-Received: by 2002:aa7:d8c6:: with SMTP id k6mr7250405eds.265.1611951982323; Fri, 29 Jan 2021 12:26:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611951982; cv=none; d=google.com; s=arc-20160816; b=PB+oibbv6ECQTNX/sKYEmPw4b3thTFl5403eX1sd14tCderistyzNi0tFfm3Ljfm03 9yxLfok2CGiyLldi8F4pzevSgSjH0fBMmJYFHMnPsxRwCFAT7n5XGu3jRFCE8ej1wyOl Rs/ohHVRVSyOQ7qhloiWsL/2F5PO/Og2PcQlet6gi5ZPjAS2h9Xh3lXJVrMW25gIzebJ pHLdYwUQOgFKiEgJWYlSVTx6wecx2lKTr61gw0hFQ5DMCLZErZnJcgfciy9tNSkmsxoe 5goEH+bqhZgabbQZrR2ZGVJkXwMOxy2Wzuow2WT/+xCR6xHPlpQ0Y0JppJVjMqeMZBvo 4p8w== 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=IyvOnmoZSqo2WxAcwPn8wTudNnGv17LW2Bgf4MzbHMg=; b=xc7RR6yrJX65snW0u+2uq8hbRuANr97uGog/YvJXGbsKw3nhxQtKDy2sL7RFDUZIKF jkN4iHAJr43lUhF56wHaUdg9uzMDBppBDjy56EVbyuSs4uR9SSlUqGq3rF/OCmkwswVJ yg3uDhWfwuqJRaiCC3hfBTf9IDfJJBenuF2rsgNA3KzEhXnyiesuMWChQnEsZEHJukZD G3//wHwdGrVYkU2JK21I7hOIKEeS29+P0R/XWEoX/8EXRqSQs9e8tEBA+u418UYx4f8P GYvq5bJuYR9ahYVs3HowyHLIkxzqn10Gjah3Ws3NSxGYVcWeJN0T7/6VJxlU43qewUEw 10ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VQH3LBiT; 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.21; Fri, 29 Jan 2021 12:26:22 -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=VQH3LBiT; 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 S233374AbhA2UYu (ORCPT + 7 others); Fri, 29 Jan 2021 15:24:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233231AbhA2UWn (ORCPT ); Fri, 29 Jan 2021 15:22:43 -0500 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4795DC061351 for ; Fri, 29 Jan 2021 12:20:31 -0800 (PST) Received: by mail-io1-xd2e.google.com with SMTP id u7so10625600iol.8 for ; Fri, 29 Jan 2021 12:20:31 -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=IyvOnmoZSqo2WxAcwPn8wTudNnGv17LW2Bgf4MzbHMg=; b=VQH3LBiTtAbVKsZ7bIPXv7N8Y56z2hGZVXASfmr8S5wK+/kuidN/tbI9eHA0E0zRtb s8EFwpujww5HWIcvaZchgGw+NwsCiBoMZZZjGizwuiVgyydyKupHLHqtPQaA7jYopSIC tHAuzDpHpxuwC1YpexvhBx8xxLgcIwp0IBIZITDnCa9cECdBL8D7yd7NwyEs60t5jYSi sBpnZjy5o7qtwEJjMH+KamWH8hw3yxzAF8T5BU5SKooTY1AlL7t8rOB1L0bc2PrVcG+4 EUV8MHriOpg2bVjwT5y4KKeYM7Qrnsgd7l7G5kelkwfLlzHtxx3xTqm4vf+yfaBPtm5K aEWg== 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=IyvOnmoZSqo2WxAcwPn8wTudNnGv17LW2Bgf4MzbHMg=; b=KDJUiujM06nFw+BwfQbkXsdA5wgSdbJs3W7qWhSnspsCgwlGNynv0Y27GfYScl48vY vrgS0Udb4eBZh/orAZzYW4ipNkynA6C8uv8Hxy/57H1RMwuqJUo0I/kCEOHMs9ekpbad 49B6MCNjvBwrAR3YN5fH3jmuxHWxcrEjtsbaZevAyK3H1cJerPnSRsiQgaJ8buiaREBm /GIfcyoT1PPMRhdnm6jxTl5et82ilJEKUsbalKnDQDS+AW60KdJFH4DPi2SySI+XxWuc KJFIk0wps3Xd9cEyS7t69QQ/ar5vIFaYCrJjQ+J1/Wb45xe+r9/I85rCkJMuFfob8igc C/gA== X-Gm-Message-State: AOAM532lyWMLFWI6gji8Uxg3yVfJOUSUJv+0x8VYqV6c8nwPyxj6iiBL FsiFbDRf2z4PxX0+GsYWWUt2Mg== X-Received: by 2002:a5d:8ac5:: with SMTP id e5mr4770819iot.33.1611951630792; Fri, 29 Jan 2021 12:20:30 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 12:20:30 -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 7/9] net: ipa: don't disable IEOB interrupt during suspend Date: Fri, 29 Jan 2021 14:20:17 -0600 Message-Id: <20210129202019.2099259-8-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 No completion interrupts will occur while an endpoint is suspended, or when a channel has been stopped for suspend. So there's no need to disable the interrupt during suspend and re-enable it when resuming. We'll enable the interrupt when we first start the channel, and disable it again only when it's "really" stopped. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 70647e8450845..74d1dd04ad6e9 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -959,30 +959,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; - /* No completions when suspended; disable interrupt if successful */ - ret = __gsi_channel_stop(channel, stop); - if (!ret) - gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id); - - return ret; + return __gsi_channel_stop(channel, stop); } /* Resume a suspended channel (starting will be requested if STOPPED) */ int gsi_channel_resume(struct gsi *gsi, u32 channel_id, bool start) { struct gsi_channel *channel = &gsi->channel[channel_id]; - int ret; - /* Re-enable the completion interrupt */ - gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id); - - ret = __gsi_channel_start(channel, start); - if (ret) - gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id); - - return ret; + return __gsi_channel_start(channel, start); } /** From patchwork Fri Jan 29 20:20:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 373362 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp2521402jam; Fri, 29 Jan 2021 12:25:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJxGiwJMC8+hkc7Y1ztGveaPH3CpZIy/YTXTkB5LSSSbtN0dxhw64ZreiUcgILH7rJJE9XVR X-Received: by 2002:a05:6402:1013:: with SMTP id c19mr7237961edu.298.1611951900926; Fri, 29 Jan 2021 12:25:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611951900; cv=none; d=google.com; s=arc-20160816; b=HXOUXsjjw6OVClHkbI4aciasSClL4z17eeMDoQ3UdrOouQyMQLvaBGgbTgSt54o5So AHfSbAVIqgxymctruPIx12A9z6Tp4EZsWE0djsTVoglETTc+0pqltXhnasVUzs7dYl9o P8XM11T8Dj7bADkTxFOnwXAx40MS9G1OzqSf1SCSC97vkkAXwurMLUexlUc+gJRjKEMm w4Hv/xtyH8NbA5mJkf0fdaZb8ZNbsUIpuzf+xpRqMzrfWzUaqRTfDOlUkwJd81MJjFUb UUNWy7C8bG572NRdaEoOFnKWBJVazwt/5FKWoKAyIeaFY+URQYtjnN/rUoyYpn4DL1hU qE6A== 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=ElDz97SBJk86D1CLyyXPt5PTHHmYPT5bhsYpZ6Pd9RU=; b=Vzcrt8exTtZkc5St72+uvJWci91w4QcxJPmic57d1foVv9Q1WsOLQmQOkbvW3gdYeR u1ELmOM8w0pahWHJzs3Sn/6rrNSSM54UUsdFbK3j14xpOfNJB6co3oL9Uj7BqUTFEsiU Go7YrkICemCOwjpVISzT5VjNUlwZtWcodVMQDHPbYGlBJtMrZvaNOacZS2HAcXV55QwG 9gZ7zY7hKQhajZZRYr+OIDHe3niTU9jAmGuISGb+C2WMRsBD5vzMuENZvPiQKRdpcqI3 6dEs+6JYGnwYPQyeSv5I9TtTbEiNHh1OQWZPESEcVBunQkvkVnpp5TOJEu9QZn4Flh/2 OzLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G43Dmqbc; 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 pj26si5206683ejb.261.2021.01.29.12.25.00; Fri, 29 Jan 2021 12:25:00 -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=G43Dmqbc; 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 S233363AbhA2UYX (ORCPT + 7 others); Fri, 29 Jan 2021 15:24:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233291AbhA2UW1 (ORCPT ); Fri, 29 Jan 2021 15:22:27 -0500 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5894AC061352 for ; Fri, 29 Jan 2021 12:20:32 -0800 (PST) Received: by mail-io1-xd2c.google.com with SMTP id n2so10641770iom.7 for ; Fri, 29 Jan 2021 12:20:32 -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=ElDz97SBJk86D1CLyyXPt5PTHHmYPT5bhsYpZ6Pd9RU=; b=G43Dmqbcif+yph9EzWLQByK13wZEhDmXd5y88G+31juZ8A0nLAIG3uKDaAi8nbOgqq PPINUPrkY0nPzc4tYOGrNGRhEuZWn+s2juH3I86KGseiCs2PJRF8qE6lrAAoiP7QLaV4 h+cix/NzrT4RYoAbyPeUN/Z1zzXByzqcBj1JtWbe/4GAIJGaCScjHlT1oCLff7XhMaRC gE4tXyA8T2dgJ7ycFWlZXnWQ03Nfla4HmDD5NU9dw6Cg7Bic+Hro1ZGA73zjdxig8lCU E9vmAbEKWzkGdT1HdTVn3Hn02iDCvn+n3OxcDsfUK+ONWHVhlUhCffDDLTKdkSdo352b hMTg== 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=ElDz97SBJk86D1CLyyXPt5PTHHmYPT5bhsYpZ6Pd9RU=; b=Clv1o865jksCohk/3nql5D0S7NFtOwUoUBk4iWDBK2SD4gMMwLOg3eU2P1EQS/I2jy PJHwHomh75gk80v3Z7Tmt32673WRCZN0G2EhZQmNRPN8YSvCORIrSnXq9qPaAUkG4PVB KdsFWTmJuBVITXFiSf3ndovQPqdwsuGD5aX8m21gr4kr+Q9ho/hwTC8PCgNsqnnHOJUA 6l6iXpq3JP84YkEO4BbkQsOREdhdbeeBjc3xWkAsLgJKZZh3Cw7aWlJOFwKR65+5p5VY 6lnBsvvc5Wpdv7vC9lZv4rZj/v16Q/S0cMuRwu7rHcub14oc2EHMSPiDDGdLmSCvVNgy sYNw== X-Gm-Message-State: AOAM533qJnSx1blszZDBmJ6OpbEOsDiR4IdJ5o+MGMHoFblGv1BFxmIA F1dKzolrc6jkwTZ0hJLyI0P3yA== X-Received: by 2002:a6b:5915:: with SMTP id n21mr5464846iob.20.1611951631841; Fri, 29 Jan 2021 12:20:31 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 12:20:31 -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 8/9] net: ipa: expand last transaction check Date: Fri, 29 Jan 2021 14:20:18 -0600 Message-Id: <20210129202019.2099259-9-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 Transactions to send data for a network device can be allocated at any time up until the point the TX queue is stopped. It is possible for ipa_start_xmit() to be called in one context just before a the transmit queue is stopped in another. Update gsi_channel_trans_last() so that for TX channels the allocated and pending transaction lists are checked--in addition to the completed and polled lists--to determine the "last" transaction. This means any transaction that has been allocated before the TX queue is stopped will be allowed to complete before we conclude the channel is quiesced. Rework the function a bit to use a list pointer and gotos. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 74d1dd04ad6e9..217ca21bfe043 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -725,22 +725,38 @@ static void gsi_evt_ring_program(struct gsi *gsi, u32 evt_ring_id) gsi_evt_ring_doorbell(gsi, evt_ring_id, 0); } -/* Return the last (most recent) transaction completed on a channel. */ +/* Find the transaction whose completion indicates a channel is quiesced */ static struct gsi_trans *gsi_channel_trans_last(struct gsi_channel *channel) { struct gsi_trans_info *trans_info = &channel->trans_info; + const struct list_head *list; struct gsi_trans *trans; spin_lock_bh(&trans_info->spinlock); - if (!list_empty(&trans_info->complete)) - trans = list_last_entry(&trans_info->complete, - struct gsi_trans, links); - else if (!list_empty(&trans_info->polled)) - trans = list_last_entry(&trans_info->polled, - struct gsi_trans, links); - else - trans = NULL; + /* There is a small chance a TX transaction got allocated just + * before we disabled transmits, so check for that. + */ + if (channel->toward_ipa) { + list = &trans_info->alloc; + if (!list_empty(list)) + goto done; + list = &trans_info->pending; + if (!list_empty(list)) + goto done; + } + + /* Otherwise (TX or RX) we want to wait for anything that + * has completed, or has been polled but not released yet. + */ + list = &trans_info->complete; + if (!list_empty(list)) + goto done; + list = &trans_info->polled; + if (list_empty(list)) + list = NULL; +done: + trans = list ? list_last_entry(list, struct gsi_trans, links) : NULL; /* Caller will wait for this, so take a reference */ if (trans) 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 */