Skip to content

Instantly share code, notes, and snippets.

@NeMO84
Created October 22, 2013 18:56
Show Gist options
  • Save NeMO84/7106119 to your computer and use it in GitHub Desktop.
Save NeMO84/7106119 to your computer and use it in GitHub Desktop.
--- r8101_n.c 2013-10-22 11:46:05.822536955 -0700
+++ r8101_n_new.c 2013-10-22 11:44:55.134534000 -0700
@@ -1904,6 +1904,9 @@
rtl8101_rx_hwaccel_skb(skb, tp->vlgrp, swab16(opts2 & 0xffff));
ret = 0;
}
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+ if (opts2 & RxVlanTag)
+ __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), swab16(opts2 & 0xffff));
#else
if (opts2 & RxVlanTag)
__vlan_hwaccel_put_tag(skb, swab16(opts2 & 0xffff));
@@ -1967,7 +1970,11 @@
else
tp->cp_cmd &= ~RxChkSum;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+ if (dev->features & NETIF_F_HW_VLAN_CTAG_RX)
+#else
if (dev->features & NETIF_F_HW_VLAN_RX)
+#endif
tp->cp_cmd |= RxVlan;
else
tp->cp_cmd &= ~RxVlan;
@@ -7292,7 +7299,11 @@
#endif
#ifdef CONFIG_R8101_VLAN
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+ dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
+#else
dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
+#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
dev->vlan_rx_kill_vid = rtl8101_vlan_rx_kill_vid;
#endif//LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
@@ -7304,8 +7315,13 @@
tp->cp_cmd |= RxChkSum;
#else
dev->features |= NETIF_F_RXCSUM | NETIF_F_SG;
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+ dev->hw_features = NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
+#else
dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
NETIF_F_RXCSUM | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
+#endif
dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
NETIF_F_HIGHDMA;
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment