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 D73B3A0093
	for <public@inbox.dpdk.org>; Tue, 19 May 2020 14:59:44 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id CECD31D5DE;
	Tue, 19 May 2020 14:59:44 +0200 (CEST)
Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com
 [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id 321091D5DE
 for <stable@dpdk.org>; Tue, 19 May 2020 14:59:42 +0200 (CEST)
Received: by mail-wr1-f65.google.com with SMTP id h17so15775153wrc.8
 for <stable@dpdk.org>; Tue, 19 May 2020 05:59:42 -0700 (PDT)
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=eMmqEuGpJRa1GiBKdaZCxCQA3N2xt00sovQBtts7u6M=;
 b=OpQzJxYnbMO8zL0MGFcHOOCu5Hqfvaq8LmTW/9zbYdvTSz+m3b8Cr72Aubhv7sk4XC
 24aEnSVSwtUSR1XvikNbucwJm0bGD6b0oRYsnF1AAlGDn5vfdlmMtqbCGDXQSu/HAZWX
 2yxvdMTseXu0MK3P4TK1gpVXOwG9dOm6oL96VNMwCMSEyaGZ3HGU3TYgPWJBHH6+n61M
 g0pc9ZoaesHbF7QMzPfxs3+rL0sLy4EVk8WPNtF85TdWtSvj15H1LWyCHCFaT72JdMgn
 ypCc6AN5Hf9GDOUofPssC40kWh7dfGpuCw47uLapGjrJ8vo/KVUJ/4XNKkoRniXIkJ4n
 KQtw==
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=eMmqEuGpJRa1GiBKdaZCxCQA3N2xt00sovQBtts7u6M=;
 b=ogoE8JAipVzP/8GMjrQH48/PyALNx/rkMzSDg9f7GbiZ3qWd4KDrped/oy5qO7th2c
 b9HlWXQNFY4ZNWpryrTVj+ZmROE1xGEZa1EJqi/sdkNDUlBa+QLpq8BSVfNcWYFP6lHa
 BTykJOoMuKeFY6I/kgINb+n/VB6Q1PyFoaX8K3wSsPWDSIrVX7OZq7wxRGeD8NWAGWwR
 OZzdO1p6iCsVv5ymSGKdpk6m4hXMtuIVLTAUe6VL+nkP7UQNmZetSwFOXqMGjVX2/uN9
 hZR+oIX+6hK+XQrH2lcJxVhK3SRl+muh8xX3t1OWkWyWyn6eNYiCYchZGXi1xZUIRKa5
 eItw==
X-Gm-Message-State: AOAM5303PeS8kWJdLna126wEeJV/iAUHuMaBGhD2MEM7S51+MleMEDlk
 HROcrCSPM+i1Tgs0km+PS/U=
X-Google-Smtp-Source: ABdhPJxzz8/pWiaHLSs/06ZNcrQ+p9j1gQrJBYMF2ZEgvrXN+7R3GdQOV/BO9NJirGrc8gVBWErQqg==
X-Received: by 2002:a5d:4b4d:: with SMTP id w13mr27325454wrs.178.1589893181939; 
 Tue, 19 May 2020 05:59:41 -0700 (PDT)
Received: from localhost ([88.98.246.218])
 by smtp.gmail.com with ESMTPSA id w18sm21077659wro.33.2020.05.19.05.59.41
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 19 May 2020 05:59:41 -0700 (PDT)
From: luca.boccassi@gmail.com
To: Igor Romanov <igor.romanov@oktetlabs.ru>
Cc: Andrew Rybchenko <arybchenko@solarflare.com>, dpdk stable <stable@dpdk.org>
Date: Tue, 19 May 2020 13:53:52 +0100
Message-Id: <20200519125804.104349-42-luca.boccassi@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200519125804.104349-1-luca.boccassi@gmail.com>
References: <20200519125804.104349-1-luca.boccassi@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] patch 'net/sfc/base: refactor filter lookup loop in
	EF10' has been queued to stable release 19.11.3
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.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/21/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 c6ae74f068cb41064c408678a5841f31e68305d0 Mon Sep 17 00:00:00 2001
From: Igor Romanov <igor.romanov@oktetlabs.ru>
Date: Tue, 10 Mar 2020 09:48:38 +0000
Subject: [PATCH] net/sfc/base: refactor filter lookup loop in EF10

[ upstream commit ad3727f71f2aa75c8a102ad0e0a1c9e99840f45b ]

The code is refactored to make it more clear and allow for
more convenient further changes.

