diff options
author | David S. Miller <davem@davemloft.net> | 2010-04-07 02:53:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-07 02:53:30 -0400 |
commit | 4a35ecf8bf1c4b039503fa554100fe85c761de76 (patch) | |
tree | 9b75f5d5636004d9a9aa496924377379be09aa1f /drivers/net/r8169.c | |
parent | b4d562e3c3553ac58c7120555c4e4aefbb090a2a (diff) | |
parent | fb9e2d887243499b8d28efcf80821c4f6a092395 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/bonding/bond_main.c
drivers/net/via-velocity.c
drivers/net/wireless/iwlwifi/iwl-agn.c
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r-- | drivers/net/r8169.c | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 64cd250f642d..340da3915b96 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -187,8 +187,13 @@ static DEFINE_PCI_DEVICE_TABLE(rtl8169_pci_tbl) = { | |||
187 | 187 | ||
188 | MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl); | 188 | MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl); |
189 | 189 | ||
190 | static int rx_copybreak = 200; | 190 | /* |
191 | static int use_dac = -1; | 191 | * we set our copybreak very high so that we don't have |
192 | * to allocate 16k frames all the time (see note in | ||
193 | * rtl8169_open() | ||
194 | */ | ||
195 | static int rx_copybreak = 16383; | ||
196 | static int use_dac; | ||
192 | static struct { | 197 | static struct { |
193 | u32 msg_enable; | 198 | u32 msg_enable; |
194 | } debug = { -1 }; | 199 | } debug = { -1 }; |
@@ -513,8 +518,7 @@ MODULE_DESCRIPTION("RealTek RTL-8169 Gigabit Ethernet driver"); | |||
513 | module_param(rx_copybreak, int, 0); | 518 | module_param(rx_copybreak, int, 0); |
514 | MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames"); | 519 | MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames"); |
515 | module_param(use_dac, int, 0); | 520 | module_param(use_dac, int, 0); |
516 | MODULE_PARM_DESC(use_dac, "Enable PCI DAC. -1 defaults on for PCI Express only." | 521 | MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot."); |
517 | " Unsafe on 32 bit PCI slot."); | ||
518 | module_param_named(debug, debug.msg_enable, int, 0); | 522 | module_param_named(debug, debug.msg_enable, int, 0); |
519 | MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)"); | 523 | MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)"); |
520 | MODULE_LICENSE("GPL"); | 524 | MODULE_LICENSE("GPL"); |
@@ -2837,8 +2841,8 @@ static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr) | |||
2837 | spin_lock_irq(&tp->lock); | 2841 | spin_lock_irq(&tp->lock); |
2838 | 2842 | ||
2839 | RTL_W8(Cfg9346, Cfg9346_Unlock); | 2843 | RTL_W8(Cfg9346, Cfg9346_Unlock); |
2840 | RTL_W32(MAC0, low); | ||
2841 | RTL_W32(MAC4, high); | 2844 | RTL_W32(MAC4, high); |
2845 | RTL_W32(MAC0, low); | ||
2842 | RTL_W8(Cfg9346, Cfg9346_Lock); | 2846 | RTL_W8(Cfg9346, Cfg9346_Lock); |
2843 | 2847 | ||
2844 | spin_unlock_irq(&tp->lock); | 2848 | spin_unlock_irq(&tp->lock); |
@@ -2990,7 +2994,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2990 | void __iomem *ioaddr; | 2994 | void __iomem *ioaddr; |
2991 | unsigned int i; | 2995 | unsigned int i; |
2992 | int rc; | 2996 | int rc; |
2993 | int this_use_dac = use_dac; | ||
2994 | 2997 | ||
2995 | if (netif_msg_drv(&debug)) { | 2998 | if (netif_msg_drv(&debug)) { |
2996 | printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n", | 2999 | printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n", |
@@ -3056,17 +3059,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3056 | 3059 | ||
3057 | tp->cp_cmd = PCIMulRW | RxChkSum; | 3060 | tp->cp_cmd = PCIMulRW | RxChkSum; |
3058 | 3061 | ||
3059 | tp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); | ||
3060 | if (!tp->pcie_cap) | ||
3061 | netif_info(tp, probe, dev, "no PCI Express capability\n"); | ||
3062 | |||
3063 | if (this_use_dac < 0) | ||
3064 | this_use_dac = tp->pcie_cap != 0; | ||
3065 | |||
3066 | if ((sizeof(dma_addr_t) > 4) && | 3062 | if ((sizeof(dma_addr_t) > 4) && |
3067 | this_use_dac && | 3063 | !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) { |
3068 | !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { | ||
3069 | netif_info(tp, probe, dev, "using 64-bit DMA\n"); | ||
3070 | tp->cp_cmd |= PCIDAC; | 3064 | tp->cp_cmd |= PCIDAC; |
3071 | dev->features |= NETIF_F_HIGHDMA; | 3065 | dev->features |= NETIF_F_HIGHDMA; |
3072 | } else { | 3066 | } else { |
@@ -3085,6 +3079,10 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3085 | goto err_out_free_res_4; | 3079 | goto err_out_free_res_4; |
3086 | } | 3080 | } |
3087 | 3081 | ||
3082 | tp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); | ||
3083 | if (!tp->pcie_cap) | ||
3084 | netif_info(tp, probe, dev, "no PCI Express capability\n"); | ||
3085 | |||
3088 | RTL_W16(IntrMask, 0x0000); | 3086 | RTL_W16(IntrMask, 0x0000); |
3089 | 3087 | ||
3090 | /* Soft reset the chip. */ | 3088 | /* Soft reset the chip. */ |
@@ -3254,9 +3252,13 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev) | |||
3254 | } | 3252 | } |
3255 | 3253 | ||
3256 | static void rtl8169_set_rxbufsize(struct rtl8169_private *tp, | 3254 | static void rtl8169_set_rxbufsize(struct rtl8169_private *tp, |
3257 | struct net_device *dev) | 3255 | unsigned int mtu) |
3258 | { | 3256 | { |
3259 | unsigned int max_frame = dev->mtu + VLAN_ETH_HLEN + ETH_FCS_LEN; | 3257 | unsigned int max_frame = mtu + VLAN_ETH_HLEN + ETH_FCS_LEN; |
3258 | |||
3259 | if (max_frame != 16383) | ||
3260 | printk(KERN_WARNING PFX "WARNING! Changing of MTU on this " | ||
3261 | "NIC may lead to frame reception errors!\n"); | ||
3260 | 3262 | ||
3261 | tp->rx_buf_sz = (max_frame > RX_BUF_SIZE) ? max_frame : RX_BUF_SIZE; | 3263 | tp->rx_buf_sz = (max_frame > RX_BUF_SIZE) ? max_frame : RX_BUF_SIZE; |
3262 | } | 3264 | } |
@@ -3269,7 +3271,17 @@ static int rtl8169_open(struct net_device *dev) | |||
3269 | 3271 | ||
3270 | pm_runtime_get_sync(&pdev->dev); | 3272 | pm_runtime_get_sync(&pdev->dev); |
3271 | 3273 | ||
3272 | rtl8169_set_rxbufsize(tp, dev); | 3274 | /* |
3275 | * Note that we use a magic value here, its wierd I know | ||
3276 | * its done because, some subset of rtl8169 hardware suffers from | ||
3277 | * a problem in which frames received that are longer than | ||
3278 | * the size set in RxMaxSize register return garbage sizes | ||
3279 | * when received. To avoid this we need to turn off filtering, | ||
3280 | * which is done by setting a value of 16383 in the RxMaxSize register | ||
3281 | * and allocating 16k frames to handle the largest possible rx value | ||
3282 | * thats what the magic math below does. | ||
3283 | */ | ||
3284 | rtl8169_set_rxbufsize(tp, 16383 - VLAN_ETH_HLEN - ETH_FCS_LEN); | ||
3273 | 3285 | ||
3274 | /* | 3286 | /* |
3275 | * Rx and Tx desscriptors needs 256 bytes alignment. | 3287 | * Rx and Tx desscriptors needs 256 bytes alignment. |
@@ -3929,7 +3941,7 @@ static int rtl8169_change_mtu(struct net_device *dev, int new_mtu) | |||
3929 | 3941 | ||
3930 | rtl8169_down(dev); | 3942 | rtl8169_down(dev); |
3931 | 3943 | ||
3932 | rtl8169_set_rxbufsize(tp, dev); | 3944 | rtl8169_set_rxbufsize(tp, dev->mtu); |
3933 | 3945 | ||
3934 | ret = rtl8169_init_ring(dev); | 3946 | ret = rtl8169_init_ring(dev); |
3935 | if (ret < 0) | 3947 | if (ret < 0) |
@@ -4808,8 +4820,8 @@ static void rtl_set_rx_mode(struct net_device *dev) | |||
4808 | mc_filter[1] = swab32(data); | 4820 | mc_filter[1] = swab32(data); |
4809 | } | 4821 | } |
4810 | 4822 | ||
4811 | RTL_W32(MAR0 + 0, mc_filter[0]); | ||
4812 | RTL_W32(MAR0 + 4, mc_filter[1]); | 4823 | RTL_W32(MAR0 + 4, mc_filter[1]); |
4824 | RTL_W32(MAR0 + 0, mc_filter[0]); | ||
4813 | 4825 | ||
4814 | RTL_W32(RxConfig, tmp); | 4826 | RTL_W32(RxConfig, tmp); |
4815 | 4827 | ||