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 16833A0546; Fri, 30 Apr 2021 14:59:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 79F784133A; Fri, 30 Apr 2021 14:58:08 +0200 (CEST) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by mails.dpdk.org (Postfix) with ESMTP id 4D705412CB for ; Fri, 30 Apr 2021 14:58:01 +0200 (CEST) Received: by mail-wm1-f41.google.com with SMTP id y124-20020a1c32820000b029010c93864955so1656598wmy.5 for ; Fri, 30 Apr 2021 05:58:01 -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=ZibLsgUysive5t7iD3UWonh9cA3Z/NY7Bqi/384ZpqrJ4T3jaWk3mPAfj3sDl27k/+ map3z927Hc4ok66cqZkISaKCuy9BqFSPfz21fyW3Fr3dWwbHo+ouUKjHV2Ibzsdvr/TP ngMk2VjogktwmTUZdquJiE4Fehc/4POlgvb7BO4ipdhg7XoZLsxcnZNBFboMIFPIS93/ Xo1vtKlq6b9l9MEqyo+gHDDWYcfhNL18/7b89o+bzu4hmuPXkBvlBgWO8XGpzllAS/ff fDBpHSdhYCF1OTrAwbUVwkp4NOvN2mjHN/KfoC6Tl+hZO4FVaosvR0MpiIohN0B9cCNe O8zA== 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=qC4C2l54UR8u2tNqcV4ZX+ghSgIYC0R3FQWvs5rrBJGbKNLTMfaObZGC+PM3WEA6lk Bddw/AusNhuHnKwkx5gkSYgQR9Rujw7wmsuxP/bJe08Iu25LhnIMLcPim3fzVO9Kvvvo 6YvTifAgp3IV1wxsjcsTOJegNIe5ACbFvHiJ3CRJGASWnV6nVNTFZlbvd4H5Pp3omLLe wki6G5Ku8JwTuRNet1p4Wu1EsfidbHEI+enhRumPkXAmsV8EtsBLzeWb8XGSd/i+gcUt t6bXbKcv28v5g76+Ywz9Y2ijDyLpleQiKCguCpjd4WlgQooXMGLgVhHwvB0VflmIF+3m kdnw== X-Gm-Message-State: AOAM531HZQpSt9DoHZ1otIamUX/YMmn95PrCrK1zlK7jn3Di8xh2EU+Z cuksCixA4jUCU9yPEc7+nq/ZzWSCSaSvMGJe X-Google-Smtp-Source: ABdhPJz9TBsAdZK3v2UHQxiv59mvgvYRz6ukJ0nklgT2Gt+SH4Ru+ug0+80jqmrYlspqdFlfww+kUg== X-Received: by 2002:a05:600c:4fd4:: with SMTP id o20mr16957116wmq.166.1619787480779; Fri, 30 Apr 2021 05:58:00 -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 l13sm13476245wmj.3.2021.04.30.05.57.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Apr 2021 05:58:00 -0700 (PDT) From: Michal Krawczyk To: dev@dpdk.org Cc: ndagan@amazom.com, gtzalik@amazon.com, igorch@amazon.com, mw@semihalf.com, Stanislaw Kardach , Michal Krawczyk , Shay Agroskin Date: Fri, 30 Apr 2021 14:57:21 +0200 Message-Id: <20210430125725.28796-19-mk@semihalf.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210430125725.28796-1-mk@semihalf.com> References: <20210430125725.28796-1-mk@semihalf.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 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