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 dpdk.space (Postfix) with ESMTP id 7E298A05D3
	for <public@inbox.dpdk.org>; Wed, 24 Apr 2019 14:33:25 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 4ED491B127;
	Wed, 24 Apr 2019 14:33:25 +0200 (CEST)
Received: from sesbmg23.ericsson.net (sesbmg23.ericsson.net [193.180.251.37])
 by dpdk.org (Postfix) with ESMTP id 71B1558EC
 for <dev@dpdk.org>; Wed, 24 Apr 2019 14:33:24 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801;
 c=relaxed/relaxed; 
 q=dns/txt; i=@ericsson.com; t=1556109204; x=1558701204;
 h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type:
 Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From:
 Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id:
 List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=5AZSNfKDPiqRycEMjU568cQ7bMzvpbBir00ndOn4uwc=;
 b=K3mzRGukjC8FySGCnrEqgW+Lp5Vm8SdcAXWaHzyrUYUKmx0C+k2ZGhsTa4pb7bzr
 tVGYtpBLtQcnQOQtQqGwoKG8PuoKWEWrOtJl7P3AExqK23p22XZt1yi6iLqJfwVi
 aov/qDNexsJGD+MwuVUmGhHtHO9hxnLfYGNNGgObLXs=;
X-AuditID: c1b4fb25-399ff700000029f0-aa-5cc057946047
Received: from ESESSMB501.ericsson.se (Unknown_Domain [153.88.183.119])
 by sesbmg23.ericsson.net (Symantec Mail Security) with SMTP id
 E9.18.10736.49750CC5; Wed, 24 Apr 2019 14:33:24 +0200 (CEST)
Received: from ESESBMB504.ericsson.se (153.88.183.171) by
 ESESSMB501.ericsson.se (153.88.183.162) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id
 15.1.1713.5; Wed, 24 Apr 2019 14:33:23 +0200
Received: from selio1a020.lmera.ericsson.se (153.88.183.153) by
 smtp.internal.ericsson.com (153.88.183.187) with Microsoft SMTP Server id
 15.1.1713.5 via Frontend Transport; Wed, 24 Apr 2019 14:33:23 +0200
Received: from breslau.lmera.ericsson.se (breslau.lmera.ericsson.se
 [150.132.109.241])
 by selio1a020.lmera.ericsson.se (8.15.1+Sun/8.15.1) with ESMTP id
 x3OCXNAc010622; Wed, 24 Apr 2019 14:33:23 +0200 (CEST)
From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= <mattias.ronnblom@ericsson.com>
To: <dev@dpdk.org>
CC: <nhorman@tuxdriver.com>, <stephen@networkplumber.org>,
 =?UTF-8?q?Mattias=20R=C3=B6nnblom?= <mattias.ronnblom@ericsson.com>
Date: Wed, 24 Apr 2019 14:33:18 +0200
Message-ID: <20190424123320.19610-1-mattias.ronnblom@ericsson.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <e105eedd-bd18-5375-13b6-0123cfff2ae8@ericsson.com>
References: <e105eedd-bd18-5375-13b6-0123cfff2ae8@ericsson.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBLMWRmVeSWpSXmKPExsUyM2J7ue6U8AMxBjf72C3efdrOZHGr+SSb
 xeI7cg7MHr8WLGX16Dk5j8njyvfVjAHMUVw2Kak5mWWpRfp2CVwZX369ZylYzVMx/fpe5gbG
 O5xdjJwcEgImEnOfbGPrYuTiEBI4yigx4UI3O4TzjVHi+LLXUM5FRonn/V9YIJzLjBJzdh1j
 AelnE/CUmPyuG8wWERCSWPrxMjuIzSzQwCixcCsHiC0s4CSxtPUZM4jNIqAqcezSckYQmxco
 vujOJnaIO+QlVm84AFbDKeAgMWfVTDBbSMBe4nbTZyaIekGJkzOfsEDM15Ro3f4bape8RPPW
 2VD1WhL3l3xhnsAoNAtJyywkLbOQtCxgZF7FKFqcWpyUm25krJdalJlcXJyfp5eXWrKJERje
 B7f8Vt3BePmN4yFGAQ5GJR7efMcDMUKsiWXFlbmHGCU4mJVEeE22748R4k1JrKxKLcqPLyrN
 SS0+xCjNwaIkzhu9ek+MkEB6YklqdmpqQWoRTJaJg1OqgTHf+9NZCbfa2ztjH9aW3/zoJhb1
 kGNqgTvjmcs3N0fPqdqeufxdB6+RyNFcC3PHosi9YQE65zzZZ84NvzvJWf9LXpSjoemZYyxW
 73dKylYez9TfacL4fdP/yPuMedVs060eWnyd6rExbeWveX3BhVtCoiOOz5c+kD2x4Lj5roa6
 zhbHmO1ZbkosxRmJhlrMRcWJAP1m2yBrAgAA
Subject: [dpdk-dev] [RFC v3 0/2] Pseudo-random number generation improvements
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>
Message-ID: <20190424123318.4lTsmp5AyDELZPuLQQ0-kkKCKkPvpudcAcF8e7fCPSY@z>

Make rte_rand() multi-thread safe, go faster and produce
better-quality pseudo-random numbers.

Thanks to Stephen Hemminger, Keith Wiles and Neil Horman for valuable
feedback.

v3:
* Since rte_rand() and rte_srand() have been a part of the API since long,
  the experimental attribute was removed and the symbols were moved out
  of the experimental section of the version.map file.
* rte_rand_max() performance improvements:
  * Avoid repeated rte_lcore_id() calls.
  * Handle a power-of-2 upper bound as a special case.
* Added a Bugzilla reference to the rte_rand() MT safety bug.

v2:
* Removed 32-bit version of rte_rand() and rte_rand_max().
* Switched from a four-sequence LFSR (producing a 32-bit number)
  to a five-sequence LFSR (producing a 64-bit number).
* Added a note on generator not being cryptographically secure.

Mattias Rönnblom (2):
  eal: replace libc-based random number generation with LFSR
  eal: introduce random generator function with upper bound

 lib/librte_eal/common/include/rte_random.h |  45 +++---
 lib/librte_eal/common/meson.build          |   1 +
 lib/librte_eal/common/rte_random.c         | 176 +++++++++++++++++++++
 lib/librte_eal/freebsd/eal/Makefile        |   1 +
 lib/librte_eal/freebsd/eal/eal.c           |   2 -
 lib/librte_eal/linux/eal/Makefile          |   1 +
 lib/librte_eal/linux/eal/eal.c             |   2 -
 lib/librte_eal/rte_eal_version.map         |   3 +
 8 files changed, 209 insertions(+), 22 deletions(-)
 create mode 100644 lib/librte_eal/common/rte_random.c

-- 
2.17.1