DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/3] fix max pools argument parsing
@ 2021-10-28 22:14 Volodymyr Fialko
  2021-10-28 22:14 ` [dpdk-dev] [PATCH 1/3] mempool/cnxk: " Volodymyr Fialko
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Volodymyr Fialko @ 2021-10-28 22:14 UTC (permalink / raw)
  To: dev; +Cc: jerinj, Volodymyr Fialko

This series should fix issue with max pool argument parsing for cnxk
platforms

Volodymyr Fialko (3):
  mempool/cnxk: fix max pools argument parsing
  common/cnxk: add roc npa init callback support
  mempool/cnxk: parse max pools during npa initialization

 drivers/common/cnxk/roc_npa.c       | 18 +++++++++++++++++
 drivers/common/cnxk/roc_npa.h       |  4 ++++
 drivers/common/cnxk/version.map     |  1 +
 drivers/mempool/cnxk/cnxk_mempool.c | 31 +++++++++++++++++++----------
 4 files changed, 44 insertions(+), 10 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 1/3] mempool/cnxk: fix max pools argument parsing
  2021-10-28 22:14 [dpdk-dev] [PATCH 0/3] fix max pools argument parsing Volodymyr Fialko
@ 2021-10-28 22:14 ` Volodymyr Fialko
  2021-10-28 22:14 ` [dpdk-dev] [PATCH 2/3] common/cnxk: add roc npa init callback support Volodymyr Fialko
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Volodymyr Fialko @ 2021-10-28 22:14 UTC (permalink / raw)
  To: dev, Ashwin Sekhar T K, Pavan Nikhilesh; +Cc: jerinj, Volodymyr Fialko, stable

roc_idev_npa_maxpools_set expects max_pools original value, not the aura

Fixes: 0a50a5aad299 ("mempool/cnxk: add device probe/remove")
Cc: stable@dpdk.org

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Reviewed-by: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
---
 drivers/mempool/cnxk/cnxk_mempool.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/mempool/cnxk/cnxk_mempool.c b/drivers/mempool/cnxk/cnxk_mempool.c
index dc36be54f6..828bf3fc36 100644
--- a/drivers/mempool/cnxk/cnxk_mempool.c
+++ b/drivers/mempool/cnxk/cnxk_mempool.c
@@ -31,25 +31,25 @@ npa_aura_size_to_u32(uint8_t val)
 }
 
 static int
-parse_max_pools(const char *key, const char *value, void *extra_args)
+parse_max_pools_handler(const char *key, const char *value, void *extra_args)
 {
 	RTE_SET_USED(key);
 	uint32_t val;
 
-	val = atoi(value);
+	val = rte_align32pow2(atoi(value));
 	if (val < npa_aura_size_to_u32(NPA_AURA_SZ_128))
 		val = 128;
 	if (val > npa_aura_size_to_u32(NPA_AURA_SZ_1M))
 		val = BIT_ULL(20);
 
-	*(uint8_t *)extra_args = rte_log2_u32(val) - 6;
+	*(uint32_t *)extra_args = val;
 	return 0;
 }
 
-static inline uint8_t
-parse_aura_size(struct rte_devargs *devargs)
+static inline uint32_t
+parse_max_pools(struct rte_devargs *devargs)
 {
-	uint8_t aura_sz = NPA_AURA_SZ_128;
+	uint32_t max_pools = npa_aura_size_to_u32(NPA_AURA_SZ_128);
 	struct rte_kvargs *kvlist;
 
 	if (devargs == NULL)
@@ -58,11 +58,11 @@ parse_aura_size(struct rte_devargs *devargs)
 	if (kvlist == NULL)
 		goto exit;
 
-	rte_kvargs_process(kvlist, CNXK_NPA_MAX_POOLS_PARAM, &parse_max_pools,
-			   &aura_sz);
+	rte_kvargs_process(kvlist, CNXK_NPA_MAX_POOLS_PARAM,
+			   &parse_max_pools_handler, &max_pools);
 	rte_kvargs_free(kvlist);
 exit:
-	return aura_sz;
+	return max_pools;
 }
 
 static inline char *
@@ -92,7 +92,7 @@ npa_init(struct rte_pci_device *pci_dev)
 	dev = mz->addr;
 	dev->pci_dev = pci_dev;
 
-	roc_idev_npa_maxpools_set(parse_aura_size(pci_dev->device.devargs));
+	roc_idev_npa_maxpools_set(parse_max_pools(pci_dev->device.devargs));
 	rc = roc_npa_dev_init(dev);
 	if (rc)
 		goto mz_free;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 2/3] common/cnxk: add roc npa init callback support
  2021-10-28 22:14 [dpdk-dev] [PATCH 0/3] fix max pools argument parsing Volodymyr Fialko
  2021-10-28 22:14 ` [dpdk-dev] [PATCH 1/3] mempool/cnxk: " Volodymyr Fialko
