From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id F346DA051C
	for <public@inbox.dpdk.org>; Tue, 11 Feb 2020 12:30:48 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id EA09D2BE9;
	Tue, 11 Feb 2020 12:30:48 +0100 (CET)
Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com
 [209.85.221.43]) by dpdk.org (Postfix) with ESMTP id 3D2321BFB6
 for <stable@dpdk.org>; Tue, 11 Feb 2020 12:30:47 +0100 (CET)
Received: by mail-wr1-f43.google.com with SMTP id c9so11921901wrw.8
 for <stable@dpdk.org>; Tue, 11 Feb 2020 03:30:47 -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=cyLXC/+h8LHeQuKVmX0/5l5K/gf02DiXuQ9qxfDXp2U=;
 b=k02x4Us+K290iKL6D9enYjTUelK/mi/Y5NtRqsENY0Mw4t3YNarF1kGnNTd8rDEj12
 ROeHkJtRwDMihLqSY1OB8HPRs61QSHb0jj4E7rvL1qmKoS/lP62jQu5EYio7voAU6I1m
 1TJqwHUWroEMhg/Vn3T8dZjQXTxr93gNpekA1bkIUDabTTsodbpbxHZ/9x1+S+8chrkp
 bK4wIttQfslVt5szUiSaLGFc0ckQ1rl0osmOL6XrEBL/XjHM3zzcIpwbfHzQQxy41Uri
 k6zNrdaHVr5YHoMzSVBYP9RENxQRA+dWCOphREF+VzlVlui7RKl26TeKCP9NPSAUktN1
 dRvw==
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=cyLXC/+h8LHeQuKVmX0/5l5K/gf02DiXuQ9qxfDXp2U=;
 b=EjJV3eQ8POSeb6CBVHL9EyMI+u22Z0s7zPVgoRosbGBKgvGisTlJsQxJDOFRLRksMs
 q1/7QX30HKXtnJipNeOp1J/ri2nzRV/hkE3cCvWUP8c9b9V61cWU1KnNPu/74as48liy
 20GvrksDb/FdFryBrajtz0LxGvgwDcj8LYCh07gkisCiC2IJGpNIuh/FxlJ65KMO8VGr
 p2I6ZfNcWD2DTigC7ap2DO2Y1Chk5WkwgoBWvxwN3MqUncIu8IEdpg69clr387qyt4jx
 l578GM1ylSP9oET9IriJ5sZpjrruKUrE0ddbLjbvjc7LuNv7OFw3fnqESgfCqHpMq+nv
 e9FQ==
X-Gm-Message-State: APjAAAVaYeh8KbFU837PdUT5PTr9lavbo08rHJnLT0yRQphI21UvxwgE
 fszNzTgY8HwByuDhneGaf9U=
X-Google-Smtp-Source: APXvYqybaIMC0TY2vb5PX32ksAc1FXBVJLLWY5EWG+8M5lhtQNB6/rGglyngkZnbi8eDTXTRMgMyGg==
X-Received: by 2002:a5d:6b82:: with SMTP id n2mr8702421wrx.153.1581420646963; 
 Tue, 11 Feb 2020 03:30:46 -0800 (PST)
Received: from localhost ([88.98.246.218])
 by smtp.gmail.com with ESMTPSA id r3sm4981581wrn.34.2020.02.11.03.30.46
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 11 Feb 2020 03:30:46 -0800 (PST)
From: luca.boccassi@gmail.com
To: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Cc: Matan Azrad <matan@mellanox.com>,
	dpdk stable <stable@dpdk.org>
Date: Tue, 11 Feb 2020 11:21:04 +0000
Message-Id: <20200211112216.3929-118-luca.boccassi@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200211112216.3929-1-luca.boccassi@gmail.com>
References: <20200211112216.3929-1-luca.boccassi@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] patch 'net/mlx5: add free on completion queue' has
	been queued to stable release 19.11.1
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

Hi,

FYI, your patch has been queued to stable release 19.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/13/20. 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.

Thanks.

Luca Boccassi

---
>From 2b2288cd0c2ff2876495eecbd4647658d57b778b Mon Sep 17 00:00:00 2001
From: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Date: Thu, 9 Jan 2020 17:16:06 +0000
Subject: [PATCH] net/mlx5: add free on completion queue

[ upstream commit 644906881881ea1f5a0400ebc83e95f203790f6e ]

