patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
To: "Yu, DapengX" <dapengx.yu@intel.com>
Cc: dpdk stable <stable@dpdk.org>
Subject: Re: [dpdk-stable] [PATCH 19.11] net/ice: fix default RSS key generation
Date: Mon, 16 Aug 2021 11:02:49 +0200	[thread overview]
Message-ID: <CAATJJ0JSOvA1zyDkb_C8365Rm0EXi23fiD5OF+CibEu-=zjPAw@mail.gmail.com> (raw)
In-Reply-To: <20210816081511.184844-1-dapengx.yu@intel.com>

On Mon, Aug 16, 2021 at 10:15 AM <dapengx.yu@intel.com> wrote:
>
> From: Dapeng Yu <dapengx.yu@intel.com>
>
> [ upstream commit 03a91d7efb7098ba739ba458bcc118c3e348fae1 ]

Thanks, applied

> In original implementation, device reconfiguration will generate
> a new default RSS key if there is no one from user, it is unexpected
> when updating a completely unrelated configuration.
>
> This patch makes default RSS key unchanged, during the lifetime of the
> DPDK application even if there are multiple reconfigurations.
>
> Fixes: 50370662b727 ("net/ice: support device and queue ops")
>
> Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
> ---
>  drivers/net/ice/ice_ethdev.c | 35 +++++++++++++++++++++++++++++------
>  1 file changed, 29 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
> index 4e15ed54bf..f8046b50fb 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -2458,6 +2458,31 @@ ice_dev_uninit(struct rte_eth_dev *dev)
>         return 0;
>  }
>
> +static void
> +ice_get_default_rss_key(uint8_t *rss_key, uint32_t rss_key_size)
> +{
> +       static struct ice_aqc_get_set_rss_keys default_key;
> +       static bool default_key_done;
> +       uint8_t *key = (uint8_t *)&default_key;
> +       size_t i;
> +
> +       if (rss_key_size > sizeof(default_key)) {
> +               PMD_DRV_LOG(WARNING,
> +                           "requested size %u is larger than default %zu, "
> +                           "only %zu bytes are gotten for key\n",
> +                           rss_key_size, sizeof(default_key),
> +                           sizeof(default_key));
> +       }
> +
> +       if (!default_key_done) {
> +               /* Calculate the default hash key */
> +               for (i = 0; i < sizeof(default_key); i++)
> +                       key[i] = (uint8_t)rte_rand();
> +               default_key_done = true;
> +       }
> +       rte_memcpy(rss_key, key, RTE_MIN(rss_key_size, sizeof(default_key)));
> +}
> +
>  static int ice_init_rss(struct ice_pf *pf)
>  {
>         struct ice_hw *hw = ICE_PF_TO_HW(pf);
> @@ -2505,15 +2530,13 @@ static int ice_init_rss(struct ice_pf *pf)
>                 }
>         }
>         /* configure RSS key */
> -       if (!rss_conf->rss_key) {
> -               /* Calculate the default hash key */
> -               for (i = 0; i < vsi->rss_key_size; i++)
> -                       vsi->rss_key[i] = (uint8_t)rte_rand();
> -       } else {
> +       if (!rss_conf->rss_key)
> +               ice_get_default_rss_key(vsi->rss_key, vsi->rss_key_size);
> +       else
>                 rte_memcpy(vsi->rss_key, rss_conf->rss_key,
>                            RTE_MIN(rss_conf->rss_key_len,
>                                    vsi->rss_key_size));
> -       }
> +
>         rte_memcpy(key.standard_rss_key, vsi->rss_key, vsi->rss_key_size);
>         ret = ice_aq_set_rss_key(hw, vsi->idx, &key);
>         if (ret)
> --
> 2.27.0
>


-- 
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd

      reply	other threads:[~2021-08-16  9:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16  8:15 dapengx.yu
2021-08-16  9:02 ` Christian Ehrhardt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAATJJ0JSOvA1zyDkb_C8365Rm0EXi23fiD5OF+CibEu-=zjPAw@mail.gmail.com' \
    --to=christian.ehrhardt@canonical.com \
    --cc=dapengx.yu@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).