summaryrefslogtreecommitdiffstats
path: root/drivers/net/ipa/gsi.h
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2022-08-31 17:40:12 -0500
committerDavid S. Miller <davem@davemloft.net>2022-09-02 12:08:44 +0100
commit12382d11670e893f976ae19087fde2f83ed4813d (patch)
treec2186b8488c075ed1090bbc71ae2408ea4591f2c /drivers/net/ipa/gsi.h
parenta01105f1748e8151ef43c300659b99d471f5f61d (diff)
downloadlinux-12382d11670e893f976ae19087fde2f83ed4813d.tar.bz2
net: ipa: use an array for transactions
Transactions are always allocated one at a time. The maximum number of them we could ever need occurs if each TRE is assigned to a transaction. So a channel requires no more transactions than the number of TREs in its transfer ring. That number is known to be a power-of-2 less than 65536. The transaction pool abstraction is used for other things, but for transactions we can use a simple array of transaction structures, and use a free index to indicate which entry in the array is the next one free for allocation. By having the number of elements in the array be a power-of-2, we can use an ever-incrementing 16-bit free index, and use it modulo the array size. Distinguish a "trans_id" (whose value can exceed the number of entries in the transaction array) from a "trans_index" (which is less than the number of entries). Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ipa/gsi.h')
-rw-r--r--drivers/net/ipa/gsi.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h
index 23de5f67374c..4a88aec7e7d9 100644
--- a/drivers/net/ipa/gsi.h
+++ b/drivers/net/ipa/gsi.h
@@ -82,7 +82,9 @@ struct gsi_trans_pool {
struct gsi_trans_info {
atomic_t tre_avail; /* TREs available for allocation */
- struct gsi_trans_pool pool; /* transaction pool */
+
+ u16 free_id; /* first free trans in array */
+ struct gsi_trans *trans; /* transaction array */
struct gsi_trans **map; /* TRE -> transaction map */
struct gsi_trans_pool sg_pool; /* scatterlist pool */