The new software manged entity is introduced in Tx datapath
- free on completion queue. This queue keeps the information
how many buffers stored in elts array must freed on send
completion. Each element of the queue contains transmitting
descriptor index to be in synch with completion entries (in
debug build only) and the index in elts array to free buffers.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/mlx5/mlx5_rxtx.h |  5 +++++
 drivers/net/mlx5/mlx5_txq.c  | 15 +++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 8a2185a0ec..7d1b2fa10c 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -297,6 +297,11 @@ struct mlx5_txq_data {
 	struct mlx5_mr_ctrl mr_ctrl; /* MR control descriptor. */
 	struct mlx5_wqe *wqes; /* Work queue. */
 	struct mlx5_wqe *wqes_end; /* Work queue array limit. */
+#ifdef NDEBUG
+	uint16_t *fcqs; /* Free completion queue. */
+#else
+	uint32_t *fcqs; /* Free completion queue (debug extended). */
+#endif
 	volatile struct mlx5_cqe *cqes; /* Completion queue. */
 	volatile uint32_t *qp_db; /* Work queue doorbell. */
 	volatile uint32_t *cq_db; /* Completion queue doorbell. */
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index 78ec36107c..2db11200d3 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -724,6 +724,17 @@ mlx5_txq_obj_new(struct rte_eth_dev *dev, uint16_t idx,
 	txq_data->wqe_pi = 0;
 	txq_data->wqe_comp = 0;
 	txq_data->wqe_thres = txq_data->wqe_s / MLX5_TX_COMP_THRESH_INLINE_DIV;
+	txq_data->fcqs = rte_calloc_socket(__func__,
+					   txq_data->cqe_s,
+					   sizeof(*txq_data->fcqs),
+					   RTE_CACHE_LINE_SIZE,
+					   txq_ctrl->socket);
+	if (!txq_data->fcqs) {
+		DRV_LOG(ERR, "port %u Tx queue %u cannot allocate memory (FCQ)",
+			dev->data->port_id, idx);
+		rte_errno = ENOMEM;
+		goto error;
+	}
 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
 	/*
 	 * If using DevX need to query and store TIS transport domain value.
@@ -772,6 +783,8 @@ error:
 		claim_zero(mlx5_glue->destroy_cq(tmpl.cq));
 	if (tmpl.qp)
 		claim_zero(mlx5_glue->destroy_qp(tmpl.qp));
+	if (txq_data && txq_data->fcqs)
+		rte_free(txq_data->fcqs);
 	if (txq_obj)
 		rte_free(txq_obj);
 	priv->verbs_alloc_ctx.type = MLX5_VERBS_ALLOC_TYPE_NONE;
@@ -826,6 +839,8 @@ mlx5_txq_obj_release(struct mlx5_txq_obj *txq_obj)
 		} else {
 			claim_zero(mlx5_glue->destroy_qp(txq_obj->qp));
 			claim_zero(mlx5_glue->destroy_cq(txq_obj->cq));
+				if (txq_obj->txq_ctrl->txq.fcqs)
+					rte_free(txq_obj->txq_ctrl->txq.fcqs);
 		}
 		LIST_REMOVE(txq_obj, next);
 		rte_free(txq_obj);
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-02-11 11:17:42.870023475 +0000
+++ 0118-net-mlx5-add-free-on-completion-queue.patch	2020-02-11 11:17:38.592004937 +0000
@@ -1,8 +1,10 @@
-From 644906881881ea1f5a0400ebc83e95f203790f6e Mon Sep 17 00:00:00 2001
+From 2b2288cd0c2ff2876495eecbd4647658d57b778b Mon Sep 17 00:00:00 2001
 From: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
 Date: Thu, 9 Jan 2020 17:16:06 +0000
 Subject: [PATCH] net/mlx5: add free on completion queue
 
+[ upstream commit 644906881881ea1f5a0400ebc83e95f203790f6e ]
+
 The new software manged entity is introduced in Tx datapath
 - free on completion queue. This queue keeps the information
 how many buffers stored in elts array must freed on send
@@ -18,7 +20,7 @@
  2 files changed, 20 insertions(+)
 
 diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
-index 30f0af3920..7d99282797 100644
+index 8a2185a0ec..7d1b2fa10c 100644
 --- a/drivers/net/mlx5/mlx5_rxtx.h
 +++ b/drivers/net/mlx5/mlx5_rxtx.h
 @@ -297,6 +297,11 @@ struct mlx5_txq_data {