[meta-intel] [PATCH 1/2] meta-isg: dpdk: fix v2.0.0 build with kernel 4.1

Ong, Boon Leong boon.leong.ong at intel.com
Tue Oct 6 10:07:28 PDT 2015


>-----Original Message-----
>From: meta-intel-bounces at yoctoproject.org [mailto:meta-intel-
>bounces at yoctoproject.org] On Behalf Of Anuj Mittal
>Sent: Monday, October 5, 2015 10:02 PM
>To: meta-intel at yoctoproject.org
>Subject: [meta-intel] [PATCH 1/2] meta-isg: dpdk: fix v2.0.0 build with kernel 4.1
>
>Backported fixes from upstream dpdk sources to ensure dpdk 2.0.0 compiles
>against kernel 4.1.
>
>Signed-off-by: Anuj Mittal <anujx.mittal at intel.com>
>---
> ...ix-a-build-warning-being-treated-as-error.patch |   45 +++++++++++++
> .../dpdk-2.0.0-kni-fix-build-with-kernel-4.0.patch |   58 ++++++++++++++++
> ...k-2.0.0-kni-fix-igb-build-with-kernel-4.1.patch |   70 ++++++++++++++++++++
> ...k-2.0.0-kni-net-fix-build-with-kernel-4.1.patch |   54 +++++++++++++++
> .../common/recipes-extended/dpdk/dpdk_2.0.0.bb     |    4 ++
> 5 files changed, 231 insertions(+)
> create mode 100644 meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-
>1.8.0-and-2.0.0-ixgbe-fix-a-build-warning-being-treated-as-error.patch
> create mode 100644 meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-
>2.0.0-kni-fix-build-with-kernel-4.0.patch
> create mode 100644 meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-
>2.0.0-kni-fix-igb-build-with-kernel-4.1.patch
> create mode 100644 meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-
>2.0.0-kni-net-fix-build-with-kernel-4.1.patch
>
>diff --git a/meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-1.8.0-and-2.0.0-
>ixgbe-fix-a-build-warning-being-treated-as-error.patch b/meta-
>isg/common/recipes-extended/dpdk/dpdk/dpdk-1.8.0-and-2.0.0-ixgbe-fix-a-build-
>warning-being-treated-as-error.patch
>new file mode 100644
>index 0000000..66edb1d
>--- /dev/null
>+++ b/meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-1.8.0-and-2.0.0-ix
>+++ gbe-fix-a-build-warning-being-treated-as-error.patch
>@@ -0,0 +1,45 @@
>+From b212cb3d806093399d51a49a6b4205a400cec510 Mon Sep 17 00:00:00
>2001
>+From: Rahul Kumar Gupta <rahul.kumarxx.gupta at intel.com>
>+Date: Thu, 1 Oct 2015 22:27:16 +0800
>+Subject: [PATCH] ixgbe: fix a build warning being treated as error
>+
>+Upstream-Status: Backport [2.1.0]
>+
>+Initialize the data byte to avoid warnings like:
>+
>+      lib/librte_pmd_ixgbe/ixgbe/ixgbe_phy.c: In function
>'ixgbe_read_i2c_combined_generic':
>+      lib/librte_pmd_ixgbe/ixgbe/ixgbe_phy.c:2101:9: error: 'low_bits' may be
>used
>+          uninitialized in this function [-Werror=maybe-uninitialized]
>+          *data |= bit << i;
>+                ^
>+      dpdk/2.0.0-r0/dpdk-2.0.0/lib/librte_pmd_ixgbe/ixgbe/ixgbe_phy.c:120:5:
>note:
>+          'low_bits' was declared here
>+          u8 low_bits;
>+             ^
>+      lib/librte_pmd_ixgbe/ixgbe/ixgbe_phy.c:2101:9: error: 'high_bits' may be
>used
>+           uninitialized in this function [-Werror=maybe-uninitialized]
>+          *data |= bit << i;
>+                ^
>+      lib/librte_pmd_ixgbe/ixgbe/ixgbe_phy.c:119:5: note: 'high_bits' was declared
>here
>+          u8 high_bits;
>+
>+Signed-off-by: Anuj Mittal <anujx.mittal at intel.com>
>+---
>+ lib/librte_pmd_ixgbe/ixgbe/ixgbe_phy.c | 1 +
>+ 1 file changed, 1 insertion(+)
>+
>+diff --git a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_phy.c
>+b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_phy.c
>+index 2305448..4774adb 100644
>+--- a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_phy.c
>++++ b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_phy.c
>+@@ -2096,6 +2096,7 @@ STATIC s32 ixgbe_clock_in_i2c_byte(struct
>+ixgbe_hw *hw, u8 *data)
>+
>+ 	DEBUGFUNC("ixgbe_clock_in_i2c_byte");
>+
>++	*data = 0;
>+ 	for (i = 7; i >= 0; i--) {
>+ 		ixgbe_clock_in_i2c_bit(hw, &bit);
>+ 		*data |= bit << i;
>+--
>+1.9.1
You mentioned that this patch is back-ported from dpdk upstream.
I looked up in http://www.dpdk.org/browse/dpdk/log/ and search for 
commit b212cb3d806093399d51a49a6b4205a400cec510 or author "Rahul Kumar Gupta", 
http://www.dpdk.org/browse/dpdk/commit/?id=b212cb3d806093399d51a49a6b4205a400cec510 
shows that the commit is bad commit reference. 

Something looks very wrong here... where is this patch collected from? 
It does not seem from dpdk upstream. 


>+
>diff --git a/meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-2.0.0-kni-fix-
>build-with-kernel-4.0.patch b/meta-isg/common/recipes-
>extended/dpdk/dpdk/dpdk-2.0.0-kni-fix-build-with-kernel-4.0.patch
>new file mode 100644
>index 0000000..625f014
>--- /dev/null
>+++ b/meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-2.0.0-kni-fix-buil
>+++ d-with-kernel-4.0.patch
>@@ -0,0 +1,58 @@
>+From 54117da1c945c046c6e3959db81511c78f876426 Mon Sep 17 00:00:00
>2001
>+From: Pablo de Lara <pablo.de.lara.guarch at intel.com>
>+Date: Tue, 28 Apr 2015 18:37:42 +0100
>+Subject: [PATCH] kni: fix build with kernel 4.0
>+
>+Upstream-Status: Backport [2.1.0]
>+
>+Due to API changes in function pointer ndo_bridge_setlink (commit
>+ad41faa8) and the rename of functions vlan_tx_* (commit df8a39de) in
>+kernel 4.0, DPDK would not build.
>+
>+This patch adds the properly checks to fix the compilation.
>+
>+Reported-by: Stephen Hemminger <stephen at networkplumber.org>
>+Signed-off-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
>+Signed-off-by: Anuj Mittal <anujx.mittal at intel.com>
>+---
>+ lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c |    6 ++++++
>+ lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |    6 ++++++
>+ 2 files changed, 12 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 24b147d..bc3c6a3 100644
>+--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
>++++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
>+@@ -2198,8 +2198,14 @@ static int igb_ndo_fdb_dump(struct sk_buff *skb,
>+#endif /* USE_DEFAULT_FDB_DEL_DUMP */
>+
>+ #ifdef HAVE_BRIDGE_ATTRIBS
>++#ifdef HAVE_NDO_BRIDGE_SET_DEL_LINK_FLAGS
>++static int igb_ndo_bridge_setlink(struct net_device *dev,
>++				  struct nlmsghdr *nlh,
>++				  u16 flags)
>++#else
>+ static int igb_ndo_bridge_setlink(struct net_device *dev,
>+ 				  struct nlmsghdr *nlh)
>++#endif /* HAVE_NDO_BRIDGE_SET_DEL_LINK_FLAGS */
>+ {
>+ 	struct igb_adapter *adapter = netdev_priv(dev);
>+ 	struct e1000_hw *hw = &adapter->hw;
>+diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
>+b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
>+index 2e7e714..54d1f86 100644
>+--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
>++++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
>+@@ -3885,4 +3885,10 @@ skb_set_hash(struct sk_buff *skb, __u32 hash,
>+__always_unused int type)  #define HAVE_NDO_FDB_ADD_VID  #endif /* >=
>+3.19.0 */
>+
>++#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) )
>++/* vlan_tx_xx functions got renamed to skb_vlan */ #define
>++vlan_tx_tag_get skb_vlan_tag_get #define vlan_tx_tag_present
>++skb_vlan_tag_present #define HAVE_NDO_BRIDGE_SET_DEL_LINK_FLAGS
>++#endif /* 4.0.0 */
>+ #endif /* _KCOMPAT_H_ */
>+--
>+1.7.9.5
>+
Look ok. This patch can be found at http://www.dpdk.org/browse/dpdk/commit/?id=d5368d3cb8348919d8162b9229c835f37b5c87cb 



>diff --git a/meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-2.0.0-kni-fix-igb-
>build-with-kernel-4.1.patch b/meta-isg/common/recipes-
>extended/dpdk/dpdk/dpdk-2.0.0-kni-fix-igb-build-with-kernel-4.1.patch
>new file mode 100644
>index 0000000..b76f501
>--- /dev/null
>+++ b/meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-2.0.0-kni-fix-igb-
>+++ build-with-kernel-4.1.patch
>@@ -0,0 +1,70 @@
>+From 97ebf687c7a635ac6f1b1e22293ed7405668c66e Mon Sep 17 00:00:00
>2001
>+From: Miguel Bernal Marin <miguel.bernal.marin at linux.intel.com>
>+Date: Fri, 26 Jun 2015 17:14:35 -0500
>+Subject: [PATCH] kni: fix igb build with kernel 4.1
>+
>+Upstream-Status: Backport [2.1.0]
>+
>+ndo_bridge_getlink has changed in kernel release 4.1. It adds new
>+parameter which breaks compilation.
>+
>+This patch add the properly checks to fix it.
>+
>+Linux: 46c264daaaa5 ("bridge/nl: remove wrong use of NLM_F_MULTI")
>+
>+Signed-off-by: Miguel Bernal Marin
>+<miguel.bernal.marin at linux.intel.com>
>+Acked-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
>+Signed-off-by: Anuj Mittal <anujx.mittal at intel.com>
>+---
>+ lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c |   10 ++++++++++
>+ lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |    5 +++++
>+ 2 files changed, 15 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 bc3c6a3..b99b365 100644
>+--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
>++++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
>+@@ -2250,8 +2250,14 @@ static int igb_ndo_bridge_setlink(struct
>+net_device *dev,  }
>+
>+ #ifdef HAVE_BRIDGE_FILTER
>++#ifdef HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK
>++static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
>++				  struct net_device *dev, u32 filter_mask,
>++				  int nlflags)
>++#else
>+ static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
>+ 				  struct net_device *dev, u32 filter_mask)
>++#endif /* HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK */
>+ #else
>+ static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
>+ 				  struct net_device *dev)
>+@@ -2269,7 +2275,11 @@ static int igb_ndo_bridge_getlink(struct sk_buff
>*skb, u32 pid, u32 seq,
>+ 		mode = BRIDGE_MODE_VEPA;
>+
>+ #ifdef HAVE_NDO_FDB_ADD_VID
>++#ifdef HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK
>++	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0,
>++nlflags); #else
>+ 	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0);
>++#endif /* HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK */
>+ #else
>+ 	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode);  #endif /*
>+HAVE_NDO_FDB_ADD_VID */ diff --git
>+a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
>+b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
>+index 54d1f86..2673281 100644
>+--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
>++++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
>+@@ -3891,4 +3891,9 @@ skb_set_hash(struct sk_buff *skb, __u32 hash,
>+__always_unused int type)  #define vlan_tx_tag_present
>+skb_vlan_tag_present  #define HAVE_NDO_BRIDGE_SET_DEL_LINK_FLAGS
>+ #endif /* 4.0.0 */
>++
>++#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) )
>++/* ndo_bridge_getlink adds new nlflags parameter */ #define
>++HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK
>++#endif /* >= 4.1.0 */
>+ #endif /* _KCOMPAT_H_ */
>+--
>+1.7.9.5
>+
Look ok.  This patch is found in upstream  http://www.dpdk.org/browse/dpdk/commit/?id=b2b5baa02945354b9bade697840f6f24d4d1a722


