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 BD4FBA0548; Mon, 10 May 2021 10:27:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 40A3940140; Mon, 10 May 2021 10:27:12 +0200 (CEST) Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) by mails.dpdk.org (Postfix) with ESMTP id 771E04003E for ; Mon, 10 May 2021 10:27:10 +0200 (CEST) Received: by mail-lf1-f46.google.com with SMTP id i9so15545875lfe.13 for ; Mon, 10 May 2021 01:27:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=VJ7FR99pC6tkAH+NuVS2zSumnafrWu1p3JmvGkp1Hgs=; b=YmDU2whRsR6cVWOz/IYINUu5KHsKa07Lxwl/1rnXyAteEfJ3GT65qqXEnXHs2jMKfX KR7JQ9z5V6YlPj0e7pGt771zdeiE+H9yHxx0m4JfLlYDCh4LmGW4+AKQKrenX9ZXanC3 9z+0O5YVWpHp6tecQd8ZssPJ505YlJGHQsn+QJMmy/hK90S9PAeRDX/ZHbFfuXC6jtcB ZGQvjBNXjyo6nAJiPXygaE/jn3hv34WyOLn/+D0KDmyl1SNDulJ+4PJg3ovFKhRVhaSB nI82qMt9X9ltp5Mpn9fyXqtD0y49W/kLgUFmXHM23Lorn9a+1ORngdcQtMrMg7nxD/FX CKNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=VJ7FR99pC6tkAH+NuVS2zSumnafrWu1p3JmvGkp1Hgs=; b=LEDnNCuxFyqUFjCGm8+gWM9xyNBHkmBvglhJCWg11u6QLICWo/V6g4oZj/8NLpAtWc bl6KPLR+J7R6y0xyfkcr1zYexjoLdsQybejf94nw+VowEyJA1LBsn6f9wJUaDobwr87u CecnQ2A54COB7WJDa+YXIuGNh6SoIzybLGz7eNSnfTIyMtqq3HwnYUfpelXhjODbP+j1 5DuiuTRg02CV+r+W3/NBe0Lbpm+Z3S0Trp/QZNyUA2HsnenTSxObj34d1o9gGZKmTzHs y/Db4KBgwbDVscKdi0Rj4Qqb+bvUcBnXPcdXONB11i3GuD0mH/FBH2pOTktBaNAq0FyX O7sQ== X-Gm-Message-State: AOAM533KiB3uRkMFPKsNtvhNNx6nEkp1VgpCralDwlZi6gwzS6WCgUWd wX4MpLL5KVIPcgrUH1mbvplBwg== X-Google-Smtp-Source: ABdhPJxSimhEdhGIwPzVa7O6d8zsOHqwDz9nP06r/Q/dTJKoX4H+YBBV+8SFysTqyBahppA/VP05QQ== X-Received: by 2002:a05:6512:1182:: with SMTP id g2mr16213769lfr.117.1620635229954; Mon, 10 May 2021 01:27:09 -0700 (PDT) Received: from toster (89-73-146-138.dynamic.chello.pl. [89.73.146.138]) by smtp.gmail.com with ESMTPSA id 19sm3170163ljw.96.2021.05.10.01.27.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 May 2021 01:27:09 -0700 (PDT) Date: Mon, 10 May 2021 10:27:07 +0200 From: Stanislaw Kardach To: Michal Krawczyk Cc: dev@dpdk.org, ndagan@amazon.com, gtzalik@amazon.com, igorch@amazon.com, upstream@semihalf.com, Shay Agroskin Message-ID: <20210510082707.sgvveh2zw6xagc33@toster> References: <20210505073348.6394-1-mk@semihalf.com> <20210506142526.28245-1-mk@semihalf.com> <20210506142526.28245-19-mk@semihalf.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210506142526.28245-19-mk@semihalf.com> Subject: Re: [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" On Thu, May 06, 2021 at 04:25:22PM +0200, Michal Krawczyk wrote: > 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]; Given Ferruh's comments on "[PATCH 17/22] net/ena: support SMP for mz alloc counter" it is probably a better idea to have this default key generated per-device and keep it in rte_eth_dev.data. This will allow to eliminate the shared memory segment (freeing issues) and increase entropy for the different devices. > /* Each rte_memzone should have unique name. > * To satisfy it, count number of allocation and add it to name. > */ > -- > 2.25.1 > -- Best Regards, Stanislaw Kardach