Advertisement
dgdev91

r8168 - Patch for 4.15 kernel (OLD)

Dec 22nd, 2017
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.61 KB | None | 0 0
  1. diff --git a/src/r8168_n.c b/src/r8168_n.c
  2. index 4cd540a..e7ee078 100755
  3. --- a/src/r8168_n.c
  4. +++ b/src/r8168_n.c
  5. @@ -87,6 +87,8 @@
  6. #include <linux/seq_file.h>
  7. #endif
  8.  
  9. +unsigned long __devicepointer;
  10. +
  11. /* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
  12. The RTL chips use a 64 element hash table based on the Ethernet CRC. */
  13. static const int multicast_filter_limit = 32;
  14. @@ -407,8 +409,14 @@ MODULE_VERSION(RTL8168_VERSION);
  15. static void rtl8168_sleep_rx_enable(struct net_device *dev);
  16. static void rtl8168_dsm(struct net_device *dev, int dev_state);
  17.  
  18. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
  19. +static void rtl8168_esd_timer(struct timer_list *timer);
  20. +static void rtl8168_link_timer(struct timer_list *timer);
  21. +#else
  22. static void rtl8168_esd_timer(unsigned long __opaque);
  23. static void rtl8168_link_timer(unsigned long __opaque);
  24. +#endif//LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
  25. +
  26. static void rtl8168_tx_clear(struct rtl8168_private *tp);
  27. static void rtl8168_rx_clear(struct rtl8168_private *tp);
  28.  
  29. @@ -22964,7 +22972,12 @@ static inline void rtl8168_request_esd_timer(struct net_device *dev)
  30. struct rtl8168_private *tp = netdev_priv(dev);
  31. struct timer_list *timer = &tp->esd_timer;
  32.  
  33. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
  34. + __devicepointer = (unsigned long)dev;
  35. + timer_setup(timer, rtl8168_esd_timer, 0);
  36. +#else
  37. setup_timer(timer, rtl8168_esd_timer, (unsigned long)dev);
  38. +#endif//LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
  39. mod_timer(timer, jiffies + RTL8168_ESD_TIMEOUT);
  40. }
  41.  
  42. @@ -22978,7 +22991,12 @@ static inline void rtl8168_request_link_timer(struct net_device *dev)
  43. struct rtl8168_private *tp = netdev_priv(dev);
  44. struct timer_list *timer = &tp->link_timer;
  45.  
  46. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
  47. + __devicepointer = (unsigned long)dev;
  48. + timer_setup(timer, rtl8168_link_timer, 0);
  49. +#else
  50. setup_timer(timer, rtl8168_link_timer, (unsigned long)dev);
  51. +#endif//LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
  52. mod_timer(timer, jiffies + RTL8168_LINK_TIMEOUT);
  53. }
  54.  
  55. @@ -24717,12 +24735,19 @@ err_out:
  56. #define PCI_DEVICE_SERIAL_NUMBER (0x0164)
  57.  
  58. static void
  59. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
  60. +rtl8168_esd_timer(struct timer_list *timer)
  61. +{
  62. + struct net_device *dev = (struct net_device *)__devicepointer;
  63. + struct rtl8168_private *tp = netdev_priv(dev);
  64. +#else
  65. rtl8168_esd_timer(unsigned long __opaque)
  66. {
  67. struct net_device *dev = (struct net_device *)__opaque;
  68. struct rtl8168_private *tp = netdev_priv(dev);
  69. - struct pci_dev *pdev = tp->pci_dev;
  70. struct timer_list *timer = &tp->esd_timer;
  71. +#endif//LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
  72. + struct pci_dev *pdev = tp->pci_dev;
  73. unsigned long timeout = RTL8168_ESD_TIMEOUT;
  74. unsigned long flags;
  75. u8 cmd;
  76. @@ -24856,11 +24881,18 @@ rtl8168_esd_timer(unsigned long __opaque)
  77. }
  78.  
  79. static void
  80. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
  81. +rtl8168_link_timer(struct timer_list *timer)
  82. +{
  83. + struct net_device *dev = (struct net_device *)__devicepointer;
  84. + struct rtl8168_private *tp = netdev_priv(dev);
  85. +#else
  86. rtl8168_link_timer(unsigned long __opaque)
  87. {
  88. struct net_device *dev = (struct net_device *)__opaque;
  89. struct rtl8168_private *tp = netdev_priv(dev);
  90. struct timer_list *timer = &tp->link_timer;
  91. +#endif//LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
  92. unsigned long flags;
  93.  
  94. spin_lock_irqsave(&tp->lock, flags);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement