DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerinjacobk@gmail.com>
To: Shijith Thotton <sthotton@marvell.com>
Cc: Jerin Jacob <jerinj@marvell.com>, dpdk-dev <dev@dpdk.org>,
	 Pavan Nikhilesh <pbhagavatula@marvell.com>
Subject: Re: [PATCH] common/cnxk: alloc link map array if HWS is available
Date: Mon, 13 Jun 2022 12:49:43 +0530	[thread overview]
Message-ID: <CALBAE1OaE7u6C7gi22WM+3=gWRQ0_5Md9o2iER20e6=GK2DuAw@mail.gmail.com> (raw)
In-Reply-To: <764fb382f2934807b8e6e0ba15c37a606a98d9d2.1654232597.git.sthotton@marvell.com>

On Fri, Jun 3, 2022 at 10:41 AM Shijith Thotton <sthotton@marvell.com> wrote:
>
> Link map array is required only if work slots are available.
>
> Signed-off-by: Shijith Thotton <sthotton@marvell.com>
> ---
>  drivers/common/cnxk/roc_sso.c | 45 +++++++++++++++++++----------------

Applied to dpdk-next-net-eventdev/for-main. Thanks


>  1 file changed, 25 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/common/cnxk/roc_sso.c b/drivers/common/cnxk/roc_sso.c
> index 358d37a9f2..34b9896d5f 100644
> --- a/drivers/common/cnxk/roc_sso.c
> +++ b/drivers/common/cnxk/roc_sso.c
> @@ -784,29 +784,34 @@ roc_sso_dev_init(struct roc_sso *roc_sso)
>         }
>         rc = -ENOMEM;
>
> -       sso->link_map =
> -               plt_zmalloc(sizeof(struct plt_bitmap *) * roc_sso->max_hws, 0);
> -       if (sso->link_map == NULL) {
> -               plt_err("Failed to allocate memory for link_map array");
> -               goto rsrc_fail;
> -       }
> +       if (roc_sso->max_hws) {
> +               sso->link_map = plt_zmalloc(
> +                       sizeof(struct plt_bitmap *) * roc_sso->max_hws, 0);
> +               if (sso->link_map == NULL) {
> +                       plt_err("Failed to allocate memory for link_map array");
> +                       goto rsrc_fail;
> +               }
>
> -       link_map_sz = plt_bitmap_get_memory_footprint(roc_sso->max_hwgrp);
> -       sso->link_map_mem = plt_zmalloc(link_map_sz * roc_sso->max_hws, 0);
> -       if (sso->link_map_mem == NULL) {
> -               plt_err("Failed to get link_map memory");
> -               goto rsrc_fail;
> -       }
> +               link_map_sz =
> +                       plt_bitmap_get_memory_footprint(roc_sso->max_hwgrp);
> +               sso->link_map_mem =
> +                       plt_zmalloc(link_map_sz * roc_sso->max_hws, 0);
> +               if (sso->link_map_mem == NULL) {
> +                       plt_err("Failed to get link_map memory");
> +                       goto rsrc_fail;
> +               }
>
> -       link_mem = sso->link_map_mem;
> -       for (i = 0; i < roc_sso->max_hws; i++) {
> -               sso->link_map[i] = plt_bitmap_init(roc_sso->max_hwgrp, link_mem,
> -                                                  link_map_sz);
> -               if (sso->link_map[i] == NULL) {
> -                       plt_err("Failed to allocate link map");
> -                       goto link_mem_free;
> +               link_mem = sso->link_map_mem;
> +
> +               for (i = 0; i < roc_sso->max_hws; i++) {
> +                       sso->link_map[i] = plt_bitmap_init(
> +                               roc_sso->max_hwgrp, link_mem, link_map_sz);
> +                       if (sso->link_map[i] == NULL) {
> +                               plt_err("Failed to allocate link map");
> +                               goto link_mem_free;
> +                       }
> +                       link_mem = PLT_PTR_ADD(link_mem, link_map_sz);
>                 }
> -               link_mem = PLT_PTR_ADD(link_mem, link_map_sz);
>         }
>         idev_sso_pffunc_set(sso->dev.pf_func);
>         idev_sso_set(roc_sso);
> --
> 2.25.1
>

      reply	other threads:[~2022-06-13  7:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03  5:10 Shijith Thotton
2022-06-13  7:19 ` Jerin Jacob [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='CALBAE1OaE7u6C7gi22WM+3=gWRQ0_5Md9o2iER20e6=GK2DuAw@mail.gmail.com' \
    --to=jerinjacobk@gmail.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=pbhagavatula@marvell.com \
    --cc=sthotton@marvell.com \
    /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).