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 BD07CA0524; Wed, 5 May 2021 09:36:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 687AF41185; Wed, 5 May 2021 09:34:27 +0200 (CEST) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mails.dpdk.org (Postfix) with ESMTP id 0299441175 for ; Wed, 5 May 2021 09:34:22 +0200 (CEST) Received: by mail-wr1-f46.google.com with SMTP id d11so661087wrw.8 for ; Wed, 05 May 2021 00:34:22 -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=ktDQ3l+z0gV6poMNUIXELHBTd/xegUCladxxPf97zDkre+/4p0h4iJldGoT7cA4LFS 3geu2L85TvtbyM5622NaWU9D01RN4MrUMMkmU1S/NIgeyuSORmD9OKfTlKQB+7adnq73 2t02f3b90G+QFOktIQMHo39Plb0FFATXijZNnAwXKWTVJIehaXUD90L43nb5DKkPIegg deOYUM5bqgM4qODRlX6mCZsRLBSQ0Qgl31LbiXpyiQMkjpU1PCmXe5JlnvtZoveYB6db 7pH4oXEl3/KdC+KO5GhIAqNGzbUovZ2+bIHZrHvsUHdsee/a6UIsj7gO3BDrpJ6ieWmJ e8rA== 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=IZhNGpmA0ZH7inP+dl/L8/m6fIyL+TkqeqIWDYYOSTV3/O1rnzVh8VRRXK1d8x/RL0 mOX3V2tfrF4PkDyLb5mhFdVnMATEz3KlMdsv1MKStRB4m9+HLMjsg9gueSqCBmhysKhl holor7Ao3EM9LKXlI0H73w8j7gqwmKwIjyFKJflxshKTljSL4FmeFUZ1O8fxEM7nitOz URaWzV+a1ewxZCs8/umUPdwjPfcV3hrJL06EsmKyOTMB2ha4m/1hmDDdWO6MWCQ1qiDE llUhftZl4wFI8hPo4kYjBj/qqIgZba0doZ6OyCjcjOKVd8oB9CutDTcEXX9XwBTvImK7 0BUw== X-Gm-Message-State: AOAM533WtUNRhIS0BuuBER2MAfqE/KjEJ5HKdh5Uecelck6h8u7oBscE fYTruWXOZvDK0UMjuaHz8NIMiqhSCM7VjSDA X-Google-Smtp-Source: ABdhPJwCAk2IgM3VfJQnjqQRGVVnkhBeM0/k4XMWjbYWJ05i940X87rcuy2+LptwxJtkFElVhcz0gw== X-Received: by 2002:adf:f043:: with SMTP id t3mr27122303wro.344.1620200062441; Wed, 05 May 2021 00:34:22 -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 t17sm4679856wmq.12.2021.05.05.00.34.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 00:34:21 -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: Wed, 5 May 2021 09:33:44 +0200 Message-Id: <20210505073348.6394-19-mk@semihalf.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210505073348.6394-1-mk@semihalf.com> References: <20210430125725.28796-1-mk@semihalf.com> <20210505073348.6394-1-mk@semihalf.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 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