Skip to content

Commit

Permalink
backports: Remove support for kernel smaller than 4.7
Browse files Browse the repository at this point in the history
This removes all the code which is needed to support kernel 4.6.

Signed-off-by: Hauke Mehrtens <[email protected]>
  • Loading branch information
hauke committed Feb 5, 2024
1 parent af27ec5 commit 1178f46
Show file tree
Hide file tree
Showing 10 changed files with 3 additions and 356 deletions.
1 change: 0 additions & 1 deletion .github/workflows/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ jobs:
strategy:
matrix:
kernel: [
"4.6",
"4.7",
"4.8",
"4.9",
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ down to older kernels. It currently backports the following subsystems:
* WWAN

This package provides the latest Linux kernel subsystem enhancements
for kernels 4.6 and above.
for kernels 4.7 and above.

# Documentation

Expand Down
30 changes: 0 additions & 30 deletions backport/backport-include/linux/devcoredump.h

This file was deleted.

8 changes: 0 additions & 8 deletions backport/backport-include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ static inline bool backport_napi_complete(struct napi_struct *n)
#define NETIF_F_CSUM_MASK NETIF_F_ALL_CSUM
#endif

#if LINUX_VERSION_IS_LESS(4,7,0)
#define netif_trans_update LINUX_BACKPORT(netif_trans_update)
static inline void netif_trans_update(struct net_device *dev)
{
dev->trans_start = jiffies;
}
#endif

#if LINUX_VERSION_IS_LESS(4,11,9)
#define netdev_set_priv_destructor(_dev, _destructor) \
(_dev)->destructor = __ ## _destructor
Expand Down
4 changes: 2 additions & 2 deletions backport/backport-include/linux/verification.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __BP_VERIFICATION_H
#define __BP_VERIFICATION_H
#include <linux/version.h>
#if (LINUX_VERSION_IS_GEQ(4,7,0) && !defined(CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION)) && \
#if !defined(CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION) && \
defined(CONFIG_CRYPTO_HASH_INFO)
#include_next <linux/verification.h>
#else
Expand All @@ -25,5 +25,5 @@ extern int verify_pkcs7_signature(const void *data, size_t len,
const void *data, size_t len,
size_t asn1hdrlen),
void *ctx);
#endif /* LINUX_VERSION_IS_GEQ(4,7,0) && !defined(CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION) */
#endif /* !defined(CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION) */
#endif /* __BP_VERIFICATION_H */
98 changes: 0 additions & 98 deletions backport/backport-include/net/netlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,104 +435,6 @@ static inline int _nla_parse_nested4(struct nlattr *tb[], int maxtype,
macro_dispatcher(_nla_parse_nested, __VA_ARGS__)(__VA_ARGS__)
#endif /* LINUX_VERSION_IS_LESS(4,12,0) */

#if LINUX_VERSION_IS_LESS(4,7,0)
/**
* nla_need_padding_for_64bit - test 64-bit alignment of the next attribute
* @skb: socket buffer the message is stored in
*
* Return true if padding is needed to align the next attribute (nla_data()) to
* a 64-bit aligned area.
*/
#define nla_need_padding_for_64bit LINUX_BACKPORT(nla_need_padding_for_64bit)
static inline bool nla_need_padding_for_64bit(struct sk_buff *skb)
{
#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
/* The nlattr header is 4 bytes in size, that's why we test
* if the skb->data _is_ aligned. A NOP attribute, plus
* nlattr header for next attribute, will make nla_data()
* 8-byte aligned.
*/
if (IS_ALIGNED((unsigned long)skb_tail_pointer(skb), 8))
return true;
#endif
return false;
}
/**
* nla_align_64bit - 64-bit align the nla_data() of next attribute
* @skb: socket buffer the message is stored in
* @padattr: attribute type for the padding
*
* Conditionally emit a padding netlink attribute in order to make
* the next attribute we emit have a 64-bit aligned nla_data() area.
* This will only be done in architectures which do not have
* HAVE_EFFICIENT_UNALIGNED_ACCESS defined.
*
* Returns zero on success or a negative error code.
*/
#define nla_align_64bit LINUX_BACKPORT(nla_align_64bit)
static inline int nla_align_64bit(struct sk_buff *skb, int padattr)
{
if (nla_need_padding_for_64bit(skb) &&
!nla_reserve(skb, padattr, 0))
return -EMSGSIZE;
return 0;
}

/**
* nla_total_size_64bit - total length of attribute including padding
* @payload: length of payload
*/
#define nla_total_size_64bit LINUX_BACKPORT(nla_total_size_64bit)
static inline int nla_total_size_64bit(int payload)
{
return NLA_ALIGN(nla_attr_size(payload))
#ifndef HAVE_EFFICIENT_UNALIGNED_ACCESS
+ NLA_ALIGN(nla_attr_size(0))
#endif
;
}
#define __nla_reserve_64bit LINUX_BACKPORT(__nla_reserve_64bit)
struct nlattr *__nla_reserve_64bit(struct sk_buff *skb, int attrtype,
int attrlen, int padattr);
#define nla_reserve_64bit LINUX_BACKPORT(nla_reserve_64bit)
struct nlattr *nla_reserve_64bit(struct sk_buff *skb, int attrtype,
int attrlen, int padattr);
#define __nla_put_64bit LINUX_BACKPORT(__nla_put_64bit)
void __nla_put_64bit(struct sk_buff *skb, int attrtype, int attrlen,
const void *data, int padattr);
#define nla_put_64bit LINUX_BACKPORT(nla_put_64bit)
int nla_put_64bit(struct sk_buff *skb, int attrtype, int attrlen,
const void *data, int padattr);
/**
* nla_put_u64_64bit - Add a u64 netlink attribute to a skb and align it
* @skb: socket buffer to add attribute to
* @attrtype: attribute type
* @value: numeric value
* @padattr: attribute type for the padding
*/
#define nla_put_u64_64bit LINUX_BACKPORT(nla_put_u64_64bit)
static inline int nla_put_u64_64bit(struct sk_buff *skb, int attrtype,
u64 value, int padattr)
{
return nla_put_64bit(skb, attrtype, sizeof(u64), &value, padattr);
}


/**
* nla_put_s64 - Add a s64 netlink attribute to a socket buffer and align it
* @skb: socket buffer to add attribute to
* @attrtype: attribute type
* @value: numeric value
* @padattr: attribute type for the padding
*/
#define nla_put_s64 LINUX_BACKPORT(nla_put_s64)
static inline int nla_put_s64(struct sk_buff *skb, int attrtype, s64 value,
int padattr)
{
return nla_put_64bit(skb, attrtype, sizeof(s64), &value, padattr);
}
#endif /* < 4.7 */

#if LINUX_VERSION_IS_LESS(4,10,0)
/**
* nla_memdup - duplicate attribute memory (kmemdup)
Expand Down
1 change: 0 additions & 1 deletion backport/compat/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ endif
compat-y += main.o

# Kernel backport compatibility code
compat-$(CPTCFG_KERNEL_4_7) += backport-4.7.o
compat-$(CPTCFG_KERNEL_4_8) += backport-4.8.o
compat-$(CPTCFG_KERNEL_4_10) += backport-4.10.o
compat-$(CPTCFG_KERNEL_4_11) += backport-4.11.o
Expand Down
31 changes: 0 additions & 31 deletions backport/compat/backport-4.10.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,6 @@
#include <linux/page_ref.h>
#include <linux/gfp.h>

#if LINUX_VERSION_IS_LESS(4,7,0)
static bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32,
const unsigned long *src)
{
bool retval = true;

/* TODO: following test will soon always be true */
if (__ETHTOOL_LINK_MODE_MASK_NBITS > 32) {
__ETHTOOL_DECLARE_LINK_MODE_MASK(ext);

bitmap_zero(ext, __ETHTOOL_LINK_MODE_MASK_NBITS);
bitmap_fill(ext, 32);
bitmap_complement(ext, ext, __ETHTOOL_LINK_MODE_MASK_NBITS);
if (bitmap_intersects(ext, src,
__ETHTOOL_LINK_MODE_MASK_NBITS)) {
/* src mask goes beyond bit 31 */
retval = false;
}
}
*legacy_u32 = src[0];
return retval;
}

static void ethtool_convert_legacy_u32_to_link_mode(unsigned long *dst,
u32 legacy_u32)
{
bitmap_zero(dst, __ETHTOOL_LINK_MODE_MASK_NBITS);
dst[0] = legacy_u32;
}
#endif

static u32 mii_get_an(struct mii_if_info *mii, u16 addr)
{
int advert;
Expand Down
Loading

0 comments on commit 1178f46

Please sign in to comment.