[dpdk-dev,2/4] drivers/net: add drivers for Cavium NICs to meson build

Message ID 20171231000203.4510-2-pbhagavatula@caviumnetworks.com (mailing list archive)
State Changes Requested, archived
Delegated to: Bruce Richardson
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Pavan Nikhilesh Dec. 31, 2017, 12:02 a.m. UTC
  Add Cavium octeontx and thunder nicvf to meson build infrastructure.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 drivers/net/meson.build                                 |  3 ++-
 drivers/net/octeontx/base/meson.build                   | 12 ++++++++++++
 drivers/net/octeontx/meson.build                        | 10 ++++++++++
 drivers/net/thunderx/Makefile                           |  2 +-
 drivers/net/thunderx/base/meson.build                   | 17 +++++++++++++++++
 drivers/net/thunderx/meson.build                        |  9 +++++++++
 ...x_nicvf_version.map => rte_pmd_thunderx_version.map} |  0
 7 files changed, 51 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/octeontx/base/meson.build
 create mode 100644 drivers/net/octeontx/meson.build
 create mode 100644 drivers/net/thunderx/base/meson.build
 create mode 100644 drivers/net/thunderx/meson.build
 rename drivers/net/thunderx/{rte_pmd_thunderx_nicvf_version.map => rte_pmd_thunderx_version.map} (100%)
  

Comments

Bruce Richardson Jan. 9, 2018, 5:29 p.m. UTC | #1
On Sun, Dec 31, 2017 at 05:32:01AM +0530, Pavan Nikhilesh wrote:
> Add Cavium octeontx and thunder nicvf to meson build infrastructure.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> ---
>  drivers/net/meson.build                                 |  3 ++-
>  drivers/net/octeontx/base/meson.build                   | 12 ++++++++++++
>  drivers/net/octeontx/meson.build                        | 10 ++++++++++
>  drivers/net/thunderx/Makefile                           |  2 +-
>  drivers/net/thunderx/base/meson.build                   | 17 +++++++++++++++++
>  drivers/net/thunderx/meson.build                        |  9 +++++++++
>  ...x_nicvf_version.map => rte_pmd_thunderx_version.map} |  0
>  7 files changed, 51 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/net/octeontx/base/meson.build
>  create mode 100644 drivers/net/octeontx/meson.build
>  create mode 100644 drivers/net/thunderx/base/meson.build
>  create mode 100644 drivers/net/thunderx/meson.build
>  rename drivers/net/thunderx/{rte_pmd_thunderx_nicvf_version.map => rte_pmd_thunderx_version.map} (100%)
> 

Some minor comments below.

> diff --git a/drivers/net/meson.build b/drivers/net/meson.build
> index 72e1d3578..b132d3558 100644
> --- a/drivers/net/meson.build
> +++ b/drivers/net/meson.build
> @@ -3,7 +3,8 @@
>  
>  drivers = ['af_packet', 'bonding',
>  	'e1000', 'fm10k', 'i40e', 'ixgbe',
> -	'null', 'pcap', 'ring']
> +	'null', 'pcap', 'ring',
> +	'octeontx', 'thunderx']
>  std_deps = ['ethdev', 'kvargs'] # 'ethdev' also pulls in mbuf, net, eal etc
>  std_deps += ['bus_pci']         # very many PMDs depend on PCI, so make std
>  std_deps += ['bus_vdev']        # same with vdev bus
> diff --git a/drivers/net/octeontx/base/meson.build b/drivers/net/octeontx/base/meson.build
> new file mode 100644
> index 000000000..637483d68
> --- /dev/null
> +++ b/drivers/net/octeontx/base/meson.build
> @@ -0,0 +1,12 @@
> +sources = [
> +	'octeontx_bgx.c',
> +	'octeontx_pkivf.c',
> +	'octeontx_pkovf.c'
> +]
> +
> +base_lib = static_library('octeontx_base', sources,
> +	c_args: cflags,
> +	dependencies: static_rte_bus_pci,
> +	include_directories: mempool_octeontx_dir)
> +
> +base_objs = base_lib.extract_all_objects()
> diff --git a/drivers/net/octeontx/meson.build b/drivers/net/octeontx/meson.build
> new file mode 100644
> index 000000000..f263a4b51
> --- /dev/null
> +++ b/drivers/net/octeontx/meson.build
> @@ -0,0 +1,10 @@
> +subdir('base')
> +objs = [base_objs]
> +
> +sources = files('octeontx_rxtx.c',
> +		'octeontx_ethdev.c'
> +		)
> +
> +deps += ['mempool_octeontx', 'eventdev']
> +
> +includes += include_directories('base')
> diff --git a/drivers/net/thunderx/Makefile b/drivers/net/thunderx/Makefile
> index e50e1ad8c..3e4501d34 100644
> --- a/drivers/net/thunderx/Makefile
> +++ b/drivers/net/thunderx/Makefile
> @@ -44,7 +44,7 @@ LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
>  LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
>  LDLIBS += -lrte_bus_pci
>  
> -EXPORT_MAP := rte_pmd_thunderx_nicvf_version.map
> +EXPORT_MAP := rte_pmd_thunderx_version.map
>  
>  LIBABIVER := 1
>  
> diff --git a/drivers/net/thunderx/base/meson.build b/drivers/net/thunderx/base/meson.build
> new file mode 100644
> index 000000000..867a6d661
> --- /dev/null
> +++ b/drivers/net/thunderx/base/meson.build
> @@ -0,0 +1,17 @@
> +sources = [
> +	'nicvf_bsvf.c',
> +	'nicvf_hw.c',
> +	'nicvf_mbox.c'
> +]
> +
> +depends = ['ethdev']
> +static_obj = []
> +foreach d: depends
> +	static_obj += [get_variable('static_rte_' + d)]
> +endforeach
> +
> +base_lib = static_library('nicvf_base', sources,
> +	c_args: cflags,
> +	dependencies: static_obj)
> +

