aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/e1000/e1000_ethtool.c2
-rw-r--r--drivers/net/e1000/e1000_main.c8
-rw-r--r--drivers/net/e1000e/netdev.c34
-rw-r--r--drivers/net/gianfar.c4
-rw-r--r--drivers/net/gianfar_mii.c4
-rw-r--r--drivers/net/hamradio/mkiss.c5
-rw-r--r--drivers/net/igb/igb_ethtool.c2
-rw-r--r--drivers/net/igb/igb_main.c28
-rw-r--r--drivers/net/ixgb/ixgb_ethtool.c2
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c41
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c12
-rw-r--r--drivers/net/tsi108_eth.c72
12 files changed, 114 insertions, 100 deletions
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index d876787ce336..85e66f4c7886 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -50,7 +50,7 @@ struct e1000_stats {
50 int stat_offset; 50 int stat_offset;
51}; 51};
52 52
53#define E1000_STAT(m) sizeof(((struct e1000_adapter *)0)->m), \ 53#define E1000_STAT(m) FIELD_SIZEOF(struct e1000_adapter, m), \
54 offsetof(struct e1000_adapter, m) 54 offsetof(struct e1000_adapter, m)
55static const struct e1000_stats e1000_gstrings_stats[] = { 55static const struct e1000_stats e1000_gstrings_stats[] = {
56 { "rx_packets", E1000_STAT(stats.gprc) }, 56 { "rx_packets", E1000_STAT(stats.gprc) },
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index d4ee8ec34b56..0991648c53dc 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -1195,6 +1195,14 @@ e1000_probe(struct pci_dev *pdev,
1195 1195
1196 printk("%s\n", print_mac(mac, netdev->dev_addr)); 1196 printk("%s\n", print_mac(mac, netdev->dev_addr));
1197 1197
1198 if (adapter->hw.bus_type == e1000_bus_type_pci_express) {
1199 DPRINTK(PROBE, WARNING, "This device (id %04x:%04x) will no "
1200 "longer be supported by this driver in the future.\n",
1201 pdev->vendor, pdev->device);
1202 DPRINTK(PROBE, WARNING, "please use the \"e1000e\" "
1203 "driver instead.\n");
1204 }
1205
1198 /* reset the hardware with the new settings */ 1206 /* reset the hardware with the new settings */
1199 e1000_reset(adapter); 1207 e1000_reset(adapter);
1200 1208
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index f58f017ee47a..3031d6d16247 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -1055,23 +1055,6 @@ static void e1000_release_hw_control(struct e1000_adapter *adapter)
1055 } 1055 }
1056} 1056}
1057 1057
1058static void e1000_release_manageability(struct e1000_adapter *adapter)
1059{
1060 if (adapter->flags & FLAG_MNG_PT_ENABLED) {
1061 struct e1000_hw *hw = &adapter->hw;
1062
1063 u32 manc = er32(MANC);
1064
1065 /* re-enable hardware interception of ARP */
1066 manc |= E1000_MANC_ARP_EN;
1067 manc &= ~E1000_MANC_EN_MNG2HOST;
1068
1069 /* don't explicitly have to mess with MANC2H since
1070 * MANC has an enable disable that gates MANC2H */
1071 ew32(MANC, manc);
1072 }
1073}
1074
1075/** 1058/**
1076 * @e1000_alloc_ring - allocate memory for a ring structure 1059 * @e1000_alloc_ring - allocate memory for a ring structure
1077 **/ 1060 **/
@@ -1561,9 +1544,6 @@ static void e1000_init_manageability(struct e1000_adapter *adapter)
1561 1544
1562 manc = er32(MANC); 1545 manc = er32(MANC);
1563 1546
1564 /* disable hardware interception of ARP */
1565 manc &= ~(E1000_MANC_ARP_EN);
1566
1567 /* enable receiving management packets to the host. this will probably 1547 /* enable receiving management packets to the host. this will probably
1568 * generate destination unreachable messages from the host OS, but 1548 * generate destination unreachable messages from the host OS, but
1569 * the packets will be handled on SMBUS */ 1549 * the packets will be handled on SMBUS */
@@ -1690,6 +1670,9 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
1690 else 1670 else
1691 rctl |= E1000_RCTL_LPE; 1671 rctl |= E1000_RCTL_LPE;
1692 1672
1673 /* Enable hardware CRC frame stripping */
1674 rctl |= E1000_RCTL_SECRC;
1675
1693 /* Setup buffer sizes */ 1676 /* Setup buffer sizes */
1694 rctl &= ~E1000_RCTL_SZ_4096; 1677 rctl &= ~E1000_RCTL_SZ_4096;
1695 rctl |= E1000_RCTL_BSEX; 1678 rctl |= E1000_RCTL_BSEX;
@@ -1755,9 +1738,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
1755 1738
1756 /* Enable Packet split descriptors */ 1739 /* Enable Packet split descriptors */
1757 rctl |= E1000_RCTL_DTYP_PS; 1740 rctl |= E1000_RCTL_DTYP_PS;
1758
1759 /* Enable hardware CRC frame stripping */
1760 rctl |= E1000_RCTL_SECRC;
1761 1741
1762 psrctl |= adapter->rx_ps_bsize0 >> 1742 psrctl |= adapter->rx_ps_bsize0 >>
1763 E1000_PSRCTL_BSIZE0_SHIFT; 1743 E1000_PSRCTL_BSIZE0_SHIFT;
@@ -2008,7 +1988,7 @@ static void e1000_power_down_phy(struct e1000_adapter *adapter)
2008 u16 mii_reg; 1988 u16 mii_reg;
2009 1989
2010 /* WoL is enabled */ 1990 /* WoL is enabled */
2011 if (!adapter->wol) 1991 if (adapter->wol)
2012 return; 1992 return;
2013 1993
2014 /* non-copper PHY? */ 1994 /* non-copper PHY? */
@@ -2140,8 +2120,6 @@ void e1000e_reset(struct e1000_adapter *adapter)
2140 phy_data &= ~IGP02E1000_PM_SPD; 2120 phy_data &= ~IGP02E1000_PM_SPD;
2141 e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, phy_data); 2121 e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, phy_data);
2142 } 2122 }
2143
2144 e1000_release_manageability(adapter);
2145} 2123}
2146 2124
2147int e1000e_up(struct e1000_adapter *adapter) 2125int e1000e_up(struct e1000_adapter *adapter)
@@ -3487,8 +3465,6 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
3487 pci_enable_wake(pdev, PCI_D3cold, 0); 3465 pci_enable_wake(pdev, PCI_D3cold, 0);
3488 } 3466 }
3489 3467
3490 e1000_release_manageability(adapter);
3491
3492 /* make sure adapter isn't asleep if manageability is enabled */ 3468 /* make sure adapter isn't asleep if manageability is enabled */
3493 if (adapter->flags & FLAG_MNG_PT_ENABLED) { 3469 if (adapter->flags & FLAG_MNG_PT_ENABLED) {
3494 pci_enable_wake(pdev, PCI_D3hot, 1); 3470 pci_enable_wake(pdev, PCI_D3hot, 1);
@@ -4054,8 +4030,6 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
4054 4030
4055 flush_scheduled_work(); 4031 flush_scheduled_work();
4056 4032
4057 e1000_release_manageability(adapter);
4058
4059 /* Release control of h/w to f/w. If f/w is AMT enabled, this 4033 /* Release control of h/w to f/w. If f/w is AMT enabled, this
4060 * would have already happened in close and is redundant. */ 4034 * would have already happened in close and is redundant. */
4061 e1000_release_hw_control(adapter); 4035 e1000_release_hw_control(adapter);
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 0431e9ed0fac..4244fc282f21 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -130,8 +130,8 @@ static void free_skb_resources(struct gfar_private *priv);
130static void gfar_set_multi(struct net_device *dev); 130static void gfar_set_multi(struct net_device *dev);
131static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); 131static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr);
132static void gfar_configure_serdes(struct net_device *dev); 132static void gfar_configure_serdes(struct net_device *dev);
133extern int gfar_local_mdio_write(struct gfar_mii *regs, int mii_id, int regnum, u16 value); 133extern int gfar_local_mdio_write(struct gfar_mii __iomem *regs, int mii_id, int regnum, u16 value);
134extern int gfar_local_mdio_read(struct gfar_mii *regs, int mii_id, int regnum); 134extern int gfar_local_mdio_read(struct gfar_mii __iomem *regs, int mii_id, int regnum);
135#ifdef CONFIG_GFAR_NAPI 135#ifdef CONFIG_GFAR_NAPI
136static int gfar_poll(struct napi_struct *napi, int budget); 136static int gfar_poll(struct napi_struct *napi, int budget);
137#endif 137#endif
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c
index 6a647d95e6ea..24327629bf03 100644
--- a/drivers/net/gianfar_mii.c
+++ b/drivers/net/gianfar_mii.c
@@ -51,7 +51,7 @@
51 * the local mdio pins, which may not be the same as system mdio bus, used for 51 * the local mdio pins, which may not be the same as system mdio bus, used for
52 * controlling the external PHYs, for example. 52 * controlling the external PHYs, for example.
53 */ 53 */
54int gfar_local_mdio_write(struct gfar_mii *regs, int mii_id, 54int gfar_local_mdio_write(struct gfar_mii __iomem *regs, int mii_id,
55 int regnum, u16 value) 55 int regnum, u16 value)
56{ 56{
57 /* Set the PHY address and the register address we want to write */ 57 /* Set the PHY address and the register address we want to write */
@@ -77,7 +77,7 @@ int gfar_local_mdio_write(struct gfar_mii *regs, int mii_id,
77 * and are always tied to the local mdio pins, which may not be the 77 * and are always tied to the local mdio pins, which may not be the
78 * same as system mdio bus, used for controlling the external PHYs, for eg. 78 * same as system mdio bus, used for controlling the external PHYs, for eg.
79 */ 79 */
80int gfar_local_mdio_read(struct gfar_mii *regs, int mii_id, int regnum) 80int gfar_local_mdio_read(struct gfar_mii __iomem *regs, int mii_id, int regnum)
81 81
82{ 82{
83 u16 value; 83 u16 value;
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index cfcd15af501e..30c9b3b0d131 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -289,7 +289,6 @@ static void ax_bump(struct mkiss *ax)
289 *ax->rbuff &= ~0x20; 289 *ax->rbuff &= ~0x20;
290 } 290 }
291 } 291 }
292 spin_unlock_bh(&ax->buflock);
293 292
294 count = ax->rcount; 293 count = ax->rcount;
295 294
@@ -297,17 +296,17 @@ static void ax_bump(struct mkiss *ax)
297 printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n", 296 printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n",
298 ax->dev->name); 297 ax->dev->name);
299 ax->stats.rx_dropped++; 298 ax->stats.rx_dropped++;
299 spin_unlock_bh(&ax->buflock);
300 return; 300 return;
301 } 301 }
302 302
303 spin_lock_bh(&ax->buflock);
304 memcpy(skb_put(skb,count), ax->rbuff, count); 303 memcpy(skb_put(skb,count), ax->rbuff, count);
305 spin_unlock_bh(&ax->buflock);
306 skb->protocol = ax25_type_trans(skb, ax->dev); 304 skb->protocol = ax25_type_trans(skb, ax->dev);
307 netif_rx(skb); 305 netif_rx(skb);
308 ax->dev->last_rx = jiffies; 306 ax->dev->last_rx = jiffies;
309 ax->stats.rx_packets++; 307 ax->stats.rx_packets++;
310 ax->stats.rx_bytes += count; 308 ax->stats.rx_bytes += count;
309 spin_unlock_bh(&ax->buflock);
311} 310}
312 311
313static void kiss_unesc(struct mkiss *ax, unsigned char s) 312static void kiss_unesc(struct mkiss *ax, unsigned char s)
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index f69721e4eaa1..0447f9bcd27a 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -43,7 +43,7 @@ struct igb_stats {
43 int stat_offset; 43 int stat_offset;
44}; 44};
45 45
46#define IGB_STAT(m) sizeof(((struct igb_adapter *)0)->m), \ 46#define IGB_STAT(m) FIELD_SIZEOF(struct igb_adapter, m), \
47 offsetof(struct igb_adapter, m) 47 offsetof(struct igb_adapter, m)
48static const struct igb_stats igb_gstrings_stats[] = { 48static const struct igb_stats igb_gstrings_stats[] = {
49 { "rx_packets", IGB_STAT(stats.gprc) }, 49 { "rx_packets", IGB_STAT(stats.gprc) },
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index d4eb8e2d8720..bff280eff5e3 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -606,9 +606,6 @@ static void igb_init_manageability(struct igb_adapter *adapter)
606 u32 manc2h = rd32(E1000_MANC2H); 606 u32 manc2h = rd32(E1000_MANC2H);
607 u32 manc = rd32(E1000_MANC); 607 u32 manc = rd32(E1000_MANC);
608 608
609 /* disable hardware interception of ARP */
610 manc &= ~(E1000_MANC_ARP_EN);
611
612 /* enable receiving management packets to the host */ 609 /* enable receiving management packets to the host */
613 /* this will probably generate destination unreachable messages 610 /* this will probably generate destination unreachable messages
614 * from the host OS, but the packets will be handled on SMBUS */ 611 * from the host OS, but the packets will be handled on SMBUS */
@@ -623,25 +620,6 @@ static void igb_init_manageability(struct igb_adapter *adapter)
623 } 620 }
624} 621}
625 622
626static void igb_release_manageability(struct igb_adapter *adapter)
627{
628 struct e1000_hw *hw = &adapter->hw;
629
630 if (adapter->en_mng_pt) {
631 u32 manc = rd32(E1000_MANC);
632
633 /* re-enable hardware interception of ARP */
634 manc |= E1000_MANC_ARP_EN;
635 manc &= ~E1000_MANC_EN_MNG2HOST;
636
637 /* don't explicitly have to mess with MANC2H since
638 * MANC has an enable disable that gates MANC2H */
639
640 /* XXX stop the hardware watchdog ? */
641 wr32(E1000_MANC, manc);
642 }
643}
644
645/** 623/**
646 * igb_configure - configure the hardware for RX and TX 624 * igb_configure - configure the hardware for RX and TX
647 * @adapter: private board structure 625 * @adapter: private board structure
@@ -844,7 +822,6 @@ void igb_reset(struct igb_adapter *adapter)
844 822
845 igb_reset_adaptive(&adapter->hw); 823 igb_reset_adaptive(&adapter->hw);
846 adapter->hw.phy.ops.get_phy_info(&adapter->hw); 824 adapter->hw.phy.ops.get_phy_info(&adapter->hw);
847 igb_release_manageability(adapter);
848} 825}
849 826
850/** 827/**
@@ -1178,9 +1155,6 @@ static void __devexit igb_remove(struct pci_dev *pdev)
1178 1155
1179 flush_scheduled_work(); 1156 flush_scheduled_work();
1180 1157
1181
1182 igb_release_manageability(adapter);
1183
1184 /* Release control of h/w to f/w. If f/w is AMT enabled, this 1158 /* Release control of h/w to f/w. If f/w is AMT enabled, this
1185 * would have already happened in close and is redundant. */ 1159 * would have already happened in close and is redundant. */
1186 igb_release_hw_control(adapter); 1160 igb_release_hw_control(adapter);
@@ -3955,8 +3929,6 @@ static int igb_suspend(struct pci_dev *pdev, pm_message_t state)
3955 pci_enable_wake(pdev, PCI_D3cold, 0); 3929 pci_enable_wake(pdev, PCI_D3cold, 0);
3956 } 3930 }
3957 3931
3958 igb_release_manageability(adapter);
3959
3960 /* make sure adapter isn't asleep if manageability is enabled */ 3932 /* make sure adapter isn't asleep if manageability is enabled */
3961 if (adapter->en_mng_pt) { 3933 if (adapter->en_mng_pt) {
3962 pci_enable_wake(pdev, PCI_D3hot, 1); 3934 pci_enable_wake(pdev, PCI_D3hot, 1);
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index a267dd862520..53a9fd086f96 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -49,7 +49,7 @@ struct ixgb_stats {
49 int stat_offset; 49 int stat_offset;
50}; 50};
51 51
52#define IXGB_STAT(m) sizeof(((struct ixgb_adapter *)0)->m), \ 52#define IXGB_STAT(m) FIELD_SIZEOF(struct ixgb_adapter, m), \
53 offsetof(struct ixgb_adapter, m) 53 offsetof(struct ixgb_adapter, m)
54static struct ixgb_stats ixgb_gstrings_stats[] = { 54static struct ixgb_stats ixgb_gstrings_stats[] = {
55 {"rx_packets", IXGB_STAT(net_stats.rx_packets)}, 55 {"rx_packets", IXGB_STAT(net_stats.rx_packets)},
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index ead49e54f31b..23d0a4afe0e1 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -220,7 +220,6 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter,
220 tx_ring->stats.bytes += tx_buffer_info->length; 220 tx_ring->stats.bytes += tx_buffer_info->length;
221 if (cleaned) { 221 if (cleaned) {
222 struct sk_buff *skb = tx_buffer_info->skb; 222 struct sk_buff *skb = tx_buffer_info->skb;
223#ifdef NETIF_F_TSO
224 unsigned int segs, bytecount; 223 unsigned int segs, bytecount;
225 segs = skb_shinfo(skb)->gso_segs ?: 1; 224 segs = skb_shinfo(skb)->gso_segs ?: 1;
226 /* multiply data chunks by size of headers */ 225 /* multiply data chunks by size of headers */
@@ -228,10 +227,6 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter,
228 skb->len; 227 skb->len;
229 total_tx_packets += segs; 228 total_tx_packets += segs;
230 total_tx_bytes += bytecount; 229 total_tx_bytes += bytecount;
231#else
232 total_tx_packets++;
233 total_tx_bytes += skb->len;
234#endif
235 } 230 }
236 ixgbe_unmap_and_free_tx_resource(adapter, 231 ixgbe_unmap_and_free_tx_resource(adapter,
237 tx_buffer_info); 232 tx_buffer_info);
@@ -1942,6 +1937,10 @@ static int ixgbe_open(struct net_device *netdev)
1942 int err; 1937 int err;
1943 u32 num_rx_queues = adapter->num_rx_queues; 1938 u32 num_rx_queues = adapter->num_rx_queues;
1944 1939
1940 /* disallow open during test */
1941 if (test_bit(__IXGBE_TESTING, &adapter->state))
1942 return -EBUSY;
1943
1945try_intr_reinit: 1944try_intr_reinit:
1946 /* allocate transmit descriptors */ 1945 /* allocate transmit descriptors */
1947 err = ixgbe_setup_all_tx_resources(adapter); 1946 err = ixgbe_setup_all_tx_resources(adapter);
@@ -2278,11 +2277,29 @@ static bool ixgbe_tx_csum(struct ixgbe_adapter *adapter,
2278 IXGBE_ADVTXD_DTYP_CTXT); 2277 IXGBE_ADVTXD_DTYP_CTXT);
2279 2278
2280 if (skb->ip_summed == CHECKSUM_PARTIAL) { 2279 if (skb->ip_summed == CHECKSUM_PARTIAL) {
2281 if (skb->protocol == htons(ETH_P_IP)) 2280 switch (skb->protocol) {
2281 case __constant_htons(ETH_P_IP):
2282 type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV4; 2282 type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV4;
2283 if (ip_hdr(skb)->protocol == IPPROTO_TCP)
2284 type_tucmd_mlhl |=
2285 IXGBE_ADVTXD_TUCMD_L4T_TCP;
2286 break;
2287
2288 case __constant_htons(ETH_P_IPV6):
2289 /* XXX what about other V6 headers?? */
2290 if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
2291 type_tucmd_mlhl |=
2292 IXGBE_ADVTXD_TUCMD_L4T_TCP;
2293 break;
2283 2294
2284 if (skb->sk->sk_protocol == IPPROTO_TCP) 2295 default:
2285 type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP; 2296 if (unlikely(net_ratelimit())) {
2297 DPRINTK(PROBE, WARNING,
2298 "partial checksum but proto=%x!\n",
2299 skb->protocol);
2300 }
2301 break;
2302 }
2286 } 2303 }
2287 2304
2288 context_desc->type_tucmd_mlhl = cpu_to_le32(type_tucmd_mlhl); 2305 context_desc->type_tucmd_mlhl = cpu_to_le32(type_tucmd_mlhl);
@@ -2778,6 +2795,14 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
2778 hw->mac.type, hw->phy.type, 2795 hw->mac.type, hw->phy.type,
2779 (part_num >> 8), (part_num & 0xff)); 2796 (part_num >> 8), (part_num & 0xff));
2780 2797
2798 if (link_width <= IXGBE_PCI_LINK_WIDTH_4) {
2799 dev_warn(&pdev->dev, "PCI-Express bandwidth available for "
2800 "this card is not sufficient for optimal "
2801 "performance.\n");
2802 dev_warn(&pdev->dev, "For optimal performance a x8 "
2803 "PCI-Express slot is required.\n");
2804 }
2805
2781 /* reset the hardware with the new settings */ 2806 /* reset the hardware with the new settings */
2782 ixgbe_start_hw(hw); 2807 ixgbe_start_hw(hw);
2783 2808
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index f18eca9831e8..250eb1954c34 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -559,8 +559,16 @@ static int mhz_setup(struct pcmcia_device *link)
559 559
560 /* Read the station address from the CIS. It is stored as the last 560 /* Read the station address from the CIS. It is stored as the last
561 (fourth) string in the Version 1 Version/ID tuple. */ 561 (fourth) string in the Version 1 Version/ID tuple. */
562 if (link->prod_id[3]) { 562 tuple->DesiredTuple = CISTPL_VERS_1;
563 station_addr = link->prod_id[3]; 563 if (first_tuple(link, tuple, parse) != CS_SUCCESS) {
564 rc = -1;
565 goto free_cfg_mem;
566 }
567 /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */
568 if (next_tuple(link, tuple, parse) != CS_SUCCESS)
569 first_tuple(link, tuple, parse);
570 if (parse->version_1.ns > 3) {
571 station_addr = parse->version_1.str + parse->version_1.ofs[3];
564 if (cvt_ascii_address(dev, station_addr) == 0) { 572 if (cvt_ascii_address(dev, station_addr) == 0) {
565 rc = 0; 573 rc = 0;
566 goto free_cfg_mem; 574 goto free_cfg_mem;
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c
index 35d15e850075..6f33f84d37b0 100644
--- a/drivers/net/tsi108_eth.c
+++ b/drivers/net/tsi108_eth.c
@@ -36,6 +36,7 @@
36#include <linux/net.h> 36#include <linux/net.h>
37#include <linux/netdevice.h> 37#include <linux/netdevice.h>
38#include <linux/etherdevice.h> 38#include <linux/etherdevice.h>
39#include <linux/ethtool.h>
39#include <linux/skbuff.h> 40#include <linux/skbuff.h>
40#include <linux/slab.h> 41#include <linux/slab.h>
41#include <linux/spinlock.h> 42#include <linux/spinlock.h>
@@ -297,18 +298,11 @@ static void tsi108_check_phy(struct net_device *dev)
297 u32 speed; 298 u32 speed;
298 unsigned long flags; 299 unsigned long flags;
299 300
300 /* Do a dummy read, as for some reason the first read
301 * after a link becomes up returns link down, even if
302 * it's been a while since the link came up.
303 */
304
305 spin_lock_irqsave(&phy_lock, flags); 301 spin_lock_irqsave(&phy_lock, flags);
306 302
307 if (!data->phy_ok) 303 if (!data->phy_ok)
308 goto out; 304 goto out;
309 305
310 tsi108_read_mii(data, MII_BMSR);
311
312 duplex = mii_check_media(&data->mii_if, netif_msg_link(data), data->init_media); 306 duplex = mii_check_media(&data->mii_if, netif_msg_link(data), data->init_media);
313 data->init_media = 0; 307 data->init_media = 0;
314 308
@@ -345,22 +339,21 @@ static void tsi108_check_phy(struct net_device *dev)
345 339
346 TSI_WRITE(TSI108_MAC_CFG2, mac_cfg2_reg); 340 TSI_WRITE(TSI108_MAC_CFG2, mac_cfg2_reg);
347 TSI_WRITE(TSI108_EC_PORTCTRL, portctrl_reg); 341 TSI_WRITE(TSI108_EC_PORTCTRL, portctrl_reg);
342 }
348 343
349 if (data->link_up == 0) { 344 if (data->link_up == 0) {
350 /* The manual says it can take 3-4 usecs for the speed change 345 /* The manual says it can take 3-4 usecs for the speed change
351 * to take effect. 346 * to take effect.
352 */ 347 */
353 udelay(5); 348 udelay(5);
354 349
355 spin_lock(&data->txlock); 350 spin_lock(&data->txlock);
356 if (is_valid_ether_addr(dev->dev_addr) && data->txfree) 351 if (is_valid_ether_addr(dev->dev_addr) && data->txfree)
357 netif_wake_queue(dev); 352 netif_wake_queue(dev);
358 353
359 data->link_up = 1; 354 data->link_up = 1;
360 spin_unlock(&data->txlock); 355 spin_unlock(&data->txlock);
361 }
362 } 356 }
363
364 } else { 357 } else {
365 if (data->link_up == 1) { 358 if (data->link_up == 1) {
366 netif_stop_queue(dev); 359 netif_stop_queue(dev);
@@ -1274,12 +1267,11 @@ static void tsi108_init_phy(struct net_device *dev)
1274 * PHY_STAT register before the link up status bit is set. 1267 * PHY_STAT register before the link up status bit is set.
1275 */ 1268 */
1276 1269
1277 data->link_up = 1; 1270 data->link_up = 0;
1278 1271
1279 while (!((phyval = tsi108_read_mii(data, MII_BMSR)) & 1272 while (!((phyval = tsi108_read_mii(data, MII_BMSR)) &
1280 BMSR_LSTATUS)) { 1273 BMSR_LSTATUS)) {
1281 if (i++ > (MII_READ_DELAY / 10)) { 1274 if (i++ > (MII_READ_DELAY / 10)) {
1282 data->link_up = 0;
1283 break; 1275 break;
1284 } 1276 }
1285 spin_unlock_irqrestore(&phy_lock, flags); 1277 spin_unlock_irqrestore(&phy_lock, flags);
@@ -1287,6 +1279,7 @@ static void tsi108_init_phy(struct net_device *dev)
1287 spin_lock_irqsave(&phy_lock, flags); 1279 spin_lock_irqsave(&phy_lock, flags);
1288 } 1280 }
1289 1281
1282 data->mii_if.supports_gmii = mii_check_gmii_support(&data->mii_if);
1290 printk(KERN_DEBUG "PHY_STAT reg contains %08x\n", phyval); 1283 printk(KERN_DEBUG "PHY_STAT reg contains %08x\n", phyval);
1291 data->phy_ok = 1; 1284 data->phy_ok = 1;
1292 data->init_media = 1; 1285 data->init_media = 1;
@@ -1527,12 +1520,46 @@ static void tsi108_init_mac(struct net_device *dev)
1527 TSI_WRITE(TSI108_EC_INTMASK, ~0); 1520 TSI_WRITE(TSI108_EC_INTMASK, ~0);
1528} 1521}
1529 1522
1523static int tsi108_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1524{
1525 struct tsi108_prv_data *data = netdev_priv(dev);
1526 unsigned long flags;
1527 int rc;
1528
1529 spin_lock_irqsave(&data->txlock, flags);
1530 rc = mii_ethtool_gset(&data->mii_if, cmd);
1531 spin_unlock_irqrestore(&data->txlock, flags);
1532
1533 return rc;
1534}
1535
1536static int tsi108_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1537{
1538 struct tsi108_prv_data *data = netdev_priv(dev);
1539 unsigned long flags;
1540 int rc;
1541
1542 spin_lock_irqsave(&data->txlock, flags);
1543 rc = mii_ethtool_sset(&data->mii_if, cmd);
1544 spin_unlock_irqrestore(&data->txlock, flags);
1545
1546 return rc;
1547}
1548
1530static int tsi108_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 1549static int tsi108_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1531{ 1550{
1532 struct tsi108_prv_data *data = netdev_priv(dev); 1551 struct tsi108_prv_data *data = netdev_priv(dev);
1552 if (!netif_running(dev))
1553 return -EINVAL;
1533 return generic_mii_ioctl(&data->mii_if, if_mii(rq), cmd, NULL); 1554 return generic_mii_ioctl(&data->mii_if, if_mii(rq), cmd, NULL);
1534} 1555}
1535 1556
1557static const struct ethtool_ops tsi108_ethtool_ops = {
1558 .get_link = ethtool_op_get_link,
1559 .get_settings = tsi108_get_settings,
1560 .set_settings = tsi108_set_settings,
1561};
1562
1536static int 1563static int
1537tsi108_init_one(struct platform_device *pdev) 1564tsi108_init_one(struct platform_device *pdev)
1538{ 1565{
@@ -1584,7 +1611,6 @@ tsi108_init_one(struct platform_device *pdev)
1584 data->mii_if.phy_id = einfo->phy; 1611 data->mii_if.phy_id = einfo->phy;
1585 data->mii_if.phy_id_mask = 0x1f; 1612 data->mii_if.phy_id_mask = 0x1f;
1586 data->mii_if.reg_num_mask = 0x1f; 1613 data->mii_if.reg_num_mask = 0x1f;
1587 data->mii_if.supports_gmii = mii_check_gmii_support(&data->mii_if);
1588 1614
1589 data->phy = einfo->phy; 1615 data->phy = einfo->phy;
1590 data->phy_type = einfo->phy_type; 1616 data->phy_type = einfo->phy_type;
@@ -1598,6 +1624,7 @@ tsi108_init_one(struct platform_device *pdev)
1598 dev->get_stats = tsi108_get_stats; 1624 dev->get_stats = tsi108_get_stats;
1599 netif_napi_add(dev, &data->napi, tsi108_poll, 64); 1625 netif_napi_add(dev, &data->napi, tsi108_poll, 64);
1600 dev->do_ioctl = tsi108_do_ioctl; 1626 dev->do_ioctl = tsi108_do_ioctl;
1627 dev->ethtool_ops = &tsi108_ethtool_ops;
1601 1628
1602 /* Apparently, the Linux networking code won't use scatter-gather 1629 /* Apparently, the Linux networking code won't use scatter-gather
1603 * if the hardware doesn't do checksums. However, it's faster 1630 * if the hardware doesn't do checksums. However, it's faster
@@ -1629,6 +1656,7 @@ tsi108_init_one(struct platform_device *pdev)
1629 goto register_fail; 1656 goto register_fail;
1630 } 1657 }
1631 1658
1659 platform_set_drvdata(pdev, dev);
1632 printk(KERN_INFO "%s: Tsi108 Gigabit Ethernet, MAC: %s\n", 1660 printk(KERN_INFO "%s: Tsi108 Gigabit Ethernet, MAC: %s\n",
1633 dev->name, print_mac(mac, dev->dev_addr)); 1661 dev->name, print_mac(mac, dev->dev_addr));
1634#ifdef DEBUG 1662#ifdef DEBUG