Skip to contentSkip to conversation

net/ena/base: add LLQ policy inline helper

PATCH Superseded Shai Brandes 1 participant 1 message Oct 18 Network drivers

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 5/13 net/ena/base: add LLQ policy inline helper

Introduce a helper to abstract the LLQ placement policy check, replacing direct mem_queue_type comparisons across ena-com.

---
 drivers/net/ena/base/ena_com.h     |  5 +++
 drivers/net/ena/base/ena_eth_com.c | 55 +++++++++++++++---------------
 drivers/net/ena/base/ena_eth_com.h |  6 ++--
 3 files changed, 35 insertions(+), 31 deletions(-)
drivers/net/ena/base/ena_com.h +5 -0
index bd395fd90c..c62fecdef2 100644
@@ -1139,6 +1139,11 @@ static inline struct ena_com_dev *ena_com_io_cq_to_ena_dev(struct ena_com_io_cq
 	return container_of(io_cq, struct ena_com_dev, io_cq_queues[io_cq->qid]);
 }
 
+static inline bool ena_com_sq_is_llq(struct ena_com_io_sq *io_sq)
+{
+	return io_sq->mem_queue_type != ENA_ADMIN_PLACEMENT_POLICY_HOST;
+}
+
 static inline bool ena_com_get_adaptive_moderation_enabled(struct ena_com_dev *ena_dev)
 {
 	return ena_dev->adaptive_coalescing;
drivers/net/ena/base/ena_eth_com.c +27 -28

160 lines not on this page · raw message

drivers/net/ena/base/ena_eth_com.h +3 -3
index f773699467..503cf45cf7 100644
@@ -110,7 +110,7 @@ static inline bool ena_com_sq_have_enough_space(struct ena_com_io_sq *io_sq,
 {
 	int temp;
 
-	if (unlikely(io_sq->mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_HOST))
+	if (unlikely(!ena_com_sq_is_llq(io_sq)))
 		return ena_com_free_q_entries(io_sq) >= required_buffers;
 
 	/* This calculation doesn't need to be 100% accurate. So to reduce
@@ -136,8 +136,8 @@ static inline bool ena_com_meta_desc_changed(struct ena_com_io_sq *io_sq,
 
 static inline bool is_llq_max_tx_burst_exists(struct ena_com_io_sq *io_sq)
 {
-	return (io_sq->mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) &&
-	       io_sq->llq_info.max_entries_in_tx_burst > 0;
+	return likely(ena_com_sq_is_llq(io_sq)) &&
+	       (io_sq->llq_info.max_entries_in_tx_burst > 0);
 }
 
 static inline bool ena_com_is_doorbell_needed(struct ena_com_io_sq *io_sq,
Signature · 1 line
2.17.1