Given there is only one dependency here, I think it's probably best just
to do like you did with the octeontx base code, and put it explicitly in
the dependencies line, rather than bothering with a loop.

> +base_objs = base_lib.extract_all_objects()
> diff --git a/drivers/net/thunderx/meson.build b/drivers/net/thunderx/meson.build
> new file mode 100644
> index 000000000..17852f732
> --- /dev/null
> +++ b/drivers/net/thunderx/meson.build
> @@ -0,0 +1,9 @@
> +subdir('base')
> +objs = [base_objs]
> +
> +sources = files('nicvf_ethdev.c',
> +		'nicvf_svf.c',
> +		'nicvf_rxtx.c')
> +cflags += '-Ofast'

Is there a reason this is explicitly needed? The optimization flags for
the DPDK build as a whole should be covered by the meson top-level
flags, based on the build type. With this given here, changing the build
type to "debug" or "debugoptimized" may not work as expected for the
driver.

> +
> +includes += include_directories('base')
> diff --git a/drivers/net/thunderx/rte_pmd_thunderx_nicvf_version.map b/drivers/net/thunderx/rte_pmd_thunderx_version.map
> similarity index 100%
> rename from drivers/net/thunderx/rte_pmd_thunderx_nicvf_version.map
> rename to drivers/net/thunderx/rte_pmd_thunderx_version.map
> -- 
> 2.15.1
>
  
