DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] pkg: add dkms to build kernel module
@ 2017-01-18 21:45 Anders Roxell
  2017-02-07 17:04 ` Thomas Monjalon
  2017-03-28 20:46 ` [dpdk-dev] [PATCHv2] pkg/dpdk.spec: " Anders Roxell
  0 siblings, 2 replies; 5+ messages in thread
From: Anders Roxell @ 2017-01-18 21:45 UTC (permalink / raw)
  To: thomas.monjalon; +Cc: dev, ricardo.salveti, Anders Roxell

Build igb-uio and rte-kni kernel module using dkms.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 pkg/dpdk.spec | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 90 insertions(+), 1 deletion(-)

diff --git a/pkg/dpdk.spec b/pkg/dpdk.spec
index 43ff9548..189cb2f2 100644
--- a/pkg/dpdk.spec
+++ b/pkg/dpdk.spec
@@ -63,6 +63,26 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
 DPDK devel is a set of makefiles, headers and examples
 for fast packet processing on x86 platforms.
 
+%package igb-uio
+Summary: Data Plane Development Kit, igb_uio kernel module
+Group: System/Kernel
+Requires: %{name}%{?_isa} = %{version}-%{release}
+Requires: gcc, make
+Requires(post):   dkms
+Requires(preun):  dkms
+%description igb-uio
+Data Plane Development Kit, igb_uio kernel module
+
+%package rte-kni
+Summary: Data Plane Development Kit, rte_kni kernel module
+Group: System/Kernel
+Requires: %{name}%{?_isa} = %{version}-%{release}
+Requires: gcc, make
+Requires(post):   dkms
+Requires(preun):  dkms
+%description rte-kni
+Data Plane Development Kit, rte_kni kernel module
+
 %package doc
 Summary: Data Plane Development Kit API documentation
 BuildArch: noarch
@@ -77,6 +97,8 @@ and guides in sphinx HTML/PDF formats.
 make O=%{target} T=%{config} config
 sed -ri 's,(RTE_MACHINE=).*,\1%{machine},' %{target}/.config
 sed -ri 's,(RTE_APP_TEST=).*,\1n,'         %{target}/.config
+sed -ri 's,(CONFIG_RTE_EAL_IGB_UIO=).*,\1n,' %{target}/.config
+sed -ri 's,(CONFIG_RTE_KNI_KMOD=).*,\1n,'    %{target}/.config
 sed -ri 's,(RTE_BUILD_SHARED_LIB=).*,\1y,' %{target}/.config
 sed -ri 's,(RTE_NEXT_ABI=).*,\1n,'         %{target}/.config
 sed -ri 's,(LIBRTE_VHOST=).*,\1y,'         %{target}/.config
@@ -92,10 +114,45 @@ make install O=%{target} DESTDIR=%{buildroot} \
 	includedir=%{_includedir}/dpdk libdir=%{_libdir} \
 	datadir=%{_datadir}/dpdk docdir=%{_docdir}/dpdk
 
+# Kernel module sources install for dkms
+%{__mkdir_p} %{buildroot}%{_usrsrc}/dpdk-igb-uio-%{version}/
+%{__cp} -r lib/librte_eal/linuxapp/igb_uio/* %{buildroot}%{_usrsrc}/dpdk-igb-uio-%{version}/
+
+%{__mkdir_p} %{buildroot}%{_usrsrc}/dpdk-rte-kni-%{version}/
+%{__cp} -r lib/librte_eal/linuxapp/kni/* %{buildroot}%{_usrsrc}/dpdk-rte-kni-%{version}/
+
+cat > %{buildroot}%{_datadir}/dpdk/buildtools/dpdk-sdk-env.sh << EOF
+export RTE_TARGET=%{target}
+export RTE_SDK="/usr/share/dpdk/"
+export RTE_INCLUDE="/usr/include/dpdk"
+EOF
+
+# Prepare dkms.conf
+cat > %{buildroot}%{_usrsrc}/dpdk-igb-uio-%{version}/dkms.conf << EOF
+
+PACKAGE_NAME="dpdk-igb-uio"
+PACKAGE_VERSION="%{version}-%{release}"
+MAKE="source /usr/share/dpdk/buildtools/dpdk-sdk-env.sh; make MODULE_CFLAGS='-I/usr/include/dpdk -include /usr/include/dpdk/rte_config.h'"
+CLEAN="source /usr/share/dpdk/buildtools/dpdk-sdk-env.sh; make clean"
+BUILT_MODULE_NAME[0]=igb_uio
+DEST_MODULE_LOCATION[0]=/updates/dkms
+AUTOINSTALL=yes
+EOF
+
+# Prepare dkms.conf
+cat > %{buildroot}%{_usrsrc}/dpdk-rte-kni-%{version}/dkms.conf << EOF
+PACKAGE_NAME="dpdk-rte-kni"
+PACKAGE_VERSION="%{version}-%{release}"
+MAKE="source /usr/share/dpdk/buildtools/dpdk-sdk-env.sh; make MODULE_CFLAGS='-I/usr/include/dpdk -include /usr/include/dpdk/rte_config.h -I%{_usrsrc}/dpdk-rte-kni-%{version}/ethtool/ixgbe -I%{_usrsrc}/dpdk-rte-kni-%{version}/ethtool/igb'"
+CLEAN="source /usr/share/dpdk/buildtools/dpdk-sdk-env.sh; make clean"
+BUILT_MODULE_NAME[0]=rte_kni
+DEST_MODULE_LOCATION[0]=/updates/dkms
+AUTOINSTALL="YES"
+EOF
+
 %files
 %dir %{_datadir}/dpdk
 %{_datadir}/dpdk/usertools
-/lib/modules/%(uname -r)/extra/*
 %{_sbindir}/*
 %{_bindir}/*
 %{_libdir}/*
@@ -107,6 +164,14 @@ make install O=%{target} DESTDIR=%{buildroot} \
 %{_datadir}/dpdk/%{target}
 %{_datadir}/dpdk/examples
 
+%files igb-uio
+%defattr(-,root,root)
+%{_usrsrc}/dpdk-igb-uio-%{version}/
+
+%files rte-kni
+%defattr(-,root,root)
+%{_usrsrc}/dpdk-rte-kni-%{version}/
+
 %files doc
 %doc %{_docdir}/dpdk
 
@@ -114,6 +179,30 @@ make install O=%{target} DESTDIR=%{buildroot} \
 /sbin/ldconfig
 /sbin/depmod
 
+%post igb-uio
+# Add to DKMS registry
+isadded=`dkms status -m "dpdk-igb-uio" -v "%{version}"`
+if [ "x${isadded}" = "x" ] ; then
+    dkms add -m "dpdk-igb-uio" -v "%{version}" || :
+fi
+dkms build -m "dpdk-igb-uio" -v "%{version}" || :
+dkms install -m "dpdk-igb-uio" -v "%{version}" --force || :
+
+%post rte-kni
+# Add to DKMS registry
+isadded=`dkms status -m "dpdk-rte-kni" -v "%{version}"`
+if [ "x${isadded}" = "x" ] ; then
+    dkms add -m "dpdk-rte-kni" -v "%{version}" || :
+fi
+dkms build -m "dpdk-rte-kni" -v "%{version}" || :
+dkms install -m "dpdk-rte-kni" -v "%{version}" --force || :
+
+%preun igb-uio
+dkms remove -m "dpdk-igb-uio" -v "%{version}" --all || :
+
+%preun rte-kni
+dkms remove -m "dpdk-rte-kni" -v "%{version}" --all || :
+
 %postun
 /sbin/ldconfig
 /sbin/depmod
-- 
2.11.0

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

* Re: [dpdk-dev] [PATCH] pkg: add dkms to build kernel module
  2017-01-18 21:45 [dpdk-dev] [PATCH] pkg: add dkms to build kernel module Anders Roxell
@ 2017-02-07 17:04 ` Thomas Monjalon
  2017-03-28 20:36   ` Anders Roxell
  2017-03-28 20:46 ` [dpdk-dev] [PATCHv2] pkg/dpdk.spec: " Anders Roxell
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Monjalon @ 2017-02-07 17:04 UTC (permalink / raw)
  To: Anders Roxell; +Cc: dev, ricardo.salveti

Hi,

So the idea is to package DPDK kernel modules with DKMS.
And if we do not want to use DKMS, we just have to remove this part?
Could we better identify the DKMS part to remove? Or add a variable to switch
between the 2 modes?

2017-01-18 22:45, Anders Roxell:
> +MAKE="source /usr/share/dpdk/buildtools/dpdk-sdk-env.sh; make MODULE_CFLAGS='-I/usr/include/dpdk -include /usr/include/dpdk/rte_config.h'"

What is dpdk-sdk-env.sh?

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

* Re: [dpdk-dev] [PATCH] pkg: add dkms to build kernel module
  2017-02-07 17:04 ` Thomas Monjalon
@ 2017-03-28 20:36   ` Anders Roxell
  0 siblings, 0 replies; 5+ messages in thread
From: Anders Roxell @ 2017-03-28 20:36 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, ricardo.salveti

On 2017-02-07 18:04, Thomas Monjalon wrote:
> Hi,

Hi,

I'm sorry for the extremely slow response.

> 
> So the idea is to package DPDK kernel modules with DKMS.
> And if we do not want to use DKMS, we just have to remove this part?
> Could we better identify the DKMS part to remove? Or add a variable to switch
> between the 2 modes?

Yes that makes sense.
I'll send a v2.

> 
> 2017-01-18 22:45, Anders Roxell:
> > +MAKE="source /usr/share/dpdk/buildtools/dpdk-sdk-env.sh; make MODULE_CFLAGS='-I/usr/include/dpdk -include /usr/include/dpdk/rte_config.h'"
> 
> What is dpdk-sdk-env.sh?

Its a file that sets up RTE_TARGET, RTE_SDK and RTE_INCLUDE, the file
will be sourced while building the modules with dkms.

Cheers,
Anders

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

* [dpdk-dev] [PATCHv2] pkg/dpdk.spec: add dkms to build kernel module
  2017-01-18 21:45 [dpdk-dev] [PATCH] pkg: add dkms to build kernel module Anders Roxell
  2017-02-07 17:04 ` Thomas Monjalon
@ 2017-03-28 20:46 ` Anders Roxell
  2018-12-21 15:18   ` Thomas Monjalon
  1 sibling, 1 reply; 5+ messages in thread
From: Anders Roxell @ 2017-03-28 20:46 UTC (permalink / raw)
  To: thomas.monjalon; +Cc: dev, ricardo.salveti, Anders Roxell

Build igb-uio and rte-kni kernel module using dkms.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 pkg/dpdk.spec | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/pkg/dpdk.spec b/pkg/dpdk.spec
index 7bc5780..550fb76 100644
--- a/pkg/dpdk.spec
+++ b/pkg/dpdk.spec
@@ -40,6 +40,8 @@ Summary: Data Plane Development Kit core
 Group: System Environment/Libraries
 License: BSD and LGPLv2 and GPLv2
 
+%define with_dkms %{?_without_dkms: 0} %{?!_without_dkms: 1}
+
 ExclusiveArch: i686 x86_64 aarch64
 %ifarch aarch64
 %global machine armv8a
@@ -72,6 +74,28 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
 DPDK devel is a set of makefiles, headers and examples
 for fast packet processing on x86 platforms.
 
+%if %{with_dkms}
+%package igb-uio
+Summary: Data Plane Development Kit, igb_uio kernel module
+Group: System/Kernel
+Requires: %{name}%{?_isa} = %{version}-%{release}
+Requires: gcc, make
+Requires(post):   dkms
+Requires(preun):  dkms
+%description igb-uio
+Data Plane Development Kit, igb_uio kernel module
+
+%package rte-kni
+Summary: Data Plane Development Kit, rte_kni kernel module
+Group: System/Kernel
+Requires: %{name}%{?_isa} = %{version}-%{release}
+Requires: gcc, make
+Requires(post):   dkms
+Requires(preun):  dkms
+%description rte-kni
+Data Plane Development Kit, rte_kni kernel module
+%endif
+
 %package doc
 Summary: Data Plane Development Kit API documentation
 BuildArch: noarch
@@ -86,6 +110,10 @@ and guides in sphinx HTML/PDF formats.
 make O=%{target} T=%{config} config
 sed -ri 's,(RTE_MACHINE=).*,\1%{machine},' %{target}/.config
 sed -ri 's,(RTE_APP_TEST=).*,\1n,'         %{target}/.config
+%if %{with_dkms}
+sed -ri 's,(CONFIG_RTE_EAL_IGB_UIO=).*,\1n,' %{target}/.config
+sed -ri 's,(CONFIG_RTE_KNI_KMOD=).*,\1n,'    %{target}/.config
+%endif
 sed -ri 's,(RTE_BUILD_SHARED_LIB=).*,\1y,' %{target}/.config
 sed -ri 's,(RTE_NEXT_ABI=).*,\1n,'         %{target}/.config
 sed -ri 's,(LIBRTE_VHOST=).*,\1y,'         %{target}/.config
@@ -103,10 +131,50 @@ make install O=%{target} DESTDIR=%{buildroot} \
 	includedir=%{_includedir}/dpdk libdir=%{_libdir} \
 	datadir=%{_datadir}/dpdk docdir=%{_docdir}/dpdk
 
+%if %{with_dkms}
+# Kernel module sources install for dkms
+%{__mkdir_p} %{buildroot}%{_usrsrc}/dpdk-igb-uio-%{version}/
+%{__cp} -r lib/librte_eal/linuxapp/igb_uio/* %{buildroot}%{_usrsrc}/dpdk-igb-uio-%{version}/
+
+%{__mkdir_p} %{buildroot}%{_usrsrc}/dpdk-rte-kni-%{version}/
+%{__cp} -r lib/librte_eal/linuxapp/kni/* %{buildroot}%{_usrsrc}/dpdk-rte-kni-%{version}/
+
+cat > %{buildroot}%{_datadir}/dpdk/buildtools/dpdk-sdk-env.sh << EOF
+export RTE_TARGET=%{target}
+export RTE_SDK="/usr/share/dpdk/"
+export RTE_INCLUDE="/usr/include/dpdk"
+EOF
+
+# Prepare dkms.conf
+cat > %{buildroot}%{_usrsrc}/dpdk-igb-uio-%{version}/dkms.conf << EOF
+
+PACKAGE_NAME="dpdk-igb-uio"
+PACKAGE_VERSION="%{version}-%{release}"
+MAKE="source /usr/share/dpdk/buildtools/dpdk-sdk-env.sh; make MODULE_CFLAGS='-I/usr/include/dpdk -include /usr/include/dpdk/rte_config.h'"
+CLEAN="source /usr/share/dpdk/buildtools/dpdk-sdk-env.sh; make clean"
+BUILT_MODULE_NAME[0]=igb_uio
+DEST_MODULE_LOCATION[0]=/updates/dkms
+AUTOINSTALL=yes
+EOF
+
+# Prepare dkms.conf
+cat > %{buildroot}%{_usrsrc}/dpdk-rte-kni-%{version}/dkms.conf << EOF
+PACKAGE_NAME="dpdk-rte-kni"
+PACKAGE_VERSION="%{version}-%{release}"
+MAKE="source /usr/share/dpdk/buildtools/dpdk-sdk-env.sh; make MODULE_CFLAGS='-I/usr/include/dpdk -include /usr/include/dpdk/rte_config.h -I%{_usrsrc}/dpdk-rte-kni-%{version}/ethtool/ixgbe -I%{_usrsrc}/dpdk-rte-kni-%{version}/ethtool/igb'"
+CLEAN="source /usr/share/dpdk/buildtools/dpdk-sdk-env.sh; make clean"
+BUILT_MODULE_NAME[0]=rte_kni
+DEST_MODULE_LOCATION[0]=/updates/dkms
+AUTOINSTALL="YES"
+EOF
+%endif
+
 %files
 %dir %{_datadir}/dpdk
 %{_datadir}/dpdk/usertools
+%if ! %{with_dkms}
 /lib/modules/%(uname -r)/extra/*
+%endif
 %{_sbindir}/*
 %{_bindir}/*
 %{_libdir}/*
@@ -118,6 +186,16 @@ make install O=%{target} DESTDIR=%{buildroot} \
 %{_datadir}/dpdk/%{target}
 %{_datadir}/dpdk/examples
 
+%if %{with_dkms}
+%files igb-uio
+%defattr(-,root,root)
+%{_usrsrc}/dpdk-igb-uio-%{version}/
+
+%files rte-kni
+%defattr(-,root,root)
+%{_usrsrc}/dpdk-rte-kni-%{version}/
+%endif
+
 %files doc
 %doc %{_docdir}/dpdk
 
@@ -125,6 +203,32 @@ make install O=%{target} DESTDIR=%{buildroot} \
 /sbin/ldconfig
 /sbin/depmod
 
+%if %{with_dkms}
+%post igb-uio
+# Add to DKMS registry
+isadded=`dkms status -m "dpdk-igb-uio" -v "%{version}"`
+if [ "x${isadded}" = "x" ] ; then
+    dkms add -m "dpdk-igb-uio" -v "%{version}" || :
+fi
+dkms build -m "dpdk-igb-uio" -v "%{version}" || :
+dkms install -m "dpdk-igb-uio" -v "%{version}" --force || :
+
+%post rte-kni
+# Add to DKMS registry
+isadded=`dkms status -m "dpdk-rte-kni" -v "%{version}"`
+if [ "x${isadded}" = "x" ] ; then
+    dkms add -m "dpdk-rte-kni" -v "%{version}" || :
+fi
+dkms build -m "dpdk-rte-kni" -v "%{version}" || :
+dkms install -m "dpdk-rte-kni" -v "%{version}" --force || :
+
+%preun igb-uio
+dkms remove -m "dpdk-igb-uio" -v "%{version}" --all || :
+
+%preun rte-kni
+dkms remove -m "dpdk-rte-kni" -v "%{version}" --all || :
+%endif
+
 %postun
 /sbin/ldconfig
 /sbin/depmod
-- 
2.1.4

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

* Re: [dpdk-dev] [PATCHv2] pkg/dpdk.spec: add dkms to build kernel module
  2017-03-28 20:46 ` [dpdk-dev] [PATCHv2] pkg/dpdk.spec: " Anders Roxell
@ 2018-12-21 15:18   ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2018-12-21 15:18 UTC (permalink / raw)
  To: Anders Roxell; +Cc: dev, ricardo.salveti

28/03/2017 22:46, Anders Roxell:
> Build igb-uio and rte-kni kernel module using dkms.
> 
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

The pkg/dpdk.spec file has been removed from the repository.
This patch is now marked as "Not Applicable".

If you think it was useful, please shout.

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

end of thread, other threads:[~2018-12-21 15:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-18 21:45 [dpdk-dev] [PATCH] pkg: add dkms to build kernel module Anders Roxell
2017-02-07 17:04 ` Thomas Monjalon
2017-03-28 20:36   ` Anders Roxell
2017-03-28 20:46 ` [dpdk-dev] [PATCHv2] pkg/dpdk.spec: " Anders Roxell
2018-12-21 15:18   ` Thomas Monjalon

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