From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3F51EA0524 for ; Fri, 5 Feb 2021 12:39:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 36DAD4067B; Fri, 5 Feb 2021 12:39:49 +0100 (CET) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by mails.dpdk.org (Postfix) with ESMTP id 9F1754067B for ; Fri, 5 Feb 2021 12:39:48 +0100 (CET) Received: by mail-wr1-f53.google.com with SMTP id c12so7315372wrc.7 for ; Fri, 05 Feb 2021 03:39:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vhJaOttsCreBvJjmFNYxSeFYbTR18x04PgeS8vnIYlQ=; b=Mt/787imcgcG67bddORQtbCVtz4WtQaehtUMiZhITQah8Nw659GiU8doPj/Cz4kldq OrLI28L24WnYOXWM+WFYPMMzlraC5+nX46kVc+2UxxlrPOB5YbAt/QRRXlJZuTLuzF/F UYKO7lEWV3ed4/Uiky3kb246wQGtCahSCooAV2CjEhigD3AMGUGiTu1XDXoXh6X8jqbe oq6CPupzdJQ0UwWRP4QuNaO54YHiOmNeJVxkLxif+V0AQHd+sULmJ8nSMgOd4ccuMoUR l3mw1OZHVsJNua27+gMxKavtEE1qTKa+rZLt505hMFfJyui773mLM4kUZkTCNmfNV9t/ AW4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vhJaOttsCreBvJjmFNYxSeFYbTR18x04PgeS8vnIYlQ=; b=K0ROep8M6EWTLjJ+W52qvMkfne7nT0r8iN7ze/uQoHK/v99f2hA9f/LH1yGux/s/7h uJEEWsS/791Itdl5N9ym4eyAaSGNULkQjJppCZgneIGkEneHndHkknoBVC7bRAyQuuYO Hfwusl01jk9XKXEFoIG1pmOtFxcItYOUN9YSzJABejvRK2T+PHGmb9NhflAMpuXaDl8f Z6A88Jh1GiEQqCqyd67nYjQdBFk7kjAVv3SrTyaFfPK4ru1TvrZMpj4WwRxhNoY9TKDn yQu4+TR/2PugnN/4qvmH/PzfA3G+6ZnIJp+ZryjVog4kl1DOuudWkCf7nHhZn1cLOoUS /i7Q== X-Gm-Message-State: AOAM532XSMTRAD1WsXK7X+p9enhUXU90TTjVm4BLBsHcPYIY2HAROUon UqFLG1pbSvy5DwRWv+Js+5k= X-Google-Smtp-Source: ABdhPJzQSi5wg3Cp1zkKnhnsYAIxc39v4+jrtTEWTk5qA05eUD9L6/z3X0pZr9XdEUXsug4D7RrOKg== X-Received: by 2002:a5d:524a:: with SMTP id k10mr4607449wrc.394.1612525188402; Fri, 05 Feb 2021 03:39:48 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id r12sm12194769wrp.13.2021.02.05.03.39.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 03:39:47 -0800 (PST) From: luca.boccassi@gmail.com To: Igor Chauskin Cc: Michal Krawczyk , dpdk stable Date: Fri, 5 Feb 2021 11:19:17 +0000 Message-Id: <20210205111920.1272063-271-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210205111920.1272063-1-luca.boccassi@gmail.com> References: <20210205111920.1272063-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/ena: fix Tx SQ free space assessment' has been queued to stable release 20.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/07/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/bde94e82f559ad767ed000945ba1dc04779ce973 Thanks. Luca Boccassi --- >From bde94e82f559ad767ed000945ba1dc04779ce973 Mon Sep 17 00:00:00 2001 From: Igor Chauskin Date: Tue, 26 Jan 2021 19:32:25 +0100 Subject: [PATCH] net/ena: fix Tx SQ free space assessment [ upstream commit 8a90f3d8d09b5fa2e7a6a7b83b8e4868acebbe01 ] Before starting transmission of Tx burst, the driver checked the available space in the sq and limited the number of packets for transmission accordingly. The calculation was incorrect for fragmented packets and potentially had significantly limited the length of Tx bursts. This patch removes the assessment and pushes packets to the sq as long as the burst is not exhausted and space is available in the sq. Correct evaluation of the required space isn't possible before the burst because it depends on the number of segments of each packet. This patch adds per-packet space evaluation for each packet before attempting to process it. In case there is not enough queue space, the burst will just stop without error. Fixes: 2061fe41f212 ("net/ena: linearize Tx mbuf") Signed-off-by: Igor Chauskin Reviewed-by: Michal Krawczyk --- drivers/net/ena/ena_ethdev.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 9ee9de6eb9..4083568d5d 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -2359,8 +2359,8 @@ static void ena_update_hints(struct ena_adapter *adapter, } } -static int ena_check_and_linearize_mbuf(struct ena_ring *tx_ring, - struct rte_mbuf *mbuf) +static int ena_check_space_and_linearize_mbuf(struct ena_ring *tx_ring, + struct rte_mbuf *mbuf) { struct ena_com_dev *ena_dev; int num_segments, header_len, rc; @@ -2370,13 +2370,21 @@ static int ena_check_and_linearize_mbuf(struct ena_ring *tx_ring, header_len = mbuf->data_len; if (likely(num_segments < tx_ring->sgl_size)) - return 0; + goto checkspace; if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV && (num_segments == tx_ring->sgl_size) && (header_len < tx_ring->tx_max_header_size)) - return 0; + goto checkspace; + /* Checking for space for 2 additional metadata descriptors due to + * possible header split and metadata descriptor. Linearization will + * be needed so we reduce the segments number from num_segments to 1 + */ + if (!ena_com_sq_have_enough_space(tx_ring->ena_com_io_sq, 3)) { + PMD_DRV_LOG(DEBUG, "Not enough space in the tx queue\n"); + return ENA_COM_NO_MEM; + } ++tx_ring->tx_stats.linearize; rc = rte_pktmbuf_linearize(mbuf); if (unlikely(rc)) { @@ -2386,7 +2394,19 @@ static int ena_check_and_linearize_mbuf(struct ena_ring *tx_ring, return rc; } - return rc; + return 0; + +checkspace: + /* Checking for space for 2 additional metadata descriptors due to + * possible header split and metadata descriptor + */ + if (!ena_com_sq_have_enough_space(tx_ring->ena_com_io_sq, + num_segments + 2)) { + PMD_DRV_LOG(DEBUG, "Not enough space in the tx queue\n"); + return ENA_COM_NO_MEM; + } + + return 0; } static void ena_tx_map_mbuf(struct ena_ring *tx_ring, @@ -2473,7 +2493,7 @@ static int ena_xmit_mbuf(struct ena_ring *tx_ring, struct rte_mbuf *mbuf) int nb_hw_desc; int rc; - rc = ena_check_and_linearize_mbuf(tx_ring, mbuf); + rc = ena_check_space_and_linearize_mbuf(tx_ring, mbuf); if (unlikely(rc)) return rc; @@ -2580,9 +2600,6 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, return 0; } - nb_pkts = RTE_MIN(ena_com_free_q_entries(tx_ring->ena_com_io_sq), - nb_pkts); - for (sent_idx = 0; sent_idx < nb_pkts; sent_idx++) { if (ena_xmit_mbuf(tx_ring, tx_pkts[sent_idx])) break; -- 2.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-05 11:18:41.141838816 +0000 +++ 0271-net-ena-fix-Tx-SQ-free-space-assessment.patch 2021-02-05 11:18:29.358701621 +0000 @@ -1 +1 @@ -From 8a90f3d8d09b5fa2e7a6a7b83b8e4868acebbe01 Mon Sep 17 00:00:00 2001 +From bde94e82f559ad767ed000945ba1dc04779ce973 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 8a90f3d8d09b5fa2e7a6a7b83b8e4868acebbe01 ] + @@ -22 +23,0 @@ -Cc: stable@dpdk.org @@ -31 +32 @@ -index 1728ceb9a8..8a937d7f27 100644 +index 9ee9de6eb9..4083568d5d 100644