Pavan Nikhilesh Jan. 11, 2018, 12:42 p.m. UTC | #2
On Tue, Jan 09, 2018 at 05:29:36PM +0000, Bruce Richardson wrote:
> On Sun, Dec 31, 2017 at 05:32:01AM +0530, Pavan Nikhilesh wrote:
> > Add Cavium octeontx and thunder nicvf to meson build infrastructure.
> >
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > ---
> >  drivers/net/meson.build                                 |  3 ++-
> >  drivers/net/octeontx/base/meson.build                   | 12 ++++++++++++
> >  drivers/net/octeontx/meson.build                        | 10 ++++++++++
> >  drivers/net/thunderx/Makefile                           |  2 +-
> >  drivers/net/thunderx/base/meson.build                   | 17 +++++++++++++++++
> >  drivers/net/thunderx/meson.build                        |  9 +++++++++
> >  ...x_nicvf_version.map => rte_pmd_thunderx_version.map} |  0
> >  7 files changed, 51 insertions(+), 2 deletions(-)
> >  create mode 100644 drivers/net/octeontx/base/meson.build
> >  create mode 100644 drivers/net/octeontx/meson.build
> >  create mode 100644 drivers/net/thunderx/base/meson.build
> >  create mode 100644 drivers/net/thunderx/meson.build
> >  rename drivers/net/thunderx/{rte_pmd_thunderx_nicvf_version.map => rte_pmd_thunderx_version.map} (100%)
> >
>
> Some minor comments below.
>
> > diff --git a/drivers/net/meson.build b/drivers/net/meson.build
> > index 72e1d3578..b132d3558 100644
> > --- a/drivers/net/meson.build
> > +++ b/drivers/net/meson.build
> > @@ -3,7 +3,8 @@
> >
> >  drivers = ['af_packet', 'bonding',
> >  	'e1000', 'fm10k', 'i40e', 'ixgbe',
> > -	'null', 'pcap', 'ring']
> > +	'null', 'pcap', 'ring',
> > +	'octeontx', 'thunderx']
> >  std_deps = ['ethdev', 'kvargs'] # 'ethdev' also pulls in mbuf, net, eal etc
> >  std_deps += ['bus_pci']         # very many PMDs depend on PCI, so make std
> >  std_deps += ['bus_vdev']        # same with vdev bus
> > diff --git a/drivers/net/octeontx/base/meson.build b/drivers/net/octeontx/base/meson.build
> > new file mode 100644
> > index 000000000..637483d68
> > --- /dev/null
> > +++ b/drivers/net/octeontx/base/meson.build
> > @@ -0,0 +1,12 @@
> > +sources = [
> > +	'octeontx_bgx.c',
> > +	'octeontx_pkivf.c',
> > +	'octeontx_pkovf.c'
> > +]
> > +
> > +base_lib = static_library('octeontx_base', sources,
> > +	c_args: cflags,
> > +	dependencies: static_rte_bus_pci,
> > +	include_directories: mempool_octeontx_dir)
> > +
> > +base_objs = base_lib.extract_all_objects()
> > diff --git a/drivers/net/octeontx/meson.build b/drivers/net/octeontx/meson.build
> > new file mode 100644
> > index 000000000..f263a4b51
> > --- /dev/null
> > +++ b/drivers/net/octeontx/meson.build
> > @@ -0,0 +1,10 @@
> > +subdir('base')
> > +objs = [base_objs]
> > +
> > +sources = files('octeontx_rxtx.c',
> > +		'octeontx_ethdev.c'
> > +		)
> > +
> > +deps += ['mempool_octeontx', 'eventdev']
> > +
> > +includes += include_directories('base')
> > diff --git a/drivers/net/thunderx/Makefile b/drivers/net/thunderx/Makefile
> > index e50e1ad8c..3e4501d34 100644
> > --- a/drivers/net/thunderx/Makefile
> > +++ b/drivers/net/thunderx/Makefile
> > @@ -44,7 +44,7 @@ LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
> >  LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
> >  LDLIBS += -lrte_bus_pci
> >
> > -EXPORT_MAP := rte_pmd_thunderx_nicvf_version.map
> > +EXPORT_MAP := rte_pmd_thunderx_version.map
> >
> >  LIBABIVER := 1
> >
> > diff --git a/drivers/net/thunderx/base/meson.build b/drivers/net/thunderx/base/meson.build
> > new file mode 100644
> > index 000000000..867a6d661
> > --- /dev/null
> > +++ b/drivers/net/thunderx/base/meson.build
> > @@ -0,0 +1,17 @@
> > +sources = [
> > +	'nicvf_bsvf.c',
> > +	'nicvf_hw.c',
> > +	'nicvf_mbox.c'
> > +]
> > +
> > +depends = ['ethdev']
> > +static_obj = []
> > +foreach d: depends
> > +	static_obj += [get_variable('static_rte_' + d)]
> > +endforeach
> > +
> > +base_lib = static_library('nicvf_base', sources,
> > +	c_args: cflags,
> > +	dependencies: static_obj)
> > +
>
> Given there is only one dependency here, I think it's probably best just
> to do like you did with the octeontx base code, and put it explicitly in
> the dependencies line, rather than bothering with a loop.

Agreed, will remove the loop and include directly.

>
> > +base_objs = base_lib.extract_all_objects()
> > diff --git a/drivers/net/thunderx/meson.build b/drivers/net/thunderx/meson.build
> > new file mode 100644
> > index 000000000..17852f732
> > --- /dev/null
> > +++ b/drivers/net/thunderx/meson.build
> > @@ -0,0 +1,9 @@
> > +subdir('base')
> > +objs = [base_objs]
> > +
> > +sources = files('nicvf_ethdev.c',
> > +		'nicvf_svf.c',
> > +		'nicvf_rxtx.c')
> > +cflags += '-Ofast'
>
> Is there a reason this is explicitly needed? The optimization flags for
> the DPDK build as a whole should be covered by the meson top-level
> flags, based on the build type. With this given here, changing the build
> type to "debug" or "debugoptimized" may not work as expected for the
> driver.

I do agree that this would mess up meson debug build. In traditional make
environment we could control file specific cflags but as far as I see I couldnt
find the support for it in meson.

