From patchwork Mon Feb 1 17:28:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 374280 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1495800jah; Mon, 1 Feb 2021 09:31:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJySfr6SI3rYuiMuJI7Qb/yuOI4vWvXKnboXK/WBaU9ZYsKUs2yQgeyZAn6JLcKq381u1TX6 X-Received: by 2002:a17:906:d93:: with SMTP id m19mr5199066eji.212.1612200665993; Mon, 01 Feb 2021 09:31:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612200665; cv=none; d=google.com; s=arc-20160816; b=toW6eZ+UNBZvkCflelNgabo/6SJGYwxk0vAjX8Ix6j/oYAtaslGemHLQ/iiYsa6cn5 4P1sLMqZQ8HoXziz6Yz+NOYniu+qj3aZg2y3TAkYu1gcPyBNEL0pChLzrd7gofe1mr+U Orik4GizaalYOyqqUNNA3wn2DnKTcTcHeiPc73jzQFdSUnQSuTreYDV89RJ1ht1wkzDA jfbmuQH+u77PDelhzen6M712Kd85k7mskUTZP9TAkz7vzBMvln5GNtt0423ulDgHbxqJ jLwULCPbfbeFQTzOXJ7IEQheSBJlkFTtUXT4dY8r9DeDgHm/x0Its9Qoj/j/fAP6wbpM vJJQ== 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=Nmi+suSrpZfRwUpuA9SDfz6AzQTTcweGvCEfMikGM/s=; b=poIrO+h0D7vWkNnQ5penK3u9u+1UpfzRXcoMg8fap3NxQ3zc1kfeDqwmET52IItTUh H/D8/dVbEM9c2tE6tGPoXCP9sYn1n7Cjf93e1Aug0LPz9L0LS6Bl5uzkEPs/EQJAJwmk EOuDjXJ2v0rqwHOYdFg0K7F9VmFJ0cOGP0WUv13JAQv7e4XrWeKj9CpWNZvKMLqFbAps FHEvcFUJd/37L9FGU2RcWBOYFPgOBBGk3pEtMYnEk9uF/IgRuC20WSgJEfx+tmEfh523 hNZBGNkifyv+mxHP1kaGkLYpHRLJcZ74g44c4M6tTFl4hQUpG1hzoKBgrCWH4AANCr+y QgMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SCjwns0x; 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 n1si4741749edv.429.2021.02.01.09.31.05; Mon, 01 Feb 2021 09:31:05 -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=SCjwns0x; 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 S231772AbhBAR3r (ORCPT + 7 others); Mon, 1 Feb 2021 12:29:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230129AbhBAR3f (ORCPT ); Mon, 1 Feb 2021 12:29:35 -0500 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16882C061756 for ; Mon, 1 Feb 2021 09:28:56 -0800 (PST) Received: by mail-il1-x134.google.com with SMTP id m20so8841631ilj.13 for ; Mon, 01 Feb 2021 09:28:56 -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=Nmi+suSrpZfRwUpuA9SDfz6AzQTTcweGvCEfMikGM/s=; b=SCjwns0xGu4PCRVAJxUo4cKOUR203WZ9Rix9ZEVp+QhKiTx9EOir+C4rbRwdem6Q+W szdAGcuBPF8xNcHUvWeTrt53S6TtRwh086q5BVt7Lwz+n6qfiZkjvaCjBcGoQVip/Tv9 ZeCUTwIbbAqlDUFA35dg9xRJupeMAdjl5qHMpssAtmNMGQkHZ2TSJYBIaPsrRpQs4z10 9AwkcdrDmMHUFN06WBX1Gvn39GbTH0ZcL3T+qwLm3ZnQ3qjqphmvgv+K2g1SYlYYJGYQ M6QlS7HoNWNSTa+sZtjFNjBPXQA+IO5Oi4fPOgZXWUqa9I0w6NVofqT4iao6epSrkbtR M38Q== 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=Nmi+suSrpZfRwUpuA9SDfz6AzQTTcweGvCEfMikGM/s=; b=P6uHEwag5Gb+jzlsvqE3wO0j3DYJ13u2BaHnELirj3Ls9NL6tvLhX1VjWBeKFnMklo Be7ezyaKYqWM+DEonNwzExo9wUknR+Z2cHBVeiXph2UGBU3Wbry2d20dVFs/ogJpA4cz yyelxovytwFLDRUYVWkLRvSA+HFp1b2pRO8Ajxsee4Qa/lsuOa5KlZU5wCNDkSrDoHhV b6b0WZCTnx7Xsb/DdT6BzpwMSIcypbHC+i20g3x/VgNQUUfABZGqf+glBygWhOm5ECB/ GVdrLJE8FF/McBdaZui+cPsJNuNCda4CnCljhlICyv0zJnN0n4v9VBGs76cQKoBFufKp BoYQ== X-Gm-Message-State: AOAM532vLF/Fe6xQcdZSgY/UPa4pH/3ucZ45tmLn0b3HZLgANnwQsi6s eG7NcSAR9hK4rz0LEb7KlerBuA== X-Received: by 2002:a05:6e02:19cc:: with SMTP id r12mr14043945ill.4.1612200535576; Mon, 01 Feb 2021 09:28:55 -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 v2sm9529856ilj.19.2021.02.01.09.28.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 09:28:54 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: willemdebruijn.kernel@gmail.com, 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 1/7] net: ipa: don't thaw channel if error starting Date: Mon, 1 Feb 2021 11:28:44 -0600 Message-Id: <20210201172850.2221624-2-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210201172850.2221624-1-elder@linaro.org> References: <20210201172850.2221624-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 Mon Feb 1 17:28:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 374281 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1495804jah; Mon, 1 Feb 2021 09:31:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwesFI6AmHcSR+Gn6dZIL6EUsKCeILGbRRr/AVt1yYhInOFpNW0Yaa4XVbm1bowa16mztQq X-Received: by 2002:a17:906:7c4b:: with SMTP id g11mr18748034ejp.475.1612200666421; Mon, 01 Feb 2021 09:31:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612200666; cv=none; d=google.com; s=arc-20160816; b=jF1fwGMZXEZW/dTcjxA+NDqislK43pjq6Gob9JPNLMW+0WKnLDd7Pnn4VmXQ6D0aXr acjz2glm5K92knu4T4Nsq5g5zW85r6lPdDPL5J9Q56hFZe0EszMDOHrYcbSY447HbEKi f7juuXQNQ8lyX73uYWO2t6JBu8UjlG/6rTP7W7aWk9xwnSPvdK2/8aIyRAQ7YsNL8uas djlF0sCiBRv1pVQs2UyYI8RUMOxZmB8Tiq7afzV26NGaqY0inTIqiRx1RA3q0WQtvavo v8sQ3yt0UDvszM9CZjLBMGtwMwl1o6GMjpX0sV2cKw+V0v1OBK9evo/+xSt5DsYJ4uqf FiPg== 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=mcSA7KhGyIumzP8SOxCZy7cD9+me0+J3xFhwzGHvASCFv0j2D2lCRCkwpcUwcTrHaR gvVPrJOGZGVE+Ql5R74lyz4Ohuy9ttjt1JcjZPRo2ImHVJldVLKeY62Yxn4jh7s02Tm5 5ncIkHm9QMo2gXgV/qiuViX1FcDQarFb/9nhARz1eqlsGpx+ckExW4SnCjO2qEPMKQFa x8fmT+laKPERKDxN3Z2J/NFLUhIdP6bVLm4yIYTcJW3ecwXcdF8Ir2Tjqrhz+XcmO+8B PLc8/IROEwSzzmlbSVslZmwkT+uWGMzXFl/poyew2SEfwo3boXrXgWA5IJ9fLRwA2PXZ QlLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YaC0edC7; 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 n1si4741749edv.429.2021.02.01.09.31.06; Mon, 01 Feb 2021 09:31:06 -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=YaC0edC7; 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 S231805AbhBAR3u (ORCPT + 7 others); Mon, 1 Feb 2021 12:29:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231475AbhBAR3h (ORCPT ); Mon, 1 Feb 2021 12:29:37 -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 966C3C0613ED for ; Mon, 1 Feb 2021 09:28:57 -0800 (PST) Received: by mail-io1-xd2a.google.com with SMTP id x21so18206468iog.10 for ; Mon, 01 Feb 2021 09:28:57 -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=YaC0edC7bZatVna8cq1y+F9Li8RsLiT8fGSwnT3dt2Q7EOGwF6UW+kFHEOf4E/+pZN Q8UcTWlzxyyi+YYpvCbrhV9MdhBK+dWAviD3Ju19eUoe0U5mJoavcL+6cYKatqkPo/dS TB5pDT+qne/Rt6Q7wBYzAcC+H2kRZ//tqPcR2HZLvEOGm3IyL5YXu9IIvymgnn6RGjxF LGE1A+QUOjxY4uOGxFLgvrh0mgHH8HT+oQtL9FuhlHaouRqik0s93nhGgD8AB+r/TrMT osgYCJiQuILQR5NbzXvBfpbTkpA1h98yTl4jmVvwKxfTQK7FWiuBVAQo6I6XW5JklakQ V+pw== 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=bLAPfWywyyjc7YYy518poqlPHll6S2bENVeGst+5H22dXOlGvhu529uM5BQBJzaYNi r2RJOIBVms0bqNsFKf8YWUcTWPW0zpK/AN02R48WYX58eA3o1eem6Unpnesn7kva+XRY wfkf5xkVDwcDNZ7X25t6nOw+k1XEBjUNyd1X6vco3g7k+3VC22iSMHkhKiTFlddcRrzu n5yF4pl8sEvhJAu9G8Zt3S22tgU4bEH59e8Pcr63nm150GbwR9PoMck6yyPEH8t86nU0 NcZSKNMOgm1CFW0LNzd3B8gTdwLibhqldx82vabk1Z6wNIeVgQAE7bkxmGBeQC6u0/bP iaIg== X-Gm-Message-State: AOAM532fcDWOrdQ4r5QyWV+2vUToaHkCSmZUU0B3bcQazX6Of/zd7aPe pcvqvfNpoyJsWzHoKwgX62W2hw== X-Received: by 2002:a5d:9ad4:: with SMTP id x20mr1836777ion.31.1612200537129; Mon, 01 Feb 2021 09:28:57 -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 v2sm9529856ilj.19.2021.02.01.09.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 09:28:56 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: willemdebruijn.kernel@gmail.com, 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: introduce gsi_channel_stop_retry() Date: Mon, 1 Feb 2021 11:28:45 -0600 Message-Id: <20210201172850.2221624-3-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210201172850.2221624-1-elder@linaro.org> References: <20210201172850.2221624-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 Mon Feb 1 17:28:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 374283 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1497006jah; Mon, 1 Feb 2021 09:32:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzAJAk9dp6SgswD7aNqgQfuK3Rvzdd6GZbtW8jqiNrKAdnmeX0IpZ3ebIC8c4bC1pdUtDVw X-Received: by 2002:a17:906:5002:: with SMTP id s2mr18357607ejj.16.1612200754565; Mon, 01 Feb 2021 09:32:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612200754; cv=none; d=google.com; s=arc-20160816; b=VdG8XJSGpLE2P6RCdtXy8/pkqpRjHQ5LclcwIclIHH42RW25AEdX0yhcsBEB+1RBYr fGRASqSI0inRFRXetjCXjA6qyrDy0EMy8K0248ZIioAtCXdD8n5qOaRBDF3KyoQkfOt9 LcmIEVkxHKUksEgKN6ZWQRVJF/qtrUuXLbLbgly/JTTjONViabsVTcQxSdg9YSBorh7g DWIr40dgNPswOf+bM9U+LnbshLphlbYv65RJ/FVFfkJAVA8AbPe2xHEtTg6VIVzv34YR eZrFq6gcYwtzfDJTI6n9xxeouBQ/hT48s3zGMRIxjiRyM2miVnZ1D+M2ADA8Xn15AFrB V5lg== 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=S6UrYR89rofy8hE7qWATkIkJyfK6GF/86I4qksnu9sI=; b=Bghkk4+dXluOls3EukLT8JoMZaC60bJj7eey15dHEWglPwkCbn4NjbrH0ItQ6yzVwk urROcbJoPoMkEi0XUNQiG3dKBQfxaDYYmTAUbeKiqBQP4kc2fGo2vwUbJV/Ay55o5mo3 zLvwG3wvbXuIL2eYXz1xTyDN14YMjg5oMyZ9EkBGVUxPEW5/bBMKAAiEk1DIN68eFLgc v2ilNy1ndkXaaR69Wzf/LSB+CWOWx8leD8ic+Up0VYLN+lH6Ne1n9+miRfKY1W4yEDKR /jEkkUGdZ6UjmF17q0L/zHuyHMT/gfgdSo26g+gz+zphKr8fha4g9TYBIS4iQu6Wpj6D 0V0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EnDETKm4; 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 q26si11344447edt.415.2021.02.01.09.32.34; Mon, 01 Feb 2021 09:32:34 -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=EnDETKm4; 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 S231949AbhBARac (ORCPT + 7 others); Mon, 1 Feb 2021 12:30:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230479AbhBARaU (ORCPT ); Mon, 1 Feb 2021 12:30:20 -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 F3C6EC061788 for ; Mon, 1 Feb 2021 09:28:58 -0800 (PST) Received: by mail-io1-xd2a.google.com with SMTP id s24so6662098iob.6 for ; Mon, 01 Feb 2021 09:28:58 -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=S6UrYR89rofy8hE7qWATkIkJyfK6GF/86I4qksnu9sI=; b=EnDETKm4J5LhZK4ej0H/mtR46vNCiJWFRQs8N3XLOT39eML1sFrccDex46b1mJJkj4 HzFY309+TQpXLC1RDIEVqVW5FxFbNH4C1xC09myhkYfxLa1k/zk3TCobP+qeeoVzbE9l Q4EAGBin9glOoxzh9dAal5ydMXVvgbsVvKP8WXyl2htHxC0bCzQJ97z6JOn+2SkY2N14 XBDX8RYGg29Jzt9zX3hifE9SXTFoPO76ZHD0TeDpl5b7QOvmB3fPbt+P2Q+SVILQkSU/ wK0nE0cC2sgIKYN0HckRq9+sBnTH3ryPFUYU+jc8myLl5ij5TXcq2kZv7ad9z6NEPDQa vD+w== 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=S6UrYR89rofy8hE7qWATkIkJyfK6GF/86I4qksnu9sI=; b=kcCrlAGMuSwUsHYW7u8gV94Vq3A3XRPTiqCj1tqW7P1vSKiI245BxoCg1RuHqH2kmS yMMC1eK+S320t/bhm1EQLQLlmrv5Oa44OEgblT677D2sjqETW3iD1f9vGgA++GljwCJF vqn+fpeSTTHmks65M/uCrkPq314Lkzz/9IaWPY1spI/pFQ1hgfyxlwcATQ/aGpvUBirt DxE11S97DQtK5FVgBvJFpD6n5075Ki+7DYsNWdS5xxJIAGhpNvsdPsk4VfFmSYEbF6Bt Oi+WyDt93mHd/LXbVfNXYPn2piIphj2H/SpLYq71ij6fWUUIlahPcNogCXDG+VSUmyos Is+Q== X-Gm-Message-State: AOAM533ASbIues5W+eOdgBz3I+/gaBnwk2kFSd1bbFoX9Zt18q6RENGt rtS5t4G3pDM5gHNvnk5njlf76w== X-Received: by 2002:a5e:840d:: with SMTP id h13mr13798860ioj.23.1612200538427; Mon, 01 Feb 2021 09:28:58 -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 v2sm9529856ilj.19.2021.02.01.09.28.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 09:28:57 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: willemdebruijn.kernel@gmail.com, 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 3/7] net: ipa: introduce __gsi_channel_start() Date: Mon, 1 Feb 2021 11:28:46 -0600 Message-Id: <20210201172850.2221624-4-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210201172850.2221624-1-elder@linaro.org> References: <20210201172850.2221624-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 started or not. 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, a completing I/O 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 Mon Feb 1 17:28:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 374284 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1498354jah; Mon, 1 Feb 2021 09:34:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJzC1gC057cPJhYY/nTdvIva5YBu7vW8yaFpRiymyhDApqR+fzSV/QZZKD6fiPijMVhbldre X-Received: by 2002:a17:906:b7c4:: with SMTP id fy4mr4043679ejb.84.1612200856067; Mon, 01 Feb 2021 09:34:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612200856; cv=none; d=google.com; s=arc-20160816; b=bLJCjvQhhZNaDlmEdP8KNYTW7BNHw2NJv+0fot13PtBi2MzYc+at09annto+y7Ro7s vgedY1uaE2hE8ADwzmU4T/U6+og+jya+D5+HedDGUZ51s08xcy3MUtXWh31tZDIfWj4j t2tpqV4bwZ9wJewIKz1wKRPc0j12wfyZ/vcnLuE6/4RBivDvrEMa8FjlNS2smCSqSFuv bnOZlpztx73guRN+kWMy08oI3ht66HgFpkQsnm7tYlH++S/RYLJWK8VKuIO6zqg0aSlV pw9LuntgF5ZYslGNHoZxPyCD8y45wBinhC8wNHSMV3UkQFJwawKXL6j46sh+t3CMExHz Uq5g== 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=L+hKOMogYoSAEzQS9I7hCg0ngLNbc+2JyWXdWXG68gP1Cj7HxRjG4PVVhpBB8T5Bfm gVLd+P+JSaY4yY+iQK6+MONf5NGXJATdo7//lGG9wgDnv6IGqWlCX7ZQHwooQhr1xsAj 2X7TkhgKCZ+Cv3ncUNrqmF3ScH72XnrkI8Qn4OmPoQESl520gL3HDA8OX3HDLzwzGITR le+C4oJ9n0X8xLa+0FokvWbZJTF7OYNNYWyayDKsJ8xjA21IqVnDwwSxlW1t7QkoiDmG N52IDOkLduJJkPeejkW9knHRFM2NQgjhlXKhTf31Yxlc85IHA9e3e6cBR3yJx79jjZ+Y ZMIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ghtetcHI; 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 de4si4526973edb.200.2021.02.01.09.34.15; Mon, 01 Feb 2021 09:34:16 -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=ghtetcHI; 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 S231664AbhBARds (ORCPT + 7 others); Mon, 1 Feb 2021 12:33:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231873AbhBARaV (ORCPT ); Mon, 1 Feb 2021 12:30:21 -0500 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43555C06178C for ; Mon, 1 Feb 2021 09:29:00 -0800 (PST) Received: by mail-il1-x135.google.com with SMTP id p8so16372472ilg.3 for ; Mon, 01 Feb 2021 09:29:00 -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=ghtetcHIUsxWLmMhZWewAvClfll7oHvu1j/xc8IPS0HcJyNq5OlSTlf67LdNXRauda rNnjFHJcIuCDYtdPZ/gCFKOQHko+47Fkmr6cxdHdlBRzwbIkywsrOR8jFFstxS0EmcQC Q99eaHWvJpIS0ymTMSIolQow6bbw838FLl9poUvhcN6Ot/EKcb0IjT9KenChGx7/T5TJ +RvGoXRc1NDH+xqfvAI6PEgwyG6L3W0uUyOoRSaeI+Ux8VhVqNz55KmzZUh9TEzZo1Hp GAN+UNGYDvWyR5VtEjG7I1CsqpSJpQmXpPvhIC5YfpQUw9+LTbbwrDDwNXf2WwU5WVj9 3IJg== 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=VPVbx02e5M6Mj01z40hFUMQyM2EDx59WGk5nXA3gAC4qaut4ZKrul+bVsNQjD4Hn46 W+Rh4BdCdkxb2dsV+ti98GuagPk6QoeLaN3LgPUSI5dUtfvM0ozzYN5t9e7+jRr9pviG P9Mur272wdedutfm0TgRuFsjLOxsktmdGkCHxY6okD6sdtZ9oQs8VJGXDxOTtlPgfpIw rRriycSqsODyA6X7sJQISlZNW9wxbHl6cUG17LYO9ulI+RdPoce7BUmXx6YyS+OWtEGy aZKppbbWAou1PyPEmntIz8tOVJPnUMN0Hs2QoOiBQhEs7z1ATZhR+6n0BgiXhS9hiJtf snxQ== X-Gm-Message-State: AOAM530cy88C8SrDAqYCmWDraFGEz40T9jT+77XCb1EbLYUNOv8992LZ mXQnKy5Eeob6oTA5MIWzGJ3Zfw== X-Received: by 2002:a92:d0d:: with SMTP id 13mr13492710iln.36.1612200539712; Mon, 01 Feb 2021 09:28:59 -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 v2sm9529856ilj.19.2021.02.01.09.28.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 09:28:59 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: willemdebruijn.kernel@gmail.com, 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 4/7] net: ipa: kill gsi_channel_freeze() and gsi_channel_thaw() Date: Mon, 1 Feb 2021 11:28:47 -0600 Message-Id: <20210201172850.2221624-5-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210201172850.2221624-1-elder@linaro.org> References: <20210201172850.2221624-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 Mon Feb 1 17:28:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 374285 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1498371jah; Mon, 1 Feb 2021 09:34:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJz8rjz67EaYOGyg2I3Z4aEZOdalqBlF7eNp5T+RxklWtFPYZ0fqgrfE4oex7131eRFVvfTh X-Received: by 2002:aa7:dc0d:: with SMTP id b13mr20144068edu.170.1612200856746; Mon, 01 Feb 2021 09:34:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612200856; cv=none; d=google.com; s=arc-20160816; b=S14DYTim/1e/AoPhEEQwAvYyAj73LdeTXG5onzqm/JwleMmBuFRvCrSgBywgR7BZNW QCeMrMyqFF1IaAZE8yqG8vRHwOp42DUsx4A3UvKXdzsTA50gEwo5bX1/BiQTSZTVlI5m qddE9w7lSrm1t1BRuphzWqpaiiOctFYo+/ZgIZ3AOJUL0NU7XRue+sdqVWoU16Bu6CM3 5GOdAojup/7ZMH65uxWtmPywHMk+aKJJQDI1ofNin5udSzRS5RFWaLvN910hcAjOs3Db MBoZrKKLMJxvUhiChhPFSyK7uKKtayERoCqc96Pg8vqQYBnixmPIbEg9tw28Ol43IkG0 kOzA== 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=AD7sJiqeRNIVKYtmxnmsyabUetsvJJmTXIczDFUxnes=; b=kdBXR6gEOi49e0Y5LkfA0+fL88vrDohtkQQ2/8giNtSfm+u+y1Ak/RgE5Ezngn4XFq 2VT49TfXEjtaYhYzesr56v2ANRJ1KD0HzXrKsui0MVjOdrZh8N/wnPUsAXh4Hq9acR02 QNBitECRogVgBaE1oNgVLPPxew0zSBv1GeXN3DYn89+6/hIdQ19mEujgeirsMbiTapR6 nlcGozz76TI92QUQDjbO1xpa82A6xm3IdnGN3HuimhylPUjw90csbRyrCOkp0wZglCcE rk6NNiD779L1f3z8qwHVoToCmhi2OUzE4o0OUjoSEQ36nXZiuyCNnyIUqCHLRIaVQmcT oM1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j0ZNpjxF; 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 de4si4526973edb.200.2021.02.01.09.34.16; Mon, 01 Feb 2021 09:34:16 -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=j0ZNpjxF; 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 S231907AbhBARd6 (ORCPT + 7 others); Mon, 1 Feb 2021 12:33:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231872AbhBARaV (ORCPT ); Mon, 1 Feb 2021 12:30:21 -0500 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFC10C061793 for ; Mon, 1 Feb 2021 09:29:01 -0800 (PST) Received: by mail-il1-x12a.google.com with SMTP id d6so16367633ilo.6 for ; Mon, 01 Feb 2021 09:29:01 -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=AD7sJiqeRNIVKYtmxnmsyabUetsvJJmTXIczDFUxnes=; b=j0ZNpjxFBP2YppUXpqlylkEtM0G6AwPuOwVc962pTU0wtZ0pfH+rl/2UiD5RinVsk2 9BKOVNgo3UoAEy2lKvayX3xIsUDH5n2AFvTXoEUd8RhvHK1w2K8mNp0CN1kUFx70feSP 9BTvoZpyU95S99+jEEuOarwPkJGC78QnCaoDFtIXMiRKfdylC9e39ICQBh/yNusj3beq FtnNFtqMnyiquX7EKXfXBDX0rHiwEBynmzuXGTDCeeVC02XCHbsoJGZQujh2wvL9sfOq 3mwRhjrGJCN2uSJ3fvA1peL0QkScFRrBBS8sVEsADr9C2LNkR7TpGpkAK4nA66/dM2xT 89Ig== 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=AD7sJiqeRNIVKYtmxnmsyabUetsvJJmTXIczDFUxnes=; b=OteNUV1J9VHW2wDcKnD21Fbxcb20Kp9EBlM1SCvF/ozJM38ndnOD3I5uxEOkqPvr9I P1k+ltgREPgtwh+v8LDyPTNg9kviQwsPOHxYiATntgt4VIHHmTHZn99TNRvnm4ToBJop bkvltc62I2uWWRRzCNVds4PZwY+d6gdpVwKh5By97xZDw+1z+TmohORx8AELwv72m2+H xxZpwnCCONp8RsLhNwO30PwI3usasm5Ly9iSf3IyXHX9TMqBq1Yc6WBXnh76QlpGf3tH kgWyKVq3zkoTrAGYqt7oEplzqS3zuTSZP35t7PPREdHPxJBpfEauJHv2x2qja2t1Ge84 R/hw== X-Gm-Message-State: AOAM5327GJWDkOzNL+Qz9BNZW+aSSeIRn85Khg13yegW40ygNLfU2mwN nUysdJubOk6/5IKMphD//EM0OHXxRkrksw== X-Received: by 2002:a05:6e02:1b84:: with SMTP id h4mr5304965ili.196.1612200541274; Mon, 01 Feb 2021 09:29:01 -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 v2sm9529856ilj.19.2021.02.01.09.28.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 09:29:00 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: willemdebruijn.kernel@gmail.com, 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 5/7] net: ipa: disable interrupt and NAPI after channel stop Date: Mon, 1 Feb 2021 11:28:48 -0600 Message-Id: <20210201172850.2221624-6-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210201172850.2221624-1-elder@linaro.org> References: <20210201172850.2221624-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Disable both the I/O completion interrupt and NAPI polling on a channel *after* we successfully stop it rather than before. This ensures a completion occurring just before the channel is stopped gets processed. Enable NAPI polling and the interrupt *before* starting a channel rather than after, to be symmetric. A stopped channel won't generate any completion interrupts anyway. Enable NAPI before the interrupt and disable it afterward. Signed-off-by: Alex Elder --- v2: Update code for *both* NAPI and the completion interrupt. drivers/net/ipa/gsi.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 565c785e33a25..93e1d29b28385 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -860,15 +860,18 @@ static int __gsi_channel_start(struct gsi_channel *channel, bool start) struct gsi *gsi = channel->gsi; int ret; + napi_enable(&channel->napi); + 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); - napi_enable(&channel->napi); + if (ret) { + gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id); + napi_disable(&channel->napi); } return ret; @@ -908,14 +911,11 @@ static int __gsi_channel_stop(struct gsi_channel *channel, bool stop) int ret; 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); - napi_enable(&channel->napi); + if (!ret) { + gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id); + napi_disable(&channel->napi); } return ret; From patchwork Mon Feb 1 17:28:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 374286 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1500052jah; Mon, 1 Feb 2021 09:36:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJyG6p9TLKHf+0WSL+sN4rnUXunPjmDGG1r8RL1WagnnoVu6X4Wfc/+SG84h5tHNn9Q0JtEF X-Received: by 2002:a17:907:948d:: with SMTP id dm13mr18442925ejc.545.1612200966360; Mon, 01 Feb 2021 09:36:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612200966; cv=none; d=google.com; s=arc-20160816; b=X+/XcvXQ9fQQnvffC3Z4XFIStSIHd7E0E39VOLt3qY0lZT4jOwNL7JSdxpTadnFPu4 b5i3eQFP5iHPpnzE22Lu20v6JIaezwmt0iUY0KQao9EeNDkji4lwiYTDwvBjRVMWbDMP g5QfrOqRvkP6h7wIofgTeBbtuWUeFj+LDI00mGgXyCQ+FNl+0hzsIX9Peaaiq6ycqLYm CrvIGcOKUobSHsxIDvZsZxi8Ozl0XVoFQnr8ar4JJDL/DepcZA9/w2Dty5oC61z4d3Y8 eNNrqWUWm0ss+3yCiRN4UP9fDIkRrVWXB81vxHyVjA1VCHMHvCylWLYp2BhcRzB4Sb91 Ql4A== 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=Q2ro88NuZQKHdsGWYPfuJW6JFivC14REhwCxv7lSOYY=; b=EdjFAbZdhFzM4L5PCXBWu1szcv2E2qpBUAdgEYluPtTa/1+rgdDdaibUpXZfWwLAGM HMxiWHuaOyO2AHbBV4jTh+ZgxXMq1O9Vbop+mZxTDTJPgx76OS3I3POi79IRw54AjZi4 lRahDaeQMuq8SE3Oyi+xdt0Dq3dbxYoUJsrJoGpQl5zKcxY2GqD77OuRYqBKAWCnNbx1 57UsZho/W77NIokCUbznC3ZAFGEm59sx/uATKIJFD41LGYhPXVGUiWKCDTgDwkKvTH1y jbxYmCi1xGDjHEdJ9fQPmmCT3Pj3vSECOT6HkiBZSBv+dGM9zRt1GVbwpoP6pBAvzLan tWkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fs7JGSWD; 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 dj5si3011896edb.450.2021.02.01.09.36.06; Mon, 01 Feb 2021 09:36:06 -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=fs7JGSWD; 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 S232157AbhBARed (ORCPT + 7 others); Mon, 1 Feb 2021 12:34:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231868AbhBARaV (ORCPT ); Mon, 1 Feb 2021 12:30:21 -0500 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4939C0617A7 for ; Mon, 1 Feb 2021 09:29:02 -0800 (PST) Received: by mail-il1-x134.google.com with SMTP id l4so16356198ilo.11 for ; Mon, 01 Feb 2021 09: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=Q2ro88NuZQKHdsGWYPfuJW6JFivC14REhwCxv7lSOYY=; b=fs7JGSWDk2DyIez9s7HBm2L8UFGxKDXrmGsbBnIVdKm37iRyP4KN93gtg94OPSLe+N Hysbo3Owd0YEQJJ6o/9qYf95tgzgdqwQgkPUHrVTve+ZUow6oC1EXxtQ1eH9wif6Nepc Z+J/XbVZtwEoyn93fOqGMq9iaG6U00Qok9genuDr34I8+dSZ34ZXOTZ4rptvk4OECSbe kSSlmlXDlxvZsEjMB2uk678TSpE4Fg1zbJm2unuaXChbtULDKtoDo/A0llwvNrtjObpy wPuCybocR5VM2bHTqmuZ9tSJMBFxU1iqRs0WBXfd0HURLfQboerUG7+qZs5VtcuUjyxi HQAw== 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=Q2ro88NuZQKHdsGWYPfuJW6JFivC14REhwCxv7lSOYY=; b=cjYmFjRV5UMM49NGgfXS7Vck/Wg1/nKTibA1y9OrMj9I/llirNnnSWSzTHHHchqd7C 3VKXzSnGuXlsWzcs66EB5lvPRTpIViGBHJhNl/1VeLPaobmIHU0qu2e2Iv7X85IIB4l+ ITKe8/NmY5FvIkuPCyaXhCr1NMDQSN0R17cqo74vcywp6pQWEuapjnEiPpJz9Ur8X0SU tAeLfL1YE2bocK5rbiETzKFm2Q7RvbaYZRIX/HVTgcmCj4qYCDwAcix7x6G2VB+CAEy/ 6iaNgFkq5vil/A73iKog6ssRPkP99bULjM611p2dGL+LEUEU1ThSWoCJ2HZTKVh0F4NL WrPg== X-Gm-Message-State: AOAM531+PmCCw0zE9rMVySDiftUiG0oCdGecjwRj9BNV2Fb+Kw6O9m08 rT1tWBsrFy72nKFOqmN8mgi8jg== X-Received: by 2002:a05:6e02:20ee:: with SMTP id q14mr13386584ilv.259.1612200542357; Mon, 01 Feb 2021 09:29:02 -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 v2sm9529856ilj.19.2021.02.01.09.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 09:29:01 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: willemdebruijn.kernel@gmail.com, 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 6/7] net: ipa: don't disable interrupt on suspend Date: Mon, 1 Feb 2021 11:28:49 -0600 Message-Id: <20210201172850.2221624-7-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210201172850.2221624-1-elder@linaro.org> References: <20210201172850.2221624-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, nor 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. Without any interrupts occurring, there is no need to disable/re-enable NAPI for channel suspend/resume either. We'll only enable NAPI and the interrupt when we first start the channel, and disable it again only when it's "really" stopped. To accomplish this, move the enable/disable calls out of __gsi_channel_start() and __gsi_channel_stop(), and into gsi_channel_start() and gsi_channel_stop() instead. Add a call to napi_synchronize() to gsi_channel_suspend(), to ensure NAPI polling is done before moving on. Signed-off-by: Alex Elder --- v2: Consolidate preparatory patch into the "real" one. v2: Update code for *both* NAPI and the completion interrupt. v2: Use common return path in gsi_channel_start(). drivers/net/ipa/gsi.c | 44 ++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 93e1d29b28385..03498182ad024 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -860,20 +860,15 @@ static int __gsi_channel_start(struct gsi_channel *channel, bool start) struct gsi *gsi = channel->gsi; int ret; - napi_enable(&channel->napi); - gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id); + 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) { - gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id); - napi_disable(&channel->napi); - } - return ret; } @@ -881,8 +876,19 @@ 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 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); + napi_disable(&channel->napi); + } + + return ret; } static int gsi_channel_stop_retry(struct gsi_channel *channel) @@ -907,16 +913,15 @@ 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; + /* Wait for any underway transactions to complete before stopping. */ gsi_channel_trans_quiesce(channel); ret = stop ? gsi_channel_stop_retry(channel) : 0; - if (!ret) { - gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id); - napi_disable(&channel->napi); - } + /* Finally, ensure NAPI polling has finished. */ + if (!ret) + napi_synchronize(&channel->napi); return ret; } @@ -925,8 +930,17 @@ 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) + 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 */ From patchwork Mon Feb 1 17: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: 374287 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1500059jah; Mon, 1 Feb 2021 09:36:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJzawNlmrhZQvsvOcw1h9+iKh54SgkrsJf//kXLEuROtYo4cET2pcniaKD2xASSq9rP+BIPE X-Received: by 2002:aa7:d754:: with SMTP id a20mr1101204eds.265.1612200966791; Mon, 01 Feb 2021 09:36:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612200966; cv=none; d=google.com; s=arc-20160816; b=GnK1VkAopI1ms4Ija6uZvcGsSUCW97Aw2Huz3ENBkEOv1TL2ly077yY0gma9wrS9Bt ckrFKCP2Lgirn3l7j+jts24/0NAMMCjdJM0rcE5AfO9JicluIG8GoUQfkgmJY4OzEY0Y POimY/S2i7RU+3HFOvyK766wy3N+vBjjxU2IE0MvDDi2Hn/t8V3zrs7X1nJB6XNXiOrU PDUaKDDczWDRB11NpuLo2KS7CF5/99k/CF0WmbQBNo4ZZ1Y1MwUZwHwBIEkVcNzfaDyI bzon+zXk12Ymu6SnmzIDgK0rd8PgvsooATeyrMCQqHtM3NOaF1o0pAnMM7+zTkRwLYg2 7Giw== 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=j/UQjfNJ3JWNq4bb7HzoAqoUGHmX5hqgPKQzmM+bjDk=; b=X7kiQwD1vjHhGCs1E4YZiUFSSIe+A9oY1NoRAcxwXgnfUeeTxw4iShMLnIefKjf8ng P8lL5vYa6eRalme9Ex1HKxul/K6JqONCpXiZUCKRvPiFpfs4CmwfVBUgVrFOo1LRZ1Uj 39ldlGz7EXMbWVhhXHWXKqYoJLZsOlox9zuQc6Ac3RnofKLJeD2laffmh0XnDr8AcmBA m1PUnK3rJoqugQmyNeLwNLpG0FhtpEZCxyf8p/Kbk7nVqaZdpnAdjdBHfGG3Y32xirji HadaQrvaNzarZzA8uT/ZCQE7IEljgqfx7/GJ78/dCDJpgYV49H6TMhM0oCE0R8hXtizK pwSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VyxQ5ara; 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 dj5si3011896edb.450.2021.02.01.09.36.06; Mon, 01 Feb 2021 09:36:06 -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=VyxQ5ara; 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 S229892AbhBAReV (ORCPT + 7 others); Mon, 1 Feb 2021 12:34:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231871AbhBARaV (ORCPT ); Mon, 1 Feb 2021 12:30:21 -0500 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F938C0617A9 for ; Mon, 1 Feb 2021 09:29:04 -0800 (PST) Received: by mail-il1-x12a.google.com with SMTP id e7so16346713ile.7 for ; Mon, 01 Feb 2021 09:29:04 -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=j/UQjfNJ3JWNq4bb7HzoAqoUGHmX5hqgPKQzmM+bjDk=; b=VyxQ5araa1L6Gf/nGTnvtNEb6ocPkU/Y50wsclb0mJSkeK1qMaoRhOHqM0A+Nhl+Bl zEmwH1xLfa657LIb5PDviN0SIvKBbiUm7rtUEomovKoXHN4X09i/fEp2YK9a32j7vsnG n2vOZaDlhuc5ewGN9dRXJ2aNR6jcq0dnkGnnVUCdPXlC2bRWy4dUvQBlTOD9XRVHD3zK DUhCrdA3Y+YIkseLTfU8gjBXlINJKmc6PMSSn8zePJTjBpPux7D3L3tZCBVBUpPCGEhR ngmLONTuuo/tcFpa7iOlTWsWmRfGvWvIUsrJ+yZRR+3jOcFmYKfasvu87touskpJC+Jw tMhw== 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=j/UQjfNJ3JWNq4bb7HzoAqoUGHmX5hqgPKQzmM+bjDk=; b=nW3ZVDjANspMuFoIicZsp/Z77ZUCG2Tc5i73k8Jr5Cjav7n9JpwsnCf3V5Ptq5sgHh HrRu0WhGyq/Skp7fSGQiv9PZioHtIooRebqnKSxNF9ovoEAgia8Jj/c0CodMZ0Iytrv5 tHI17IobSxbTXA5bhq8i2akb85gpK2YLTjNtnML74DFBCaUhs2LX8HcenzTVAGVf3p9a yXR55DacTvNWou93UiVdGMxO4/1xSwo6eekHHNg25/0Q8x7mfywfJQuNwOYoG59rGusC r0BAc6KyX6otOdV1m0dUtilTtJnNQy0tYWrVlM3iNqX2gfPtYG9B5VrQ5D9fqcA8gGdb G15A== X-Gm-Message-State: AOAM530acXGWqj19E+5LTbfwG7FE3BApgy5A9Fv6qknF8diXROzx6m4H ODGIR/PiYwyvuLszGC0KeXgDag== X-Received: by 2002:a05:6e02:1d09:: with SMTP id i9mr13862591ila.207.1612200543565; Mon, 01 Feb 2021 09:29:03 -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 v2sm9529856ilj.19.2021.02.01.09.29.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 09:29:02 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: willemdebruijn.kernel@gmail.com, 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 7/7] net: ipa: expand last transaction check Date: Mon, 1 Feb 2021 11:28:50 -0600 Message-Id: <20210201172850.2221624-8-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210201172850.2221624-1-elder@linaro.org> References: <20210201172850.2221624-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 03498182ad024..8b64cbe4737a4 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)