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 B2F87A0524; Thu, 6 May 2021 16:28:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A778F41180; Thu, 6 May 2021 16:26:10 +0200 (CEST) Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) by mails.dpdk.org (Postfix) with ESMTP id 2FF6441176 for ; Thu, 6 May 2021 16:26:07 +0200 (CEST) Received: by mail-lj1-f177.google.com with SMTP id e12so7298632ljn.2 for ; Thu, 06 May 2021 07:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nOPHTMCCkX8C83tBIu21N5+HJY6fLAgf/yI6j5uKwM8=; b=at/cXFHiZN0IcDyT/yfjd/WEPNohFpuzp057mvtfAFBjG5WXPZzbujMSPxd/r2ORC9 YXx1o1fORW/i/vbQSgdPu2D2qaBd83FWAUvl/rQMXaWxBVOl4GE8RJbdxb3NDWQrvTyU qj2H1rXMmzRjiEsXAGjdh/NYNQg+ZE4Wk3l08vxctF2tXtJc5WvLM13yQRyd8FLloYIS Nzsc9pZju5Gzec2ZnwfdU3wOMCL1mrsLhpT2ydiJkc8LmTO36kTIiW/dNx0FoNzvM+bV 9bNsQPEFVOdSnkzPqqtq+aNQgvtyfRmmih0ijCuNQoqmbxp74SPl8W7UhzpOkxgCrnnt dh7Q== 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=nOPHTMCCkX8C83tBIu21N5+HJY6fLAgf/yI6j5uKwM8=; b=d2F4tjBTHykh9EV+HP5PH/OiIng9yJ8VSw6orpaXRHUtJnf8iPycbN38LrbpFcx9Ls q7E9mQXkiWt2cUEIwRDAf14E4HZ0Ez/qv2ssYHQd3A4M3NZmJUjIU1a0YpQdGL6Tv1H9 kdbh66kMQA0A2Dg9oQ8KHxikYy2mNtF4Tx8D/h2FGbpsNm6ZAKcpAp7gNnHffc1KOVqy hbwlBX5RcnccelCK4s7EPX33o4L9bnG4exGOyjElBiaYh/YkQ7jdDJJF2XgaBl/0Pg8V dg36FXg7SrCvJZBSIy86NF1l/ovg62KXBEd0LyNVfE2QM3UVW2uLqxJyxd+E5DKLgmZx EhAA== X-Gm-Message-State: AOAM532c1N3oUBqRf+wIsTlt6o4812qiyM039Ohi8y0dEBSHjU9TGBVP uDgkwZ6rdlEzNhl5kT0EGqL+YQnsjwNASfVA X-Google-Smtp-Source: ABdhPJxruCidQnL5EmrFkpO1Auct++5V5Occc1so/K/N9oOXBlwHrRFlS++vQZ+T21bARbdGtO1xRA== X-Received: by 2002:a2e:9c06:: with SMTP id s6mr3632415lji.508.1620311166527; Thu, 06 May 2021 07:26:06 -0700 (PDT) Received: from DESKTOP-U5LNN3J.localdomain (89-79-189-199.dynamic.chello.pl. [89.79.189.199]) by smtp.gmail.com with ESMTPSA id b40sm892908ljr.101.2021.05.06.07.26.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 May 2021 07:26:05 -0700 (PDT) From: Michal Krawczyk To: dev@dpdk.org Cc: ndagan@amazon.com, gtzalik@amazon.com, igorch@amazon.com, upstream@semihalf.com, Stanislaw Kardach , Michal Krawczyk , Shay Agroskin Date: Thu, 6 May 2021 16:25:22 +0200 Message-Id: <20210506142526.28245-19-mk@semihalf.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210506142526.28245-1-mk@semihalf.com> References: <20210505073348.6394-1-mk@semihalf.com> <20210506142526.28245-1-mk@semihalf.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 18/22] net/ena: move default RSS key to shared mem 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 Sender: "dev" From: Stanislaw Kardach Make sure the same random generated RSS key is available to all ENA PMD instances in all processes. Signed-off-by: Stanislaw Kardach Reviewed-by: Michal Krawczyk Reviewed-by: Igor Chauskin Reviewed-by: Shay Agroskin --- drivers/net/ena/ena_ethdev.c | 16 +++++----------- drivers/net/ena/ena_ethdev.h | 1 + 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 0780e2fee2..5c365e1ab5 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -276,19 +276,9 @@ static const struct eth_dev_ops ena_dev_ops = { void ena_rss_key_fill(void *key, size_t size) { - static bool key_generated; - static uint8_t default_key[ENA_HASH_KEY_SIZE]; - size_t i; - RTE_ASSERT(size <= ENA_HASH_KEY_SIZE); - if (!key_generated) { - for (i = 0; i < ENA_HASH_KEY_SIZE; ++i) - default_key[i] = rte_rand() & 0xff; - key_generated = true; - } - - rte_memcpy(key, default_key, size); + rte_memcpy(key, ena_shared_data->default_key, size); } static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf, @@ -1758,7 +1748,11 @@ static uint32_t ena_calc_max_io_queue_num(struct ena_com_dev *ena_dev, static void ena_prepare_shared_data(struct ena_shared_data *shared_data) { + size_t i; + memset(shared_data, 0, sizeof(*shared_data)); + for (i = 0; i < ENA_HASH_KEY_SIZE; ++i) + shared_data->default_key[i] = rte_rand() & 0xff; } static int ena_shared_data_init(void) diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h index e8858c6118..1f7383dce0 100644 --- a/drivers/net/ena/ena_ethdev.h +++ b/drivers/net/ena/ena_ethdev.h @@ -209,6 +209,7 @@ struct ena_offloads { /* Holds data shared between all instances of ENA PMD. */ struct ena_shared_data { + uint8_t default_key[ENA_HASH_KEY_SIZE]; /* Each rte_memzone should have unique name. * To satisfy it, count number of allocation and add it to name. */ -- 2.25.1