>diff --git a/meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-2.0.0-kni-net-fix-
>build-with-kernel-4.1.patch b/meta-isg/common/recipes-
>extended/dpdk/dpdk/dpdk-2.0.0-kni-net-fix-build-with-kernel-4.1.patch
>new file mode 100644
>index 0000000..2a4dd63
>--- /dev/null
>+++ b/meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-2.0.0-kni-net-fix-
>+++ build-with-kernel-4.1.patch
>@@ -0,0 +1,54 @@
>+From abb59c037a74d822e402f9d9a3d6c4d06ce7c748 Mon Sep 17 00:00:00
>2001
>+From: Miguel Bernal Marin <miguel.bernal.marin at linux.intel.com>
>+Date: Fri, 26 Jun 2015 17:14:36 -0500
>+Subject: [PATCH] kni: fix build with kernel 4.1
>+
>+Upstream-Status: Backport [2.1.1]
>+
>+rebuild member was removed from headers_ops in kernel release 4.1.
>+Therefore kni module compilation breaks.
>+
>+This patch add the properly checks to fix it.
>+
>+Linux: d476059e77d1 ("net: Kill dev_rebuild_header")
>+
>+Signed-off-by: Miguel Bernal Marin
>+<miguel.bernal.marin at linux.intel.com>
>+Acked-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
>+Signed-off-by: Anuj Mittal <anujx.mittal at intel.com>
>+---
>+ lib/librte_eal/linuxapp/kni/kni_net.c |    4 ++++
>+ 1 file changed, 4 insertions(+)
>+
>+diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c
>+b/lib/librte_eal/linuxapp/kni/kni_net.c
>+index dd95db5..c515870 100644
>+--- a/lib/librte_eal/linuxapp/kni/kni_net.c
>++++ b/lib/librte_eal/linuxapp/kni/kni_net.c
>+@@ -604,6 +604,7 @@ kni_net_header(struct sk_buff *skb, struct
>+net_device *dev,
>+ /*
>+  * Re-fill the eth header
>+  */
>++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0))
>+ static int
>+ kni_net_rebuild_header(struct sk_buff *skb)  { @@ -615,6 +616,7 @@
>+kni_net_rebuild_header(struct sk_buff *skb)
>+
>+ 	return 0;
>+ }
>++#endif /* < 4.1.0  */
>+
>+ /**
>+  * kni_net_set_mac - Change the Ethernet Address of the KNI NIC @@
>+-634,7 +636,9 @@ static int kni_net_set_mac(struct net_device *netdev,
>+void *p)
>+
>+ static const struct header_ops kni_net_header_ops = {
>+ 	.create  = kni_net_header,
>++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0))
>+ 	.rebuild = kni_net_rebuild_header,
>++#endif /* < 4.1.0  */
>+ 	.cache   = NULL,  /* disable caching */
>+ };
>+
>+--
>+1.7.9.5
>+
Look ok.  This patch is found at http://www.dpdk.org/browse/dpdk/commit/?id=b90fcf82e8698c7031321c816d017a291f3ec914 

