From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id A8581A0524
	for <public@inbox.dpdk.org>; Fri,  5 Feb 2021 12:19:47 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id A23364067B;
	Fri,  5 Feb 2021 12:19:47 +0100 (CET)
Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com
 [209.85.221.48]) by mails.dpdk.org (Postfix) with ESMTP id 847494067B
 for <stable@dpdk.org>; Fri,  5 Feb 2021 12:19:46 +0100 (CET)
Received: by mail-wr1-f48.google.com with SMTP id a1so7274825wrq.6
 for <stable@dpdk.org>; Fri, 05 Feb 2021 03:19:46 -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=coqRpieJUHv2+zgeJDOK0PT9kqgsa/T7aH+3VRjnvg8=;
 b=VD3jhDtLRDQPE4mzcOYBv3bAVqi8Pz3w3ICt5CPnQG0o/bZ4lYXgJ6co4sjfLNzsf8
 hr1hy2rA65CTjK049seNU5PsoWo0b7g06Tf6ijAhGTHvgnV0kUYObNNn1ld2lB8YE3ic
 0I/hFR8KXp6YlIbeql/K6cxjaQI5uL0sw/7Q9KPxm/F59/MycigCW8SMJuXoRiXtWqx4
 AdVcVN6/c8E0MEu56DXof7KG0HYVZapdi04FEH/a4m+eePmJyZyvyktuDv+bxs80szr2
 +2Twwgi4lKvAtO7TfUEjLKhBz7XAV/YEP7KsblNAwQSWv5fPKEQwms1jWebmwLHWlltD
 Jqmg==
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=coqRpieJUHv2+zgeJDOK0PT9kqgsa/T7aH+3VRjnvg8=;
 b=aomVcrhSrE71l8aPMu+BnIj/kCaV3qzhKJVV6q4+N2wlkXaQTk6So14P6jXkRonIix
 KYVMK+pEU258OrDTck/558zXN27pJw6cxZaPdtD7oD+WNZjIHwCxG7h19uNHPn1cN50X
 7JBLk8QZaF8Lj/0O+/KknM/A9bKEm++Z5bZTLod0Sk9DiIcqHYFU27X69PdMouh9y4OM
 RGmkLjFOQxb1rLxHYSdmTlSms8qSFBVdMMdhnRQd4Eqn0UXnHLqrRAXoDJRB1VsnydoL
 Zu6RPTCJVbiq5eqfA4my0T+rEc2V0aFL934u6B9kGwH2BHIIXHyQI7FZRWE6nHImkAtO
 oF3Q==
X-Gm-Message-State: AOAM530kl3p6LozrcAiHWR9p+wHApOkNr0Z44wTAwqGCIogmi6qQeGEc
 Gi1bi5ypl7jGaN40oi0T3iXCLs9WUcbndg==
X-Google-Smtp-Source: ABdhPJxGBGpRFsgsStwQG3GxziwZFHL8fe0zavZxFWdO0nskDjviRbYb0rKzMWH+RrejbBhxBbk9gA==
X-Received: by 2002:adf:ffc4:: with SMTP id x4mr4387165wrs.67.1612523986321;
 Fri, 05 Feb 2021 03:19:46 -0800 (PST)
Received: from localhost ([88.98.246.218])
 by smtp.gmail.com with ESMTPSA id l5sm11788850wrv.44.2021.02.05.03.19.45
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 05 Feb 2021 03:19:45 -0800 (PST)
From: luca.boccassi@gmail.com
To: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Cc: David Marchand <david.marchand@redhat.com>, dpdk stable <stable@dpdk.org>
Date: Fri,  5 Feb 2021 11:14:52 +0000
Message-Id: <20210205111920.1272063-6-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 'rib: fix insertion in some cases' 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 <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 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/73db17f246bfdb1bd44f66b1e936148025a28517

Thanks.

Luca Boccassi

---
>From 73db17f246bfdb1bd44f66b1e936148025a28517 Mon Sep 17 00:00:00 2001
From: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Date: Tue, 8 Dec 2020 17:00:04 +0000
Subject: [PATCH] rib: fix insertion in some cases

[ upstream commit e682b020840a9035beacd24cba4f6baabcfaf5ff ]

According to GCC documentation for __builtin_clz:
Returns the number of leading 0-bits in x,
starting at the most significant bit position.
If x is 0, the result is undefined.
__builtin_clz will be called with 0 if the existing
prefix address matches the one we want to insert.

Fixes: 5a5793a5ffa2 ("rib: add RIB library")

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
---
 lib/librte_rib/rte_rib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_rib/rte_rib.c b/lib/librte_rib/rte_rib.c
index 2a370d7f84..6c29e1c49a 100644
--- a/lib/librte_rib/rte_rib.c
+++ b/lib/librte_rib/rte_rib.c
@@ -301,7 +301,7 @@ rte_rib_insert(struct rte_rib *rib, uint32_t ip, uint8_t depth)
 	/* closest node found, new_node should be inserted in the middle */
 	common_depth = RTE_MIN(depth, (*tmp)->depth);
 	common_prefix = ip ^ (*tmp)->ip;
-	d = __builtin_clz(common_prefix);
+	d = (common_prefix == 0) ? 32 : __builtin_clz(common_prefix);
 
 	common_depth = RTE_MIN(d, common_depth);
 	common_prefix = ip & rte_rib_depth_to_mask(common_depth);
-- 
2.29.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-02-05 11:18:29.614347527 +0000
+++ 0006-rib-fix-insertion-in-some-cases.patch	2021-02-05 11:18:28.586686923 +0000
@@ -1 +1 @@
-From e682b020840a9035beacd24cba4f6baabcfaf5ff Mon Sep 17 00:00:00 2001
+From 73db17f246bfdb1bd44f66b1e936148025a28517 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit e682b020840a9035beacd24cba4f6baabcfaf5ff ]
+
@@ -14 +15,0 @@
-Cc: stable@dpdk.org