2022-09-06 17:32:39

by Alex Elder

[permalink] [raw]
Subject: [PATCH net-next 0/6] net: ipa: don't use lists for transaction state

This is the last series of patches to convert the IPA code so
integer IDs are used rather than lists to track the state of
transactions.

A first series of patches added ID fields to track the state of
transactions:
https://lore.kernel.org/netdev/[email protected]
The second series started transitioning code to use these IDs rather
than lists to manage state:
https://lore.kernel.org/netdev/[email protected]

This final series finishes the transition, to always use IDs instead
of the lists to manage transaction state. As a result, the list
fields, links, and a spinlock to protect updates are no longer
needed, so they are removed. This permits a few other improvements
to be implemented.

-Alex

Alex Elder (5):
net: ipa: always use transaction IDs instead of lists
net: ipa: kill the allocated transaction list
net: ipa: kill all other transaction lists
net: ipa: update channel in gsi_channel_trans_complete()
net: ipa: don't have gsi_channel_update() return a value

drivers/net/ipa/gsi.c | 11 +--
drivers/net/ipa/gsi.h | 7 --
drivers/net/ipa/gsi_private.h | 22 ++----
drivers/net/ipa/gsi_trans.c | 136 ++++++----------------------------
drivers/net/ipa/gsi_trans.h | 3 -
5 files changed, 35 insertions(+), 144 deletions(-)

--
2.34.1


2022-09-06 18:10:57

by Alex Elder

[permalink] [raw]
Subject: [PATCH net-next 2/5] net: ipa: kill the allocated transaction list

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 <[email protected]>
---
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

2022-09-06 18:11:26

by Alex Elder

[permalink] [raw]
Subject: [PATCH net-next 1/5] net: ipa: always use transaction IDs instead of lists

In gsi_channel_trans_complete(), use the completed and pending IDs
to determine whether there are any transactions in completed state.

Similarly, in gsi_channel_trans_cancel_pending(), use the pending
and committed IDs to mark pending transactions cancelled. Rearrange
the logic a bit there for a simpler result.

This removes the only user of list_last_entry_or_null(), so get rid
of that macro.

Remove the temporary warnings added by the previous commit.

Signed-off-by: Alex Elder <[email protected]>
---
drivers/net/ipa/gsi_private.h | 14 ---------
drivers/net/ipa/gsi_trans.c | 58 ++++++++++-------------------------
2 files changed, 16 insertions(+), 56 deletions(-)

diff --git a/drivers/net/ipa/gsi_private.h b/drivers/net/ipa/gsi_private.h
index 51bbc7a40dc2d..0b2516fa21b5d 100644
--- a/drivers/net/ipa/gsi_private.h
+++ b/drivers/net/ipa/gsi_private.h
@@ -16,20 +16,6 @@ struct gsi_channel;

#define GSI_RING_ELEMENT_SIZE 16 /* bytes; must be a power of 2 */

