meta-isg: dpdk: fix v1.8.0 build with kernel 4.1

Backported fixes from upstream dpdk sources to
ensure dpdk 1.8.0 compiles against kernel 4.1.

Signed-off-by: Anuj Mittal <anujx.mittal@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
This commit is contained in:
Anuj Mittal 2015-10-08 23:50:01 +08:00 committed by Saul Wold
parent 723b2078ae
commit cd5d22bb68
3 changed files with 232 additions and 1 deletions

View File

@ -0,0 +1,69 @@
From 4e6326ae5375d55966a5c872f391cf99de373057 Mon Sep 17 00:00:00 2001
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Date: Sun, 22 Mar 2015 18:02:16 +0000
Subject: [PATCH] kni: fix build with kernel 3.19
Upstream-Status: Backport [2.1.0]
Due to API changes in functions ndo_dflt_bridge_getlink
(commit 2c3c031c) and ndo_fdb_add (commit f6f6424b)
in kernel 3.19, DPDK would not build.
This patch solves the problem, by checking the kernel version
and adding the necessary new parameters.
Mind that function igb_ndo_fdb_add does not need the extra parameter
if USE_CONST_DEV_UC_CHAR is not set, since that macro is only defined
when kernel is greater or equal than 3.7
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
(cherry picked from commit 98f255ed0a4a73bf785e884dc2069405de840546)
Signed-off-by: Rahul Kumar Gupta <rahul.kumarxx.gupta@intel.com>
---
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 7 +++++++
lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 4 ++++
2 files changed, 11 insertions(+)
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
index a802a02..24b147d 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
@@ -2103,6 +2103,9 @@ static int igb_set_features(struct net_device *netdev,
static int igb_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
struct net_device *dev,
const unsigned char *addr,
+#ifdef HAVE_NDO_FDB_ADD_VID
+ u16 vid,
+#endif
u16 flags)
#else
static int igb_ndo_fdb_add(struct ndmsg *ndm,
@@ -2259,7 +2262,11 @@ static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
else
mode = BRIDGE_MODE_VEPA;
+#ifdef HAVE_NDO_FDB_ADD_VID
+ return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0);
+#else
return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode);
+#endif /* HAVE_NDO_FDB_ADD_VID */
}
#endif /* HAVE_BRIDGE_ATTRIBS */
#endif /* NTF_SELF */
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
index 1213cc6..2e7e714 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
@@ -3881,4 +3881,8 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)
#define HAVE_VF_MIN_MAX_TXRATE 1
#endif /* >= 3.16.0 */
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) )
+#define HAVE_NDO_FDB_ADD_VID
+#endif /* >= 3.19.0 */
+
#endif /* _KCOMPAT_H_ */
--
1.9.1

View File

