public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@linaro.org>
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/5] net: ipa: kill the allocated transaction list
Date: Tue,  6 Sep 2022 12:19:39 -0500	[thread overview]
Message-ID: <20220906171942.957704-3-elder@linaro.org> (raw)
In-Reply-To: <20220906171942.957704-1-elder@linaro.org>

The only place the trans_info->alloc list is used is when
initializing it, when adding a transaction to it when allocation
finishes, and when moving a transaction from that list to the
committed list.

We can just skip putting a transaction on the allocated list, and
add it (rather than move it) to the committed list when it is
committed.

On additional caveat is that an allocated transaction that's
committed without any TREs added will be immediately freed.  Because
we aren't adding allocated transactions to a list any more, the
list links need to be initialized to ensure they're valid at the
time list_del() is called for the transaction.

Then we can safely eliminate the allocated transaction list.

Signed-off-by: Alex Elder <elder@linaro.org>
---
 drivers/net/ipa/gsi.h       |  1 -
 drivers/net/ipa/gsi_trans.c | 12 +++---------
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h
index 13468704c4000..a3f2d27a7e4b3 100644
--- a/drivers/net/ipa/gsi.h
+++ b/drivers/net/ipa/gsi.h
@@ -96,7 +96,6 @@ struct gsi_trans_info {
 	struct gsi_trans_pool cmd_pool;	/* command payload DMA pool */
 
 	spinlock_t spinlock;		/* protects updates to the lists */
-	struct list_head alloc;		/* allocated, not committed */
 	struct list_head committed;	/* committed, awaiting doorbell */
 	struct list_head pending;	/* pending, awaiting completion */
 	struct list_head complete;	/* completed, awaiting poll */
diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c
index a131a4fbb53fc..254c09824004c 100644
--- a/drivers/net/ipa/gsi_trans.c
+++ b/drivers/net/ipa/gsi_trans.c
@@ -246,7 +246,7 @@ struct gsi_trans *gsi_channel_trans_complete(struct gsi_channel *channel)
 	return &trans_info->trans[trans_id %= channel->tre_count];
 }
 
-/* Move a transaction from the allocated list to the committed list */
+/* Move a transaction from allocated to committed state */
 static void gsi_trans_move_committed(struct gsi_trans *trans)
 {
 	struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id];
@@ -254,7 +254,7 @@ static void gsi_trans_move_committed(struct gsi_trans *trans)
 
 	spin_lock_bh(&trans_info->spinlock);
 
-	list_move_tail(&trans->links, &trans_info->committed);
+	list_add_tail(&trans->links, &trans_info->committed);
 
 	spin_unlock_bh(&trans_info->spinlock);
 
@@ -383,6 +383,7 @@ struct gsi_trans *gsi_channel_trans_alloc(struct gsi *gsi, u32 channel_id,
 	memset(trans, 0, sizeof(*trans));
 
 	/* Initialize non-zero fields in the transaction */
+	INIT_LIST_HEAD(&trans->links);
 	trans->gsi = gsi;
 	trans->channel_id = channel_id;
 	trans->rsvd_count = tre_count;
@@ -398,12 +399,6 @@ struct gsi_trans *gsi_channel_trans_alloc(struct gsi *gsi, u32 channel_id,
 	/* This free transaction will now be allocated */
 	trans_info->free_id++;
 
-	spin_lock_bh(&trans_info->spinlock);
-
-	list_add_tail(&trans->links, &trans_info->alloc);
-
-	spin_unlock_bh(&trans_info->spinlock);
-
 	return trans;
 }
 
@@ -821,7 +816,6 @@ int gsi_channel_trans_init(struct gsi *gsi, u32 channel_id)
 		goto err_map_free;
 
 	spin_lock_init(&trans_info->spinlock);
-	INIT_LIST_HEAD(&trans_info->alloc);
 	INIT_LIST_HEAD(&trans_info->committed);
 	INIT_LIST_HEAD(&trans_info->pending);
 	INIT_LIST_HEAD(&trans_info->complete);
-- 
2.34.1


  parent reply	other threads:[~2022-09-06 17:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 17:19 [PATCH net-next 0/6] net: ipa: don't use lists for transaction state Alex Elder
2022-09-06 17:19 ` [PATCH net-next 1/5] net: ipa: always use transaction IDs instead of lists Alex Elder
2022-09-06 17:19 ` Alex Elder [this message]
2022-09-06 17:19 ` [PATCH net-next 3/5] net: ipa: kill all other transaction lists Alex Elder
2022-09-06 17:19 ` [PATCH net-next 4/5] net: ipa: update channel in gsi_channel_trans_complete() Alex Elder
2022-09-06 17:19 ` [PATCH net-next 5/5] net: ipa: don't have gsi_channel_update() return a value Alex Elder
2022-09-09 10:50 ` [PATCH net-next 0/6] net: ipa: don't use lists for transaction state patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220906171942.957704-3-elder@linaro.org \
    --to=elder@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=elder@kernel.org \
    --cc=evgreen@chromium.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=quic_avuyyuru@quicinc.com \
    --cc=quic_cpratapa@quicinc.com \
    --cc=quic_jponduru@quicinc.com \
    --cc=quic_subashab@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox