Skip to content

Commit 8a84a7a

Browse files
committed
Add 2.16.1 release
1 parent 54b8e29 commit 8a84a7a

File tree

3 files changed

+869
-292
lines changed

3 files changed

+869
-292
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ clean:
3232

3333
.PHONY: install
3434
install:
35+
ifneq ($(shell lsmod | grep r8153_ecm),)
36+
rmmod r8153_ecm
37+
endif
3538
ifneq ($(shell lsmod | grep r8152),)
3639
rmmod r8152
3740
endif

compatibility.h

Lines changed: 68 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
#include <linux/init.h>
99
#include <linux/version.h>
1010
#include <linux/in.h>
11-
#include <acpi/acpi.h>
11+
#include <linux/acpi.h>
12+
13+
#if defined(RTL8152_S5_WOL) && defined(CONFIG_PM)
14+
#include <linux/reboot.h>
15+
#endif /* defined(RTL8152_S5_WOL) && defined(CONFIG_PM) */
1216

1317
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
1418
#include <linux/mdio.h>
@@ -17,19 +21,30 @@
1721
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) */
1822
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31) */
1923

24+
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0)
25+
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0)
26+
#define PHY_MAC_INTERRUPT PHY_IGNORE_INTERRUPT
2027
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0)
28+
#ifdef CONFIG_PM
29+
#define pm_ptr(_ptr) (_ptr)
30+
#else
31+
#define pm_ptr(_ptr) NULL
32+
#endif
33+
2134
#define from_tasklet(var, callback_tasklet, tasklet_fieldname) \
2235
container_of((struct tasklet_struct *)callback_tasklet, typeof(*var), tasklet_fieldname)
2336

2437
#define tasklet_setup(t, fun) tasklet_init(t, fun, (unsigned long)t)
38+
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0)
39+
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,7,0)
2540
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0)
2641
/* Iterate through singly-linked GSO fragments of an skb. */
2742
#define skb_list_walk_safe(first, skb, next_skb) \
2843
for ((skb) = (first), (next_skb) = (skb) ? (skb)->next : NULL; (skb); \
2944
(skb) = (next_skb), (next_skb) = (skb) ? (skb)->next : NULL)
3045
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0)
3146
#ifndef __has_attribute
32-
# define __GCC4_has_attribute___fallthrough__ 0
47+
# define __has_attribute(x) 0
3348
#endif
3449

3550
#if __has_attribute(__fallthrough__)
@@ -38,11 +53,11 @@
3853
# define fallthrough do {} while (0) /* fallthrough */
3954
#endif
4055

41-
#define MDIO_EEE_2_5GT 0x0001 /* 2.5GT EEE cap */
56+
#define MDIO_EEE_2_5GT 0x0001 /* 2.5GT EEE cap */
57+
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0)
4258
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0)
43-
#define MDIO_AN_10GBT_CTRL_ADV2_5G 0x0080 /* Advertise 2.5GBASE-T */
44-
#define MDIO_AN_10GBT_STAT_LP2_5G 0x0020 /* LP is 2.5GBT capable */
45-
59+
#define MDIO_AN_10GBT_CTRL_ADV2_5G 0x0080 /* Advertise 2.5GBASE-T */
60+
#define MDIO_AN_10GBT_STAT_LP2_5G 0x0020 /* LP is 2.5GBT capable */
4661
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0)
4762
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0)
4863
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0)
@@ -94,8 +109,12 @@
94109
#define NETIF_F_HW_VLAN_CTAG_RX NETIF_F_HW_VLAN_RX
95110
#define NETIF_F_HW_VLAN_CTAG_TX NETIF_F_HW_VLAN_TX
96111
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
97-
#define USB_DEVICE_INTERFACE_CLASS(vend, prod, iclass) \
98-
USB_DEVICE_AND_INTERFACE_INFO(vend, prod, iclass, 0xff, 0)
112+
#define USB_DEVICE_INTERFACE_CLASS(vend, prod, cl) \
113+
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
114+
USB_DEVICE_ID_MATCH_INT_CLASS, \
115+
.idVendor = (vend), \
116+
.idProduct = (prod), \
117+
.bInterfaceClass = (cl)
99118

100119
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
101120
#ifndef SPEED_UNKNOWN
@@ -520,10 +539,21 @@
520539
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
521540
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) */
522541
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
542+
static inline int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr)
543+
{
544+
return -EOPNOTSUPP;
545+
}
523546
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) */
524547
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,9,0) */
525548
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0) */
526549
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0) */
550+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,19,10) && \
551+
!(LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,217) && LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0))
552+
static inline void skb_mark_not_on_list(struct sk_buff *skb)
553+
{
554+
skb->next = NULL;
555+
}
556+
#endif
527557
static inline void linkmode_set_bit(int nr, volatile unsigned long *addr)
528558
{
529559
__set_bit(nr, addr);
@@ -548,18 +578,41 @@
548578
else
549579
linkmode_clear_bit(nr, addr);
550580
}
551-
552-
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,217) || LINUX_VERSION_CODE < KERNEL_VERSION(4,19,10)
553-
static inline void skb_mark_not_on_list(struct sk_buff *skb)
554-
{
555-
skb->next = NULL;
556-
}
557-
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,14,217) || LINUX_VERSION_CODE < KERNEL_VERSION(4,19,10) */
558581
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0) */
559582
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0) */
583+
// static inline u16 pci_dev_id(struct pci_dev *dev)
584+
// {
585+
// return PCI_DEVID(dev->bus->number, dev->devfn);
586+
// }
587+
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0) */
560588
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0) */
561589
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) */
590+
static inline void tcp_v6_gso_csum_prep(struct sk_buff *skb)
591+
{
592+
struct ipv6hdr *ipv6h = ipv6_hdr(skb);
593+
struct tcphdr *th = tcp_hdr(skb);
594+
595+
ipv6h->payload_len = 0;
596+
th->check = ~tcp_v6_check(0, &ipv6h->saddr, &ipv6h->daddr, 0);
597+
}
598+
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,7,0) */
599+
static inline void fsleep(unsigned long usecs)
600+
{
601+
if (usecs <= 10)
602+
udelay(usecs);
603+
else if (usecs <= 20000)
604+
usleep_range(usecs, 2 * usecs);
605+
else
606+
msleep(DIV_ROUND_UP(usecs, 1000));
607+
}
608+
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0) */
562609
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0) */
610+
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0) */
611+
static inline void eth_hw_addr_set(struct net_device *dev, const u8 *addr)
612+
{
613+
memcpy(dev->dev_addr, addr, 6);
614+
}
615+
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) */
563616

564617
#ifndef FALSE
565618
#define TRUE 1

0 commit comments

Comments
 (0)