@ 2021-10-28 22:14 ` Volodymyr Fialko
  2021-10-28 22:14 ` [dpdk-dev] [PATCH 3/3] mempool/cnxk: parse max pools during npa initialization Volodymyr Fialko
  2021-10-29 14:18 ` [dpdk-dev] [PATCH 0/3] fix max pools argument parsing Jerin Jacob
  3 siblings, 0 replies; 5+ messages in thread
From: Volodymyr Fialko @ 2021-10-28 22:14 UTC (permalink / raw)
  To: dev, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori,
	Satha Rao, Ray Kinsella
  Cc: jerinj, Volodymyr Fialko

Add support for registering callback for roc npa init

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
---
 drivers/common/cnxk/roc_npa.c   | 18 ++++++++++++++++++
 drivers/common/cnxk/roc_npa.h   |  4 ++++
 drivers/common/cnxk/version.map |  1 +
 3 files changed, 23 insertions(+)

diff --git a/drivers/common/cnxk/roc_npa.c b/drivers/common/cnxk/roc_npa.c
index a0d2cc8f19..f16950e611 100644
--- a/drivers/common/cnxk/roc_npa.c
+++ b/drivers/common/cnxk/roc_npa.c
@@ -5,6 +5,18 @@
 #include "roc_api.h"
 #include "roc_priv.h"
 
+static roc_npa_lf_init_cb_t lf_init_cb;
+
+int
+roc_npa_lf_init_cb_register(roc_npa_lf_init_cb_t cb)
+{
+	if (lf_init_cb != NULL)
+		return -EEXIST;
+
+	lf_init_cb = cb;
+	return 0;
+}
+
 void
 roc_npa_aura_op_range_set(uint64_t aura_handle, uint64_t start_iova,
 			  uint64_t end_iova)
@@ -694,6 +706,12 @@ npa_lf_init(struct dev *dev, struct plt_pci_device *pci_dev)
 	if (__atomic_fetch_add(&idev->npa_refcnt, 1, __ATOMIC_SEQ_CST) != 0)
 		return 0;
 
+	if (lf_init_cb) {
+		rc = (*lf_init_cb)(pci_dev);
+		if (rc)
+			goto fail;
+	}
+
 	rc = npa_attach(dev->mbox);
 	if (rc)
 		goto fail;
diff --git a/drivers/common/cnxk/roc_npa.h b/drivers/common/cnxk/roc_npa.h
index 1cf50e5c4e..46350fdb48 100644
--- a/drivers/common/cnxk/roc_npa.h
+++ b/drivers/common/cnxk/roc_npa.h
@@ -648,6 +648,10 @@ void __roc_api roc_npa_aura_op_range_set(uint64_t aura_handle,
 					 uint64_t start_iova,
 					 uint64_t end_iova);
 
+/* Init callbacks */
+typedef int (*roc_npa_lf_init_cb_t)(struct plt_pci_device *pci_dev);
+int __roc_api roc_npa_lf_init_cb_register(roc_npa_lf_init_cb_t cb);
+
 /* Debug */
 int __roc_api roc_npa_ctx_dump(void);
 int __roc_api roc_npa_dump(void);
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index d9ad940ce7..ffa030a41f 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -285,6 +285,7 @@ INTERNAL {
 	roc_npa_dev_fini;
 	roc_npa_dev_init;
 	roc_npa_dump;
+	roc_npa_lf_init_cb_register;
 	roc_npa_pool_create;
 	roc_npa_pool_destroy;
 	roc_npa_pool_op_pc_reset;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 3/3] mempool/cnxk: parse max pools during npa initialization
  2021-10-28 22:14 [dpdk-dev] [PATCH 0/3] fix max pools argument parsing Volodymyr Fialko
  2021-10-28 22:14 ` [dpdk-dev] [PATCH 1/3] mempool/cnxk: " Volodymyr Fialko
  2021-10-28 22:14 ` [dpdk-dev] [PATCH 2/3] common/cnxk: add roc npa init callback support Volodymyr Fialko
@ 2021-10-28 22:14 ` Volodymyr Fialko
  2021-10-29 14:18 ` [dpdk-dev] [PATCH 0/3] fix max pools argument parsing Jerin Jacob
  3 siblings, 0 replies; 5+ messages in thread
From: Volodymyr Fialko @ 2021-10-28 22:14 UTC (permalink / raw)
  To: dev, Ashwin Sekhar T K, Pavan Nikhilesh; +Cc: jerinj, Volodymyr Fialko

Register callback for max_pools argument parsing

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
---
 drivers/mempool/cnxk/cnxk_mempool.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/mempool/cnxk/cnxk_mempool.c b/drivers/mempool/cnxk/cnxk_mempool.c
index 828bf3fc36..beefb90048 100644
--- a/drivers/mempool/cnxk/cnxk_mempool.c
+++ b/drivers/mempool/cnxk/cnxk_mempool.c
@@ -65,6 +65,13 @@ parse_max_pools(struct rte_devargs *devargs)
 	return max_pools;
 }
 
+static int
+cnxk_mempool_plt_parse_devargs(struct rte_pci_device *pci_dev)
+{
+	roc_idev_npa_maxpools_set(parse_max_pools(pci_dev->device.devargs));
+	return 0;
+}
+
 static inline char *
 npa_dev_to_name(struct rte_pci_device *pci_dev, char *name)
 {
@@ -92,7 +99,6 @@ npa_init(struct rte_pci_device *pci_dev)
 	dev = mz->addr;
 	dev->pci_dev = pci_dev;
 
-	roc_idev_npa_maxpools_set(parse_max_pools(pci_dev->device.devargs));
 	rc = roc_npa_dev_init(dev);
 	if (rc)
 		goto mz_free;
@@ -188,3 +194,8 @@ RTE_PMD_REGISTER_PCI_TABLE(mempool_cnxk, npa_pci_map);
 RTE_PMD_REGISTER_KMOD_DEP(mempool_cnxk, "vfio-pci");
 RTE_PMD_REGISTER_PARAM_STRING(mempool_cnxk,
 			      CNXK_NPA_MAX_POOLS_PARAM "=<128-1048576>");
+
+RTE_INIT(cnxk_mempool_parse_devargs)
+{
+	roc_npa_lf_init_cb_register(cnxk_mempool_plt_parse_devargs);
+}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 0/3] fix max pools argument parsing
  2021-10-28 22:14 [dpdk-dev] [PATCH 0/3] fix max pools argument parsing Volodymyr Fialko
                   ` (2 preceding siblings ...)
  2021-10-28 22:14 ` [dpdk-dev] [PATCH 3/3] mempool/cnxk: parse max pools during npa initialization Volodymyr Fialko
@ 2021-10-29 14:18 ` Jerin Jacob
  3 siblings, 0 replies; 5+ messages in thread