On inspecting this patch, I found " kni: fix vhost build with kernel 4.1" @ 
http://www.dpdk.org/browse/dpdk/commit/?id=8d8fb8aa5836e719d5fb896693b16afabd5118b9 
which is related to vhost and dpdk.inc does have PACKAGECONFIG option for vhost. 
So, I believe that the above patch will be valuable to be included in v2.0.0 ...  

>diff --git a/meta-isg/common/recipes-extended/dpdk/dpdk_2.0.0.bb b/meta-
>isg/common/recipes-extended/dpdk/dpdk_2.0.0.bb
>index 33ebaac..044bd4b 100644
>--- a/meta-isg/common/recipes-extended/dpdk/dpdk_2.0.0.bb
>+++ b/meta-isg/common/recipes-extended/dpdk/dpdk_2.0.0.bb
>@@ -2,6 +2,10 @@ include dpdk.inc
>
> SRC_URI += "file://dpdk-2.0.0-dpdk-enable-ip_fragmentation-in-
>common_linuxapp.patch \
>             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-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 \
>             "
>
> SRC_URI[dpdk.md5sum] = "e9e7935c9eec920841ad373949514934"
>--
>1.7.9.5
>
>--
>_______________________________________________
>meta-intel mailing list
>meta-intel at yoctoproject.org
>https://lists.yoctoproject.org/listinfo/meta-intel


More information about the meta-intel mailing list