DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/nfp: allow more then one secondary process on the PF
@ 2023-06-15  1:54 Chaoyong He
  2023-06-21 12:56 ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Chaoyong He @ 2023-06-15  1:54 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Peng Zhang, Chaoyong He

From: Peng Zhang <peng.zhang@corigine.com>

When adding support for multiple processes the number of secondary process
on the PF was limited by the way NFP access registers on the device over
the CPP interface.

The limitation on the CPP interface appears to have been addressed since
the initial multi processes work was merged in 2018. No particular
change have been identified that in itself solved the issue, but after
extensive testing without any issues, multiple secondary process on the
PF works without issues.

Remove the limitation allowing only one single secondary process on PF.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
 doc/guides/nics/nfp.rst                    | 13 ++---
 drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 61 +---------------------
 2 files changed, 5 insertions(+), 69 deletions(-)

diff --git a/doc/guides/nics/nfp.rst b/doc/guides/nics/nfp.rst
index f102238a28..16e0b862e1 100644
--- a/doc/guides/nics/nfp.rst
+++ b/doc/guides/nics/nfp.rst
@@ -134,15 +134,10 @@ suffix added to the PCI ID: wwww:xx:yy.z_portn. For example, a PF with PCI ID
 PF multiprocess support
 -----------------------
 
-Due to how the driver needs to access the NFP through a CPP interface, which
-implies to use specific registers inside the chip, the number of secondary
-processes with PF ports is limited to only one.
-
-This limitation will be solved in future versions, but having basic
-multiprocess support is important for allowing development and debugging
-through the PF using a secondary process, which will create a CPP bridge
-for user space tools accessing the NFP.
-
+The current NFP PMD supports the PF multiprocess. Having basic multiprocess
+support is important for allowing development and debugging through the PF
+using a secondary process, which will create a CPP bridge for user space tools
+accessing the NFP.
 
 System configuration
 --------------------
diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
index 9d63e0ee73..e230c40051 100644
--- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
+++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
@@ -114,7 +114,6 @@ struct nfp_pcie_user {
 
 	int device;
 	int lock;
-	int secondary_lock;
 	char busdev[BUSDEV_SZ];
 	int barsz;
 	char *cfg;
@@ -287,10 +286,7 @@ nfp_reconfigure_bar(struct nfp_pcie_user *nfp, struct nfp_bar *bar, int tgt,
  *         for setting the link up or down. Secondary processes do not need
  *         to map the first two slots again, but it requires one slot for
  *         accessing the link, even if it is not likely the secondary process
- *         starting the port. This implies a limit of secondary processes
- *         supported. Due to this requirement and future extensions requiring
- *         new slots per process, only one secondary process is supported by
- *         now.
+ *         starting the port.
  *         For Flower firmware:
  *         NFP PMD need another fixed slots, used as the configureation BAR
  *         for ctrl vNIC.
@@ -659,52 +655,6 @@ nfp_acquire_process_lock(struct nfp_pcie_user *desc)
 	return 0;
 }
 
-static int
-nfp_acquire_secondary_process_lock(struct nfp_pcie_user *desc)
-{
-	int rc;
-	struct flock lock;
-	const char *lockname = "/.lock_nfp_secondary";
-	char *home_path;
-	char *lockfile;
-
-	memset(&lock, 0, sizeof(lock));
-
-	/*
-	 * Using user's home directory. Note this can be called in a DPDK app
-	 * being executed as non-root. This is not the case for the previous
-	 * function nfp_acquire_process_lock which is invoked only when UIO
-	 * driver is used because that implies root user.
-	 */
-	home_path = getenv("HOME");
-	lockfile = calloc(strlen(home_path) + strlen(lockname) + 1,
-			  sizeof(char));
-
-	if (lockfile == NULL)
-		return -ENOMEM;
-
-	strcat(lockfile, home_path);
-	strcat(lockfile, "/.lock_nfp_secondary");
-	desc->secondary_lock = open(lockfile, O_RDWR | O_CREAT | O_NONBLOCK,
-				    0666);
-	if (desc->secondary_lock < 0) {
-		PMD_DRV_LOG(ERR, "NFP lock for secondary process failed");
-		free(lockfile);
-		return desc->secondary_lock;
-	}
-
-	lock.l_type = F_WRLCK;
-	lock.l_whence = SEEK_SET;
-	rc = fcntl(desc->secondary_lock, F_SETLK, &lock);
-	if (rc < 0) {
-		PMD_DRV_LOG(ERR, "NFP lock for secondary process failed");
-		close(desc->secondary_lock);
-	}
-
-	free(lockfile);
-	return rc;
-}
-
 static int
 nfp6000_set_model(struct rte_pci_device *dev, struct nfp_cpp *cpp)
 {
@@ -819,13 +769,6 @@ nfp6000_init(struct nfp_cpp *cpp, struct rte_pci_device *dev)
 			goto error;
 	}
 
-	/* Just support for one secondary process */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
-		ret = nfp_acquire_secondary_process_lock(desc);
-		if (ret)
-			goto error;
-	}
-
 	if (nfp6000_set_model(dev, cpp) < 0)
 		goto error;
 	if (nfp6000_set_interface(dev, cpp) < 0)
@@ -856,8 +799,6 @@ nfp6000_free(struct nfp_cpp *cpp)
 	nfp_disable_bars(desc);
 	if (cpp->driver_lock_needed)
 		close(desc->lock);
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		close(desc->secondary_lock);
 	close(desc->device);
 	free(desc);
 }
-- 
2.39.1


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

* Re: [PATCH] net/nfp: allow more then one secondary process on the PF
  2023-06-15  1:54 [PATCH] net/nfp: allow more then one secondary process on the PF Chaoyong He
@ 2023-06-21 12:56 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2023-06-21 12:56 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers, niklas.soderlund, Peng Zhang

On 6/15/2023 2:54 AM, Chaoyong He wrote:
> From: Peng Zhang <peng.zhang@corigine.com>
> 
> When adding support for multiple processes the number of secondary process
> on the PF was limited by the way NFP access registers on the device over
> the CPP interface.
> 
> The limitation on the CPP interface appears to have been addressed since
> the initial multi processes work was merged in 2018. No particular
> change have been identified that in itself solved the issue, but after
> extensive testing without any issues, multiple secondary process on the
> PF works without issues.
> 
> Remove the limitation allowing only one single secondary process on PF.
> 
> Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
>

Applied to dpdk-next-net/main, thanks.


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

end of thread, other threads:[~2023-06-21 12:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-15  1:54 [PATCH] net/nfp: allow more then one secondary process on the PF Chaoyong He
2023-06-21 12:56 ` Ferruh Yigit

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