AFAIK meson's default cflags include '-O3' and not '-Ofast'. I will do a quick
benchmark before v2 based on that include the cflag. Also, in case if -Ofast is
necessary I will add a condition to enable it only in case of a normal build.

>
> > +
> > +includes += include_directories('base')
> > diff --git a/drivers/net/thunderx/rte_pmd_thunderx_nicvf_version.map b/drivers/net/thunderx/rte_pmd_thunderx_version.map
> > similarity index 100%
> > rename from drivers/net/thunderx/rte_pmd_thunderx_nicvf_version.map
> > rename to drivers/net/thunderx/rte_pmd_thunderx_version.map
> > --
> > 2.15.1
> >
  

Patch

diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index 72e1d3578..b132d3558 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -3,7 +3,8 @@ 
 
 drivers = ['af_packet', 'bonding',
 	'e1000', 'fm10k', 'i40e', 'ixgbe',
-	'null', 'pcap', 'ring']
+	'null', 'pcap', 'ring',
+	'octeontx', 'thunderx']
 std_deps = ['ethdev', 'kvargs'] # 'ethdev' also pulls in mbuf, net, eal etc
 std_deps += ['bus_pci']         # very many PMDs depend on PCI, so make std
 std_deps += ['bus_vdev']        # same with vdev bus
diff --git a/drivers/net/octeontx/base/meson.build b/drivers/net/octeontx/base/meson.build
new file mode 100644
index 000000000..637483d68
--- /dev/null
+++ b/drivers/net/octeontx/base/meson.build
@@ -0,0 +1,12 @@ 
+sources = [
+	'octeontx_bgx.c',
+	'octeontx_pkivf.c',
+	'octeontx_pkovf.c'
+]
+
+base_lib = static_library('octeontx_base', sources,
+	c_args: cflags,
+	dependencies: static_rte_bus_pci,
+	include_directories: mempool_octeontx_dir)
+
+base_objs = base_lib.extract_all_objects()
diff --git a/drivers/net/octeontx/meson.build b/drivers/net/octeontx/meson.build
new file mode 100644
index 000000000..f263a4b51
--- /dev/null
+++ b/drivers/net/octeontx/meson.build
@@ -0,0 +1,10 @@ 
+subdir('base')
+objs = [base_objs]
+
+sources = files('octeontx_rxtx.c',
+		'octeontx_ethdev.c'
+		)
+
+deps += ['mempool_octeontx', 'eventdev']
+
+includes += include_directories('base')
diff --git a/drivers/net/thunderx/Makefile b/drivers/net/thunderx/Makefile
index e50e1ad8c..3e4501d34 100644
--- a/drivers/net/thunderx/Makefile
+++ b/drivers/net/thunderx/Makefile
@@ -44,7 +44,7 @@  LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 LDLIBS += -lrte_bus_pci
 
-EXPORT_MAP := rte_pmd_thunderx_nicvf_version.map
+EXPORT_MAP := rte_pmd_thunderx_version.map
 
 LIBABIVER := 1
 
diff --git a/drivers/net/thunderx/base/meson.build b/drivers/net/thunderx/base/meson.build
new file mode 100644
index 000000000..867a6d661
--- /dev/null
+++ b/drivers/net/thunderx/base/meson.build
@@ -0,0 +1,17 @@ 
+sources = [
+	'nicvf_bsvf.c',
+	'nicvf_hw.c',
+	'nicvf_mbox.c'
+]
+
+depends = ['ethdev']
+static_obj = []
+foreach d: depends
+	static_obj += [get_variable('static_rte_' + d)]
+endforeach
+
+base_lib = static_library('nicvf_base', sources,
+	c_args: cflags,
+	dependencies: static_obj)
+
+base_objs = base_lib.extract_all_objects()
diff --git a/drivers/net/thunderx/meson.build b/drivers/net/thunderx/meson.build
new file mode 100644
index 000000000..17852f732
--- /dev/null
+++ b/drivers/net/thunderx/meson.build
@@ -0,0 +1,9 @@ 
+subdir('base')
+objs = [base_objs]
+
+sources = files('nicvf_ethdev.c',
+		'nicvf_svf.c',
+		'nicvf_rxtx.c')
+cflags += '-Ofast'
+
+includes += include_directories('base')
diff --git a/drivers/net/thunderx/rte_pmd_thunderx_nicvf_version.map b/drivers/net/thunderx/rte_pmd_thunderx_version.map
similarity index 100%
rename from drivers/net/thunderx/rte_pmd_thunderx_nicvf_version.map
rename to drivers/net/thunderx/rte_pmd_thunderx_version.map