[v1,11/13] bus/pci: process declarative PCI devargs

Message ID 1cd54c876b80f441c483a2f43c1c1fba219b9237.1535633784.git.gaetan.rivet@6wind.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Implement new devargs framework |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Gaëtan Rivet Aug. 30, 2018, 1:42 p.m. UTC
  Introduce the facility to process future PCI parameters.

Once the matching between PCI devices and devargs has been done, it is
possible to process each devargs. New parameters would have the PCI
device handle to work with when parsing the device (bus specific)
parameters.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
 drivers/bus/pci/pci_common.c |  3 +++
 drivers/bus/pci/pci_params.c | 10 ++++++++++
 drivers/bus/pci/private.h    | 13 +++++++++++++
 3 files changed, 26 insertions(+)
  

Comments

Stephen Hemminger Aug. 30, 2018, 4:15 p.m. UTC | #1
On Thu, 30 Aug 2018 15:42:02 +0200
Gaetan Rivet <gaetan.rivet@6wind.com> wrote:

> +int
> +rte_pci_devargs_process(struct rte_pci_device *pdev)
> +{
> +	/* For the moment, no PCI param
> +	 * needs to be processed.
> +	 */
> +	(void) pdev;
> +	return 0;
> +}

Use __rte_unused rather than the (void) cast?
  
Gaëtan Rivet Aug. 30, 2018, 4:37 p.m. UTC | #2
On Thu, Aug 30, 2018 at 09:15:18AM -0700, Stephen Hemminger wrote:
> On Thu, 30 Aug 2018 15:42:02 +0200
> Gaetan Rivet <gaetan.rivet@6wind.com> wrote:
> 
> > +int
> > +rte_pci_devargs_process(struct rte_pci_device *pdev)
> > +{
> > +	/* For the moment, no PCI param
> > +	 * needs to be processed.
> > +	 */
> > +	(void) pdev;
> > +	return 0;
> > +}
> 
> Use __rte_unused rather than the (void) cast?

Ok.

I was wondering whether we should keep this patch.
Its only use is to mark the proper place where this function,
once it has become needed, would need to be called.

PCI bus does not have any parameters configuring devices, this function
will only be needed once some have been added.
  

Patch

diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index c7695d108..900cd9090 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -247,6 +247,9 @@  pci_probe_all_drivers(struct rte_pci_device *dev)
 	if (dev->driver != NULL)
 		return 0;
 
+	if (rte_pci_devargs_process(dev) < 0)
+		return -1;
+
 	FOREACH_DRIVER_ON_PCIBUS(dr) {
 		rc = rte_pci_probe_one_driver(dr, dev);
 		if (rc < 0)
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index a09af3b1c..f34bf3da9 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -127,3 +127,13 @@  rte_pci_devargs_prepare(struct rte_devargs *devargs)
 	rte_kvargs_free(kvargs);
 	return ret;
 }
+
+int
+rte_pci_devargs_process(struct rte_pci_device *pdev)
+{
+	/* For the moment, no PCI param
+	 * needs to be processed.
+	 */
+	(void) pdev;
+	return 0;
+}
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 9beb24c6a..06dc85e85 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -207,4 +207,17 @@  rte_pci_dev_iterate(const void *start,
 int
 rte_pci_devargs_prepare(struct rte_devargs *da);
 
+/*
+ * Process the device devargs, if any.
+ *
+ * @param pdev
+ *   PCI device
+ *
+ * @return
+ *   0 on success.
+ *   <0 on error.
+ */
+int
+rte_pci_devargs_process(struct rte_pci_device *pdev);
+
 #endif /* _PCI_PRIVATE_H_ */