From nobody Mon Apr 27 12:16:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A313C43334 for ; Mon, 13 Jun 2022 19:22:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349606AbiFMTWg (ORCPT ); Mon, 13 Jun 2022 15:22:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348960AbiFMTVf (ORCPT ); Mon, 13 Jun 2022 15:21:35 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A5F932052 for ; Mon, 13 Jun 2022 10:18:06 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id e66so6102817pgc.8 for ; Mon, 13 Jun 2022 10:18:06 -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=KwXY14Kz4g2aCYAhdgeSpgsRv05HFkaBSKgnXrsuDCI=; b=xeagx102iZADD8vk/6snUp2Y6cRGsNv1mAD7IDjympqVvYfiMzNOk4WBMCsM6E9Rz8 gF8d0YMOQgauc99u+zhhag3P3yCbc/6E4Ei3febosxzlesH6c3f788NXi/7RMSIvnqmG px7Rwwj0v8R83vIycU1S4BZ5RaQXjCHu/t/eKH5N0SFbQSQ99TEsxcTvg0LumocszxhO hrqLphG+9rCcGVZ/aMdesKL8hx4+q+TFbvjSp7PChzG8DXmDNNILcqbcLR6O5pstSjeI iHidJpc1F7ZEu/i5qxDboqUs9QOUiviEH/A6JrfgcIbpGUMFPTNy4ysSTMDWXV43gmWH WnHg== 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=KwXY14Kz4g2aCYAhdgeSpgsRv05HFkaBSKgnXrsuDCI=; b=fPd9xDukr4tGV/0dPHNCCq9xr4Ua/Bhtx3GPW/cJImKhhpcpm+ep+kmBvMRIKcA6F5 REmNBh1guAyUwixXObK8RBIJ9SPj0WZ0p4ViueEEPjUZnsROfUDOx5hMluVZh8OCS9Q1 nIKmVV+iAHdHwwO3hljQONNaCSzfEJRnmiLrI9cqgAoxONKM9TgwAV3CnR/cLeo+K7PE 89NJ8YnVdVYb3cl3zT0CoLlLB49Zq7X7cnco6F5eqgj30ISU8n0BlWiYXuBIsoI4oSwo 5WUnl8CqLUxWKn3IFciZG8FckZSGHG7oczXd32DcvXczSrrL+9/PNTWjhC8Bmqp6PoKq w9/g== X-Gm-Message-State: AOAM530XzbDbvZ3ftFA6VXeY5ZaQ0KvVewjJXw3ivarPBnsQz70M5ej9 TuYPw7hvYclcVDLMSc7sNSLEMA== X-Google-Smtp-Source: ABdhPJzUzxhI0lhys4D/Olq54dljejhmpv3sYwLxkp0naQcvqNQRnmbZmw8PvLIUp9jxtrK1HaCR+A== X-Received: by 2002:a63:894a:0:b0:3fc:a724:578c with SMTP id v71-20020a63894a000000b003fca724578cmr530868pgd.499.1655140685485; Mon, 13 Jun 2022 10:18:05 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jun 2022 10:18:05 -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 1/6] net: ipa: use "tre_ring" for all TRE ring local variables Date: Mon, 13 Jun 2022 12:17:54 -0500 Message-Id: <20220613171759.578856-2-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" All local variables that represent event rings are named "ring". All but two functions that represent a channel's TRE ring with a local variable use the name "tre_ring". For consistency, use that name in the two functions that don't fit the pattern. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi_trans.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c index 278e467c5430b..e3f3c736c7409 100644 --- a/drivers/net/ipa/gsi_trans.c +++ b/drivers/net/ipa/gsi_trans.c @@ -549,7 +549,7 @@ static void gsi_trans_tre_fill(struct gsi_tre *dest_tre= , dma_addr_t addr, static void __gsi_trans_commit(struct gsi_trans *trans, bool ring_db) { struct gsi_channel *channel =3D &trans->gsi->channel[trans->channel_id]; - struct gsi_ring *ring =3D &channel->tre_ring; + struct gsi_ring *tre_ring =3D &channel->tre_ring; enum ipa_cmd_opcode opcode =3D IPA_CMD_NONE; bool bei =3D channel->toward_ipa; struct gsi_tre *dest_tre; @@ -567,8 +567,8 @@ static void __gsi_trans_commit(struct gsi_trans *trans,= bool ring_db) * transfer request, whose opcode is IPA_CMD_NONE. */ cmd_opcode =3D channel->command ? &trans->cmd_opcode[0] : NULL; - avail =3D ring->count - ring->index % ring->count; - dest_tre =3D gsi_ring_virt(ring, ring->index); + avail =3D tre_ring->count - tre_ring->index % tre_ring->count; + dest_tre =3D gsi_ring_virt(tre_ring, tre_ring->index); for_each_sg(trans->sgl, sg, trans->used, i) { bool last_tre =3D i =3D=3D trans->used - 1; dma_addr_t addr =3D sg_dma_address(sg); @@ -576,14 +576,14 @@ static void __gsi_trans_commit(struct gsi_trans *tran= s, bool ring_db) =20 byte_count +=3D len; if (!avail--) - dest_tre =3D gsi_ring_virt(ring, 0); + dest_tre =3D gsi_ring_virt(tre_ring, 0); if (cmd_opcode) opcode =3D *cmd_opcode++; =20 gsi_trans_tre_fill(dest_tre, addr, len, last_tre, bei, opcode); dest_tre++; } - ring->index +=3D trans->used; + tre_ring->index +=3D trans->used; =20 if (channel->toward_ipa) { /* We record TX bytes when they are sent */ @@ -595,7 +595,7 @@ static void __gsi_trans_commit(struct gsi_trans *trans,= bool ring_db) } =20 /* Associate the last TRE with the transaction */ - gsi_channel_trans_map(channel, ring->index - 1, trans); + gsi_channel_trans_map(channel, tre_ring->index - 1, trans); =20 gsi_trans_move_pending(trans); =20 @@ -675,7 +675,7 @@ void gsi_channel_trans_cancel_pending(struct gsi_channe= l *channel) int gsi_trans_read_byte(struct gsi *gsi, u32 channel_id, dma_addr_t addr) { struct gsi_channel *channel =3D &gsi->channel[channel_id]; - struct gsi_ring *ring =3D &channel->tre_ring; + struct gsi_ring *tre_ring =3D &channel->tre_ring; struct gsi_trans_info *trans_info; struct gsi_tre *dest_tre; =20 @@ -687,10 +687,10 @@ int gsi_trans_read_byte(struct gsi *gsi, u32 channel_= id, dma_addr_t addr) =20 /* Now fill the the reserved TRE and tell the hardware */ =20 - dest_tre =3D gsi_ring_virt(ring, ring->index); + dest_tre =3D gsi_ring_virt(tre_ring, tre_ring->index); gsi_trans_tre_fill(dest_tre, addr, 1, true, false, IPA_CMD_NONE); =20 - ring->index++; + tre_ring->index++; gsi_channel_doorbell(channel); =20 return 0; --=20 2.34.1 From nobody Mon Apr 27 12:16:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 324F7C43334 for ; Mon, 13 Jun 2022 19:22:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349640AbiFMTWj (ORCPT ); Mon, 13 Jun 2022 15:22:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347036AbiFMTVf (ORCPT ); Mon, 13 Jun 2022 15:21:35 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7A062018E for ; Mon, 13 Jun 2022 10:18:07 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id t3-20020a17090a510300b001ea87ef9a3dso6578389pjh.4 for ; Mon, 13 Jun 2022 10:18:07 -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=WtNMojkay1TGl3veVsLBCL1IdXBJpZKRASa03E0Bjrk=; b=bD24dxGKfFGeICbVrf9DLa7VMCKl7hRiega5n95H/eRXArWOFPAijUtmC8XnhIs344 MVS8fyo8pPj1M5rKcmAnIfOYtcwbNMqSL9vZYMTaVwB7idEGvuS5UPOwdvUVHTkf7WJI Qp+dfmBTkTqZbhSL4lQM14CfJl2WjLkE+csJXn8gFOLD75H8Swz0u6USqEWWaVkjm6Ir 2/OhGrtbDgC1d6vVjwqGaPGgaD0FDt3cs/mmmwQIbZgb6rkSPupDSE0bCOBWjBmYkjIU tIYwarv0ZUhF0HKlinhT4RsfcZbijiu0esNDtQvbMFuiey8l6572d2ljoHbCPNklFv7j cTrA== 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=WtNMojkay1TGl3veVsLBCL1IdXBJpZKRASa03E0Bjrk=; b=rtqGWvI+2mZSb7K4FD9X+nkzxnq+C5D4PNyqc56wrgrGsfcz3ECaacen7J2ilDW6k6 w9gwVzhJD4b2q9OM7HnABgTB03aeNJ3/G95qm6fUq8PLfSIxxEhRNcsQXhJ8mKh/0BT9 a2PRhcIFG1slVEgf7lRoeCdd4LLWgjcsf6cKdxnkWqp5mtpHSnjd95VWOrfgzMs33B/p vMYfGi1Tc5gHEeGbbZfL9ksV1gPx/dm8hHEbt72sHEFrXHgPZxffuNQtROW2E/UjZ9jg xGQr5i8j1Xcte2pyWHR1o9LYtY64GE4TUUiBprRycv5aORo9+MZOiLsEZ8cgxvl9JMcx FsSg== X-Gm-Message-State: AJIora+eZitxb2a7u4QLIj8KmgOSO0d3hXIDADTW3Id7cjEoFdD8z/b9 odgO6RLDTsZFuLSlmB8UdVlsQQ== X-Google-Smtp-Source: AGRyM1v/xmb1YOfRGIydVrWS4Zge68b0oTo5AEN1qZItO+KXP82nbbG7O45y1BuRTZIM0E+/iHssfA== X-Received: by 2002:a17:902:bf45:b0:15c:df47:3d6 with SMTP id u5-20020a170902bf4500b0015cdf4703d6mr347304pls.58.1655140687192; Mon, 13 Jun 2022 10:18:07 -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.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jun 2022 10:18:06 -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 2/6] net: ipa: rename two transaction fields Date: Mon, 13 Jun 2022 12:17:55 -0500 Message-Id: <20220613171759.578856-3-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" There are two fields in a GSI transaction that keep track of TRE counts. The first represents the number of TREs reserved for the transaction in the TRE ring; that's currently named "tre_count". The second is the number of TREs that are actually *used* by the transaction at the time it is committed. Rename the "tre_count" field to be "rsvd_count", to make its meaning a little more specific. The "_count" is present in the name mainly to avoid interpreting it as a reserved (not-to-be-used) field. This name also distinguishes it from the "tre_count" field associated with a channel. Rename the "used" field to be "used_count", to match the convention used for reserved TREs. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi_trans.c | 41 +++++++++++++++++++------------------ drivers/net/ipa/gsi_trans.h | 8 ++++---- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c index e3f3c736c7409..986857eb39296 100644 --- a/drivers/net/ipa/gsi_trans.c +++ b/drivers/net/ipa/gsi_trans.c @@ -355,7 +355,7 @@ struct gsi_trans *gsi_channel_trans_alloc(struct gsi *g= si, u32 channel_id, trans =3D gsi_trans_pool_alloc(&trans_info->pool, 1); trans->gsi =3D gsi; trans->channel_id =3D channel_id; - trans->tre_count =3D tre_count; + trans->rsvd_count =3D tre_count; init_completion(&trans->completion); =20 /* Allocate the scatterlist and (if requested) info entries. */ @@ -405,17 +405,17 @@ void gsi_trans_free(struct gsi_trans *trans) /* Releasing the reserved TREs implicitly frees the sgl[] and * (if present) info[] arrays, plus the transaction itself. */ - gsi_trans_tre_release(trans_info, trans->tre_count); + gsi_trans_tre_release(trans_info, trans->rsvd_count); } =20 /* Add an immediate command to a transaction */ void gsi_trans_cmd_add(struct gsi_trans *trans, void *buf, u32 size, dma_addr_t addr, enum ipa_cmd_opcode opcode) { - u32 which =3D trans->used++; + u32 which =3D trans->used_count++; struct scatterlist *sg; =20 - WARN_ON(which >=3D trans->tre_count); + WARN_ON(which >=3D trans->rsvd_count); =20 /* Commands are quite different from data transfer requests. * Their payloads come from a pool whose memory is allocated @@ -446,9 +446,9 @@ int gsi_trans_page_add(struct gsi_trans *trans, struct = page *page, u32 size, struct scatterlist *sg =3D &trans->sgl[0]; int ret; =20 - if (WARN_ON(trans->tre_count !=3D 1)) + if (WARN_ON(trans->rsvd_count !=3D 1)) return -EINVAL; - if (WARN_ON(trans->used)) + if (WARN_ON(trans->used_count)) return -EINVAL; =20 sg_set_page(sg, page, size, offset); @@ -456,7 +456,7 @@ int gsi_trans_page_add(struct gsi_trans *trans, struct = page *page, u32 size, if (!ret) return -ENOMEM; =20 - trans->used++; /* Transaction now owns the (DMA mapped) page */ + trans->used_count++; /* Transaction now owns the (DMA mapped) page */ =20 return 0; } @@ -465,25 +465,26 @@ int gsi_trans_page_add(struct gsi_trans *trans, struc= t page *page, u32 size, int gsi_trans_skb_add(struct gsi_trans *trans, struct sk_buff *skb) { struct scatterlist *sg =3D &trans->sgl[0]; - u32 used; + u32 used_count; int ret; =20 - if (WARN_ON(trans->tre_count !=3D 1)) + if (WARN_ON(trans->rsvd_count !=3D 1)) return -EINVAL; - if (WARN_ON(trans->used)) + if (WARN_ON(trans->used_count)) return -EINVAL; =20 /* skb->len will not be 0 (checked early) */ ret =3D skb_to_sgvec(skb, sg, 0, skb->len); if (ret < 0) return ret; - used =3D ret; + used_count =3D ret; =20 - ret =3D dma_map_sg(trans->gsi->dev, sg, used, trans->direction); + ret =3D dma_map_sg(trans->gsi->dev, sg, used_count, trans->direction); if (!ret) return -ENOMEM; =20 - trans->used +=3D used; /* Transaction now owns the (DMA mapped) skb */ + /* Transaction now owns the (DMA mapped) skb */ + trans->used_count +=3D used_count; =20 return 0; } @@ -559,7 +560,7 @@ static void __gsi_trans_commit(struct gsi_trans *trans,= bool ring_db) u32 avail; u32 i; =20 - WARN_ON(!trans->used); + WARN_ON(!trans->used_count); =20 /* Consume the entries. If we cross the end of the ring while * filling them we'll switch to the beginning to finish. @@ -569,8 +570,8 @@ static void __gsi_trans_commit(struct gsi_trans *trans,= bool ring_db) cmd_opcode =3D channel->command ? &trans->cmd_opcode[0] : NULL; avail =3D tre_ring->count - tre_ring->index % tre_ring->count; dest_tre =3D gsi_ring_virt(tre_ring, tre_ring->index); - for_each_sg(trans->sgl, sg, trans->used, i) { - bool last_tre =3D i =3D=3D trans->used - 1; + for_each_sg(trans->sgl, sg, trans->used_count, i) { + bool last_tre =3D i =3D=3D trans->used_count - 1; dma_addr_t addr =3D sg_dma_address(sg); u32 len =3D sg_dma_len(sg); =20 @@ -583,7 +584,7 @@ static void __gsi_trans_commit(struct gsi_trans *trans,= bool ring_db) gsi_trans_tre_fill(dest_tre, addr, len, last_tre, bei, opcode); dest_tre++; } - tre_ring->index +=3D trans->used; + tre_ring->index +=3D trans->used_count; =20 if (channel->toward_ipa) { /* We record TX bytes when they are sent */ @@ -611,7 +612,7 @@ static void __gsi_trans_commit(struct gsi_trans *trans,= bool ring_db) /* Commit a GSI transaction */ void gsi_trans_commit(struct gsi_trans *trans, bool ring_db) { - if (trans->used) + if (trans->used_count) __gsi_trans_commit(trans, ring_db); else gsi_trans_free(trans); @@ -620,7 +621,7 @@ void gsi_trans_commit(struct gsi_trans *trans, bool rin= g_db) /* Commit a GSI transaction and wait for it to complete */ void gsi_trans_commit_wait(struct gsi_trans *trans) { - if (!trans->used) + if (!trans->used_count) goto out_trans_free; =20 refcount_inc(&trans->refcount); @@ -638,7 +639,7 @@ void gsi_trans_complete(struct gsi_trans *trans) { /* If the entire SGL was mapped when added, unmap it now */ if (trans->direction !=3D DMA_NONE) - dma_unmap_sg(trans->gsi->dev, trans->sgl, trans->used, + dma_unmap_sg(trans->gsi->dev, trans->sgl, trans->used_count, trans->direction); =20 ipa_gsi_trans_complete(trans); diff --git a/drivers/net/ipa/gsi_trans.h b/drivers/net/ipa/gsi_trans.h index 020c3b32de1d7..b5f80250ca006 100644 --- a/drivers/net/ipa/gsi_trans.h +++ b/drivers/net/ipa/gsi_trans.h @@ -33,8 +33,8 @@ struct gsi_trans_pool; * @gsi: GSI pointer * @channel_id: Channel number transaction is associated with * @cancelled: If set by the core code, transaction was cancelled - * @tre_count: Number of TREs reserved for this transaction - * @used: Number of TREs *used* (could be less than tre_count) + * @rsvd_count: Number of TREs reserved for this transaction + * @used_count: Number of TREs *used* (could be less than rsvd_count) * @len: Total # of transfer bytes represented in sgl[] (set by core) * @data: Preserved but not touched by the core transaction code * @cmd_opcode: Array of command opcodes (command channel only) @@ -56,8 +56,8 @@ struct gsi_trans { =20 bool cancelled; /* true if transaction was cancelled */ =20 - u8 tre_count; /* # TREs requested */ - u8 used; /* # entries used in sgl[] */ + u8 rsvd_count; /* # TREs requested */ + u8 used_count; /* # entries used in sgl[] */ u32 len; /* total # bytes across sgl[] */ =20 union { --=20 2.34.1 From nobody Mon Apr 27 12:16:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 875A6C433EF for ; Mon, 13 Jun 2022 19:22:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349763AbiFMTWt (ORCPT ); Mon, 13 Jun 2022 15:22:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348458AbiFMTVh (ORCPT ); Mon, 13 Jun 2022 15:21:37 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87BEE13D52 for ; Mon, 13 Jun 2022 10:18:09 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id 31so4466125pgv.11 for ; Mon, 13 Jun 2022 10:18:09 -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=E83xgHGBSlrea3RuRNnmqu56ICtmNe3QaOTQd1XRhUI=; b=tzG6BM+baSkEPI4er+Nz+huiMvaIlnP8LzlHaV3xyVOnFP7ZqVRuoupLMBwr56xZ05 NvbZ67hvGY6+DrHEeHtorK8TfFe3mUu590VgPhZGENKFb3+FMZqtPSJaQG7tNBlkJZcl SNMIphuVrVSEreNDIAu13lc3fXRidszhKXlRXSn8RCFkNSpBzqpnf+II0sQLxdwmhUpY PQraqwpVPDAsLbm7A8Le1Od6+gGW7naHHqTeH8kggT5HEBIq6GopqKgejHeC6Y9KuSBC 7Yll/LVgaP3YCjT5lKA9zqRHmmtI9nb2wuqRMjGPbhEfke5e+FVOoAwj6Swgc09oYuP0 323Q== 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=E83xgHGBSlrea3RuRNnmqu56ICtmNe3QaOTQd1XRhUI=; b=NN0owpXYJZVxFIYOat3cyNewT5rdQpUF7/z9huAiRTN0fhHSakLy5b8uyMfAUHXZ4g XXRIMRBHTyRZVI7GiVgwN61UcsuZJBqFTRuup3jdircWHqNFN1rZCSanGX3AnSj+bi2n oXrP+Q0Vrb7IXasrC1OnvKVhtw/Vj4oIsPyLWecVWX0yfIV5lzLGTml1TBdrUtXgk0wK MXeww0nFL5+BJTeEiCrJJnKpgPePiNg1fAH7GOInDkhSCnXgi+Jf1WHrlN/WHtGpy65j LnZvDuycUrgmwpd/A1zBQS5U+yiChPKG/Z3lE2o8x/b9L59YOkROfLGJdX+X6TDnm8ho tj2w== X-Gm-Message-State: AOAM53340DzgWC8vbKiNNM9qcfcrzAMbezGulPdAITO9JtXAKAGZ939D xxZRQqUA4klK/sIZYqZFgAUFfg== X-Google-Smtp-Source: ABdhPJxvKkxI4ovaeSFS1/tZfofauDJd1SGhM+GSw9nJetd2y/4vx7vszEcxop4IOQxgxVzTgzDVrA== X-Received: by 2002:a63:24c7:0:b0:3fc:5c99:a196 with SMTP id k190-20020a6324c7000000b003fc5c99a196mr526249pgk.521.1655140688993; Mon, 13 Jun 2022 10:18:08 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jun 2022 10:18:08 -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 3/6] net: ipa: introduce gsi_trans_tx_committed() Date: Mon, 13 Jun 2022 12:17:56 -0500 Message-Id: <20220613171759.578856-4-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Create a new function that encapsulates recording information needed for TX channel statistics when a transaction is committed. Record the accumulated length in the transaction before the call (for both RX and TX), so it can be used when updating TX statistics. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 11 +++++++++++ drivers/net/ipa/gsi_private.h | 9 +++++++++ drivers/net/ipa/gsi_trans.c | 11 +++-------- drivers/net/ipa/gsi_trans.h | 7 ++++--- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 5b446d2a07c8a..1091ac23567d5 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -991,6 +991,17 @@ void gsi_resume(struct gsi *gsi) enable_irq(gsi->irq); } =20 +void gsi_trans_tx_committed(struct gsi_trans *trans) +{ + struct gsi_channel *channel =3D &trans->gsi->channel[trans->channel_id]; + + trans->trans_count =3D channel->trans_count; + trans->byte_count =3D channel->byte_count; + + channel->trans_count++; + channel->byte_count +=3D trans->len; +} + void gsi_trans_tx_queued(struct gsi_trans *trans) { u32 channel_id =3D trans->channel_id; diff --git a/drivers/net/ipa/gsi_private.h b/drivers/net/ipa/gsi_private.h index 56450a1899074..74cbc287fc715 100644 --- a/drivers/net/ipa/gsi_private.h +++ b/drivers/net/ipa/gsi_private.h @@ -104,6 +104,15 @@ void gsi_channel_doorbell(struct gsi_channel *channel); */ void *gsi_ring_virt(struct gsi_ring *ring, u32 index); =20 +/** + * gsi_trans_tx_committed() - Record bytes committed for transmit + * @trans: TX endpoint transaction being committed + * + * Report that a TX transaction has been committed. It updates some + * statistics used to manage transmit rates. + */ +void gsi_trans_tx_committed(struct gsi_trans *trans); + /** * gsi_trans_tx_queued() - Report a queued TX channel transaction * @trans: Transaction being passed to hardware diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c index 986857eb39296..a110be72f70b6 100644 --- a/drivers/net/ipa/gsi_trans.c +++ b/drivers/net/ipa/gsi_trans.c @@ -586,14 +586,9 @@ static void __gsi_trans_commit(struct gsi_trans *trans= , bool ring_db) } tre_ring->index +=3D trans->used_count; =20 - if (channel->toward_ipa) { - /* We record TX bytes when they are sent */ - trans->len =3D byte_count; - trans->trans_count =3D channel->trans_count; - trans->byte_count =3D channel->byte_count; - channel->trans_count++; - channel->byte_count +=3D byte_count; - } + trans->len =3D byte_count; + if (channel->toward_ipa) + gsi_trans_tx_committed(trans); =20 /* Associate the last TRE with the transaction */ gsi_channel_trans_map(channel, tre_ring->index - 1, trans); diff --git a/drivers/net/ipa/gsi_trans.h b/drivers/net/ipa/gsi_trans.h index b5f80250ca006..7084507830c21 100644 --- a/drivers/net/ipa/gsi_trans.h +++ b/drivers/net/ipa/gsi_trans.h @@ -35,7 +35,7 @@ struct gsi_trans_pool; * @cancelled: If set by the core code, transaction was cancelled * @rsvd_count: Number of TREs reserved for this transaction * @used_count: Number of TREs *used* (could be less than rsvd_count) - * @len: Total # of transfer bytes represented in sgl[] (set by core) + * @len: Number of bytes sent or received by the transaction * @data: Preserved but not touched by the core transaction code * @cmd_opcode: Array of command opcodes (command channel only) * @sgl: An array of scatter/gather entries managed by core code @@ -45,8 +45,9 @@ struct gsi_trans_pool; * @byte_count: TX channel byte count recorded when transaction committed * @trans_count: Channel transaction count when committed (for BQL account= ing) * - * The size used for some fields in this structure were chosen to ensure - * the full structure size is no larger than 128 bytes. + * The @len field is set when the transaction is committed. For RX + * transactions it is updated later to reflect the actual number of bytes + * received. */ struct gsi_trans { struct list_head links; /* gsi_channel lists */ --=20 2.34.1 From nobody Mon Apr 27 12:16:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9678CC433EF for ; Mon, 13 Jun 2022 19:22:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349802AbiFMTWy (ORCPT ); Mon, 13 Jun 2022 15:22:54 -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-Google-Smtp-Source: AGRyM1tbugpngnjnsVxDW/H2h+O7cqrQ4cPBWb75KKvzvcsQ4VozsdbIv0BdVetKwulfcfrTLtHVPw== 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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 =3D &trans->gsi->channel[trans->channel_id]; =20 - trans->trans_count =3D channel->trans_count; - trans->byte_count =3D channel->byte_count; - channel->trans_count++; channel->byte_count +=3D trans->len; + + trans->trans_count =3D channel->trans_count; + trans->byte_count =3D channel->byte_count; } =20 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 =3D trans->byte_count + trans->len; - u64 trans_count =3D trans->trans_count + 1; + u64 trans_count =3D trans->trans_count - channel->compl_trans_count; + u64 byte_count =3D trans->byte_count - channel->compl_byte_count; =20 - byte_count -=3D channel->compl_byte_count; - channel->compl_byte_count +=3D byte_count; - trans_count -=3D channel->compl_trans_count; channel->compl_trans_count +=3D trans_count; + channel->compl_byte_count +=3D byte_count; =20 ipa_gsi_channel_tx_completed(channel->gsi, gsi_channel_id(channel), trans_count, byte_count); --=20 2.34.1 From nobody Mon Apr 27 12:16:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9C4CC433EF for ; Mon, 13 Jun 2022 19:24:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349454AbiFMTYR (ORCPT ); Mon, 13 Jun 2022 15:24:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349535AbiFMTWU (ORCPT ); Mon, 13 Jun 2022 15:22:20 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF90032072 for ; Mon, 13 Jun 2022 10:18:12 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id g10-20020a17090a708a00b001ea8aadd42bso6631616pjk.0 for ; Mon, 13 Jun 2022 10:18:12 -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=qCvC/gb8V8fECBsNeP2ccfvKaZ3jzeuxKm8/lAah6es=; b=JeWQv4aSZy+O2cZxsGMbsgJn5bVOigH7tXE9IA96vfg6/XH7Rm8GbjyIelcLUNrrSc hTatJU8NTiUKeILq/kNFHf4VeFZHJNUnBcwmlDMBiQQtq7IkqFTSXQ9mAFz7KH7Bl+2h XwyNU57gxcooV0RfxWHiZ6jaBchMhPmOkUqDpPTmShFDiFy6XobZN2quWxaaAzyEMm00 7p5Tbggf16ga4S+n9v9p71pLhN1uRuX+cFw1JZ4yVIa+A64wQHYeJW7Xqvr0IxySdN9b VbH9FL+sk450DH8fJQsmf3Mizt2npnc7sjtOnKuAPiRyoYGIXD2ABP29Vjwk9QZt+mKu t8/w== 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=qCvC/gb8V8fECBsNeP2ccfvKaZ3jzeuxKm8/lAah6es=; b=L29gUr/eDyI9JFAELDiZkKn+UFWAp20Z7KNACMazp1zS7bT5k3lHK1LTaY5OdKsv8I hLw6N8fhrARRKEQWDZLX5+644Y07/kg1GprD0QOi2hOdsz+NixjX8kbTnkJE6dmYrRwA zLAJml+PLx4qttVKMzoCv4fOdGGdP9sqVXRFUVGqziKWiqdk+IkEaaiAZnEyCi9b5Fve Qm30KVWDsUo7/Q9js+l558ejH5gEWGEqVKRNYve69MNkc8hizd1ap5wlkQqhfF/dlW72 pYErgdl3jXjS/mQcUcCOBqes/rhOZZ8jBzaDM6AfXFRJeXdeXcKP0SHxfuEiH8vEZdol KH1Q== X-Gm-Message-State: AOAM530xg7/EGTgpqw5Z4n6kXy1F37LZMEPEKb4xG/g9XHbPjWWony4C CtuXVmDmAGYcAFIjrCthIR7Jfg== X-Google-Smtp-Source: ABdhPJxC7vKhUUaEoHFlVYvxzF/159YMTOwsQ5llqhN5liF2o40yzwFWPyP6C9y5PqyS9XtL4XqiSg== X-Received: by 2002:a17:90b:a53:b0:1ea:750e:93db with SMTP id gw19-20020a17090b0a5300b001ea750e93dbmr17143228pjb.66.1655140692442; Mon, 13 Jun 2022 10:18:12 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jun 2022 10:18:12 -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 5/6] net: ipa: stop counting total RX bytes and transactions Date: Mon, 13 Jun 2022 12:17:58 -0500 Message-Id: <20220613171759.578856-6-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" In gsi_evt_ring_rx_update(), we update each transaction so its len field reflects the actual number of bytes received. In the process, the total number of transactions and bytes processed on the channel are summed, and added to a running total for the channel. But we don't actually use those running totals for RX endpoints. They're maintained for TX channels to support CoDel when they are associated with a "real" network device. So stop maintaining these totals for RX endpoints, and update the comment where the fields are defined to make it clear they're only valid for TX channels. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 8 -------- drivers/net/ipa/gsi.h | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 4f8187c543824..c2cafd9247a70 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -1374,8 +1374,6 @@ static void gsi_evt_ring_rx_update(struct gsi_evt_rin= g *evt_ring, u32 index) struct gsi_event *event_done; struct gsi_event *event; struct gsi_trans *trans; - u32 trans_count =3D 0; - u32 byte_count =3D 0; u32 event_avail; u32 old_index; =20 @@ -1399,8 +1397,6 @@ static void gsi_evt_ring_rx_update(struct gsi_evt_rin= g *evt_ring, u32 index) event_done =3D gsi_ring_virt(ring, index); do { trans->len =3D __le16_to_cpu(event->len); - byte_count +=3D trans->len; - trans_count++; =20 /* Move on to the next event and transaction */ if (--event_avail) @@ -1409,10 +1405,6 @@ static void gsi_evt_ring_rx_update(struct gsi_evt_ri= ng *evt_ring, u32 index) event =3D gsi_ring_virt(ring, 0); trans =3D gsi_trans_pool_next(&trans_info->pool, trans); } while (event !=3D event_done); - - /* We record RX bytes when they are received */ - channel->byte_count +=3D byte_count; - channel->trans_count +=3D trans_count; } =20 /* Initialize a ring, including allocating DMA memory for its entries */ diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h index 89dac7fc8c4cb..bad1a78a96ede 100644 --- a/drivers/net/ipa/gsi.h +++ b/drivers/net/ipa/gsi.h @@ -117,9 +117,9 @@ struct gsi_channel { struct gsi_ring tre_ring; u32 evt_ring_id; =20 + /* The following counts are used only for TX endpoints */ u64 byte_count; /* total # bytes transferred */ u64 trans_count; /* total # transactions */ - /* The following counts are used only for TX endpoints */ u64 queued_byte_count; /* last reported queued byte count */ u64 queued_trans_count; /* ...and queued trans count */ u64 compl_byte_count; /* last reported completed byte count */ --=20 2.34.1 From nobody Mon Apr 27 12:16:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E1B5C433EF for ; Mon, 13 Jun 2022 19:23:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349825AbiFMTW6 (ORCPT ); Mon, 13 Jun 2022 15:22:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349185AbiFMTVk (ORCPT ); Mon, 13 Jun 2022 15:21:40 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9675326FD for ; Mon, 13 Jun 2022 10:18:14 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id c196so6329546pfb.1 for ; Mon, 13 Jun 2022 10:18:14 -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=VP4KQHv/fOTk1uSuALx0rQHJbV2oSTFRWBWAJzpP+gE=; b=ypBkktvD0AWy15WiMJmTTqief/l8LnhS6sft/yvTkNe4TXAbwY1giPwzMIVIlJMj/T CG0DiU0Z9HAOIWlLTwxcdY65JSdAp96GOdfzUr/xEWTSzSFhCYTBrG9vvKHr4mjlCQzG uu/fL66iivcNZjZC6w4MChZkLTr4NCqQXa6kL9NujPJj97GqO3wp9KmQxP7on8qHnn2p sbNONY8N5/rEqCFcw4KnIxPtZ9Ffzwd2mCAr0X1rJ+n6ZG48MYenk6NkgJvEFvXQuns0 Ch55V77MnQKOMUlXWtkUMewKXmb0zyHXOF4FVJvRjUbSxMb3+UGHXQmXg2WhFFfCTK13 v8SQ== 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=VP4KQHv/fOTk1uSuALx0rQHJbV2oSTFRWBWAJzpP+gE=; b=2ceGp6hTivxVEn6AdfE/4C83OfJ9/fY3YFTouiIOc2DXKtcki4UXlAPX5SkFmUW23W ZQ0I9EMRlWDhA72djxoEl87Oq5pTXE4XNwe/0K1j+hpF0MVVnaxzloTM42SAThNEJbqh WO7ivQh7eb5CvgFlEqikRx565wpwMil3cyVleGgSfU5gkFO9vnyVSVvhK4utFIHXrgxz mOfql2uRy+3DNINM88Gi5t+GmR9BgNXeoty3LVksDykq2pPk9lXoH0GU9vCDIxx06EJJ P++DWERkpzWxiW5+YNTaDQ9owUi+uTmla/CVVskwPCvI7ky8rLr6Dhv6jGvtY1NUoQww fu/Q== X-Gm-Message-State: AOAM533WSt9XkS/kH40lTYnQmJSo/9XEkdTilKzqEktpTDpQdOKk4EUT BOv/w27XDV1VGj4nJSPko3Z2hQ== X-Google-Smtp-Source: ABdhPJwWO6p1O1jMAWb63Gp7Nr1Qe4p+1PNjRbbTIJ63//BsAb8NehROChTlbDkjmUEAREnOZIhpEQ== X-Received: by 2002:a63:a0e:0:b0:3fd:a62e:fa5f with SMTP id 14-20020a630a0e000000b003fda62efa5fmr588604pgk.126.1655140694122; Mon, 13 Jun 2022 10:18:14 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jun 2022 10:18:13 -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: rework gsi_channel_tx_update() Date: Mon, 13 Jun 2022 12:17:59 -0500 Message-Id: <20220613171759.578856-7-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Rename gsi_channel_tx_update() to be gsi_trans_tx_completed(), and pass it just the transaction pointer, deriving the channel from the transaction. Update the comments above the function to provide a more concise description of how statistics for TX endpoints are maintained and used. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 54 ++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index c2cafd9247a70..df8af1f00fc8b 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -1021,40 +1021,36 @@ void gsi_trans_tx_queued(struct gsi_trans *trans) } =20 /** - * gsi_channel_tx_update() - Report completed TX transfers - * @channel: Channel that has completed transmitting packets - * @trans: Last transation known to be complete - * - * Compute the number of transactions and bytes that have been transferred - * over a TX channel since the given transaction was committed. Report th= is - * information to the network stack. - * - * At the time a transaction is committed, we record its channel's - * committed transaction and byte counts *in the transaction*. - * Completions are signaled by the hardware with an interrupt, and - * we can determine the latest completed transaction at that time. - * - * The difference between the byte/transaction count recorded in - * the transaction and the count last time we recorded a completion - * tells us exactly how much data has been transferred between - * completions. - * - * Calling this each time we learn of a newly-completed transaction - * allows us to provide accurate information to the network stack - * about how much work has been completed by the hardware at a given - * point in time. + * gsi_trans_tx_completed() - Report completed TX transactions + * @trans: TX channel transaction that has completed + * + * Report that a transaction on a TX channel has completed. At the time a + * transaction is committed, we record *in the transaction* its channel's + * committed transaction and byte counts. Transactions are completed in + * order, and the difference between the channel's byte/transaction count + * when the transaction was committed and when it completes tells us + * exactly how much data has been transferred while the transaction was + * pending. + * + * We report this information to the network stack, which uses it to manage + * the rate at which data is sent to hardware. */ -static void -gsi_channel_tx_update(struct gsi_channel *channel, struct gsi_trans *trans) +static void gsi_trans_tx_completed(struct gsi_trans *trans) { - u64 trans_count =3D trans->trans_count - channel->compl_trans_count; - u64 byte_count =3D trans->byte_count - channel->compl_byte_count; + u32 channel_id =3D trans->channel_id; + struct gsi *gsi =3D trans->gsi; + struct gsi_channel *channel; + u32 trans_count; + u32 byte_count; + + channel =3D &gsi->channel[channel_id]; + trans_count =3D trans->trans_count - channel->compl_trans_count; + byte_count =3D trans->byte_count - channel->compl_byte_count; =20 channel->compl_trans_count +=3D trans_count; channel->compl_byte_count +=3D byte_count; =20 - ipa_gsi_channel_tx_completed(channel->gsi, gsi_channel_id(channel), - trans_count, byte_count); + ipa_gsi_channel_tx_completed(gsi, channel_id, trans_count, byte_count); } =20 /* Channel control interrupt handler */ @@ -1504,7 +1500,7 @@ static struct gsi_trans *gsi_channel_update(struct gs= i_channel *channel) * up the network stack. */ if (channel->toward_ipa) - gsi_channel_tx_update(channel, trans); + gsi_trans_tx_completed(trans); else gsi_evt_ring_rx_update(evt_ring, index); =20 --=20 2.34.1