diff options
-rw-r--r-- | drivers/net/r8169.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 60f96c468a24..67d414b061d7 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -186,7 +186,12 @@ static struct pci_device_id rtl8169_pci_tbl[] = { | |||
186 | 186 | ||
187 | MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl); | 187 | MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl); |
188 | 188 | ||
189 | static int rx_copybreak = 200; | 189 | /* |
190 | * we set our copybreak very high so that we don't have | ||
191 | * to allocate 16k frames all the time (see note in | ||
192 | * rtl8169_open() | ||
193 | */ | ||
194 | static int rx_copybreak = 16383; | ||
190 | static int use_dac; | 195 | static int use_dac; |
191 | static struct { | 196 | static struct { |
192 | u32 msg_enable; | 197 | u32 msg_enable; |
@@ -3245,9 +3250,13 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev) | |||
3245 | } | 3250 | } |
3246 | 3251 | ||
3247 | static void rtl8169_set_rxbufsize(struct rtl8169_private *tp, | 3252 | static void rtl8169_set_rxbufsize(struct rtl8169_private *tp, |
3248 | struct net_device *dev) | 3253 | unsigned int mtu) |
3249 | { | 3254 | { |
3250 | unsigned int max_frame = dev->mtu + VLAN_ETH_HLEN + ETH_FCS_LEN; | 3255 | unsigned int max_frame = mtu + VLAN_ETH_HLEN + ETH_FCS_LEN; |
3256 | |||
3257 | if (max_frame != 16383) | ||
3258 | printk(KERN_WARNING "WARNING! Changing of MTU on this NIC" | ||
3259 | "May lead to frame reception errors!\n"); | ||
3251 | 3260 | ||
3252 | tp->rx_buf_sz = (max_frame > RX_BUF_SIZE) ? max_frame : RX_BUF_SIZE; | 3261 | tp->rx_buf_sz = (max_frame > RX_BUF_SIZE) ? max_frame : RX_BUF_SIZE; |
3253 | } | 3262 | } |
@@ -3259,7 +3268,17 @@ static int rtl8169_open(struct net_device *dev) | |||
3259 | int retval = -ENOMEM; | 3268 | int retval = -ENOMEM; |
3260 | 3269 | ||
3261 | 3270 | ||
3262 | rtl8169_set_rxbufsize(tp, dev); | 3271 | /* |
3272 | * Note that we use a magic value here, its wierd I know | ||
3273 | * its done because, some subset of rtl8169 hardware suffers from | ||
3274 | * a problem in which frames received that are longer than | ||
3275 | * the size set in RxMaxSize register return garbage sizes | ||
3276 | * when received. To avoid this we need to turn off filtering, | ||
3277 | * which is done by setting a value of 16383 in the RxMaxSize register | ||
3278 | * and allocating 16k frames to handle the largest possible rx value | ||
3279 | * thats what the magic math below does. | ||
3280 | */ | ||
3281 | rtl8169_set_rxbufsize(tp, 16383 - VLAN_ETH_HLEN - ETH_FCS_LEN); | ||
3263 | 3282 | ||
3264 | /* | 3283 | /* |
3265 | * Rx and Tx desscriptors needs 256 bytes alignment. | 3284 | * Rx and Tx desscriptors needs 256 bytes alignment. |
@@ -3912,7 +3931,7 @@ static int rtl8169_change_mtu(struct net_device *dev, int new_mtu) | |||
3912 | 3931 | ||
3913 | rtl8169_down(dev); | 3932 | rtl8169_down(dev); |
3914 | 3933 | ||
3915 | rtl8169_set_rxbufsize(tp, dev); | 3934 | rtl8169_set_rxbufsize(tp, dev->mtu); |
3916 | 3935 | ||
3917 | ret = rtl8169_init_ring(dev); | 3936 | ret = rtl8169_init_ring(dev); |
3918 | if (ret < 0) | 3937 | if (ret < 0) |