-/**
- * list_last_entry_or_null - get the last element from a list
- * @ptr: the list head to take the element from.
- * @type: the type of the struct this is embedded in.
- * @member: the name of the list_head within the struct.
- *
- * Note that if the list is empty, it returns NULL.
- */
-#define list_last_entry_or_null(ptr, type, member) ({ \
- struct list_head *head__ = (ptr); \
- struct list_head *pos__ = READ_ONCE(head__->prev); \
- pos__ != head__ ? list_entry(pos__, type, member) : NULL; \
-})
-
/**
* gsi_trans_move_complete() - Mark a GSI transaction completed
* @trans: Transaction to commit
diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c
index 05ab4d052c68b..a131a4fbb53fc 100644
--- a/drivers/net/ipa/gsi_trans.c
+++ b/drivers/net/ipa/gsi_trans.c
@@ -239,22 +239,11 @@ struct gsi_trans *gsi_channel_trans_complete(struct gsi_channel *channel)
{
struct gsi_trans_info *trans_info = &channel->trans_info;
u16 trans_id = trans_info->completed_id;
- struct gsi_trans *trans;

- trans = list_first_entry_or_null(&trans_info->complete,
- struct gsi_trans, links);
-
- if (!trans) {
- WARN_ON(trans_id != trans_info->pending_id);
+ if (trans_id == trans_info->pending_id)
return NULL;
- }

- if (!WARN_ON(trans_id == trans_info->pending_id)) {
- trans_id %= channel->tre_count;
- WARN_ON(trans != &trans_info->trans[trans_id]);
- }
-
- return trans;
+ return &trans_info->trans[trans_id %= channel->tre_count];
}

/* Move a transaction from the allocated list to the committed list */
@@ -705,47 +694,32 @@ void gsi_trans_complete(struct gsi_trans *trans)
void gsi_channel_trans_cancel_pending(struct gsi_channel *channel)
{
struct gsi_trans_info *trans_info = &channel->trans_info;
- struct gsi_trans *trans;
- struct gsi_trans *first;
- struct gsi_trans *last;
- bool cancelled;
+ u16 trans_id = trans_info->pending_id;

/* channel->gsi->mutex is held by caller */
spin_lock_bh(&trans_info->spinlock);

- cancelled = !list_empty(&trans_info->pending);
- list_for_each_entry(trans, &trans_info->pending, links)
- trans->cancelled = true;
-
list_splice_tail_init(&trans_info->pending, &trans_info->complete);

- first = list_first_entry_or_null(&trans_info->complete,
- struct gsi_trans, links);
- last = list_last_entry_or_null(&trans_info->complete,
- struct gsi_trans, links);
-
spin_unlock_bh(&trans_info->spinlock);

+ /* If there are no pending transactions, we're done */
+ if (trans_id == trans_info->committed_id)
+ return;
+
+ /* Mark all pending transactions cancelled */
+ do {
+ struct gsi_trans *trans;
+
+ trans = &trans_info->trans[trans_id % channel->tre_count];
+ trans->cancelled = true;
+ } while (++trans_id != trans_info->committed_id);
+
/* All pending transactions are now completed */
- WARN_ON(cancelled != (trans_info->pending_id !=
- trans_info->committed_id));
-
trans_info->pending_id = trans_info->committed_id;

/* Schedule NAPI polling to complete the cancelled transactions */
- if (cancelled) {
- u16 trans_id;
-
- napi_schedule(&channel->napi);
-
- trans_id = trans_info->completed_id;
- trans = &trans_info->trans[trans_id % channel->tre_count];
- WARN_ON(trans != first);
-
- trans_id = trans_info->pending_id - 1;
- trans = &trans_info->trans[trans_id % channel->tre_count];
- WARN_ON(trans != last);
- }
+ napi_schedule(&channel->napi);
}

/* Issue a command to read a single byte from a channel */
--
2.34.1

2022-09-06 18:14:41

by Alex Elder

[permalink] [raw]
Subject: [PATCH net-next 3/5] net: ipa: kill all other transaction lists

None of the transaction lists are actually needed any more, because
transaction IDs (which have been shown to be equivalent) are used
instead. So we can remove all of them, as well as the spinlock
that protects updates to them.

Not requiring a lock simplifies gsi_trans_free() as well; we only
need to check the reference count once to decide whether we've hit
the last reference.

This makes the links field in the gsi_trans structure unused, so get
rid of that as well.

Signed-off-by: Alex Elder <[email protected]>
---
drivers/net/ipa/gsi.h | 6 ----
drivers/net/ipa/gsi_trans.c | 71 ++++---------------------------------
drivers/net/ipa/gsi_trans.h | 3 --
3 files changed, 6 insertions(+), 74 deletions(-)

diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h
index a3f2d27a7e4b3..84d178a1a7d22 100644
--- a/drivers/net/ipa/gsi.h
+++ b/drivers/net/ipa/gsi.h
@@ -94,12 +94,6 @@ struct gsi_trans_info {

struct gsi_trans_pool sg_pool; /* scatterlist pool */
struct gsi_trans_pool cmd_pool; /* command payload DMA pool */
-
- spinlock_t spinlock; /* protects updates to the lists */
- struct list_head committed; /* committed, awaiting doorbell */
- struct list_head pending; /* pending, awaiting completion */
- struct list_head complete; /* completed, awaiting poll */
- struct list_head polled; /* returned by gsi_channel_poll_one() */
};

/* Hardware values signifying the state of a channel */
diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c
index 254c09824004c..a3ae0ca4813c6 100644
--- a/drivers/net/ipa/gsi_trans.c
+++ b/drivers/net/ipa/gsi_trans.c
@@ -252,75 +252,43 @@ static void gsi_trans_move_committed(struct gsi_trans *trans)
struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id];
struct gsi_trans_info *trans_info = &channel->trans_info;

- spin_lock_bh(&trans_info->spinlock);
-
- list_add_tail(&trans->links, &trans_info->committed);
-
- spin_unlock_bh(&trans_info->spinlock);
-
/* This allocated transaction is now committed */
trans_info->allocated_id++;
}

-/* Move transactions from the committed list to the pending list */
+/* Move committed transactions to pending state */
static void gsi_trans_move_pending(struct gsi_trans *trans)
{
struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id];
struct gsi_trans_info *trans_info = &channel->trans_info;
u16 trans_index = trans - &trans_info->trans[0];
- struct list_head list;
u16 delta;

