DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerinjacobk@gmail.com>
To: Rahul Bhansali <rbhansali@marvell.com>
Cc: dev@dpdk.org, Nithin Dabilpuram <ndabilpuram@marvell.com>,
	 Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	 Satha Rao <skoteshwar@marvell.com>,
	jerinj@marvell.com
Subject: Re: [PATCH v2] common/cnxk: reserve last LMT line for control ops
Date: Thu, 28 Sep 2023 12:21:02 +0530	[thread overview]
Message-ID: <CALBAE1MYJimzEezAP4226LXOHT0aZTqquEO0y2XXprDeWrb3Lg@mail.gmail.com> (raw)
In-Reply-To: <20230921131953.1483157-1-rbhansali@marvell.com>

On Thu, Sep 21, 2023 at 6:51 PM Rahul Bhansali <rbhansali@marvell.com> wrote:
>
> As rte_eth_dev_configure() can be called from any EAL or non-EAL cores.
> And in case of non-EAL core, LMT address will not be a valid. So,
> reserving last LMT line 2047 for control path specific functionality.
>
> Signed-off-by: Rahul Bhansali <rbhansali@marvell.com>


Changed the log as

    common/cnxk: fix LMT line access from non EAL cores

    In case of rte_eth_dev_configure() called from non EAL cores, the
    LMT ID will not be valid. As a fix, last LMT line 2047 will be
    reserved for non-EAL core to compute LMT address in control path
    specific functionality.

    Fixes: 7c67c489d466 ("common/cnxk: fetch engine capabilities")
    Cc: stable@dpdk.org

    Signed-off-by: Rahul Bhansali <rbhansali@marvell.com>


Added following diff

