Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1515138iol; Fri, 10 Jun 2022 09:01:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHV1uemnVPaxVh4MWiaZEwp936hTsGnWhknwEcycq+Y2x6m2+Wq4jtBzKzLnokrTc8rnGr X-Received: by 2002:a05:6402:23a2:b0:42d:d5f1:d470 with SMTP id j34-20020a05640223a200b0042dd5f1d470mr38472656eda.365.1654876919316; Fri, 10 Jun 2022 09:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654876919; cv=none; d=google.com; s=arc-20160816; b=H5tnJp0XjlrBmhohifRcw4t44M7yuD2bVwUWxooZQr7s6IJOa8OodHyIUCXJlVuTiR wOPY9vSGot8qbdUi4IlyL5qUoNM6K4d/rQ3Qau6lVBiqGhqUNvIyhw+L1UMTPm3UrdPz Ia0DEuUNyTp5jOiLCllfGptUgd9cMdD34EG19z3/AJKqSfSpFiOjtmOPJ4uTvm5Bmi/a eXkm4MEKkbAQBd2ZhLik2DhOR/R4pQH2vThob1ixrfh2kwdRSk+09T/RaROe5WFjozF7 Wfa6EVHAM95WDV0Ow8rnkq+YUUcthzs/QwT4sEjcMHIbj395F1EBZjDJNSpSEtYGBMps LTXQ== 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=rzg7Iow9fAmaKgsdU7mGzgw2dtvwGPhEQmm7lb2v2dI=; b=YkmSmr2tEgCR3mZbsX6B4hwew90urvxVAzLwRkPyC8y2BbDeVH9Fvzo05mwCJhqLSz XpjG4MuyWb/V1YC9aTPAoQljLS+8PKsfHo0o2Yju9E/v43pkAm/+uNljjqJ+Xo0IACm5 3iQqOxAAx8wp5Y5Dyst00/3EGk8tmUa7sNy4Bg659GKfqy07mCA5V2E6zZsG7y1ZoK61 aGx8ZcWxnqctHVQOyJFTgFrXOfWnCHeXMtCQvwQMC4gBZLxwYnSx71LG4jBXJp6KSs7n BO6A+Ti9pXGRnDHO3V00moEXPceGdkzZZg5ND6zs+ZZSxX6qFLJt/n/c9tUH6nFcIbmx AOoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Go3UU13R; 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 p20-20020a17090628d400b006feb8cc461esi11843743ejd.416.2022.06.10.09.01.30; Fri, 10 Jun 2022 09:01:59 -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=Go3UU13R; 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 S234911AbiFJPrV (ORCPT + 99 others); Fri, 10 Jun 2022 11:47:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346087AbiFJPq3 (ORCPT ); Fri, 10 Jun 2022 11:46:29 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20C8858E53 for ; Fri, 10 Jun 2022 08:46:26 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id d123so6695007iof.10 for ; Fri, 10 Jun 2022 08:46:26 -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=rzg7Iow9fAmaKgsdU7mGzgw2dtvwGPhEQmm7lb2v2dI=; b=Go3UU13RUL7Su3WFcFQZEQWn19aFNSiLMT4iZEqcX5aXxDh7U8Gg9rTXlMFcHMpOZ+ 0gHSPaiNYkNQujued/pPga7cYZNSq0DXDatYShLZXacJ7r/609m2c1xqjf513rhDAHi3 nf0WsnhopAGSDvCjKYrP/8t7+uhMOi9FVn9PYZ8soB5Os10HWdYQdYp6Atym4N5SdRPR 3/i8pF++h1oaRthygyMqzgxNRr6PsE3TH2F8Ik2VLWJjl9yua8b9Kfs0J+ZIz6tu0dUU jEFWqR9X96G/JWqNo3HyZmfYGWOrTKyNUfY3gBENo3tEuMWkQ3iQU2R/8/sWTuyKlijP iEoA== 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=rzg7Iow9fAmaKgsdU7mGzgw2dtvwGPhEQmm7lb2v2dI=; b=igl+uT5/1gx5lNGD+Df4zQ/MtdzDfolgQcjdE2mmJllG4983SOgYt3jvU2fyMNx8L9 RhKId//jdzGEuaP6PXkSfJPHuoAkbfUjQrIEbVyZPK5u2jFiMPN1sjQnmA3nD4JXMrTH 1NkAz7Cre3geAacMopTDo1eKpEfLdYIo73zUodZEyHww3yhVsEivAQvn5JFcJ/HFb6h4 W1Wi/kFqE5txLa8eIb+Q0GiMhFw/XdAQt0T1pxY7UFTcT1W1lA+GdM4BT4ZkzkmypKs9 jazrUAY1Q1DRSwY8iXlqjaTOerReHD5gh0jjfxf1Uc5rXdjE+pt7jFjPdL/wIZlVsdGs M6Kg== X-Gm-Message-State: AOAM533cHbORGuoIS7NJ/ES/vDhO1vkEvRCDP0QIhD4d+wg+EJn+BqM0 /MlfrNPpLnRKtKMZ5V/gVHM0+g== X-Received: by 2002:a05:6638:1346:b0:331:b571:9fd6 with SMTP id u6-20020a056638134600b00331b5719fd6mr14413045jad.266.1654875985510; Fri, 10 Jun 2022 08:46:25 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id y15-20020a92950f000000b002d3adf71893sm12100488ilh.20.2022.06.10.08.46.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 08:46:25 -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 6/6] net: ipa: derive channel from transaction Date: Fri, 10 Jun 2022 10:46:15 -0500 Message-Id: <20220610154616.249304-7-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220610154616.249304-1-elder@linaro.org> References: <20220610154616.249304-1-elder@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 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 In gsi_channel_tx_queued(), we report when a transaction gets passed to hardware. Change that function so it takes transaction rather than a channel as its argument, and derive the channel from the transaction. Rename the function accordingly. Delete the header comments above the function definition; the ones above the declaration in "gsi_private.h" should suffice. In addition, the comments above gsi_channel_tx_update() do a fine job of explaining what's going on. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 28 +++++++--------------------- drivers/net/ipa/gsi_private.h | 12 +++++------- drivers/net/ipa/gsi_trans.c | 2 +- 3 files changed, 13 insertions(+), 29 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 64417668b8a9a..5b446d2a07c8a 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -991,36 +991,22 @@ void gsi_resume(struct gsi *gsi) enable_irq(gsi->irq); } -/** - * gsi_channel_tx_queued() - Report queued TX transfers for a channel - * @channel: Channel for which to report - * - * Report to the network stack the number of bytes and transactions that - * have been queued to hardware since last call. This and the next function - * supply information used by the network stack for throttling. - * - * For each channel we track the number of transactions used and bytes of - * data those transactions represent. We also track what those values are - * each time this function is called. Subtracting the two tells us - * the number of bytes and transactions that have been added between - * successive calls. - * - * Calling this each time we ring the channel doorbell allows us to - * provide accurate information to the network stack about how much - * work we've given the hardware at any point in time. - */ -void gsi_channel_tx_queued(struct gsi_channel *channel) +void gsi_trans_tx_queued(struct gsi_trans *trans) { + u32 channel_id = trans->channel_id; + struct gsi *gsi = trans->gsi; + struct gsi_channel *channel; u32 trans_count; u32 byte_count; + channel = &gsi->channel[channel_id]; + byte_count = channel->byte_count - channel->queued_byte_count; trans_count = channel->trans_count - channel->queued_trans_count; channel->queued_byte_count = channel->byte_count; channel->queued_trans_count = channel->trans_count; - ipa_gsi_channel_tx_queued(channel->gsi, gsi_channel_id(channel), - trans_count, byte_count); + ipa_gsi_channel_tx_queued(gsi, channel_id, trans_count, byte_count); } /** diff --git a/drivers/net/ipa/gsi_private.h b/drivers/net/ipa/gsi_private.h index ea333a244cf5e..56450a1899074 100644 --- a/drivers/net/ipa/gsi_private.h +++ b/drivers/net/ipa/gsi_private.h @@ -105,14 +105,12 @@ void gsi_channel_doorbell(struct gsi_channel *channel); void *gsi_ring_virt(struct gsi_ring *ring, u32 index); /** - * gsi_channel_tx_queued() - Report the number of bytes queued to hardware - * @channel: Channel whose bytes have been queued + * gsi_trans_tx_queued() - Report a queued TX channel transaction + * @trans: Transaction being passed to hardware * - * This arranges for the the number of transactions and bytes for - * transfer that have been queued to hardware to be reported. It - * passes this information up the network stack so it can be used to - * throttle transmissions. + * Report to the network stack that a TX transaction is being supplied + * to the hardware. */ -void gsi_channel_tx_queued(struct gsi_channel *channel); +void gsi_trans_tx_queued(struct gsi_trans *trans); #endif /* _GSI_PRIVATE_H_ */ diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c index 870a4c1752838..278e467c5430b 100644 --- a/drivers/net/ipa/gsi_trans.c +++ b/drivers/net/ipa/gsi_trans.c @@ -603,7 +603,7 @@ static void __gsi_trans_commit(struct gsi_trans *trans, bool ring_db) if (ring_db || !atomic_read(&channel->trans_info.tre_avail)) { /* Report what we're handing off to hardware for TX channels */ if (channel->toward_ipa) - gsi_channel_tx_queued(channel); + gsi_trans_tx_queued(trans); gsi_channel_doorbell(channel); } } -- 2.34.1