- spin_lock_bh(&trans_info->spinlock);
-
- /* Move this transaction and all predecessors to the pending list */
- list_cut_position(&list, &trans_info->committed, &trans->links);
- list_splice_tail(&list, &trans_info->pending);
-
- spin_unlock_bh(&trans_info->spinlock);
-
/* These committed transactions are now pending */
delta = trans_index - trans_info->committed_id + 1;
trans_info->committed_id += delta % channel->tre_count;
}

-/* Move a transaction and all of its predecessors from the pending list
- * to the completed list.
- */
+/* Move pending transactions to completed state */
void gsi_trans_move_complete(struct gsi_trans *trans)
{
struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id];
struct gsi_trans_info *trans_info = &channel->trans_info;
u16 trans_index = trans - trans_info->trans;
- struct list_head list;
u16 delta;

- spin_lock_bh(&trans_info->spinlock);
-
- /* Move this transaction and all predecessors to completed list */
- list_cut_position(&list, &trans_info->pending, &trans->links);
- list_splice_tail(&list, &trans_info->complete);
-
- spin_unlock_bh(&trans_info->spinlock);
-
/* These pending transactions are now completed */
delta = trans_index - trans_info->pending_id + 1;
delta %= channel->tre_count;
trans_info->pending_id += delta;
}

-/* Move a transaction from the completed list to the polled list */
+/* Move a transaction from completed to polled state */
void gsi_trans_move_polled(struct gsi_trans *trans)
{
struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id];
struct gsi_trans_info *trans_info = &channel->trans_info;