Fixes: e7cd430c864f ("net/sfc/base: import SFN7xxx family support")

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/base/ef10_filter.c | 80 ++++++++++++++----------------
 1 file changed, 38 insertions(+), 42 deletions(-)

diff --git a/drivers/net/sfc/base/ef10_filter.c b/drivers/net/sfc/base/ef10_filter.c
index e4f8de51c0..5578765ab3 100644
--- a/drivers/net/sfc/base/ef10_filter.c
+++ b/drivers/net/sfc/base/ef10_filter.c
@@ -628,56 +628,52 @@ ef10_filter_add_internal(
 	 * else a free slot to insert at.  If any of them are busy,
 	 * we have to wait and retry.
 	 */
-	for (;;) {
-		ins_index = -1;
-		depth = 1;
-		EFSYS_LOCK(enp->en_eslp, state);
-		locked = B_TRUE;
+retry:
+	EFSYS_LOCK(enp->en_eslp, state);
+	locked = B_TRUE;
 
-		for (;;) {
-			i = (hash + depth) & (EFX_EF10_FILTER_TBL_ROWS - 1);
-			saved_spec = ef10_filter_entry_spec(eftp, i);
+	ins_index = -1;
 
-			if (!saved_spec) {
-				if (ins_index < 0) {
-					ins_index = i;
-				}
-			} else if (ef10_filter_equal(spec, saved_spec)) {
-				if (ef10_filter_entry_is_busy(eftp, i))
-					break;
-				if (saved_spec->efs_priority
-					    == EFX_FILTER_PRI_AUTO) {
-					ins_index = i;
-					goto found;
-				} else if (ef10_filter_is_exclusive(spec)) {
-					if (may_replace) {
-						ins_index = i;
-						goto found;
-					} else {
-						rc = EEXIST;
-						goto fail1;
-					}
-				}
+	for (depth = 1; depth <= EF10_FILTER_SEARCH_LIMIT; depth++) {
+		i = (hash + depth) & (EFX_EF10_FILTER_TBL_ROWS - 1);
+		saved_spec = ef10_filter_entry_spec(eftp, i);
 
-				/* Leave existing */
+		if (saved_spec == NULL) {
+			if (ins_index < 0)
+				ins_index = i;
+		} else if (ef10_filter_equal(spec, saved_spec)) {
+			if (ef10_filter_entry_is_busy(eftp, i)) {
+				EFSYS_UNLOCK(enp->en_eslp, state);
+				locked = B_FALSE;
+				goto retry;
 			}
 
-			/*
-			 * Once we reach the maximum search depth, use
-			 * the first suitable slot or return EBUSY if
-			 * there was none.
-			 */
-			if (depth == EF10_FILTER_SEARCH_LIMIT) {
-				if (ins_index < 0) {
-					rc = EBUSY;
-					goto fail2;
-				}
+			if (saved_spec->efs_priority == EFX_FILTER_PRI_AUTO) {
+				ins_index = i;
 				goto found;
 			}
-			depth++;
+
+			if (ef10_filter_is_exclusive(spec)) {
+				if (may_replace) {
+					ins_index = i;
+					goto found;
+				} else {
+					rc = EEXIST;
+					goto fail1;
+				}
+			}
+
+			/* Leave existing */
 		}
-		EFSYS_UNLOCK(enp->en_eslp, state);
-		locked = B_FALSE;
+	}
+
+	/*
+	 * Once we reach the maximum search depth, use the first suitable slot
+	 * or return EBUSY if there was none.
+	 */
+	if (ins_index < 0) {
+		rc = EBUSY;
+		goto fail2;
 	}
 
 found:
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-05-19 13:56:20.547584364 +0100
+++ 0042-net-sfc-base-refactor-filter-lookup-loop-in-EF10.patch	2020-05-19 13:56:18.243502251 +0100
@@ -1,13 +1,14 @@
-From ad3727f71f2aa75c8a102ad0e0a1c9e99840f45b Mon Sep 17 00:00:00 2001
+From c6ae74f068cb41064c408678a5841f31e68305d0 Mon Sep 17 00:00:00 2001
 From: Igor Romanov <igor.romanov@oktetlabs.ru>
 Date: Tue, 10 Mar 2020 09:48:38 +0000
 Subject: [PATCH] net/sfc/base: refactor filter lookup loop in EF10
 
+[ upstream commit ad3727f71f2aa75c8a102ad0e0a1c9e99840f45b ]
+
 The code is refactored to make it more clear and allow for
 more convenient further changes.
 
 Fixes: e7cd430c864f ("net/sfc/base: import SFN7xxx family support")
-Cc: stable@dpdk.org
 
 Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
 Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>