aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/ipa
diff options
context:
space:
mode:
authorAlex Elder2022-09-06 12:19:42 -0500
committerDavid S. Miller2022-09-09 11:45:25 +0100
commit019e37eaef97d99285390b6eb42410a54a5d6412 (patch)
tree44b0dce2f682ec745122d4e78f2a3ad1dea5d864 /drivers/net/ipa
parente0e3406c60d7e5b004cc3059dea6c7574d26ca66 (diff)
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 <elder@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ipa')
-rw-r--r--drivers/net/ipa/gsi.c8
-rw-r--r--drivers/net/ipa/gsi_private.h6
-rw-r--r--drivers/net/ipa/gsi_trans.c7
3 files changed, 11 insertions, 10 deletions
diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c
index 5471843b665f..3f97653450bb 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 a937811bb1bb..af4cc13864e2 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 0b78ae904bac..03e54fc4376a 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];
}