aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/natsemi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/natsemi.c')
-rw-r--r--drivers/net/natsemi.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index a6033d48b5cc..60f46bc2bf64 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -140,7 +140,7 @@ MODULE_LICENSE("GPL");
140module_param(mtu, int, 0); 140module_param(mtu, int, 0);
141module_param(debug, int, 0); 141module_param(debug, int, 0);
142module_param(rx_copybreak, int, 0); 142module_param(rx_copybreak, int, 0);
143module_param(dspcfg_workaround, int, 1); 143module_param(dspcfg_workaround, int, 0);
144module_param_array(options, int, NULL, 0); 144module_param_array(options, int, NULL, 0);
145module_param_array(full_duplex, int, NULL, 0); 145module_param_array(full_duplex, int, NULL, 0);
146MODULE_PARM_DESC(mtu, "DP8381x MTU (all boards)"); 146MODULE_PARM_DESC(mtu, "DP8381x MTU (all boards)");
@@ -203,7 +203,7 @@ skbuff at an offset of "+2", 16-byte aligning the IP header.
203IIId. Synchronization 203IIId. Synchronization
204 204
205Most operations are synchronized on the np->lock irq spinlock, except the 205Most operations are synchronized on the np->lock irq spinlock, except the
206recieve and transmit paths which are synchronised using a combination of 206receive and transmit paths which are synchronised using a combination of
207hardware descriptor ownership, disabling interrupts and NAPI poll scheduling. 207hardware descriptor ownership, disabling interrupts and NAPI poll scheduling.
208 208
209IVb. References 209IVb. References
@@ -726,7 +726,7 @@ static void move_int_phy(struct net_device *dev, int addr)
726 * There are two addresses we must avoid: 726 * There are two addresses we must avoid:
727 * - the address on the external phy that is used for transmission. 727 * - the address on the external phy that is used for transmission.
728 * - the address that we want to access. User space can access phys 728 * - the address that we want to access. User space can access phys
729 * on the mii bus with SIOCGMIIREG/SIOCSMIIREG, independant from the 729 * on the mii bus with SIOCGMIIREG/SIOCSMIIREG, independent from the
730 * phy that is used for transmission. 730 * phy that is used for transmission.
731 */ 731 */
732 732
@@ -860,6 +860,9 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
860 prev_eedata = eedata; 860 prev_eedata = eedata;
861 } 861 }
862 862
863 /* Store MAC Address in perm_addr */
864 memcpy(dev->perm_addr, dev->dev_addr, ETH_ALEN);
865
863 dev->base_addr = (unsigned long __force) ioaddr; 866 dev->base_addr = (unsigned long __force) ioaddr;
864 dev->irq = irq; 867 dev->irq = irq;
865 868
@@ -1570,7 +1573,7 @@ static int netdev_open(struct net_device *dev)
1570 init_timer(&np->timer); 1573 init_timer(&np->timer);
1571 np->timer.expires = round_jiffies(jiffies + NATSEMI_TIMER_FREQ); 1574 np->timer.expires = round_jiffies(jiffies + NATSEMI_TIMER_FREQ);
1572 np->timer.data = (unsigned long)dev; 1575 np->timer.data = (unsigned long)dev;
1573 np->timer.function = &netdev_timer; /* timer handler */ 1576 np->timer.function = netdev_timer; /* timer handler */
1574 add_timer(&np->timer); 1577 add_timer(&np->timer);
1575 1578
1576 return 0; 1579 return 0;
@@ -1982,7 +1985,7 @@ static void init_ring(struct net_device *dev)
1982 1985
1983 np->rx_head_desc = &np->rx_ring[0]; 1986 np->rx_head_desc = &np->rx_ring[0];
1984 1987
1985 /* Please be carefull before changing this loop - at least gcc-2.95.1 1988 /* Please be careful before changing this loop - at least gcc-2.95.1
1986 * miscompiles it otherwise. 1989 * miscompiles it otherwise.
1987 */ 1990 */
1988 /* Initialize all Rx descriptors. */ 1991 /* Initialize all Rx descriptors. */
@@ -2025,8 +2028,8 @@ static void drain_rx(struct net_device *dev)
2025 np->rx_ring[i].cmd_status = 0; 2028 np->rx_ring[i].cmd_status = 0;
2026 np->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */ 2029 np->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */
2027 if (np->rx_skbuff[i]) { 2030 if (np->rx_skbuff[i]) {
2028 pci_unmap_single(np->pci_dev, 2031 pci_unmap_single(np->pci_dev, np->rx_dma[i],
2029 np->rx_dma[i], buflen, 2032 buflen + NATSEMI_PADDING,
2030 PCI_DMA_FROMDEVICE); 2033 PCI_DMA_FROMDEVICE);
2031 dev_kfree_skb(np->rx_skbuff[i]); 2034 dev_kfree_skb(np->rx_skbuff[i]);
2032 } 2035 }
@@ -2357,7 +2360,8 @@ static void netdev_rx(struct net_device *dev, int *work_done, int work_to_do)
2357 PCI_DMA_FROMDEVICE); 2360 PCI_DMA_FROMDEVICE);
2358 } else { 2361 } else {
2359 pci_unmap_single(np->pci_dev, np->rx_dma[entry], 2362 pci_unmap_single(np->pci_dev, np->rx_dma[entry],
2360 buflen, PCI_DMA_FROMDEVICE); 2363 buflen + NATSEMI_PADDING,
2364 PCI_DMA_FROMDEVICE);
2361 skb_put(skb = np->rx_skbuff[entry], pkt_len); 2365 skb_put(skb = np->rx_skbuff[entry], pkt_len);
2362 np->rx_skbuff[entry] = NULL; 2366 np->rx_skbuff[entry] = NULL;
2363 } 2367 }
@@ -2817,7 +2821,7 @@ static int netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
2817 u32 tmp; 2821 u32 tmp;
2818 2822
2819 ecmd->port = dev->if_port; 2823 ecmd->port = dev->if_port;
2820 ecmd->speed = np->speed; 2824 ethtool_cmd_speed_set(ecmd, np->speed);
2821 ecmd->duplex = np->duplex; 2825 ecmd->duplex = np->duplex;
2822 ecmd->autoneg = np->autoneg; 2826 ecmd->autoneg = np->autoneg;
2823 ecmd->advertising = 0; 2827 ecmd->advertising = 0;
@@ -2875,9 +2879,9 @@ static int netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
2875 tmp = mii_nway_result( 2879 tmp = mii_nway_result(
2876 np->advertising & mdio_read(dev, MII_LPA)); 2880 np->advertising & mdio_read(dev, MII_LPA));
2877 if (tmp == LPA_100FULL || tmp == LPA_100HALF) 2881 if (tmp == LPA_100FULL || tmp == LPA_100HALF)
2878 ecmd->speed = SPEED_100; 2882 ethtool_cmd_speed_set(ecmd, SPEED_100);
2879 else 2883 else
2880 ecmd->speed = SPEED_10; 2884 ethtool_cmd_speed_set(ecmd, SPEED_10);
2881 if (tmp == LPA_100FULL || tmp == LPA_10FULL) 2885 if (tmp == LPA_100FULL || tmp == LPA_10FULL)
2882 ecmd->duplex = DUPLEX_FULL; 2886 ecmd->duplex = DUPLEX_FULL;
2883 else 2887 else
@@ -2905,7 +2909,8 @@ static int netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
2905 return -EINVAL; 2909 return -EINVAL;
2906 } 2910 }
2907 } else if (ecmd->autoneg == AUTONEG_DISABLE) { 2911 } else if (ecmd->autoneg == AUTONEG_DISABLE) {
2908 if (ecmd->speed != SPEED_10 && ecmd->speed != SPEED_100) 2912 u32 speed = ethtool_cmd_speed(ecmd);
2913 if (speed != SPEED_10 && speed != SPEED_100)
2909 return -EINVAL; 2914 return -EINVAL;
2910 if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL) 2915 if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
2911 return -EINVAL; 2916 return -EINVAL;
@@ -2953,7 +2958,7 @@ static int netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
2953 if (ecmd->advertising & ADVERTISED_100baseT_Full) 2958 if (ecmd->advertising & ADVERTISED_100baseT_Full)
2954 np->advertising |= ADVERTISE_100FULL; 2959 np->advertising |= ADVERTISE_100FULL;
2955 } else { 2960 } else {
2956 np->speed = ecmd->speed; 2961 np->speed = ethtool_cmd_speed(ecmd);
2957 np->duplex = ecmd->duplex; 2962 np->duplex = ecmd->duplex;
2958 /* user overriding the initial full duplex parm? */ 2963 /* user overriding the initial full duplex parm? */
2959 if (np->duplex == DUPLEX_HALF) 2964 if (np->duplex == DUPLEX_HALF)