Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp793678iog; Mon, 13 Jun 2022 13:08:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tSXuQ1ZxaHwgZg9RE8SJUFl+QOgxZkQSiVv55mRbN5sQFoVPmeOa62J3PczJuH9dvd1rLN X-Received: by 2002:a17:902:e746:b0:164:1974:e46c with SMTP id p6-20020a170902e74600b001641974e46cmr957101plf.139.1655150890065; Mon, 13 Jun 2022 13:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655150890; cv=none; d=google.com; s=arc-20160816; b=HFeO3P60Jge6TbkAOkVbEhcYhqM5Qn2jEksTJWjCLUDpj4PP+D+IYILJdfaMDUQbXg OVPEXe8p49kTB9i92m3/74aCNS33n1JnSr9bgHudPg5oilQDWiGxCGk+Z4a7tBrqLl0f 1B1aYoljJYM8AfizDDSVYE8VRC+xug0hnzFWnIihyxxTJ949qYD7x0WYl1XzAs5dQ4hH JLDhuktRnW95GQEoJIMGce6TczC6+kkEYEk8Ne3NQtoYq0c5z+HmNqYOy9YJHNmjAcN4 3HyQGZEJ6ri0RBRWtUD30y18zrCZruIChYK/jlzOXDkATAsAfAnOEqo1e1VEApwri2ok 3vIg== 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=xzqDsv8rtz2ntmcXP4PLB6njoMFSh8lVBgrQ9sAi0RI=; b=SLiZZ+UJht/ArT6/Vcm6n8h0EnIEHIu6njav1LkQQw35NCUCj2MxUnJEnvsTU9Ss97 FAJzdCweEPgqcOFSbIGXWcEvHBCpdTaT43AEyX+UxgsHhHgVNVWesCsjJhepiXc1gilL oUjd5HWGb0KlNf/LLE8NuH2Z1IbIU3HB52BZMsyXq0fObU3b2l9gbNMacnFTe0v6p2hk k8Ut0Ss9K8v672rnnFOyy7Q9G9yUue9tj3NAdx+7T42CXBFPPC1paKvhTZFiLQr/vkO7 1DJwiQhGXxY5SC9IGtQl5VPN7ayb8fXeaT6vZI6cElv27iScOXcCTJnl3AKj47mi96VG k4Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lkveocfu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d16-20020a170903231000b0016641fc434asi12398938plh.190.2022.06.13.13.07.57; Mon, 13 Jun 2022 13:08:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lkveocfu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S1349787AbiFMTWx (ORCPT + 99 others); Mon, 13 Jun 2022 15:22:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349162AbiFMTVj (ORCPT ); Mon, 13 Jun 2022 15:21:39 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5246211A1D for ; Mon, 13 Jun 2022 10:18:11 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id g16-20020a17090a7d1000b001ea9f820449so4774000pjl.5 for ; Mon, 13 Jun 2022 10:18:11 -0700 (PDT) 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=xzqDsv8rtz2ntmcXP4PLB6njoMFSh8lVBgrQ9sAi0RI=; b=LkveocfuKKqxyt9m9cKzjRpx55OA9njIHmeO7J/rmpVv/eQ7lyZNJbx2vLCJR1IKQ+ eiaz9Ohld7Dk02cgTBzZ6oAIlH0qIqmrHEzsxnT/e+CLn9HVwpbuXImqNpeYUpHBiXVy FRzlEWlJLhN6/cs1vp9fNR2mWDM5h75IBgPJe15tQ+onkyTJCZfmO8lBvleiRrsz0Bda M1H6pW0r2rgNWQ0MvvGh1I4Cf8GkbcZOSzcXxs8nJbBTS1z0ap+2SkNDATbYgRfqHhgh qNyDeMuPO4W4t2W0oG5EQPonrMF2moXpJ7CLGup3ilMPoH16dgLCAGJf/XUVJUQiqAZN P6mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xzqDsv8rtz2ntmcXP4PLB6njoMFSh8lVBgrQ9sAi0RI=; b=cKJ6FgVfXNjNzKXe8VhABRp+5HgCTtfzGB7EXCn/KCDT3YAUmBz+XeMgrtYKMNXLlA ZHjNBV29z/Er62oF49mb40a695xZTouKd8xsTN8uWWwg1U+IH7QuDixbtxkh8GAZDErl mCnqdUYI8FzQ1WXppeeQRAdrgzoiSmPl/+kFhl+18VaFzZ48+ohzNvRAY2HsKotAneDp vO+pB/epU92iBEnzxLr4DRo4OinhJNn1KpHxNiZCGvehZgtSRU4egAb7ahf0/q3mcED0 ZP31uoHAObdfqO3AFDwPS4Uxjv/6V3Sv4sbr9TC5pnFnJBYnhMRlVRhVvmPB2nkI26XN NTxQ== X-Gm-Message-State: AJIora+fUFHJ4V2FAPgj863PZrO8Dr09hoVlt/8kSA+5APYzh/F+16g0 j7rLjmkwTjL4xpPgPd3lHep96A== X-Received: by 2002:a17:90b:3701:b0:1ea:9f82:59ef with SMTP id mg1-20020a17090b370100b001ea9f8259efmr810334pjb.239.1655140690712; Mon, 13 Jun 2022 10:18:10 -0700 (PDT) Received: from localhost.localdomain ([192.77.111.2]) by smtp.gmail.com with ESMTPSA id u17-20020a62d451000000b0050dc762812csm5646641pfl.6.2022.06.13.10.18.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jun 2022 10:18:10 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, evgreen@chromium.org, bjorn.andersson@linaro.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/6] net: ipa: simplify TX completion statistics Date: Mon, 13 Jun 2022 12:17:57 -0500 Message-Id: <20220613171759.578856-5-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220613171759.578856-1-elder@linaro.org> References: <20220613171759.578856-1-elder@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a TX request is issued, its channel's accumulated byte and transaction counts are recorded. This currently does *not* take into account the transaction being committed. Later, when the transaction completes, the number of bytes and transactions that have completed since the transaction was committed are reported to the network stack. The transaction and its byte count are accounted for at that time. Instead, record the transaction and its bytes in the counts recorded at commit time. This avoids the need to do so when the transaction completes, and provides a (small) simplification of that code. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 1091ac23567d5..4f8187c543824 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -995,11 +995,11 @@ void gsi_trans_tx_committed(struct gsi_trans *trans) { struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id]; - trans->trans_count = channel->trans_count; - trans->byte_count = channel->byte_count; - channel->trans_count++; channel->byte_count += trans->len; + + trans->trans_count = channel->trans_count; + trans->byte_count = channel->byte_count; } void gsi_trans_tx_queued(struct gsi_trans *trans) @@ -1047,13 +1047,11 @@ void gsi_trans_tx_queued(struct gsi_trans *trans) static void gsi_channel_tx_update(struct gsi_channel *channel, struct gsi_trans *trans) { - u64 byte_count = trans->byte_count + trans->len; - u64 trans_count = trans->trans_count + 1; + u64 trans_count = trans->trans_count - channel->compl_trans_count; + u64 byte_count = trans->byte_count - channel->compl_byte_count; - byte_count -= channel->compl_byte_count; - channel->compl_byte_count += byte_count; - trans_count -= channel->compl_trans_count; channel->compl_trans_count += trans_count; + channel->compl_byte_count += byte_count; ipa_gsi_channel_tx_completed(channel->gsi, gsi_channel_id(channel), trans_count, byte_count); -- 2.34.1