From: Jerin Jacob @ 2021-10-29 14:18 UTC (permalink / raw)
  To: Volodymyr Fialko, Ferruh Yigit; +Cc: dpdk-dev, Jerin Jacob

On Fri, Oct 29, 2021 at 3:45 AM Volodymyr Fialko <vfialko@marvell.com> wrote:
>
> This series should fix issue with max pool argument parsing for cnxk
> platforms
>
> Volodymyr Fialko (3):
>   mempool/cnxk: fix max pools argument parsing
>   common/cnxk: add roc npa init callback support
>   mempool/cnxk: parse max pools during npa initialization


Updated the git log as below[1]

Series Acked-by: Jerin Jacob <jerinj@marvell.com>
Series applied to dpdk-next-net-mrvl/for-next-net. Thanks.

[1]
commit 5a6221d1e943b4e808b88ee2fd457d9ea6da5861 (HEAD -> for-next-net,
origin/for-next-net)
Author: Volodymyr Fialko <vfialko@marvell.com>
Date:   Fri Oct 29 00:14:46 2021 +0200

    mempool/cnxk: postpone devargs parsing

    Use roc_npa_lf_init_cb_register() scheme to register
    callback for max_pools argument parsing.
    This will remove the dependency on the order of PCI
    devices probed.

    Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
    Reviewed-by: Jerin Jacob <jerinj@marvell.com>

commit 2184cde7957e25abf23c8ce12ea3a3f7df4ade70
Author: Volodymyr Fialko <vfialko@marvell.com>
Date:   Fri Oct 29 00:14:45 2021 +0200

    common/cnxk: add ROC NPA init callback support

    Add support for registering callback for ROC NPA init.

    Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
    Reviewed-by: Jerin Jacob <jerinj@marvell.com>

commit b189001ce0ba7c4ccd67b7e40d9ba96cf96b21d1
Author: Volodymyr Fialko <vfialko@marvell.com>
Date:   Fri Oct 29 00:14:44 2021 +0200

    mempool/cnxk: fix max pools argument parsing

    roc_idev_npa_maxpools_set() expects max_pools original value,
    not the AURA.

    Fixes: 0a50a5aad299 ("mempool/cnxk: add device probe/remove")
    Cc: stable@dpdk.org

    Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
    Acked-by: Jerin Jacob <jerinj@marvell.com>


>
>  drivers/common/cnxk/roc_npa.c       | 18 +++++++++++++++++
>  drivers/common/cnxk/roc_npa.h       |  4 ++++
>  drivers/common/cnxk/version.map     |  1 +
>  drivers/mempool/cnxk/cnxk_mempool.c | 31 +++++++++++++++++++----------
>  4 files changed, 44 insertions(+), 10 deletions(-)
>
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-29 14:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28 22:14 [dpdk-dev] [PATCH 0/3] fix max pools argument parsing Volodymyr Fialko
2021-10-28 22:14 ` [dpdk-dev] [PATCH 1/3] mempool/cnxk: " Volodymyr Fialko
2021-10-28 22:14 ` [dpdk-dev] [PATCH 2/3] common/cnxk: add roc npa init callback support Volodymyr Fialko
2021-10-28 22:14 ` [dpdk-dev] [PATCH 3/3] mempool/cnxk: parse max pools during npa initialization Volodymyr Fialko
2021-10-29 14:18 ` [dpdk-dev] [PATCH 0/3] fix max pools argument parsing Jerin Jacob

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).