From patchwork Thu Jan 21 11:48: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: 367827 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp497299jam; Thu, 21 Jan 2021 03:56:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJxe/QqtAjBK3iHrz/pQUHx+k2DCFhLjonYJUR6nQihaySzz5Or64drLHPdPfs4JDNoBSTEZ X-Received: by 2002:aa7:c308:: with SMTP id l8mr11190255edq.246.1611230175822; Thu, 21 Jan 2021 03:56:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611230175; cv=none; d=google.com; s=arc-20160816; b=YFgO9mCFpSLSkUcjWhYybvSo2ULrSoFDBmS1YLh3WmhGHJKUvaN3gooMGq3CH2Mx4E uoy6pfH+LsaTag9FKCB/m+MXL8LDTzj9pmRGKUuVqR5COJXzRmYjjIbsedHif9id4xJD 1O/UdT/zIrIP2tTWsX6OmeJ7QlrrvcdH0sl/OZIXzTzswiusF5IUO6REOKbZlHLjWeTR f15s3ZETq+aldwk3n7r36GpONCyuw1XC2urQv7jjsYL5UpsCAJU1/G9zL4RCeFrec5Zk V+RXFTcYyLvEHsZQQ7Kl8Y5Ci7J4IqcirfNIcDtTmZ4KgDojw8Rm8bL6z40rIJu+FGVV hHvQ== 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=lB7a5cRodpbpGb/+6TS9nogIS/hSgl+bcWuo7lSLV6I=; b=taB66k1UStrfDkMU6xYg7dIsVBQBHv/s/BB6iDBHe3esD2TFrJTVyo8xfbQ9+KjkEn j/RKw2H7azZpdInglxNl4As69iQqzbapzSI/wmY0f9UeK216s/Zc4fQCWc6+z0m1+p9O xVyof4USryYDb96fqu2dEz6/igk5+JQiqOvaw5NsM/so3kCswJIg5z5t8hOKNm86q1GV dOGUuA/2YKQpsAewGdS2zcRklljUTGicqtK2M8Olvc7eDawHXq9x64dV2fjcsCeV3nWn O40baib/QfXpI0ldIxBr7R1mlwvRBRbe3WQws3L8cqFJQPs6ZPQe96bxJg+4O26S2BeF O3/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TZOGTIjV; 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 js1si1693967ejc.88.2021.01.21.03.56.15; Thu, 21 Jan 2021 03:56:15 -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=TZOGTIjV; 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 S1730801AbhAULz1 (ORCPT + 7 others); Thu, 21 Jan 2021 06:55:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730849AbhAULt4 (ORCPT ); Thu, 21 Jan 2021 06:49:56 -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 8EB57C061786 for ; Thu, 21 Jan 2021 03:48:28 -0800 (PST) Received: by mail-io1-xd2a.google.com with SMTP id e22so3368643iom.5 for ; Thu, 21 Jan 2021 03:48: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=lB7a5cRodpbpGb/+6TS9nogIS/hSgl+bcWuo7lSLV6I=; b=TZOGTIjV+H03KgIz69zU7KTj3IXoyXgRRTOVe++ketr0sARbl8xJe3yneNmzr+VKT0 RIATGg9tYV+y3+3o3LOe8XVizpY+jv0GiDTmUXZdxIamIVlEXzv38Ro4OJhjiWXv8x2C FQ2k9I/gWte1WsL0an9l5lqIyXoNmIL6dsvGVJRlQBOV4haNZaNH50K+aG8sopmtgpLo 8nhEsgjC/mlb1XNunkblS/8d8nOGVakFsDnPDXVgqMjOxKmOsFs9izi1wVdAVvJVJhGb NLHv/vT81WPx2tby6Yx0bAXj32YDzGrDkQAwbibIC4hwGAr1TP93/GQqK+ftbTng7bIl K81g== 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=lB7a5cRodpbpGb/+6TS9nogIS/hSgl+bcWuo7lSLV6I=; b=SX3KoFzlP4d871HOYGgL+6MAXc1PLzD45ye1RRFySTS8x7O85fiHw9PjQoS7Suj/Dj f0bykhKS5GLeMU4M9tVr/C2R7C7qc/2yZZOANycI21LKoufGr4d37h0GK1Q1KbpT84OV uqrmN/sGfT1XpbuIeblMnPCGNR+RSkGr7CwtEPmjBZ4ses7Cw5Vq0TulTC+o6NS3+BD0 ut/9PbBBhDWfMDZqnYpLMH7SpTb9bcdJ6hb8LTAvXcQ2K2ag4lwNT/DlM4bATMusWkk+ 5A8M7L8s3Mxe6lonzsPM7tl4OYnFleNrGMb9Lzt6ERKmkvunQpSdypOFHivgWVV4YL/X FxTg== X-Gm-Message-State: AOAM531IJxOf2k+5PnAKf9NQJYafNFyJM7RyiKWDtU9cb61xl0ZVLzre c6Lm8/4bjvqszKN9EkycjnsKeScWexHOZw== X-Received: by 2002:a92:cccd:: with SMTP id u13mr11747369ilq.273.1611229707990; Thu, 21 Jan 2021 03:48:27 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id p5sm2762766ilm.80.2021.01.21.03.48.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jan 2021 03:48:27 -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 v2 3/5] net: ipa: have gsi_channel_update() return a value Date: Thu, 21 Jan 2021 05:48:19 -0600 Message-Id: <20210121114821.26495-4-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210121114821.26495-1-elder@linaro.org> References: <20210121114821.26495-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Have gsi_channel_update() return the first transaction in the updated completed transaction list, or NULL if no new transactions have been added. Signed-off-by: Alex Elder --- v2: Do not drop the static keyword that limits the function scope. drivers/net/ipa/gsi.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 634f514e861e7..6e5817e16c0f6 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -1452,7 +1452,7 @@ void gsi_channel_doorbell(struct gsi_channel *channel) } /* Consult hardware, move any newly completed transactions to completed list */ -static void gsi_channel_update(struct gsi_channel *channel) +static struct gsi_trans *gsi_channel_update(struct gsi_channel *channel) { u32 evt_ring_id = channel->evt_ring_id; struct gsi *gsi = channel->gsi; @@ -1471,7 +1471,7 @@ static void gsi_channel_update(struct gsi_channel *channel) offset = GSI_EV_CH_E_CNTXT_4_OFFSET(evt_ring_id); index = gsi_ring_index(ring, ioread32(gsi->virt + offset)); if (index == ring->index % ring->count) - return; + return NULL; /* Get the transaction for the latest completed event. Take a * reference to keep it from completing before we give the events @@ -1496,6 +1496,8 @@ static void gsi_channel_update(struct gsi_channel *channel) gsi_evt_ring_doorbell(channel->gsi, channel->evt_ring_id, index); gsi_trans_free(trans); + + return gsi_channel_trans_complete(channel); } /** @@ -1516,11 +1518,8 @@ static struct gsi_trans *gsi_channel_poll_one(struct gsi_channel *channel) /* Get the first transaction from the completed list */ trans = gsi_channel_trans_complete(channel); - if (!trans) { - /* List is empty; see if there's more to do */ - gsi_channel_update(channel); - trans = gsi_channel_trans_complete(channel); - } + if (!trans) /* List is empty; see if there's more to do */ + trans = gsi_channel_update(channel); if (trans) gsi_trans_move_polled(trans);