* [PATCH 14/21] net/ena/base: remove redundant zeroing of Tx desc
@ 2025-10-15 7:14 Shai Brandes
0 siblings, 0 replies; only message in thread
From: Shai Brandes @ 2025-10-15 7:14 UTC (permalink / raw)
To: stephen; +Cc: dev, Shai Brandes
For LLQ, tx descriptors are stored in the bounce buffer,
which is already being zeroed out upon every call to
ena_com_get_next_bounce_buffer.
This patch utilizes the existing zero-out operation of the
bounce buffer, eliminating redundant zeroing of tx
descriptors in LLQ case.
Signed-off-by: Shai Brandes <shaibran@amazon.com>
Reviewed-by: Amit Bernstein <amitbern@amazon.com>
Reviewed-by: Yosef Raisman <yraisman@amazon.com>
---
drivers/net/ena/base/ena_eth_com.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ena/base/ena_eth_com.c b/drivers/net/ena/base/ena_eth_com.c
index 7d982854c0..c1e3c55f82 100644
--- a/drivers/net/ena/base/ena_eth_com.c
+++ b/drivers/net/ena/base/ena_eth_com.c
@@ -234,12 +234,21 @@ static int ena_com_close_bounce_buffer(struct ena_com_io_sq *io_sq)
return ENA_COM_OK;
}
-static void *get_sq_desc(struct ena_com_io_sq *io_sq)
+/* There is an assumption in function get_tx_sq_desc() that both descriptors have the same size */
+_Static_assert(sizeof(struct ena_eth_io_tx_meta_desc) == (sizeof(struct ena_eth_io_tx_desc)),
+ "ena_eth_io_tx_meta_desc should be the same size as ena_eth_io_tx_desc");
+static void *get_tx_sq_desc(struct ena_com_io_sq *io_sq)
{
+ void *tx_desc;
+
if (io_sq->mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV)
return get_sq_desc_llq(io_sq);
- return get_sq_desc_regular_queue(io_sq);
+ tx_desc = get_sq_desc_regular_queue(io_sq);
+
+ memset(tx_desc, 0x0, sizeof(struct ena_eth_io_tx_desc));
+
+ return tx_desc;
}
static int ena_com_sq_update_llq_tail(struct ena_com_io_sq *io_sq)
@@ -372,12 +381,10 @@ static int ena_com_create_meta(struct ena_com_io_sq *io_sq,
{
struct ena_eth_io_tx_meta_desc *meta_desc = NULL;
- meta_desc = get_sq_desc(io_sq);
+ meta_desc = get_tx_sq_desc(io_sq);
if (unlikely(!meta_desc))
return ENA_COM_FAULT;
- memset(meta_desc, 0x0, sizeof(struct ena_eth_io_tx_meta_desc));
-
meta_desc->len_ctrl |= ENA_ETH_IO_TX_META_DESC_META_DESC_MASK;
meta_desc->len_ctrl |= ENA_ETH_IO_TX_META_DESC_EXT_VALID_MASK;
@@ -535,7 +542,7 @@ int ena_com_prepare_tx(struct ena_com_io_sq *io_sq,
return rc;
}
- desc = get_sq_desc(io_sq);
+ desc = get_tx_sq_desc(io_sq);
if (unlikely(!desc))
return ENA_COM_FAULT;
@@ -597,12 +604,10 @@ int ena_com_prepare_tx(struct ena_com_io_sq *io_sq,
return rc;
}
- desc = get_sq_desc(io_sq);
+ desc = get_tx_sq_desc(io_sq);
if (unlikely(!desc))
return ENA_COM_FAULT;
- memset(desc, 0x0, sizeof(struct ena_eth_io_tx_desc));
-
desc->len_ctrl |= ENA_FIELD_PREP((u32)io_sq->phase,
ENA_ETH_IO_TX_DESC_PHASE_MASK,
ENA_ETH_IO_TX_DESC_PHASE_SHIFT);
--
2.17.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-10-15 7:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-15 7:14 [PATCH 14/21] net/ena/base: remove redundant zeroing of Tx desc Shai Brandes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).