Skip to content

Commit

Permalink
kni: fix build for SLES15-SP3
Browse files Browse the repository at this point in the history
[ upstream commit c28e216 ]

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

Signed-off-by: Aman Singh <aman.deep.singh@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Longfeng Liang <longfengx.liang@intel.com>
  • Loading branch information
amandee1 authored and cpaelzer committed Nov 30, 2021
1 parent b154202 commit 6c8f6b7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
3 changes: 2 additions & 1 deletion kernel/linux/kni/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 13 additions & 1 deletion kernel/linux/kni/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2018 Luca Boccassi <bluca@debian.org>

# 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@'])
Expand All @@ -16,7 +27,8 @@ custom_target('rte_kni',
command: ['make', '-j4', '-C', kernel_dir + '/build',
'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/librte_eal/common/include' +
' -I' + meson.source_root() + '/lib/librte_eal/linux/eal/include' +
' -I' + meson.build_root() +
Expand Down
5 changes: 5 additions & 0 deletions kernel/linux/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ if get_option('kernel_dir') == '' and meson.is_cross_build()
endif

kernel_dir = get_option('kernel_dir')
kernel_source_dir = get_option('kernel_dir')
if kernel_dir == ''
# use default path for native builds
kernel_version = run_command('uname', '-r').stdout().strip()
kernel_dir = '/lib/modules/' + kernel_version
if kernel_source_dir == ''
# use default path for native builds
kernel_source_dir = '/lib/modules/' + kernel_version + '/source'
endif
endif

# test running make in kernel directory, using "make kernelversion"
Expand Down

0 comments on commit 6c8f6b7

Please sign in to comment.