From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8E2A0A0562; Tue, 31 Mar 2020 11:40:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A91181BFD4; Tue, 31 Mar 2020 11:40:57 +0200 (CEST) Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) by dpdk.org (Postfix) with ESMTP id 02A7B1BFC1 for ; Tue, 31 Mar 2020 11:40:55 +0200 (CEST) Received: by mail-ed1-f65.google.com with SMTP id u59so24257915edc.12 for ; Tue, 31 Mar 2020 02:40:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=x3O6DVnRNDkvh0anq1/l0Ar3bjcMyQlsGIChC+voLlA=; b=tKDlEAKY6O7vQmC6/b+e6/SGeP/8XTvOZGwglmYS6pdU1jAFZBhMpdzdIVGWx35XNJ dJydBGY43jVZpAkeEKdy0pjV3PttHqlGlDXrvjJRAhAJaWbCWDdcl8T15FRjxbHuil3m OlUbdvE19JorgX/YfitPnyoY61wobN1knQT6ZvP9zOhu59xBR2RLlN9uZr+zZpuRzoVz acBrBvl8yMnEQ7DZlUdpWTb+7bRJyu2mj4ek8vYovVO7kDEPJ3WPhtJ08QmI4YD5x6x4 gqFu1IdfnYijnUgjXP3512nrpGXE6qP2S5G8Wwp7L/HMBDut7KsqFK/BYOsbJKWx6+Pb kckg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=x3O6DVnRNDkvh0anq1/l0Ar3bjcMyQlsGIChC+voLlA=; b=mNLFIx9iiZNl7QMGgS6TG1grU5XJOlZC8Im3owVUofqyX9UPYaJ69itVLbzfhfMt15 D70IALf8eRJqFJEjfOV8difhG3ol4tCDSpKZMz3LOXB4lrbvMQ6HEAWacY/6ANFmRLZn Y5YGcvzIIzx7nFu3G3mnXY/ll55cEzn/pzk5arK3cGx4eu3Idn1ASQ1dE3AtsENpAK0M yfor/puv/EZhPvRhg9H54hpMkaOlvn356mPoPPnCwvioQZQ6Ro13OaofBnyrNlad2qMP qfyLMYjr/xzytN44sUvkM7JorZUrBSuCAss9FItsLrt07pcm4BEiBAUA9mkP/aiy8Z8r cYAQ== X-Gm-Message-State: ANhLgQ1YWEdTDwlq9ztVnItKEWGtcadp3rQgJCggUJc1+yetGNzLUezf zEba8cVfJkjSKhoEu+LAVznpc5PQ2vhEBd7J3CPhtg== X-Google-Smtp-Source: ADFU+vtwuSjVLTg/byG4aCQZ5sEPyG2VdDZx0SVcxlXyx8pVIxjlNYa/LlrtdmBpGSEGFRULbBp43BE/XAeW3k/8lJA= X-Received: by 2002:a50:d7d7:: with SMTP id m23mr15616419edj.41.1585647655534; Tue, 31 Mar 2020 02:40:55 -0700 (PDT) MIME-Version: 1.0 References: <20200327101823.12646-1-mk@semihalf.com> <20200327101823.12646-5-mk@semihalf.com> <2c706c63-1138-8097-eda2-ef721ed30071@solarflare.com> In-Reply-To: <2c706c63-1138-8097-eda2-ef721ed30071@solarflare.com> From: =?UTF-8?Q?Micha=C5=82_Krawczyk?= Date: Tue, 31 Mar 2020 11:40:44 +0200 Message-ID: To: Andrew Rybchenko Cc: dev@dpdk.org, Marcin Wojtas , Maciej Bielski , "Tzalik, Guy" , "Schmeilin, Evgeny" , "Chauskin, Igor" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH 04/29] net/ena/base: set default hash key X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" pt., 27 mar 2020 o 12:12 Andrew Rybchenko napisa=C5=82(a): > > On 3/27/20 1:17 PM, Michal Krawczyk wrote: > > The RSS hash key was present in the device, but it wasn't exposed to > > the user. The other key still cannot be set, but now it can be accessed > > if one needs to do that. > > > > By default, the random hash key is used and it is generated only once > > when requested for the first time. > > > > Signed-off-by: Michal Krawczyk > > Reviewed-by: Igor Chauskin > > Reviewed-by: Guy Tzalik > > [snip] > > > diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.= c > > index cab38152a7..4c1e4899d0 100644 > > --- a/drivers/net/ena/ena_ethdev.c > > +++ b/drivers/net/ena/ena_ethdev.c > > @@ -256,6 +256,22 @@ static const struct eth_dev_ops ena_dev_ops =3D { > > .reta_query =3D ena_rss_reta_query, > > }; > > > > +void ena_rss_key_fill(void *key, size_t size) > > +{ > > + static bool key_generated; > > + static uint8_t default_key[ENA_HASH_KEY_SIZE]; > > You have thread-safety patches in the series before this one. > Is it OK to be thread-unsafe here? > > > + > > + RTE_ASSERT(size <=3D ENA_HASH_KEY_SIZE); > > + > > + if (unlikely(!key_generated)) { > > I believe that unlikely() is not required here. It is not a > datapath and there is no point to use likely/unlikely on > control path. > I will remove it in v2. > > + for (size_t i =3D 0; i < ENA_HASH_KEY_SIZE; ++i) > > It is C99 feature which breaks DPDK build pretty often, since > neither c99 nor higher are requested in default DPDK build. > Ok, will be fixed in v2. > > + default_key[i] =3D rte_rand() & 0xff; > > + key_generated =3D true; > > + } > > + > > + rte_memcpy(key, default_key, size); > > +} > > + > > static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf, > > struct ena_com_rx_ctx *ena_rx_ctx) > > { > > >