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 F1342A0562; Tue, 31 Mar 2020 11:51:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 94EA51BFC5; Tue, 31 Mar 2020 11:51:32 +0200 (CEST) Received: from mail-ed1-f67.google.com (mail-ed1-f67.google.com [209.85.208.67]) by dpdk.org (Postfix) with ESMTP id C74952BCE for ; Tue, 31 Mar 2020 11:51:31 +0200 (CEST) Received: by mail-ed1-f67.google.com with SMTP id o1so6105897edv.1 for ; Tue, 31 Mar 2020 02:51:31 -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=KCPSZTQDZODENSgxY50+V4N7AZO/CQ6APEi0MW9hulE=; b=CudkEgU27YZ7pbOfxalXfYCAuMSzapvh6LexdLP2aYQE4EUS8H5B6F/KI0X9uGqkBn 1jor8kz43k90uwCzZ97IbLX7Z8nQsyg2DfwujA2h0mW2EMQGBAzHRFk95xMaXKZExroL UBHfJqMEBdF6oUXV5outGjp/Se8uiEENPPZVNRnn79fYjePikpbP0Nox0wFvhvwf8pEJ ZfwPTN1qsBygZdQx+14DaBEDjaK1p4lxJoEwK4VSjm/D7Z6jpwT1nSha8oIvzpxVfE/T KEEnNxxDROO56n+Bhg/UXZMTgZ5N2Kt/zG/FQGA8TT75Jgew/aNWgnwK+M2Ki0wmdzUY FrkA== 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=KCPSZTQDZODENSgxY50+V4N7AZO/CQ6APEi0MW9hulE=; b=WqioOpTokHOYSrjvKxihrqwMqUm/G+GXrZ+07RfReOvuDsW+mUVlj9WgprUeGEjxxG a3tAjZdfQdaoqkaphc9LfZQepOKi99nQ8xifyTlAmLbF0li4CzIkK70vbtOynVbosFrE zFNI/8/nztcbnBE/ZJqLP+omkZF7ZUK72sEzPPDnJpPsqbYpzxrIUyTAMwcvUnNXl4ev 21HeKDvAuhopCHVu7qQipx+XL1cZ67y1rmDCFTRZmMj84dPzcwYRGXwhc7icJ5zZNDb7 VSm7HZtI8rUeaEbcBqQ31TukD6NgT7fqFnkXGN851f4MdXVwhfaXCYLK7+RXtnrMQc/Y LZ8Q== X-Gm-Message-State: ANhLgQ38St1JTXYYW5jUb4ubwrZxo2O5TSEk384dZeIdKt1s5aPO3IdR aqHCAOQqp9qx729WdNQpfGSo77tHQblZcQunaG+tuQ== X-Google-Smtp-Source: ADFU+vsccTDgqsM1qNyiKIp10oQuwutCViAkVSKefMFEHZ86KnmxnjjSiwDmmdE7S2ccM64SD68wJhcwPJEEzWDIzJc= X-Received: by 2002:a17:906:b802:: with SMTP id dv2mr14991239ejb.92.1585648291533; Tue, 31 Mar 2020 02:51:31 -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: From: =?UTF-8?Q?Micha=C5=82_Krawczyk?= Date: Tue, 31 Mar 2020 11:51:20 +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" wt., 31 mar 2020 o 11:40 Micha=C5=82 Krawczyk napisa=C5= =82(a): > > 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 access= ed > > > 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_ethde= v.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? > > I forgot to refer to this comment, sorry. ena_rss_key_fill() is called only from ena_start() and as far as I know, it can be called only from single-threaded context (device configuration flow). In that case, there is no risk and we can be thread-unsafe. > > > + > > > + 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_ct= x) > > > { > > > > >