From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id CD875A09E9;
	Mon, 14 Dec 2020 11:29:28 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 9CFFFC968;
	Mon, 14 Dec 2020 11:29:12 +0100 (CET)
Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com
 [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id C7DF84F90
 for <dev@dpdk.org>; Mon, 14 Dec 2020 11:29:10 +0100 (CET)
Received: from pps.filterd (m0045849.ppops.net [127.0.0.1])
 by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id
 0BEAPMsk002790; Mon, 14 Dec 2020 02:29:08 -0800
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-type; s=pfpt0220; bh=qR/BGZRmTmE19VTmAEED4fIdbxZjnFz9EyTt1KQH9O4=;
 b=PwsF8nXe5gGE+1alrM/sRzsbdtKnMMqELIS9mjEc64vhqe+L8f5bS63Tgn+pcjzeZ0V7
 eNeN0yXf2WaqKJlnqLQxyLg2B88LYHMuhFY2XpIXo0UBJzmNY+uEtj/Qh3lNDKwnLBAk
 RdXhZagNk99R62eVh68VwclhhZ6x8aqeujBizrgRK1cf7qgFmfFBN5FSPKAzgHSuL48z
 43yhHN5KyD+xdN/OYGHJtoNdO4J+iNiuUh0jz7eTN0yFX/2bKqXnEbdG3lHKgI4u3/ac
 O6RbwEYWtwl3/6ptDzYA4M83c6ilr56A6FPg0voRrLbu7fR5Zr80Bt3qm78ssSa5f7EQ Aw== 
Received: from sc-exch01.marvell.com ([199.233.58.181])
 by mx0a-0016f401.pphosted.com with ESMTP id 35cv3sv1ee-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Mon, 14 Dec 2020 02:29:08 -0800
Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH01.marvell.com
 (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2;
 Mon, 14 Dec 2020 02:29:07 -0800
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com
 (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend
 Transport; Mon, 14 Dec 2020 02:29:08 -0800
Received: from hyd1588t430.marvell.com (unknown [10.29.52.204])
 by maili.marvell.com (Postfix) with ESMTP id 612483F7041;
 Mon, 14 Dec 2020 02:29:06 -0800 (PST)
From: Nithin Dabilpuram <ndabilpuram@marvell.com>
To: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
CC: <jerinj@marvell.com>, <dev@dpdk.org>, Nithin Dabilpuram
 <ndabilpuram@marvell.com>
Date: Mon, 14 Dec 2020 15:58:35 +0530
Message-ID: <20201214102835.19980-2-ndabilpuram@marvell.com>
X-Mailer: git-send-email 2.8.4
In-Reply-To: <20201214102835.19980-1-ndabilpuram@marvell.com>
References: <20201214102835.19980-1-ndabilpuram@marvell.com>
MIME-Version: 1.0
Content-Type: text/plain
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737
 definitions=2020-12-14_04:2020-12-11,
 2020-12-14 signatures=0
Subject: [dpdk-dev] [PATCH 2/2] bitmap: fix bitmap not empty API for 128B
	cacheline
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Currently bitmap line not empty check API assumes cache line
of 64B and only checks 8 slabs. Since in 128B cacheline, we
have 16 slabs per cacheline, plt_bitmap_clear() will mark
complete line as empty as soon as 8 slabs are full thereby
breaking bitmap scan functionality. Fix it by defining new
__plt_bitmap_line_not_empty() for 128B cacheline platform.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
 lib/librte_eal/include/rte_bitmap.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/lib/librte_eal/include/rte_bitmap.h b/lib/librte_eal/include/rte_bitmap.h
index 7c90ef3..d9a1b54 100644
--- a/lib/librte_eal/include/rte_bitmap.h
+++ b/lib/librte_eal/include/rte_bitmap.h
@@ -417,6 +417,7 @@ rte_bitmap_set_slab(struct rte_bitmap *bmp, uint32_t pos, uint64_t slab)
 	*slab1 |= 1llu << offset1;
 }
 
+#if RTE_BITMAP_CL_SLAB_SIZE == 8
 static inline uint64_t
 __rte_bitmap_line_not_empty(uint64_t *slab2)
 {
@@ -432,6 +433,30 @@ __rte_bitmap_line_not_empty(uint64_t *slab2)
 	return v1 | v3;
 }
 
+#elif RTE_BITMAP_CL_SLAB_SIZE == 16
+static inline uint64_t
+__rte_bitmap_line_not_empty(uint64_t *slab2)
+{
+	uint64_t v1, v2, v3, v4, v5, v6, v7, v8;
+
+	v1 = slab2[0] | slab2[1];
+	v2 = slab2[2] | slab2[3];
+	v3 = slab2[4] | slab2[5];
+	v4 = slab2[6] | slab2[7];
+	v5 = slab2[8] | slab2[9];
+	v6 = slab2[10] | slab2[11];
+	v7 = slab2[12] | slab2[13];
+	v8 = slab2[14] | slab2[15];
+	v1 |= v2;
+	v3 |= v4;
+	v5 |= v6;
+	v7 |= v8;
+
+	return v1 | v3 | v5 | v7;
+}
+
+#endif
+
 /**
  * Bitmap bit clear
  *
-- 
2.8.4