[dpdk-dev,v2,1/2] drivers: add common folder

Message ID 20180320144046.15382-1-pbhagavatula@caviumnetworks.com (mailing list archive)
State Superseded, archived
Headers

Checks

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

Commit Message

Pavan Nikhilesh March 20, 2018, 2:40 p.m. UTC
  Add driver/common folder and skeleton makefile for adding commonly used
functions across mempool, event and net devices.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---

 v2 Changes:
 - Removed dependency on bus.

 drivers/Makefile           | 13 +++++++------
 drivers/common/Makefile    |  7 +++++++
 drivers/common/meson.build |  5 +++++
 drivers/meson.build        | 11 ++++++-----
 4 files changed, 25 insertions(+), 11 deletions(-)
 create mode 100644 drivers/common/Makefile
 create mode 100644 drivers/common/meson.build

--
2.16.2
  

Comments

Thomas Monjalon March 20, 2018, 3:45 p.m. UTC | #1
20/03/2018 15:40, Pavan Nikhilesh:
> Add driver/common folder and skeleton makefile for adding commonly used
> functions across mempool, event and net devices.

I am not sure there is a real benefit of introducing such new directory.
Is it only solving the choice of where you add files used
by several drivers?
Is drivers/bus/X/ the directory of choice for platform shared files?
  
Pavan Nikhilesh March 20, 2018, 4:06 p.m. UTC | #2
Hi Thomas,

On Tue, Mar 20, 2018 at 04:45:47PM +0100, Thomas Monjalon wrote:
> 20/03/2018 15:40, Pavan Nikhilesh:
> > Add driver/common folder and skeleton makefile for adding commonly used
> > functions across mempool, event and net devices.
>
> I am not sure there is a real benefit of introducing such new directory.
> Is it only solving the choice of where you add files used
> by several drivers?
> Is drivers/bus/X/ the directory of choice for platform shared files?

drivers/bus doesn't seem to be a appropriate abstraction common API's
used across multiple PMD's.

This change is in regards with the discussion on ml:
http://dpdk.org/ml/archives/dev/2018-March/092822.html

drivers/common seems to be a popular opinion but maybe we could use something
like drivers/SoC or if you have something in mind please suggest.

Thanks,
Pavan.

>
>
>
  
Bruce Richardson March 20, 2018, 5:01 p.m. UTC | #3
On Tue, Mar 20, 2018 at 09:36:25PM +0530, Pavan Nikhilesh wrote:
> Hi Thomas,
> 
> On Tue, Mar 20, 2018 at 04:45:47PM +0100, Thomas Monjalon wrote:
> > 20/03/2018 15:40, Pavan Nikhilesh:
> > > Add driver/common folder and skeleton makefile for adding commonly
> > > used functions across mempool, event and net devices.
> >
> > I am not sure there is a real benefit of introducing such new
> > directory.  Is it only solving the choice of where you add files used
> > by several drivers?  Is drivers/bus/X/ the directory of choice for
> > platform shared files?
> 
> drivers/bus doesn't seem to be a appropriate abstraction common API's
> used across multiple PMD's.
> 
> This change is in regards with the discussion on ml:
> http://dpdk.org/ml/archives/dev/2018-March/092822.html
> 
> drivers/common seems to be a popular opinion but maybe we could use
> something like drivers/SoC or if you have something in mind please
> suggest.
> 
I think drivers/common is a better solution as it's not just platform buses
or SoC's that this occurs with. Even PCI devices can export multiple
functions, such as in the QAT case, which leads to the case where you have
shared code between different driver classes. I don't think the PCI bus
driver is a good place to put QAT shared code. :-)
  
Thomas Monjalon March 20, 2018, 5:27 p.m. UTC | #4
20/03/2018 18:01, Bruce Richardson:
> On Tue, Mar 20, 2018 at 09:36:25PM +0530, Pavan Nikhilesh wrote:
> > Hi Thomas,
> > 
> > On Tue, Mar 20, 2018 at 04:45:47PM +0100, Thomas Monjalon wrote:
> > > 20/03/2018 15:40, Pavan Nikhilesh:
> > > > Add driver/common folder and skeleton makefile for adding commonly
> > > > used functions across mempool, event and net devices.
> > >
> > > I am not sure there is a real benefit of introducing such new
> > > directory.  Is it only solving the choice of where you add files used
> > > by several drivers?  Is drivers/bus/X/ the directory of choice for
> > > platform shared files?
> > 
> > drivers/bus doesn't seem to be a appropriate abstraction common API's
> > used across multiple PMD's.
> > 
> > This change is in regards with the discussion on ml:
> > http://dpdk.org/ml/archives/dev/2018-March/092822.html
> > 
> > drivers/common seems to be a popular opinion but maybe we could use
> > something like drivers/SoC or if you have something in mind please
> > suggest.
> > 
> I think drivers/common is a better solution as it's not just platform buses
> or SoC's that this occurs with. Even PCI devices can export multiple
> functions, such as in the QAT case, which leads to the case where you have
> shared code between different driver classes. I don't think the PCI bus
> driver is a good place to put QAT shared code. :-)

If drivers X and Y share some code, it is possible to link files from
X directory in Y library.

If we want a more explicit and separate directory for shared code,
what would be the name of the sub-directories?
	drivers/common/qat?
	drivers/common/octeontx?
	drivers/common/marvell?
	drivers/common/mellanox?
  
Fiona Trahe March 20, 2018, 7:25 p.m. UTC | #5
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Tuesday, March 20, 2018 5:28 PM
> To: Richardson, Bruce <bruce.richardson@intel.com>
> Cc: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>; jerin.jacob@caviumnetworks.com;
> santosh.shukla@caviumnetworks.com; Burakov, Anatoly <anatoly.burakov@intel.com>;
> lironh@marvell.com; Trahe, Fiona <fiona.trahe@intel.com>; shreyansh.jain@nxp.com;
> hemant.agrawal@nxp.com; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2 1/2] drivers: add common folder
> 
> 20/03/2018 18:01, Bruce Richardson:
> > On Tue, Mar 20, 2018 at 09:36:25PM +0530, Pavan Nikhilesh wrote:
> > > Hi Thomas,
> > >
> > > On Tue, Mar 20, 2018 at 04:45:47PM +0100, Thomas Monjalon wrote:
> > > > 20/03/2018 15:40, Pavan Nikhilesh:
> > > > > Add driver/common folder and skeleton makefile for adding commonly
> > > > > used functions across mempool, event and net devices.
> > > >
> > > > I am not sure there is a real benefit of introducing such new
> > > > directory.  Is it only solving the choice of where you add files used
> > > > by several drivers?  Is drivers/bus/X/ the directory of choice for
> > > > platform shared files?
> > >
> > > drivers/bus doesn't seem to be a appropriate abstraction common API's
> > > used across multiple PMD's.
> > >
> > > This change is in regards with the discussion on ml:
> > > http://dpdk.org/ml/archives/dev/2018-March/092822.html
> > >
> > > drivers/common seems to be a popular opinion but maybe we could use
> > > something like drivers/SoC or if you have something in mind please
> > > suggest.
> > >
> > I think drivers/common is a better solution as it's not just platform buses
> > or SoC's that this occurs with. Even PCI devices can export multiple
> > functions, such as in the QAT case, which leads to the case where you have
> > shared code between different driver classes. I don't think the PCI bus
> > driver is a good place to put QAT shared code. :-)
> 
> If drivers X and Y share some code, it is possible to link files from
> X directory in Y library.
> 
> If we want a more explicit and separate directory for shared code,
> what would be the name of the sub-directories?
> 	drivers/common/qat?
> 	drivers/common/octeontx?
> 	drivers/common/marvell?
> 	drivers/common/mellanox?
> 
[Fiona] Yes. We plan to add drivers/common/qat.
  

Patch

diff --git a/drivers/Makefile b/drivers/Makefile
index ee65c87b0..d279c4892 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -3,18 +3,19 @@ 

 include $(RTE_SDK)/mk/rte.vars.mk

+DIRS-y += common
 DIRS-y += bus
 DIRS-y += mempool
-DEPDIRS-mempool := bus
+DEPDIRS-mempool := bus common
 DIRS-y += net
-DEPDIRS-net := bus mempool
+DEPDIRS-net := bus common mempool
 DIRS-$(CONFIG_RTE_LIBRTE_BBDEV) += bbdev
-DEPDIRS-bbdev := bus mempool
+DEPDIRS-bbdev := bus common mempool
 DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto
-DEPDIRS-crypto := bus mempool
+DEPDIRS-crypto := bus common mempool
 DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event
-DEPDIRS-event := bus mempool net
+DEPDIRS-event := bus common mempool net
 DIRS-$(CONFIG_RTE_LIBRTE_RAWDEV) += raw
-DEPDIRS-raw := bus mempool net event
+DEPDIRS-raw := bus common mempool net event

 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/common/Makefile b/drivers/common/Makefile
new file mode 100644
index 000000000..192066307
--- /dev/null
+++ b/drivers/common/Makefile
@@ -0,0 +1,7 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Cavium, Inc
+#
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/common/meson.build b/drivers/common/meson.build
new file mode 100644
index 000000000..9c2565f00
--- /dev/null
+++ b/drivers/common/meson.build
@@ -0,0 +1,5 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Cavium, Inc
+
+config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON'
+driver_name_fmt = 'rte_@0@_common'
diff --git a/drivers/meson.build b/drivers/meson.build
index b41a0f18e..5a0b5bc34 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -2,11 +2,12 @@ 
 # Copyright(c) 2017 Intel Corporation

 # Defines the order in which the drivers are buit.
-driver_classes = ['bus',
-	       'mempool', # depends on bus.
-	       'net',     # depends on bus and mempool.
-	       'crypto',  # depenss on bus, mempool (net in future).
-	       'event']   # depends on bus, mempool and net.
+driver_classes = ['common',
+	       'bus',
+	       'mempool', # depends on bus and common.
+	       'net',     # depends on bus, common and mempool.
+	       'crypto',  # depenss on bus, common and mempool (net in future).
+	       'event']   # depends on bus, common, mempool and net.

 foreach class:driver_classes
 	drivers = []