net/nfp: allow more then one secondary process on the PF
Checks
Commit Message
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(-)
Comments
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.
@@ -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
--------------------
@@ -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);
}