From patchwork Thu Jan 21 11:48: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: 367826 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp497295jam; Thu, 21 Jan 2021 03:56:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBHtjS77BqD+qtiR66D9cZcuNPGfbTtY15e7KchZgHpx28J8ZMfG/Pt8CNZ7pscg4oidyf X-Received: by 2002:a50:cdc8:: with SMTP id h8mr1681587edj.293.1611230175448; 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=ZrvuUZCKcafVcrZxftEjOWTIyajYxXnM0s9o6tQpc7iG/EgBUvinwbBQ8uJVM4wRi8 +iYCgj5gCAiPQSSPNDKx0gChRpxB2pPaiaqVglrQWYx7SZUf4VYyS+JxZhHdzOJsUZUt EcKltaw1IHSMmJoV2YMf1AOYTRg798MI1st66GIcLfanFha1VFh5PlQi/Ydbt2cP11v8 oL1frl5vrsXVXSDf7kCCOS8tjOFZv/W3wG3UWBMyXFXJM5UY7NOLWUy6NhRvYY/F+Zpk vwlHMyJswFCSIQUL7Uq4Y8RzPCdiZma2whQibep04QRH4gRpLEBYwlnpoIzES8HGgalE RyQQ== 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=G8bjLZpoNIzOiv6PkD0iZ3h3ctPEFqZsMrd34LvNS2U=; b=z0T1INxt1+7UX+TxEoGvbN0Y8sGk+wozqJym9eGuvZCbbR39Ph0uR2MJvFfnB3XeCQ U4oOds7/Zdd/wVTY1hqiI2inSsDwqEq7Eq8rRwPecGeTTWCr8QmGHjVu6DlZef5C5Pil WUa0+Bibkb4s+wbCYIiVI1B9t/E7rcYogm/BeBHP2OkMPzhGmj3w5+WTZAreCbix1XIx i2F+DeBEp6CA9rvaJA2Poo1jTfqtpdYfX6cq1iDNwGIfPoPj24ChL/WrOxCH0QUoX6Pa pB5/aENbk70qC8xpNF77Hkyo+5DfdI35ZeYrz4GP9rVMj/pc5pUurETsU+2YOXJB6xBA fJHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JAFtsJX4; 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=JAFtsJX4; 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 S1730706AbhAULzP (ORCPT + 7 others); Thu, 21 Jan 2021 06:55:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730789AbhAULtI (ORCPT ); Thu, 21 Jan 2021 06:49:08 -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 8A092C0613CF for ; Thu, 21 Jan 2021 03:48:26 -0800 (PST) Received: by mail-io1-xd29.google.com with SMTP id d81so3378448iof.3 for ; Thu, 21 Jan 2021 03:48: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=G8bjLZpoNIzOiv6PkD0iZ3h3ctPEFqZsMrd34LvNS2U=; b=JAFtsJX4NG1ehyjtn4swO/HcsgonIYApimTOBD7fbZ9tIigJYaY/JUxrpOotUR/PzP jDeiPwxedRzEvUGtRCjQZMWVX73vHZO3kctNZcWeLjrRh2P8IOeaX/jGkEhFCh3tW0lL MI2HeR8e6xBFvtT5R+H4lqjqD5h6BqzhNc9X2deLpWCopIZSPSAFWfcXvGPGXLKDCrRp 0DtMV50E2Qfh5WSvjZF7QsCpOsQyFJBheLSAhNAP45XB1eblAqhxjNhHof2kc6ghBDL3 F5c4jIy4QNdQ89ps3HFOVHCPF4nKOUarcUFgxOlb3lIMFLzPF4n4YQ0hchwQ2jZoFZbs Km2A== 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=G8bjLZpoNIzOiv6PkD0iZ3h3ctPEFqZsMrd34LvNS2U=; b=BeUaN1Tf5WsmJe+H9nIrxnFXPB4UahibRv8S7OOgy6tZOm4kIAokj9H+jRuBo88lMP gHUFz+pf7uqyvu+Mn8Jao+SJxCqceRgiHQrVj3GF+C4OQBsMNXd86sS9q2J0TOQkJHuG CL/7TnbEfi8pthyLGu46387/IH6Vw072YfPSi4KVFXB+h8TQKk9dRlHns2Gt8Xa8jPDL 1nSQ3F3gM+ga9WwbbDqI0G0oLEdU6opGnIOVjEEndYT0dcU+shQk7s96mIzWgwL4r5VH Uj5vPRLcRCBIifrY1ZIpdM6kYE9d0NxSqt3iXlcQa/ctfbafqGuQshPL/SGupwDDwys3 lg+A== X-Gm-Message-State: AOAM532XRAtLtq3nxh4qL8EEgPiJArsdWT/93T0eKyR/aeme1Ao1SlNG 8ZinOY3X756RuQINgnNQChmdO4Ce2ELkfw== X-Received: by 2002:a92:8587:: with SMTP id f129mr11964455ilh.119.1611229705925; Thu, 21 Jan 2021 03:48:25 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jan 2021 03:48: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 v2 1/5] net: ipa: count actual work done in gsi_channel_poll() Date: Thu, 21 Jan 2021 05:48:17 -0600 Message-Id: <20210121114821.26495-2-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 There is an off-by-one problem in gsi_channel_poll(). The count of transactions completed is incremented each time through the loop *before* determining whether there is any more work to do. As a result, if we exit the loop early the counter its value is one more than the number of transactions actually processed. Instead, increment the count after processing, to ensure it reflects the number of processed transactions. The result is more naturally described as a for loop rather than a while loop, so change that. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 5b29f7d9d6ac1..56a5eb61b20c4 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -1543,13 +1543,12 @@ static struct gsi_trans *gsi_channel_poll_one(struct gsi_channel *channel) static int gsi_channel_poll(struct napi_struct *napi, int budget) { struct gsi_channel *channel; - int count = 0; + int count; channel = container_of(napi, struct gsi_channel, napi); - while (count < budget) { + for (count = 0; count < budget; count++) { struct gsi_trans *trans; - count++; trans = gsi_channel_poll_one(channel); if (!trans) break;