Skip to contentSkip to conversation

kni: resolve build issue for OpenSuse15.3

PATCH In review Aman Singh 4 participants 5 messages Oct 13, 2021 – Oct 25, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore

Aman Singh

author
#0 lore raw

PATCH 1/1 kni: resolve build issue for OpenSuse15.3

As suse version numbering is inconsistent to determine Linux kernel API to be used. In this patch we check parameter of 'ndo_tx_timeout' API directly from the kernel source. This is done only for suse build.

Bugzilla ID: 812
Cc: [email protected]

---
 kernel/linux/kni/compat.h    |  3 ++-
 kernel/linux/kni/meson.build | 14 +++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)
kernel/linux/kni/compat.h +2 -1
index 5f65640d5e..664785674f 100644
@@ -133,7 +133,8 @@
 
 #if KERNEL_VERSION(5, 6, 0) <= LINUX_VERSION_CODE || \
 	(defined(RHEL_RELEASE_CODE) && \
-	 RHEL_RELEASE_VERSION(8, 3) <= RHEL_RELEASE_CODE)
+	 RHEL_RELEASE_VERSION(8, 3) <= RHEL_RELEASE_CODE) || \
+	 (defined(CONFIG_SUSE_KERNEL) && defined(HAVE_ARG_TX_QUEUE))
 #define HAVE_TX_TIMEOUT_TXQUEUE
 #endif
 
kernel/linux/kni/meson.build +13 -1
index c15c78b0b4..32533fe932 100644
@@ -1,6 +1,17 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Luca Boccassi <[email protected]>
 
+# For SUSE build check function arguments of ndo_tx_timeout API
+# Ref: https://jira.devtools.intel.com/browse/DPDK-29263
+kmod_cflags = ''
+file_path = kernel_build_dir + '/include/linux/netdevice.h'
+run_cmd = run_command('grep', 'ndo_tx_timeout', file_path)
+
+if run_cmd.stdout().contains('txqueue') == true
+   kmod_cflags = '-DHAVE_ARG_TX_QUEUE'
+endif
+
+
 kni_mkfile = custom_target('rte_kni_makefile',
         output: 'Makefile',
         command: ['touch', '@OUTPUT@'])
@@ -17,7 +28,8 @@ custom_target('rte_kni',
         command: ['make', '-j4', '-C', kernel_build_dir,
             'M=' + meson.current_build_dir(),
             'src=' + meson.current_source_dir(),
-            'MODULE_CFLAGS=-include ' + meson.source_root() + '/config/rte_config.h' +
+            ' '.join(['MODULE_CFLAGS=', kmod_cflags,'-include '])
+            + meson.source_root() + '/config/rte_config.h' +
             ' -I' + meson.source_root() + '/lib/eal/include' +
             ' -I' + meson.source_root() + '/lib/kni' +
             ' -I' + meson.build_root() +
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 51 lines · Aman Singh

As suse version numbering is inconsistent to determine Linux kernel API to be used. In this patch we check parameter of 'ndo_tx_timeout' API directly from the kernel source. This is done only for suse build.

Bugzilla ID: 812
Cc: [email protected]

---
  kernel/linux/kni/compat.h    |  3 ++-
  kernel/linux/kni/meson.build | 14 +++++++++++++-
  2 files changed, 15 insertions(+), 2 deletions(-)
kernel/linux/kni/compat.h +2 -1
index 5f65640d5e..664785674f 100644
@@ -133,7 +133,8 @@
 
  #if KERNEL_VERSION(5, 6, 0) <= LINUX_VERSION_CODE || \
  	(defined(RHEL_RELEASE_CODE) && \
-	 RHEL_RELEASE_VERSION(8, 3) <= RHEL_RELEASE_CODE)
+	 RHEL_RELEASE_VERSION(8, 3) <= RHEL_RELEASE_CODE) || \
+	 (defined(CONFIG_SUSE_KERNEL) && defined(HAVE_ARG_TX_QUEUE))
  #define HAVE_TX_TIMEOUT_TXQUEUE
  #endif
 
kernel/linux/kni/meson.build +11 -0
index c15c78b0b4..32533fe932 100644
@@ -1,6 +1,17 @@
  # SPDX-License-Identifier: BSD-3-Clause
  # Copyright(c) 2018 Luca Boccassi <[email protected]>
 
+# For SUSE build check function arguments of ndo_tx_timeout API
+# Ref: https://jira.devtools.intel.com/browse/DPDK-29263
+kmod_cflags = ''
+file_path = kernel_build_dir + '/include/linux/netdevice.h'
+run_cmd = run_command('grep', 'ndo_tx_timeout', file_path)
+
+if run_cmd.stdout().contains('txqueue') == true
+   kmod_cflags = '-DHAVE_ARG_TX_QUEUE'
+endif
+
+
  kni_mkfile = custom_target('rte_kni_makefile',
          output: 'Makefile',
          command: ['touch', '@OUTPUT@'])

kernel/linux/kni/meson.build custom_target('rte_kni', · line 35

Quoted 9 lines
kernel/linux/kni/meson.build +2 -1
@@ -17,7 +28,8 @@ custom_target('rte_kni',
          command: ['make', '-j4', '-C', kernel_build_dir,
              'M=' + meson.current_build_dir(),
              'src=' + meson.current_source_dir(),
-            'MODULE_CFLAGS=-include ' + meson.source_root() + '/config/rte_config.h' +
+            ' '.join(['MODULE_CFLAGS=', kmod_cflags,'-include '])
+            + meson.source_root() + '/config/rte_config.h' +
              ' -I' + meson.source_root() + '/lib/eal/include' +
              ' -I' + meson.source_root() + '/lib/kni' +
              ' -I' + meson.build_root() +

I didn't check on the SUSE, but _unconventional_ detection method is not causing any problem in my test environment.

#2 lore raw

PATCH v2 1/1 kni: fix build for SLES15-SP3

In reply to Aman Singh

From: Aman Singh <[email protected]>

As suse version numbering is inconsistent to determine Linux kernel API to be used. In this patch we check parameter of 'ndo_tx_timeout' API directly from the kernel source. This is done only for suse build.

Bugzilla ID: 812
Cc: [email protected]

---
Cc: Christian Ehrhardt <[email protected]>
Cc: Marco Varlese <[email protected]>

v2:
* Use explicit 'source' folder for header path. In SUSE 'source' is not link to 'build' folder.

---
 kernel/linux/kni/compat.h    |  3 ++-
 kernel/linux/kni/meson.build | 14 +++++++++++++-
 kernel/linux/meson.build     |  5 +++++
 3 files changed, 20 insertions(+), 2 deletions(-)
kernel/linux/kni/compat.h +2 -1
index 5f65640d5ed2..664785674ff1 100644
@@ -133,7 +133,8 @@
 
 #if KERNEL_VERSION(5, 6, 0) <= LINUX_VERSION_CODE || \
 	(defined(RHEL_RELEASE_CODE) && \
-	 RHEL_RELEASE_VERSION(8, 3) <= RHEL_RELEASE_CODE)
+	 RHEL_RELEASE_VERSION(8, 3) <= RHEL_RELEASE_CODE) || \
+	 (defined(CONFIG_SUSE_KERNEL) && defined(HAVE_ARG_TX_QUEUE))
 #define HAVE_TX_TIMEOUT_TXQUEUE
 #endif
 
kernel/linux/kni/meson.build +13 -1
index c15c78b0b474..c683fc7b36b2 100644
@@ -1,6 +1,17 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Luca Boccassi <[email protected]>
 
+# For SUSE build check function arguments of ndo_tx_timeout API
+# Ref: https://jira.devtools.intel.com/browse/DPDK-29263
+kmod_cflags = ''
+file_path = kernel_source_dir + '/include/linux/netdevice.h'
+run_cmd = run_command('grep', 'ndo_tx_timeout', file_path)
+
+if run_cmd.stdout().contains('txqueue') == true
+   kmod_cflags = '-DHAVE_ARG_TX_QUEUE'
+endif
+
+
 kni_mkfile = custom_target('rte_kni_makefile',
         output: 'Makefile',
         command: ['touch', '@OUTPUT@'])
@@ -17,7 +28,8 @@ custom_target('rte_kni',
         command: ['make', '-j4', '-C', kernel_build_dir,
             'M=' + meson.current_build_dir(),
             'src=' + meson.current_source_dir(),
-            'MODULE_CFLAGS=-include ' + meson.source_root() + '/config/rte_config.h' +
+            ' '.join(['MODULE_CFLAGS=', kmod_cflags,'-include '])
+            + meson.source_root() + '/config/rte_config.h' +
             ' -I' + meson.source_root() + '/lib/eal/include' +
             ' -I' + meson.source_root() + '/lib/kni' +
             ' -I' + meson.build_root() +
kernel/linux/meson.build +5 -0
index 3a00ea954cc5..0637452e955c 100644
@@ -4,6 +4,7 @@
 subdirs = ['kni']
 
 kernel_build_dir = get_option('kernel_dir')
+kernel_source_dir = get_option('kernel_dir')
 kernel_install_dir = ''
 install = not meson.is_cross_build()
 cross_args = []
@@ -16,6 +17,10 @@ if not meson.is_cross_build()
         # use default path for native builds
         kernel_build_dir = '/lib/modules/' + kernel_version + '/build'
     endif
+    if kernel_source_dir == ''
+        # use default path for native builds
+        kernel_source_dir = '/lib/modules/' + kernel_version + '/source'
+    endif
 
     # test running make in kernel directory, using "make kernelversion"
     make_returncode = run_command('make', '-sC', kernel_build_dir,
Signature · 1 line
2.31.1
Tested-by Longfeng Liang on v2 1/1
#3 lore raw

Re: [dpdk-dev] [PATCH v2] kni: fix build for SLES15-SP3

Quoted 15 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Ferruh Yigit
Sent: Tuesday, October 19, 2021 6:49 PM
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Singh, Aman Deep <[email protected]>; [email protected]; Christian Ehrhardt <[email protected]>; Marco Varlese <[email protected]>
Subject: [dpdk-dev] [PATCH v2] kni: fix build for SLES15-SP3

From: Aman Singh <[email protected]>

As suse version numbering is inconsistent to determine Linux kernel API to be used. In this patch we check parameter of 'ndo_tx_timeout' API directly from the kernel source. This is done only for suse build.

Quoted 5 lines

Bugzilla ID: 812
Cc: [email protected]

#4 lore raw

Re: [dpdk-dev] [PATCH v2] kni: fix build for SLES15-SP3

Quoted 6 lines
Quoted 6 lines

From: Aman Singh <[email protected]>

As suse version numbering is inconsistent to determine Linux kernel API to be used. In this patch we check parameter of 'ndo_tx_timeout' API directly from the kernel source. This is done only for suse build.

Quoted 6 lines
Quoted 5 lines

Bugzilla ID: 812
Cc: [email protected]

Applied, thanks.