[for-next-net]dell[dpdk-next-net-mrvl] $ git diff
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index 4dce181437..9c7d8813e0 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -462,10 +462,10 @@ INTERNAL {
        roc_npc_validate_portid_action;
        roc_ot_ipsec_inb_sa_init;
        roc_ot_ipsec_outb_sa_init;
+       roc_plt_control_lmt_id_get;
        roc_plt_init;
        roc_plt_init_cb_register;
        roc_plt_lmt_validate;
-       roc_plt_control_lmt_id_get;
        roc_sso_dev_fini;
        roc_sso_dev_init;
        roc_sso_dump;



Applied to dpdk-next-net-mrvl/for-next-net. Thanks





> ---
> v2 change: No change, sent as independent of series.
>
>  drivers/common/cnxk/roc_dev.c      |  5 +++++
>  drivers/common/cnxk/roc_nix_inl.c  |  6 ++++--
>  drivers/common/cnxk/roc_platform.c | 25 +++++++++++++++++++++++++
>  drivers/common/cnxk/roc_platform.h |  5 +++++
>  drivers/common/cnxk/version.map    |  2 ++
>  5 files changed, 41 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c
> index 18d7981825..3815da078a 100644
> --- a/drivers/common/cnxk/roc_dev.c
> +++ b/drivers/common/cnxk/roc_dev.c
> @@ -1369,6 +1369,11 @@ dev_init(struct dev *dev, struct plt_pci_device *pci_dev)
>         if (!dev_cache_line_size_valid())
>                 return -EFAULT;
>
> +       if (!roc_plt_lmt_validate()) {
> +               plt_err("Failed to validate LMT line");
> +               return -EFAULT;
> +       }
> +
>         bar2 = (uintptr_t)pci_dev->mem_resource[2].addr;
>         bar4 = (uintptr_t)pci_dev->mem_resource[4].addr;
>         if (bar2 == 0 || bar4 == 0) {
> diff --git a/drivers/common/cnxk/roc_nix_inl.c b/drivers/common/cnxk/roc_nix_inl.c
> index 5cb1f11f53..750fd08355 100644
> --- a/drivers/common/cnxk/roc_nix_inl.c
> +++ b/drivers/common/cnxk/roc_nix_inl.c
> @@ -779,8 +779,10 @@ nix_inl_eng_caps_get(struct nix *nix)
>
>                 hw_res->cn10k.compcode = CPT_COMP_NOT_DONE;
>
> -               /* Use this lcore's LMT line as no one else is using it */
> -               ROC_LMT_BASE_ID_GET(lmt_base, lmt_id);
> +               /* Use this reserved LMT line as no one else is using it */
> +               lmt_id = roc_plt_control_lmt_id_get();
> +               lmt_base += ((uint64_t)lmt_id << ROC_LMT_LINE_SIZE_LOG2);
> +
>                 memcpy((void *)lmt_base, &inst, sizeof(inst));
>
>                 lmt_arg = ROC_CN10K_CPT_LMT_ARG | (uint64_t)lmt_id;
> diff --git a/drivers/common/cnxk/roc_platform.c b/drivers/common/cnxk/roc_platform.c
> index a8a83a3723..15cbb6d68f 100644
> --- a/drivers/common/cnxk/roc_platform.c
> +++ b/drivers/common/cnxk/roc_platform.c
> @@ -21,6 +21,31 @@ roc_plt_init_cb_register(roc_plt_init_cb_t cb)
>         return 0;
>  }
>
> +uint16_t
> +roc_plt_control_lmt_id_get(void)
> +{
> +       uint32_t lcore_id = plt_lcore_id();
> +       if (lcore_id != LCORE_ID_ANY)
> +               return lcore_id << ROC_LMT_LINES_PER_CORE_LOG2;
> +       else
> +               /* Return Last LMT ID to be use in control path functionality */
> +               return ROC_NUM_LMT_LINES - 1;
> +}
> +
> +uint16_t
> +roc_plt_lmt_validate(void)
> +{
> +       if (!roc_model_is_cn9k()) {
> +               /* Last LMT line is reserved for control specific operation and can be
> +                * use from any EAL or non EAL cores.
> +                */
> +               if ((RTE_MAX_LCORE << ROC_LMT_LINES_PER_CORE_LOG2) >
> +                   (ROC_NUM_LMT_LINES - 1))
> +                       return 0;
> +       }
> +       return 1;
> +}
> +
>  int
>  roc_plt_init(void)
>  {
> diff --git a/drivers/common/cnxk/roc_platform.h b/drivers/common/cnxk/roc_platform.h
> index dbc0858e18..6d52a14009 100644
> --- a/drivers/common/cnxk/roc_platform.h
> +++ b/drivers/common/cnxk/roc_platform.h
> @@ -316,6 +316,11 @@ extern int cnxk_logtype_dpi;
>  __rte_internal
>  int roc_plt_init(void);
>
> +__rte_internal
> +uint16_t roc_plt_control_lmt_id_get(void);
> +__rte_internal
> +uint16_t roc_plt_lmt_validate(void);
> +
>  /* Init callbacks */
>  typedef int (*roc_plt_init_cb_t)(void);
>  int __roc_api roc_plt_init_cb_register(roc_plt_init_cb_t cb);
> diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
> index 38064919e4..4dce181437 100644
> --- a/drivers/common/cnxk/version.map
> +++ b/drivers/common/cnxk/version.map
> @@ -464,6 +464,8 @@ INTERNAL {
>         roc_ot_ipsec_outb_sa_init;
>         roc_plt_init;
>         roc_plt_init_cb_register;
> +       roc_plt_lmt_validate;
> +       roc_plt_control_lmt_id_get;
>         roc_sso_dev_fini;
>         roc_sso_dev_init;
>         roc_sso_dump;
> --
> 2.25.1
>

      reply	other threads:[~2023-09-28  6:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-20 10:12 [PATCH 1/2] " Rahul Bhansali
2023-09-20 10:12 ` [PATCH 2/2] net/cnxk: separate callback for Rx flush on CN10k Rahul Bhansali
2023-09-21  2:44   ` Jerin Jacob
2023-09-21 13:19 ` [PATCH v2] common/cnxk: reserve last LMT line for control ops Rahul Bhansali
2023-09-28  6:51   ` 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=CALBAE1MYJimzEezAP4226LXOHT0aZTqquEO0y2XXprDeWrb3Lg@mail.gmail.com \
    --to=jerinjacobk@gmail.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=rbhansali@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@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).