From c81f8c26115a64b9a97ecdb2a64e824dd839ee73 Mon Sep 17 00:00:00 2001 From: Artur Rojek Date: Thu, 12 Aug 2021 10:34:17 +0200 Subject: [PATCH] ena: Avoid unnecessary mbuf collapses for LLQ condition In case of Low-latency Queue, one small enough descriptor can be pushed directly to the ENA hw, thus saving one fragment. Check for this condition before performing collapse. Obtained from: Semihalf MFC after: 2 weeks Sponsored by: Amazon, Inc. --- sys/dev/ena/ena_datapath.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/ena/ena_datapath.c b/sys/dev/ena/ena_datapath.c index 15bd09c489cf..c0066b1209cc 100644 --- a/sys/dev/ena/ena_datapath.c +++ b/sys/dev/ena/ena_datapath.c @@ -801,6 +801,11 @@ ena_check_and_collapse_mbuf(struct ena_ring *tx_ring, struct mbuf **mbuf) /* One segment must be reserved for configuration descriptor. */ if (num_frags < adapter->max_tx_sgl_size) return (0); + + if ((num_frags == adapter->max_tx_sgl_size) && + ((*mbuf)->m_pkthdr.len < tx_ring->tx_max_header_size)) + return (0); + counter_u64_add(tx_ring->tx_stats.collapse, 1); collapsed_mbuf = m_collapse(*mbuf, M_NOWAIT,