- spin_lock_bh(&trans_info->spinlock);
-
- list_move_tail(&trans->links, &trans_info->polled);
-
- spin_unlock_bh(&trans_info->spinlock);
-
/* This completed transaction is now polled */
trans_info->completed_id++;
}
@@ -383,7 +351,6 @@ 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;
@@ -396,7 +363,7 @@ struct gsi_trans *gsi_channel_trans_alloc(struct gsi *gsi, u32 channel_id,
trans->direction = direction;
refcount_set(&trans->refcount, 1);

- /* This free transaction will now be allocated */
+ /* This free transaction is now allocated */
trans_info->free_id++;

return trans;
@@ -405,31 +372,15 @@ struct gsi_trans *gsi_channel_trans_alloc(struct gsi *gsi, u32 channel_id,
/* Free a previously-allocated transaction */
void gsi_trans_free(struct gsi_trans *trans)
{
- refcount_t *refcount = &trans->refcount;
struct gsi_trans_info *trans_info;
- bool last;

- /* We must hold the lock to release the last reference */
- if (refcount_dec_not_one(refcount))
- return;
-
- trans_info = &trans->gsi->channel[trans->channel_id].trans_info;
-
- spin_lock_bh(&trans_info->spinlock);
-
- /* Reference might have been added before we got the lock */
- last = refcount_dec_and_test(refcount);
- if (last)
- list_del(&trans->links);
-
- spin_unlock_bh(&trans_info->spinlock);
-
- if (!last)
+ if (!refcount_dec_and_test(&trans->refcount))
return;

/* Unused transactions are allocated but never committed, pending,
* completed, or polled.
*/
+ trans_info = &trans->gsi->channel[trans->channel_id].trans_info;
if (!trans->used_count) {
trans_info->allocated_id++;
trans_info->committed_id++;
@@ -692,11 +643,6 @@ void gsi_channel_trans_cancel_pending(struct gsi_channel *channel)
u16 trans_id = trans_info->pending_id;

/* channel->gsi->mutex is held by caller */
- spin_lock_bh(&trans_info->spinlock);
-
- list_splice_tail_init(&trans_info->pending, &trans_info->complete);
-
- spin_unlock_bh(&trans_info->spinlock);

/* If there are no pending transactions, we're done */
if (trans_id == trans_info->committed_id)
@@ -815,11 +761,6 @@ int gsi_channel_trans_init(struct gsi *gsi, u32 channel_id)
if (ret)
goto err_map_free;

- spin_lock_init(&trans_info->spinlock);
- INIT_LIST_HEAD(&trans_info->committed);
- INIT_LIST_HEAD(&trans_info->pending);
- INIT_LIST_HEAD(&trans_info->complete);
- INIT_LIST_HEAD(&trans_info->polled);

return 0;

diff --git a/drivers/net/ipa/gsi_trans.h b/drivers/net/ipa/gsi_trans.h
index 7084507830c21..af8c4c6719d11 100644
--- a/drivers/net/ipa/gsi_trans.h
+++ b/drivers/net/ipa/gsi_trans.h
@@ -29,7 +29,6 @@ struct gsi_trans_pool;
* struct gsi_trans - a GSI transaction
*
* Most fields in this structure for internal use by the transaction core code:
- * @links: Links for channel transaction lists by state
* @gsi: GSI pointer
* @channel_id: Channel number transaction is associated with
* @cancelled: If set by the core code, transaction was cancelled
@@ -50,8 +49,6 @@ struct gsi_trans_pool;
* received.
*/
struct gsi_trans {
- struct list_head links; /* gsi_channel lists */
-
struct gsi *gsi;
u8 channel_id;

--
2.34.1

2022-09-06 18:22:01

by Alex Elder

[permalink] [raw]
Subject: [PATCH net-next 4/5] net: ipa: update channel in gsi_channel_trans_complete()

Have gsi_channel_trans_complete() update the known state from
hardware rather than doing so in gsi_channel_poll_one().

Signed-off-by: Alex Elder <[email protected]>
---
drivers/net/ipa/gsi.c | 5 +----
drivers/net/ipa/gsi_private.h | 8 ++++++++
drivers/net/ipa/gsi_trans.c | 2 +-
3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c
index 16df699009a86..5471843b665fc 100644
--- a/drivers/net/ipa/gsi.c
+++ b/drivers/net/ipa/gsi.c
@@ -1475,7 +1475,7 @@ void gsi_channel_doorbell(struct gsi_channel *channel)
}

/* Consult hardware, move any newly completed transactions to completed list */
-static struct gsi_trans *gsi_channel_update(struct gsi_channel *channel)
+struct gsi_trans *gsi_channel_update(struct gsi_channel *channel)
{
u32 evt_ring_id = channel->evt_ring_id;
struct gsi *gsi = channel->gsi;
@@ -1529,9 +1529,6 @@ static struct gsi_trans *gsi_channel_poll_one(struct gsi_channel *channel)

/* Get the first transaction from the completed list */
trans = gsi_channel_trans_complete(channel);
- if (!trans) /* List is empty; see if there's more to do */
- trans = gsi_channel_update(channel);
-
if (trans)
gsi_trans_move_polled(trans);

diff --git a/drivers/net/ipa/gsi_private.h b/drivers/net/ipa/gsi_private.h
index 0b2516fa21b5d..a937811bb1bb7 100644
--- a/drivers/net/ipa/gsi_private.h
+++ b/drivers/net/ipa/gsi_private.h
@@ -94,6 +94,14 @@ void gsi_channel_trans_exit(struct gsi_channel *channel);
*/
void gsi_channel_doorbell(struct gsi_channel *channel);

+/* gsi_channel_update() - Update knowledge of channel hardware state
+ * @channel: Channel whose doorbell should be rung
+ *
+ * Consult hardware, move any newly completed transactions to a
+ * channel's completed list
+ */
+struct gsi_trans *gsi_channel_update(struct gsi_channel *channel);
+
/**
* gsi_ring_virt() - Return virtual address for a ring entry
* @ring: Ring whose address is to be translated
diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c
index a3ae0ca4813c6..0b78ae904bacf 100644
--- a/drivers/net/ipa/gsi_trans.c
+++ b/drivers/net/ipa/gsi_trans.c
@@ -241,7 +241,7 @@ struct gsi_trans *gsi_channel_trans_complete(struct gsi_channel *channel)
u16 trans_id = trans_info->completed_id;

if (trans_id == trans_info->pending_id)
- return NULL;
+ return gsi_channel_update(channel);

return &trans_info->trans[trans_id %= channel->tre_count];
}
--
2.34.1

2022-09-06 18:22:22

by Alex Elder

[permalink] [raw]
Subject: [PATCH net-next 5/5] net: ipa: don't have gsi_channel_update() return a value

If it finds no completed transactions, gsi_channel_trans_complete()
calls gsi_channel_update() to check hardware. If new transactions
have completed, gsi_channel_update() records that, then calls
gsi_channel_trans_complete() to return the first of those found.
This recursion won't go any further, but can be avoided if we
have gsi_channel_update() only be responsible for updating state
after accessing hardware.

Change gsi_channel_update() so it simply checks for and handles
new completions, without returning a value. If it needs to call
that function, have gsi_channel_trans_complete() determine whether
there are new transactions available after the update.

Signed-off-by: Alex Elder <[email protected]>
---
drivers/net/ipa/gsi.c | 8 +++-----
drivers/net/ipa/gsi_private.h | 6 +++---
drivers/net/ipa/gsi_trans.c | 7 +++++--
3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c
index 5471843b665fc..3f97653450bb9 100644
--- a/drivers/net/ipa/gsi.c
+++ b/drivers/net/ipa/gsi.c
@@ -1475,7 +1475,7 @@ void gsi_channel_doorbell(struct gsi_channel *channel)
}

/* Consult hardware, move any newly completed transactions to completed list */
-struct gsi_trans *gsi_channel_update(struct gsi_channel *channel)
+void gsi_channel_update(struct gsi_channel *channel)
{
u32 evt_ring_id = channel->evt_ring_id;
struct gsi *gsi = channel->gsi;
@@ -1494,12 +1494,12 @@ struct gsi_trans *gsi_channel_update(struct gsi_channel *channel)
offset = GSI_EV_CH_E_CNTXT_4_OFFSET(evt_ring_id);
index = gsi_ring_index(ring, ioread32(gsi->virt + offset));
if (index == ring->index % ring->count)
- return NULL;
+ return;

/* Get the transaction for the latest completed event. */
trans = gsi_event_trans(gsi, gsi_ring_virt(ring, index - 1));
if (!trans)
- return NULL;
+ return;

/* For RX channels, update each completed transaction with the number
* of bytes that were actually received. For TX channels, report
@@ -1507,8 +1507,6 @@ struct gsi_trans *gsi_channel_update(struct gsi_channel *channel)
* up the network stack.
*/
gsi_evt_ring_update(gsi, evt_ring_id, index);
-
- return gsi_channel_trans_complete(channel);
}

/**
diff --git a/drivers/net/ipa/gsi_private.h b/drivers/net/ipa/gsi_private.h
index a937811bb1bb7..af4cc13864e21 100644
--- a/drivers/net/ipa/gsi_private.h
+++ b/drivers/net/ipa/gsi_private.h
@@ -95,12 +95,12 @@ void gsi_channel_trans_exit(struct gsi_channel *channel);
void gsi_channel_doorbell(struct gsi_channel *channel);

/* gsi_channel_update() - Update knowledge of channel hardware state
- * @channel: Channel whose doorbell should be rung
+ * @channel: Channel to be updated
*
* Consult hardware, move any newly completed transactions to a
- * channel's completed list
+ * channel's completed list.
*/
-struct gsi_trans *gsi_channel_update(struct gsi_channel *channel);
+void gsi_channel_update(struct gsi_channel *channel);

/**
* gsi_ring_virt() - Return virtual address for a ring entry
diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c
index 0b78ae904bacf..03e54fc4376a6 100644
--- a/drivers/net/ipa/gsi_trans.c
+++ b/drivers/net/ipa/gsi_trans.c
@@ -240,8 +240,11 @@ struct gsi_trans *gsi_channel_trans_complete(struct gsi_channel *channel)
struct gsi_trans_info *trans_info = &channel->trans_info;
u16 trans_id = trans_info->completed_id;

- if (trans_id == trans_info->pending_id)
- return gsi_channel_update(channel);
+ if (trans_id == trans_info->pending_id) {
+ gsi_channel_update(channel);
+ if (trans_id == trans_info->pending_id)
+ return NULL;
+ }

return &trans_info->trans[trans_id %= channel->tre_count];
}
--
2.34.1

2022-09-09 11:00:56

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net-next 0/6] net: ipa: don't use lists for transaction state

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <[email protected]>:

On Tue, 6 Sep 2022 12:19:37 -0500 you wrote:
> This is the last series of patches to convert the IPA code so
> integer IDs are used rather than lists to track the state of
> transactions.
>
> A first series of patches added ID fields to track the state of
> transactions:
> https://lore.kernel.org/netdev/[email protected]
> The second series started transitioning code to use these IDs rather
> than lists to manage state:
> https://lore.kernel.org/netdev/[email protected]
>
> [...]

Here is the summary with links:
- [net-next,1/5] net: ipa: always use transaction IDs instead of lists
(no matching commit)
- [net-next,2/5] net: ipa: kill the allocated transaction list
https://git.kernel.org/netdev/net-next/c/11902b41f2fa
- [net-next,3/5] net: ipa: kill all other transaction lists
https://git.kernel.org/netdev/net-next/c/d338ae28d8a8
- [net-next,4/5] net: ipa: update channel in gsi_channel_trans_complete()
https://git.kernel.org/netdev/net-next/c/e0e3406c60d7
- [net-next,5/5] net: ipa: don't have gsi_channel_update() return a value
https://git.kernel.org/netdev/net-next/c/019e37eaef97

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html