1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Update r8152

This commit is contained in:
Ycarus (Yannick Chabanois) 2022-12-21 12:50:32 +01:00
parent d1760e0efb
commit cb31c04475
3 changed files with 112 additions and 0 deletions

View file

@ -0,0 +1,19 @@
--- a/r8152.c
+++ b/r8152.c
@@ -1026,6 +1026,16 @@
#define RTL_ADVERTISED_1000_FULL BIT(5)
#define RTL_ADVERTISED_2500_FULL BIT(6)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
+static inline void netif_set_gso_max_size(struct net_device *dev,
+ unsigned int size)
+{
+ /* dev->gso_max_size is read locklessly from sk_setup_caps() */
+ WRITE_ONCE(dev->gso_max_size, size);
+}
+#endif
+
+
/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
* The RTL chips use a 64 element hash table based on the Ethernet CRC.
*/

View file

@ -0,0 +1,38 @@
--- a/compatibility.h
+++ b/compatibility.h
@@ -237,9 +237,15 @@
#define napi_disable(napi_ptr) netif_poll_disable(container_of(napi_ptr, struct r8152, napi)->netdev)
#define napi_schedule(napi_ptr) netif_rx_schedule(container_of(napi_ptr, struct r8152, napi)->netdev)
#define napi_complete(napi_ptr) netif_rx_complete(container_of(napi_ptr, struct r8152, napi)->netdev)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
+ #define netif_napi_add_weight(ndev, napi_ptr, function, weight_t) \
+ ndev->poll = function; \
+ ndev->weight = weight_t;
+#else
#define netif_napi_add(ndev, napi_ptr, function, weight_t) \
ndev->poll = function; \
ndev->weight = weight_t;
+#endif
typedef unsigned long uintptr_t;
#define DMA_BIT_MASK(value) \
(value < 64 ? ((1ULL << value) - 1) : 0xFFFFFFFFFFFFFFFFULL)
--- a/r8152.c
+++ b/r8152.c
@@ -20718,10 +20718,17 @@
usb_set_intfdata(intf, tp);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
+ if (tp->support_2500full)
+ netif_napi_add_weight(netdev, &tp->napi, r8152_poll, 256);
+ else
+ netif_napi_add_weight(netdev, &tp->napi, r8152_poll, 64);
+#else
if (tp->support_2500full)
netif_napi_add(netdev, &tp->napi, r8152_poll, 256);
else
netif_napi_add(netdev, &tp->napi, r8152_poll, 64);
+#endif
ret = register_netdev(netdev);
if (ret != 0) {