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; } /**