@ -0,0 +1,155 @@
From ccb0f3b60c1ec84a97698d9699a4b7e5cf074b21 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 23 Feb 2015 16:53:56 +0200
Subject: [PATCH] mk: rework gcc version detection to permit versions newer
than 4.x
Upstream-Status: Backport [2.1.0]
Separately comparing major and minor versions becomes seriously clumsy
when with major version changes, convert the entire version string into
a numeric value (ie 4.6.0 becomes 460 and 5.0.0 becomes 500) and use
that for comparisons, eliminate unnecessary negations while at it.
This makes the comparisons simpler, more obvious and makes gcc 5.0
naturally recognized at least as capable as newest 4.x.
This three-digit scheme would run into trouble if gcc ever went to
two-digit version segments, but that hasn't happened in the last 10+
years so it seems like a safe assumption.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
(cherry picked from commit 71f0ab1849b4fc3ca928deb566df12ca725ed150)
Signed-off-by: Rahul Kumar Gupta <rahul.kumarxx.gupta@intel.com>
Conflicts:
lib/librte_pmd_fm10k/Makefile
Makefile part of fm10k feature enabled as part of
commit a6061d9e7075b5457a9234117d75a2c05227457d which we ae not
backporting. Makefile changes not taken.
---
lib/librte_pmd_i40e/Makefile | 2 +-
lib/librte_pmd_ixgbe/Makefile | 6 +++---
lib/librte_pmd_vmxnet3/Makefile | 2 +-
mk/toolchain/gcc/rte.toolchain-compat.mk | 22 ++++++++++------------
4 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/lib/librte_pmd_i40e/Makefile b/lib/librte_pmd_i40e/Makefile
index 98e4bdf..61c3675 100644
--- a/lib/librte_pmd_i40e/Makefile
+++ b/lib/librte_pmd_i40e/Makefile
@@ -65,7 +65,7 @@ CFLAGS_BASE_DRIVER += -Wno-pointer-to-int-cast
CFLAGS_BASE_DRIVER += -Wno-format-nonliteral
CFLAGS_BASE_DRIVER += -Wno-format-security
-ifeq ($(shell test $(GCC_MAJOR_VERSION) -ge 4 -a $(GCC_MINOR_VERSION) -ge 4 && echo 1), 1)
+ifeq ($(shell test $(GCC_VERSION) -ge 440 && echo 1), 1)
CFLAGS_BASE_DRIVER += -Wno-unused-but-set-variable
endif
diff --git a/lib/librte_pmd_ixgbe/Makefile b/lib/librte_pmd_ixgbe/Makefile
index 3588047..592fe74 100644
--- a/lib/librte_pmd_ixgbe/Makefile
+++ b/lib/librte_pmd_ixgbe/Makefile
@@ -56,18 +56,18 @@ else
#
# CFLAGS for gcc
#
-ifneq ($(shell test $(GCC_MAJOR_VERSION) -le 4 -a $(GCC_MINOR_VERSION) -le 3 && echo 1), 1)
+ifeq ($(shell test $(GCC_VERSION) -ge 440 && echo 1), 1)
CFLAGS += -Wno-deprecated
endif
CFLAGS_BASE_DRIVER = -Wno-unused-parameter -Wno-unused-value
CFLAGS_BASE_DRIVER += -Wno-strict-aliasing -Wno-format-extra-args
-ifeq ($(shell test $(GCC_MAJOR_VERSION) -ge 4 -a $(GCC_MINOR_VERSION) -ge 6 && echo 1), 1)
+ifeq ($(shell test $(GCC_VERSION) -ge 460 && echo 1), 1)
CFLAGS_ixgbe_common.o += -Wno-unused-but-set-variable
CFLAGS_ixgbe_x550.o += -Wno-unused-but-set-variable -Wno-maybe-uninitialized
endif
-ifeq ($(shell test $(GCC_MAJOR_VERSION) -le 4 -a $(GCC_MINOR_VERSION) -le 6 && echo 1), 1)
+ifeq ($(shell test $(GCC_VERSION) -le 460 && echo 1), 1)
CFLAGS_ixgbe_x550.o += -Wno-uninitialized
CFLAGS_ixgbe_phy.o += -Wno-uninitialized
endif
diff --git a/lib/librte_pmd_vmxnet3/Makefile b/lib/librte_pmd_vmxnet3/Makefile
index 6872c74..3b7674e 100644
--- a/lib/librte_pmd_vmxnet3/Makefile
+++ b/lib/librte_pmd_vmxnet3/Makefile
@@ -56,7 +56,7 @@ else
#
# CFLAGS for gcc
#
-ifneq ($(shell test $(GCC_MAJOR_VERSION) -le 4 -a $(GCC_MINOR_VERSION) -le 3 && echo 1), 1)
+ifeq ($(shell test $(GCC_VERSION) -ge 440 && echo 1), 1)
CFLAGS += -Wno-deprecated
endif
CFLAGS_BASE_DRIVER = -Wno-unused-parameter -Wno-unused-value
diff --git a/mk/toolchain/gcc/rte.toolchain-compat.mk b/mk/toolchain/gcc/rte.toolchain-compat.mk
index e40e103..a867559 100644
--- a/mk/toolchain/gcc/rte.toolchain-compat.mk
+++ b/mk/toolchain/gcc/rte.toolchain-compat.mk
@@ -38,17 +38,15 @@
#find out GCC version
-GCC_MAJOR_VERSION = $(shell $(CC) -dumpversion | cut -f1 -d.)
+GCC_VERSION = $(subst .,,$(shell $(CC) -dumpversion))
-# if GCC is not 4.x
-ifneq ($(GCC_MAJOR_VERSION),4)
+# if GCC is older than 4.x
+ifeq ($(shell test $(GCC_VERSION) -lt 400 && echo 1), 1)
MACHINE_CFLAGS =
-$(warning You are not using GCC 4.x. This is neither supported, nor tested.)
+$(warning You are using GCC < 4.x. This is neither supported, nor tested.)
else
- GCC_MINOR_VERSION = $(shell $(CC) -dumpversion | cut -f2 -d.)
-
# GCC graceful degradation
# GCC 4.2.x - added support for generic target
# GCC 4.3.x - added support for core2, ssse3, sse4.1, sse4.2
@@ -57,18 +55,18 @@ else
# GCC 4.6.x - added support for corei7, corei7-avx
# GCC 4.7.x - added support for fsgsbase, rdrnd, f16c, core-avx-i, core-avx2
- ifeq ($(shell test $(GCC_MINOR_VERSION) -le 7 && echo 1), 1)
+ ifeq ($(shell test $(GCC_VERSION) -le 470 && echo 1), 1)
MACHINE_CFLAGS := $(patsubst -march=core-avx-i,-march=corei7-avx,$(MACHINE_CFLAGS))
MACHINE_CFLAGS := $(patsubst -march=core-avx2,-march=core-avx2,$(MACHINE_CFLAGS))
endif
- ifeq ($(shell test $(GCC_MINOR_VERSION) -lt 6 && echo 1), 1)
+ ifeq ($(shell test $(GCC_VERSION) -lt 460 && echo 1), 1)
MACHINE_CFLAGS := $(patsubst -march=corei7-avx,-march=core2 -maes -mpclmul -mavx,$(MACHINE_CFLAGS))
MACHINE_CFLAGS := $(patsubst -march=corei7,-march=core2 -maes -mpclmul,$(MACHINE_CFLAGS))
endif
- ifeq ($(shell test $(GCC_MINOR_VERSION) -lt 5 && echo 1), 1)
+ ifeq ($(shell test $(GCC_VERSION) -lt 450 && echo 1), 1)
MACHINE_CFLAGS := $(patsubst -march=atom,-march=core2 -mssse3,$(MACHINE_CFLAGS))
endif
- ifeq ($(shell test $(GCC_MINOR_VERSION) -lt 4 && echo 1), 1)
+ ifeq ($(shell test $(GCC_VERSION) -lt 440 && echo 1), 1)
MACHINE_CFLAGS := $(filter-out -mavx -mpclmul -maes,$(MACHINE_CFLAGS))
ifneq ($(findstring SSE4_2, $(CPUFLAGS)),)
MACHINE_CFLAGS += -msse4.2
@@ -77,12 +75,12 @@ else
MACHINE_CFLAGS += -msse4.1
endif
endif
- ifeq ($(shell test $(GCC_MINOR_VERSION) -lt 3 && echo 1), 1)
+ ifeq ($(shell test $(GCC_VERSION) -lt 430 && echo 1), 1)
MACHINE_CFLAGS := $(filter-out -msse% -mssse%,$(MACHINE_CFLAGS))
MACHINE_CFLAGS := $(patsubst -march=core2,-march=generic,$(MACHINE_CFLAGS))
MACHINE_CFLAGS += -msse3
endif
- ifeq ($(shell test $(GCC_MINOR_VERSION) -lt 2 && echo 1), 1)
+ ifeq ($(shell test $(GCC_VERSION) -lt 420 && echo 1), 1)
MACHINE_CFLAGS := $(filter-out -march% -mtune% -msse%,$(MACHINE_CFLAGS))
endif
endif
--
1.9.1

View File

@ -1,6 +1,13 @@
include dpdk.inc
SRC_URI += "file://dpdk-1.8.0-and-2.0.0-examples-add-config-variable-to-enable-disable-dpdk.patch"
SRC_URI += "file://dpdk-1.8.0-and-2.0.0-examples-add-config-variable-to-enable-disable-dpdk.patch \
file://dpdk-1.8.0-and-2.0.0-ixgbe-fix-a-build-warning-being-treated-as-error.patch \
file://dpdk-1.8.0-kni-fix-build-with-kernel-3.19.patch \
file://dpdk-2.0.0-kni-fix-build-with-kernel-4.0.patch \
file://dpdk-2.0.0-kni-fix-igb-build-with-kernel-4.1.patch \
file://dpdk-2.0.0-kni-net-fix-build-with-kernel-4.1.patch \
file://dpdk-1.8.0-mk-rework-gcc-version-detection-to-permit-versions-n.patch \
"
SRC_URI[dpdk.md5sum] = "11ad8785aaa869cc87265bcb8d828f22"
SRC_URI[dpdk.sha256sum] = "9f5386830bd999355182e20408f3fc2cfa0802a4497fdded8d43202feede1939"