Skip to content

Commit

Permalink
Fix for linux 5.19 without breaking older kernel compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
hcartiaux committed Sep 14, 2022
1 parent d3bba0b commit 6ffb376
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions r8152.c
Original file line number Diff line number Diff line change
Expand Up @@ -20458,9 +20458,13 @@ static ssize_t sg_en_store(struct device *dev, struct device_attribute *attr,
return -EINVAL;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0)
/* LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0) */
netif_set_tso_max_size(netdev, tso_size);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
/* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) */
netif_set_gso_max_size(netdev, tso_size);
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) */
#endif

return count;
}
Expand Down Expand Up @@ -20620,12 +20624,16 @@ static int rtl8152_probe(struct usb_interface *intf,
rtl_get_mapt_ver(tp);

netdev->ethtool_ops = &ops;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0)
/* LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0) */
netif_set_tso_max_size(netdev, RTL_LIMITED_TSO_SIZE);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
/* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) */
if (!tp->sg_use)
netif_set_gso_max_size(netdev, RTL_LIMITED_TSO_SIZE);
#else
netdev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) */
#endif

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
/* MTU range: 68 - 1500 or 9194 */
Expand Down

0 comments on commit 6ffb376

Please sign in to comment.