* [PATCH] raw/cnxk_bphy: support multi-process mode
@ 2023-10-03 20:41 Tomasz Duszynski
2023-10-04 17:47 ` Jerin Jacob
0 siblings, 1 reply; 2+ messages in thread
From: Tomasz Duszynski @ 2023-10-03 20:41 UTC (permalink / raw)
To: dev, Jakub Palider, Tomasz Duszynski, Anatoly Burakov; +Cc: jerinj, thomas
Add support for sharing BPHY PMD across multiple running processes.
In scenarios where resources need to be shared across processes
user-space need to ensure serialization.
Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
Tested-by: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
---
doc/guides/rawdevs/cnxk_bphy.rst | 8 ++++++++
drivers/raw/cnxk_bphy/cnxk_bphy.c | 16 ++++++++++------
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/doc/guides/rawdevs/cnxk_bphy.rst b/doc/guides/rawdevs/cnxk_bphy.rst
index 2490912534..b544b543a3 100644
--- a/doc/guides/rawdevs/cnxk_bphy.rst
+++ b/doc/guides/rawdevs/cnxk_bphy.rst
@@ -19,6 +19,14 @@ The BPHY CGX/RPM implements following features in the rawdev API:
- Access to BPHY CGX/RPM via a set of predefined messages
- Access to BPHY memory
- Custom interrupt handlers
+- Multiprocess aware
+
+Limitations
+-----------
+
+In multiprocess mode user-space application must ensure no resources
+sharing takes place. Otherwise, user-space application should ensure
+synchronization.
Device Setup
------------
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
index d42cca649c..15dbc4c1a6 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
@@ -359,10 +359,12 @@ bphy_rawdev_probe(struct rte_pci_driver *pci_drv,
bphy_dev->mem.res2 = pci_dev->mem_resource[2];
bphy_dev->bphy.pci_dev = pci_dev;
- ret = roc_bphy_dev_init(&bphy_dev->bphy);
- if (ret) {
- rte_rawdev_pmd_release(bphy_rawdev);
- return ret;
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ ret = roc_bphy_dev_init(&bphy_dev->bphy);
+ if (ret) {
+ rte_rawdev_pmd_release(bphy_rawdev);
+ return ret;
+ }
}
return 0;
@@ -390,8 +392,10 @@ bphy_rawdev_remove(struct rte_pci_device *pci_dev)
return -EINVAL;
}
- bphy_dev = (struct bphy_device *)rawdev->dev_private;
- roc_bphy_dev_fini(&bphy_dev->bphy);
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ bphy_dev = (struct bphy_device *)rawdev->dev_private;
+ roc_bphy_dev_fini(&bphy_dev->bphy);
+ }
return rte_rawdev_pmd_release(rawdev);
}
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] raw/cnxk_bphy: support multi-process mode
2023-10-03 20:41 [PATCH] raw/cnxk_bphy: support multi-process mode Tomasz Duszynski
@ 2023-10-04 17:47 ` Jerin Jacob
0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2023-10-04 17:47 UTC (permalink / raw)
To: Tomasz Duszynski; +Cc: dev, Jakub Palider, Anatoly Burakov, jerinj, thomas
On Wed, Oct 4, 2023 at 5:16 AM Tomasz Duszynski <tduszynski@marvell.com> wrote:
>
> Add support for sharing BPHY PMD across multiple running processes.
> In scenarios where resources need to be shared across processes
> user-space need to ensure serialization.
>
> Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
> Reviewed-by: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
> Tested-by: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
Updated the git commit as follows and applied to
dpdk-next-net-mrvl/for-next-net. Thanks
Author: Tomasz Duszynski <tduszynski@marvell.com>
Date: Tue Oct 3 22:41:09 2023 +0200
raw/cnxk_bphy: support multi-process mode
Add support for multi process mode in BPHY PMD.
Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
> ---
> doc/guides/rawdevs/cnxk_bphy.rst | 8 ++++++++
> drivers/raw/cnxk_bphy/cnxk_bphy.c | 16 ++++++++++------
> 2 files changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/doc/guides/rawdevs/cnxk_bphy.rst b/doc/guides/rawdevs/cnxk_bphy.rst
> index 2490912534..b544b543a3 100644
> --- a/doc/guides/rawdevs/cnxk_bphy.rst
> +++ b/doc/guides/rawdevs/cnxk_bphy.rst
> @@ -19,6 +19,14 @@ The BPHY CGX/RPM implements following features in the rawdev API:
> - Access to BPHY CGX/RPM via a set of predefined messages
> - Access to BPHY memory
> - Custom interrupt handlers
> +- Multiprocess aware
> +
> +Limitations
> +-----------
> +
> +In multiprocess mode user-space application must ensure no resources
> +sharing takes place. Otherwise, user-space application should ensure
> +synchronization.
>
> Device Setup
> ------------
> diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
> index d42cca649c..15dbc4c1a6 100644
> --- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
> +++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
> @@ -359,10 +359,12 @@ bphy_rawdev_probe(struct rte_pci_driver *pci_drv,
> bphy_dev->mem.res2 = pci_dev->mem_resource[2];
> bphy_dev->bphy.pci_dev = pci_dev;
>
> - ret = roc_bphy_dev_init(&bphy_dev->bphy);
> - if (ret) {
> - rte_rawdev_pmd_release(bphy_rawdev);
> - return ret;
> + if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
> + ret = roc_bphy_dev_init(&bphy_dev->bphy);
> + if (ret) {
> + rte_rawdev_pmd_release(bphy_rawdev);
> + return ret;
> + }
> }
>
> return 0;
> @@ -390,8 +392,10 @@ bphy_rawdev_remove(struct rte_pci_device *pci_dev)
> return -EINVAL;
> }
>
> - bphy_dev = (struct bphy_device *)rawdev->dev_private;
> - roc_bphy_dev_fini(&bphy_dev->bphy);
> + if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
> + bphy_dev = (struct bphy_device *)rawdev->dev_private;
> + roc_bphy_dev_fini(&bphy_dev->bphy);
> + }
>
> return rte_rawdev_pmd_release(rawdev);
> }
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-04 17:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-03 20:41 [PATCH] raw/cnxk_bphy: support multi-process mode Tomasz Duszynski
2023-10-04 17:47 ` 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).