From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6BD0342527; Wed, 6 Sep 2023 17:53:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5AE28402B8; Wed, 6 Sep 2023 17:53:16 +0200 (CEST) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mails.dpdk.org (Postfix) with ESMTP id D02C04027C for ; Wed, 6 Sep 2023 17:53:14 +0200 (CEST) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1c336f5b1ffso27324215ad.2 for ; Wed, 06 Sep 2023 08:53:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1694015594; x=1694620394; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=adFNDuCeYQHTO9UeV5jkHlvDqf+YGxxWajuRln4hw2M=; b=FYiJ6k8zWjgtUgDLz3aYMCnd+Ukrhnbs1EviazByrzLsPo0f3FPMwz74LKA45pm8qm +Ca1tE70JsHeiuqxgQCph2GwHC8G2Gk1fFwnCpZoKv32ybFjfKKc5RlgMXIQhdXvfzL3 GKREaz2vUipHUUPfnhos9A1VH4co3vuqlLFDJsUBJCps57zmuYvYRwYjODzdyP9WqQyD B60ZNsvp3Di6Kq47DAXdx+PScWTgGJjiTt+A6r4dSRre1TV6MH8wmhbbiNL6fmRRxJGV K8CBPNxgh/WrBw5L1nLUXZoptmOORRP0eITeQ6zuiNpFeGGdXlCW7Uje9kY6FPhNnfWv zjGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694015594; x=1694620394; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=adFNDuCeYQHTO9UeV5jkHlvDqf+YGxxWajuRln4hw2M=; b=HQBpMZzcPq2u/O3eZWHRZjEBsXOrVFpACGFMjAnJRWv8dMrSvz0lJPf2LeTkNll062 5I98qk4ClNrZ2XY2VKJVT8dPprBeo/gEXaNyR1x5bH8aFFmKSdI3tPExHKCrE8Q/N4HS Drq2OdBEYn2RwYibatZAXpdOArAc8QUQ9uIzxG+t0ZOR4tQ4vNEE2Ctlq1DkHFh2v1jN GpA4BLOJpHzLeFXPbgwC2muzLMn1zESH9+ztED5QxDPHB33gMSdK0Uc7mGoAeWC/Tfl4 LoyrQNy4OprBF6yillBejGpayC53WUKtUUm5GUu3ZDvo2mhS5ZhbXzep/aeHAYWfQBqF fhhQ== X-Gm-Message-State: AOJu0YyNI8BAlrxb25y49iTVDd+3T5prZbuimDp2+AViKHuckYbVWQUp hbiXKMgo8vEgkzc+ZxmiVi/ujlMFtEXSP3MloIw= X-Google-Smtp-Source: AGHT+IGwG7pEmCTXIcfYvHdC6wY8bS2EH73Kbor9TjsYEcI1z/ZwPM9aZXkQcxnyhRbJ//jJwTP41A== X-Received: by 2002:a17:902:f68c:b0:1c3:329c:6c09 with SMTP id l12-20020a170902f68c00b001c3329c6c09mr12076737plg.65.1694015593727; Wed, 06 Sep 2023 08:53:13 -0700 (PDT) Received: from hermes.local (204-195-112-131.wavecable.com. [204.195.112.131]) by smtp.gmail.com with ESMTPSA id f12-20020a17090274cc00b001bc5dc0cd75sm11207581plt.180.2023.09.06.08.53.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Sep 2023 08:53:13 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , mattias.ronnblom@ericsson.com, Matan Azrad , Viacheslav Ovsiienko , Ori Kam , Suanming Mou , Bruce Richardson Subject: [PATCH] random: initialize the random state for non-eal lcores Date: Wed, 6 Sep 2023 08:53:02 -0700 Message-Id: <20230906155302.82749-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The per-lcore PRNG was not initializing the rand_state of all the lcores. Any usage of rte_random by a non-EAL lcore would use rand_states[RTE_MAX_LCORE] which was never initialized. Fix by using RTE_DIM() which will get all lcores. Fixes: 3f002f069612 ("eal: replace libc-based random generation with LFSR") Cc: mattias.ronnblom@ericsson.com Signed-off-by: Stephen Hemminger --- drivers/common/mlx5/linux/mlx5_common_os.c | 2 +- lib/eal/common/rte_random.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c index 2ebb8ac8b6e5..7260c1a19fd3 100644 --- a/drivers/common/mlx5/linux/mlx5_common_os.c +++ b/drivers/common/mlx5/linux/mlx5_common_os.c @@ -266,7 +266,7 @@ mlx5_glue_path(char *buf, size_t size) goto error; return buf; error: - RTE_LOG(ERR, PMD, "unable to append \"-glue\" to last component of" + DRV_LOG(ERR, "unable to append \"-glue\" to last component of" " RTE_EAL_PMD_PATH (\"" RTE_EAL_PMD_PATH "\"), please" " re-configure DPDK"); return NULL; diff --git a/lib/eal/common/rte_random.c b/lib/eal/common/rte_random.c index 53636331a27b..812e5b4757b5 100644 --- a/lib/eal/common/rte_random.c +++ b/lib/eal/common/rte_random.c @@ -84,7 +84,7 @@ rte_srand(uint64_t seed) unsigned int lcore_id; /* add lcore_id to seed to avoid having the same sequence */ - for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) + for (lcore_id = 0; lcore_id < RTE_DIM(rand_states); lcore_id++) __rte_srand_lfsr258(seed + lcore_id, &rand_states[lcore_id]); } -- 2.39.2