* [dpdk-stable] [PATCH 1/3] kni: fix kernel 5.4 build - merged pci_aspm.h
2019-10-21 11:16 [dpdk-stable] [PATCH 0/3] kni: fix kernel 5.4 builds Christian Ehrhardt
@ 2019-10-21 11:16 ` Christian Ehrhardt
2019-10-21 11:16 ` [dpdk-stable] [PATCH 2/3] kni: fix kernel 5.4 build - num_online_cpus Christian Ehrhardt
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Christian Ehrhardt @ 2019-10-21 11:16 UTC (permalink / raw)
To: Luca Boccassi, dpdk stable; +Cc: Thomas Monjalon, Christian Ehrhardt
Due to kernel change [1] pci-aspm.h no more exists and we need to
include just pci.h instead in kernels >=5.4
The failure due to that is just a not-found include:
/usr/src/dpdk-rte-kni-18.11.2/ethtool/ixgbe/kcompat.h:2225:10:
fatal error: linux/pci-aspm.h: No such file or directory
2225 | #include <linux/pci-aspm.h>
Fix it by including just pci.h depending on kernel version we build
against.
Not applying to master branch due to kni ethtool being removed in [2]
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7ce2e76a
[2]: https://git.dpdk.org/dpdk/commit/?id=ea6b39b5
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
kernel/linux/kni/ethtool/igb/kcompat.h | 8 ++++++--
kernel/linux/kni/ethtool/ixgbe/kcompat.h | 8 ++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/kernel/linux/kni/ethtool/igb/kcompat.h b/kernel/linux/kni/ethtool/igb/kcompat.h
index f041a3ebe..74390aa5f 100644
--- a/kernel/linux/kni/ethtool/igb/kcompat.h
+++ b/kernel/linux/kni/ethtool/igb/kcompat.h
@@ -2413,13 +2413,17 @@ static inline int _kc_skb_is_gso_v6(const struct sk_buff *skb)
extern void _kc_pci_disable_link_state(struct pci_dev *dev, int state);
#define pci_disable_link_state(p, s) _kc_pci_disable_link_state(p, s)
-#else /* < 2.6.26 */
+#else /* < 2.6.26 or > 5.4 */
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) )
+#include <linux/pci.h>
+#else
#include <linux/pci-aspm.h>
+#endif
#define HAVE_NETDEV_VLAN_FEATURES
#ifndef PCI_EXP_LNKCAP_ASPMS
#define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */
#endif /* PCI_EXP_LNKCAP_ASPMS */
-#endif /* < 2.6.26 */
+#endif /* < 2.6.26 or > 5.4 */
/*****************************************************************************/
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) )
static inline void _kc_ethtool_cmd_speed_set(struct ethtool_cmd *ep,
diff --git a/kernel/linux/kni/ethtool/ixgbe/kcompat.h b/kernel/linux/kni/ethtool/ixgbe/kcompat.h
index 419fd1f13..64d39a7ae 100644
--- a/kernel/linux/kni/ethtool/ixgbe/kcompat.h
+++ b/kernel/linux/kni/ethtool/ixgbe/kcompat.h
@@ -2221,10 +2221,14 @@ static inline int _kc_skb_is_gso_v6(const struct sk_buff *skb)
extern void _kc_pci_disable_link_state(struct pci_dev *dev, int state);
#define pci_disable_link_state(p, s) _kc_pci_disable_link_state(p, s)
-#else /* < 2.6.26 */
+#else /* < 2.6.26 or > 5.4 */
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) )
+#include <linux/pci.h>
+#else
#include <linux/pci-aspm.h>
+#endif
#define HAVE_NETDEV_VLAN_FEATURES
-#endif /* < 2.6.26 */
+#endif /* < 2.6.26 or > 5.4 */
/*****************************************************************************/
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) )
static inline void _kc_ethtool_cmd_speed_set(struct ethtool_cmd *ep,
--
2.23.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-stable] [PATCH 2/3] kni: fix kernel 5.4 build - num_online_cpus
2019-10-21 11:16 [dpdk-stable] [PATCH 0/3] kni: fix kernel 5.4 builds Christian Ehrhardt
2019-10-21 11:16 ` [dpdk-stable] [PATCH 1/3] kni: fix kernel 5.4 build - merged pci_aspm.h Christian Ehrhardt
@ 2019-10-21 11:16 ` Christian Ehrhardt
2019-10-21 11:16 ` [dpdk-stable] [PATCH 3/3] kni: fix kernel 5.4 build - skb_frag_t to bio_vec Christian Ehrhardt
2019-10-21 17:30 ` [dpdk-stable] [PATCH 0/3] kni: fix kernel 5.4 builds Luca Boccassi
3 siblings, 0 replies; 6+ messages in thread
From: Christian Ehrhardt @ 2019-10-21 11:16 UTC (permalink / raw)
To: Luca Boccassi, dpdk stable; +Cc: Thomas Monjalon, Christian Ehrhardt
num_online_cpus was redefined [1] to now be a static inline function.
Due to that the check we had to redefine num_online_cpus as needed
triggers as false-positive and breaks like:
/usr/src/dpdk-rte-kni-18.11.2/ethtool/ixgbe/kcompat.h:239:27:
error: ‘smp_num_cpus’ undeclared (first use in this function)
239 | #define num_online_cpus() smp_num_cpus
That redefine isn't needed for ages, and with >5.4 we can just rely on
it. From the kernel it already is either a working function or defined
as 1UL in case of non SMP.
Not applying to master branch due to kni ethtool being removed in [2]
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0c09ab96
[2]: https://git.dpdk.org/dpdk/commit/?id=ea6b39b
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
kernel/linux/kni/ethtool/igb/kcompat.h | 2 ++
kernel/linux/kni/ethtool/ixgbe/kcompat.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/kernel/linux/kni/ethtool/igb/kcompat.h b/kernel/linux/kni/ethtool/igb/kcompat.h
index 74390aa5f..964317508 100644
--- a/kernel/linux/kni/ethtool/igb/kcompat.h
+++ b/kernel/linux/kni/ethtool/igb/kcompat.h
@@ -218,9 +218,11 @@ struct msix_entry {
#define node_online(node) ((node) == 0)
#endif
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0) )
#ifndef num_online_cpus
#define num_online_cpus() smp_num_cpus
#endif
+#endif
#ifndef cpu_online
#define cpu_online(cpuid) test_bit((cpuid), &cpu_online_map)
diff --git a/kernel/linux/kni/ethtool/ixgbe/kcompat.h b/kernel/linux/kni/ethtool/ixgbe/kcompat.h
index 64d39a7ae..e1671e91a 100644
--- a/kernel/linux/kni/ethtool/ixgbe/kcompat.h
+++ b/kernel/linux/kni/ethtool/ixgbe/kcompat.h
@@ -235,9 +235,11 @@ struct msix_entry {
#define node_online(node) ((node) == 0)
#endif
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0) )
#ifndef num_online_cpus
#define num_online_cpus() smp_num_cpus
#endif
+#endif
#ifndef cpu_online
#define cpu_online(cpuid) test_bit((cpuid), &cpu_online_map)
--
2.23.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-stable] [PATCH 3/3] kni: fix kernel 5.4 build - skb_frag_t to bio_vec
2019-10-21 11:16 [dpdk-stable] [PATCH 0/3] kni: fix kernel 5.4 builds Christian Ehrhardt
2019-10-21 11:16 ` [dpdk-stable] [PATCH 1/3] kni: fix kernel 5.4 build - merged pci_aspm.h Christian Ehrhardt
2019-10-21 11:16 ` [dpdk-stable] [PATCH 2/3] kni: fix kernel 5.4 build - num_online_cpus Christian Ehrhardt
@ 2019-10-21 11:16 ` Christian Ehrhardt
2019-10-21 17:30 ` [dpdk-stable] [PATCH 0/3] kni: fix kernel 5.4 builds Luca Boccassi
3 siblings, 0 replies; 6+ messages in thread
From: Christian Ehrhardt @ 2019-10-21 11:16 UTC (permalink / raw)
To: Luca Boccassi, dpdk stable; +Cc: Thomas Monjalon, Christian Ehrhardt
The kernel changed [1] skb_frag_struct to unify things with bio_vec in
the block layer. Due to that access to those elements needs to be
modified.
Former 'struct skb_frag_struct *' always were actually 'skb_frag_t *'
just behind a typedef. Since it now appears as bio_vec lets use that
type to have working access again.
Bio_vec carries the ofset under a different name so the element access
of skb_frag_t also changes from page_offset to bv_offset with kernel
5.4.
Not applying to master branch due to kni ethtool being removed in [2]
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8842d285
[2]: https://git.dpdk.org/dpdk/commit/?id=ea6b39b5
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
kernel/linux/kni/ethtool/igb/igb_main.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/kernel/linux/kni/ethtool/igb/igb_main.c b/kernel/linux/kni/ethtool/igb/igb_main.c
index cda2b063d..69d3ea5fa 100644
--- a/kernel/linux/kni/ethtool/igb/igb_main.c
+++ b/kernel/linux/kni/ethtool/igb/igb_main.c
@@ -5331,7 +5331,7 @@ static void igb_tx_map(struct igb_ring *tx_ring,
struct sk_buff *skb = first->skb;
struct igb_tx_buffer *tx_buffer;
union e1000_adv_tx_desc *tx_desc;
- struct skb_frag_struct *frag;
+ skb_frag_t *frag;
dma_addr_t dma;
unsigned int data_len, size;
u32 tx_flags = first->tx_flags;
@@ -8231,7 +8231,7 @@ static void igb_pull_tail(struct igb_ring *rx_ring,
union e1000_adv_rx_desc *rx_desc,
struct sk_buff *skb)
{
- struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[0];
+ skb_frag_t *frag = &skb_shinfo(skb)->frags[0];
unsigned char *va;
unsigned int pull_len;
@@ -8249,7 +8249,11 @@ static void igb_pull_tail(struct igb_ring *rx_ring,
/* update pointers to remove timestamp header */
skb_frag_size_sub(frag, IGB_TS_HDR_LEN);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0)
frag->page_offset += IGB_TS_HDR_LEN;
+#else
+ frag->bv_offset += pull_len;
+#endif
skb->data_len -= IGB_TS_HDR_LEN;
skb->len -= IGB_TS_HDR_LEN;
@@ -8269,7 +8273,11 @@ static void igb_pull_tail(struct igb_ring *rx_ring,
/* update all of the pointers */
skb_frag_size_sub(frag, pull_len);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0)
frag->page_offset += pull_len;
+#else
+ frag->bv_offset += pull_len;
+#endif
skb->data_len -= pull_len;
skb->tail += pull_len;
}
--
2.23.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-stable] [PATCH 0/3] kni: fix kernel 5.4 builds
2019-10-21 11:16 [dpdk-stable] [PATCH 0/3] kni: fix kernel 5.4 builds Christian Ehrhardt
` (2 preceding siblings ...)
2019-10-21 11:16 ` [dpdk-stable] [PATCH 3/3] kni: fix kernel 5.4 build - skb_frag_t to bio_vec Christian Ehrhardt
@ 2019-10-21 17:30 ` Luca Boccassi
2019-10-24 15:58 ` Kevin Traynor
3 siblings, 1 reply; 6+ messages in thread
From: Luca Boccassi @ 2019-10-21 17:30 UTC (permalink / raw)
To: Christian Ehrhardt, dpdk stable; +Cc: Thomas Monjalon
On Mon, 2019-10-21 at 13:16 +0200, Christian Ehrhardt wrote:
> Hi,
> I've got a report [1] from our kernel Team which regularly pre-checks
> new kernels ahead of time. All of this is about kni/ethtool failing
> to
> build with 5.4.
>
> I know that going forward there is [2] so the master branch doesn't
> care
> anymore.
>
> To be clear, Thomas was rather straight on this topic on IRC :-)
> [11:18] <tmonjalo> cpaelzer: Drop KNI ethtool from your package!
> [11:20] <tmonjalo> That's a lot easier than maintaining this... thing
> [11:31] <cpaelzer> tmonjalo: that is true and correct for the future,
> which also reflects what happened in master branch
> [11:31] <cpaelzer> tmonjalo: but the past is the past and I guess I
> need to fix it there
> [11:34] <tmonjalo> cpaelzer: there is another way: drop it and wait
> for requests ;)
> [11:35] <cpaelzer> I'm not bold enough to do that
> [11:35] <cpaelzer> but I already have it in the not officially
> supported packages
> [11:35] <cpaelzer> so I can worst case just stop caring, but then I
> like to fix things ...
>
> But I wondered if we should keep it a bit alive at least for a while
> for
> Distributions that carry it as package. Personally for Ubuntu that
> would be
> around the time of whatever kernel is recent April next year and
> valid
> for DPDK 17.11 and 18.11. But needs surely will differ for different
> distributions.
>
> Here is a patch series intended for stable releases only, tested with
> kernel 5.3 (old behavior) and 5.4 (new behavior). We might want to
> have
> someone test other distros and other (older) kernels as well maybe?
>
> I'm throwing in the patch series as suggestion for a fix, but it
> might
> as well be just the start for a discussion to document the projects
> thoughts about released e.g. 17.11.x/18.11.x versions carrying that
> package and how they are suggested to handle kni-ethtool being sort
> of
> unmaintainable.
> I'll surely start that discussion with Luca for the Debian/Ubuntu
> scope.
>
> [1]:
> https://bugs.launchpad.net/ubuntu/eoan/+source/dpdk/+bug/1848585
>
> [2]:
> https://git.dpdk.org/dpdk/commit/?id=ea6b39b5
>
>
> Christian Ehrhardt (3):
> kni: fix kernel 5.4 build - merged pci_aspm.h
> kni: fix kernel 5.4 build - num_online_cpus
> kni: fix kernel 5.4 build - skb_frag_t to bio_vec
>
> kernel/linux/kni/ethtool/igb/igb_main.c | 12 ++++++++++--
> kernel/linux/kni/ethtool/igb/kcompat.h | 10 ++++++++--
> kernel/linux/kni/ethtool/ixgbe/kcompat.h | 10 ++++++++--
> 3 files changed, 26 insertions(+), 6 deletions(-)
Series-acked-by: Luca Boccassi <bluca@debian.org>
Given we are shipping with it we need to support it for the lifetime of
the branches, so thanks for the patches.
--
Kind regards,
Luca Boccassi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-stable] [PATCH 0/3] kni: fix kernel 5.4 builds
2019-10-21 17:30 ` [dpdk-stable] [PATCH 0/3] kni: fix kernel 5.4 builds Luca Boccassi
@ 2019-10-24 15:58 ` Kevin Traynor
0 siblings, 0 replies; 6+ messages in thread
From: Kevin Traynor @ 2019-10-24 15:58 UTC (permalink / raw)
To: Luca Boccassi, Christian Ehrhardt, dpdk stable; +Cc: Thomas Monjalon
On 21/10/2019 18:30, Luca Boccassi wrote:
> On Mon, 2019-10-21 at 13:16 +0200, Christian Ehrhardt wrote:
>> Hi,
>> I've got a report [1] from our kernel Team which regularly pre-checks
>> new kernels ahead of time. All of this is about kni/ethtool failing
>> to
>> build with 5.4.
>>
>> I know that going forward there is [2] so the master branch doesn't
>> care
>> anymore.
>>
>> To be clear, Thomas was rather straight on this topic on IRC :-)
>> [11:18] <tmonjalo> cpaelzer: Drop KNI ethtool from your package!
>> [11:20] <tmonjalo> That's a lot easier than maintaining this... thing
>> [11:31] <cpaelzer> tmonjalo: that is true and correct for the future,
>> which also reflects what happened in master branch
>> [11:31] <cpaelzer> tmonjalo: but the past is the past and I guess I
>> need to fix it there
>> [11:34] <tmonjalo> cpaelzer: there is another way: drop it and wait
>> for requests ;)
>> [11:35] <cpaelzer> I'm not bold enough to do that
>> [11:35] <cpaelzer> but I already have it in the not officially
>> supported packages
>> [11:35] <cpaelzer> so I can worst case just stop caring, but then I
>> like to fix things ...
>>
>> But I wondered if we should keep it a bit alive at least for a while
>> for
>> Distributions that carry it as package. Personally for Ubuntu that
>> would be
>> around the time of whatever kernel is recent April next year and
>> valid
>> for DPDK 17.11 and 18.11. But needs surely will differ for different
>> distributions.
>>
>> Here is a patch series intended for stable releases only, tested with
>> kernel 5.3 (old behavior) and 5.4 (new behavior). We might want to
>> have
>> someone test other distros and other (older) kernels as well maybe?
>>
>> I'm throwing in the patch series as suggestion for a fix, but it
>> might
>> as well be just the start for a discussion to document the projects
>> thoughts about released e.g. 17.11.x/18.11.x versions carrying that
>> package and how they are suggested to handle kni-ethtool being sort
>> of
>> unmaintainable.
>> I'll surely start that discussion with Luca for the Debian/Ubuntu
>> scope.
>>
>> [1]:
>> https://bugs.launchpad.net/ubuntu/eoan/+source/dpdk/+bug/1848585
>>
>> [2]:
>> https://git.dpdk.org/dpdk/commit/?id=ea6b39b5
>>
>>
>> Christian Ehrhardt (3):
>> kni: fix kernel 5.4 build - merged pci_aspm.h
>> kni: fix kernel 5.4 build - num_online_cpus
>> kni: fix kernel 5.4 build - skb_frag_t to bio_vec
>>
>> kernel/linux/kni/ethtool/igb/igb_main.c | 12 ++++++++++--
>> kernel/linux/kni/ethtool/igb/kcompat.h | 10 ++++++++--
>> kernel/linux/kni/ethtool/ixgbe/kcompat.h | 10 ++++++++--
>> 3 files changed, 26 insertions(+), 6 deletions(-)
>
> Series-acked-by: Luca Boccassi <bluca@debian.org>
>
> Given we are shipping with it we need to support it for the lifetime of
> the branches, so thanks for the patches.
>
Thanks Christian and Luca, applied on 18.11 branch
^ permalink raw reply [flat|nested] 6+ messages in thread