Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 189183
b: refs/heads/master
c: c0cd884
h: refs/heads/master
i:
  189181: 156cdc1
  189179: 31af1e3
  189175: 8eeff19
  189167: 0b53e6f
  189151: f0369de
  189119: 7b2fb55
  189055: a85d903
  188927: 7056ffa
v: v3
  • Loading branch information
Neil Horman authored and David S. Miller committed Mar 29, 2010
1 parent ae527f9 commit 5b24364
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 54c1a859efd9fd6cda05bc700315ba2519c14eba
refs/heads/master: c0cd884af045338476b8e69a61fceb3f34ff22f1
29 changes: 24 additions & 5 deletions trunk/drivers/net/r8169.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,12 @@ static DEFINE_PCI_DEVICE_TABLE(rtl8169_pci_tbl) = {

MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl);

static int rx_copybreak = 200;
/*
* we set our copybreak very high so that we don't have
* to allocate 16k frames all the time (see note in
* rtl8169_open()
*/
static int rx_copybreak = 16383;
static int use_dac;
static struct {
u32 msg_enable;
Expand Down Expand Up @@ -3217,9 +3222,13 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev)
}

static void rtl8169_set_rxbufsize(struct rtl8169_private *tp,
struct net_device *dev)
unsigned int mtu)
{
unsigned int max_frame = dev->mtu + VLAN_ETH_HLEN + ETH_FCS_LEN;
unsigned int max_frame = mtu + VLAN_ETH_HLEN + ETH_FCS_LEN;

if (max_frame != 16383)
printk(KERN_WARNING "WARNING! Changing of MTU on this NIC"
"May lead to frame reception errors!\n");

tp->rx_buf_sz = (max_frame > RX_BUF_SIZE) ? max_frame : RX_BUF_SIZE;
}
Expand All @@ -3231,7 +3240,17 @@ static int rtl8169_open(struct net_device *dev)
int retval = -ENOMEM;


rtl8169_set_rxbufsize(tp, dev);
/*
* Note that we use a magic value here, its wierd I know
* its done because, some subset of rtl8169 hardware suffers from
* a problem in which frames received that are longer than
* the size set in RxMaxSize register return garbage sizes
* when received. To avoid this we need to turn off filtering,
* which is done by setting a value of 16383 in the RxMaxSize register
* and allocating 16k frames to handle the largest possible rx value
* thats what the magic math below does.
*/
rtl8169_set_rxbufsize(tp, 16383 - VLAN_ETH_HLEN - ETH_FCS_LEN);

/*
* Rx and Tx desscriptors needs 256 bytes alignment.
Expand Down Expand Up @@ -3884,7 +3903,7 @@ static int rtl8169_change_mtu(struct net_device *dev, int new_mtu)

rtl8169_down(dev);

rtl8169_set_rxbufsize(tp, dev);
rtl8169_set_rxbufsize(tp, dev->mtu);

ret = rtl8169_init_ring(dev);
if (ret < 0)
Expand Down

0 comments on commit 5b24364

Please sign in to comment.