diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:57:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:57:17 -0400 |
commit | 9028780a3e6d2c3dd940e89b377765cca008b6df (patch) | |
tree | 1e72fceedcb72b65e8851d0a56586a699e09ad2e /drivers | |
parent | 5335a40be6867eff986a31bcd8fc82a5cb1e16bb (diff) | |
parent | e824f7836de25b1c2f659a2412d32227f1f68bcb (diff) |
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (40 commits)
[netdrvr] atl1: fix build
pasemi_mac: Use local-mac-address instead of mac-address if available
pasemi_mac: PHY support
pasemi_mac: Add msglevel support and "debug" module param
pasemi_mac: Logic cleanup / rx performance improvements
pasemi_mac: Minor cleanup / define fixes
pasemi_mac: Add SKB reuse / copy-break
pasemi_mac: Timer and interrupt fixes
pasemi_mac: Abstract and fix up interrupt restart routines
pasemi_mac: Move the IRQ mapping from the PCI layer to the driver
tc35815: Remove unnecessary skb->dev assignment
drivers/net/dm9000: Convert to generic boolean
AT91RM9200 Ethernet: Fix multicast addressing
AT91RM9200 Ethernet: Support additional PHYs
PCMCIA-NETDEV : xirc2ps_cs: bugfix of multicast code
sky2: re-enable 88E8056 for most motherboards
MIPS: Drop unnecessary CONFIG_ISA from RBTX49XX
ne: MIPS: Use platform_driver for ne on RBTX49XX
ne: Add NEEDS_PORTLIST to control ISA auto-probe
ne: Misc fixes for platform driver.
...
Fix conflict in drivers/net/pasemi_mac.c (get_property() got renamed to
of_get_property()) manually.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
30 files changed, 1188 insertions, 510 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 279ec625cec4..b86ccd2ecd5b 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1104,7 +1104,7 @@ config ETH16I | |||
1104 | 1104 | ||
1105 | config NE2000 | 1105 | config NE2000 |
1106 | tristate "NE2000/NE1000 support" | 1106 | tristate "NE2000/NE1000 support" |
1107 | depends on NET_ISA || (Q40 && m) || M32R | 1107 | depends on NET_ISA || (Q40 && m) || M32R || TOSHIBA_RBTX4927 || TOSHIBA_RBTX4938 |
1108 | select CRC32 | 1108 | select CRC32 |
1109 | ---help--- | 1109 | ---help--- |
1110 | If you have a network (Ethernet) card of this type, say Y and read | 1110 | If you have a network (Ethernet) card of this type, say Y and read |
@@ -2488,6 +2488,7 @@ config NETXEN_NIC | |||
2488 | config PASEMI_MAC | 2488 | config PASEMI_MAC |
2489 | tristate "PA Semi 1/10Gbit MAC" | 2489 | tristate "PA Semi 1/10Gbit MAC" |
2490 | depends on PPC64 && PCI | 2490 | depends on PPC64 && PCI |
2491 | select PHYLIB | ||
2491 | help | 2492 | help |
2492 | This driver supports the on-chip 1/10Gbit Ethernet controller on | 2493 | This driver supports the on-chip 1/10Gbit Ethernet controller on |
2493 | PA Semi's PWRficient line of chips. | 2494 | PA Semi's PWRficient line of chips. |
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c index 152fa7a042b8..ef2cc80256a3 100644 --- a/drivers/net/arm/at91_ether.c +++ b/drivers/net/arm/at91_ether.c | |||
@@ -225,6 +225,16 @@ static irqreturn_t at91ether_phy_interrupt(int irq, void *dev_id) | |||
225 | if (!(phy & ((1 << 2) | 1))) | 225 | if (!(phy & ((1 << 2) | 1))) |
226 | goto done; | 226 | goto done; |
227 | } | 227 | } |
228 | else if (lp->phy_type == MII_T78Q21x3_ID) { /* ack interrupt in Teridian PHY */ | ||
229 | read_phy(lp->phy_address, MII_T78Q21INT_REG, &phy); | ||
230 | if (!(phy & ((1 << 2) | 1))) | ||
231 | goto done; | ||
232 | } | ||
233 | else if (lp->phy_type == MII_DP83848_ID) { | ||
234 | read_phy(lp->phy_address, MII_DPPHYSTS_REG, &phy); /* ack interrupt in DP83848 PHY */ | ||
235 | if (!(phy & (1 << 7))) | ||
236 | goto done; | ||
237 | } | ||
228 | 238 | ||
229 | update_linkspeed(dev, 0); | 239 | update_linkspeed(dev, 0); |
230 | 240 | ||
@@ -280,6 +290,19 @@ static void enable_phyirq(struct net_device *dev) | |||
280 | dsintr = (1 << 10) | ( 1 << 8); | 290 | dsintr = (1 << 10) | ( 1 << 8); |
281 | write_phy(lp->phy_address, MII_TPISTATUS, dsintr); | 291 | write_phy(lp->phy_address, MII_TPISTATUS, dsintr); |
282 | } | 292 | } |
293 | else if (lp->phy_type == MII_T78Q21x3_ID) { /* for Teridian PHY */ | ||
294 | read_phy(lp->phy_address, MII_T78Q21INT_REG, &dsintr); | ||
295 | dsintr = dsintr | 0x500; /* set bits 8, 10 */ | ||
296 | write_phy(lp->phy_address, MII_T78Q21INT_REG, dsintr); | ||
297 | } | ||
298 | else if (lp->phy_type == MII_DP83848_ID) { /* National Semiconductor DP83848 PHY */ | ||
299 | read_phy(lp->phy_address, MII_DPMISR_REG, &dsintr); | ||
300 | dsintr = dsintr | 0x3c; /* set bits 2..5 */ | ||
301 | write_phy(lp->phy_address, MII_DPMISR_REG, dsintr); | ||
302 | read_phy(lp->phy_address, MII_DPMICR_REG, &dsintr); | ||
303 | dsintr = dsintr | 0x3; /* set bits 0,1 */ | ||
304 | write_phy(lp->phy_address, MII_DPMICR_REG, dsintr); | ||
305 | } | ||
283 | 306 | ||
284 | disable_mdi(); | 307 | disable_mdi(); |
285 | spin_unlock_irq(&lp->lock); | 308 | spin_unlock_irq(&lp->lock); |
@@ -323,6 +346,19 @@ static void disable_phyirq(struct net_device *dev) | |||
323 | dsintr = ~((1 << 10) | (1 << 8)); | 346 | dsintr = ~((1 << 10) | (1 << 8)); |
324 | write_phy(lp->phy_address, MII_TPISTATUS, dsintr); | 347 | write_phy(lp->phy_address, MII_TPISTATUS, dsintr); |
325 | } | 348 | } |
349 | else if (lp->phy_type == MII_T78Q21x3_ID) { /* for Teridian PHY */ | ||
350 | read_phy(lp->phy_address, MII_T78Q21INT_REG, &dsintr); | ||
351 | dsintr = dsintr & ~0x500; /* clear bits 8, 10 */ | ||
352 | write_phy(lp->phy_address, MII_T78Q21INT_REG, dsintr); | ||
353 | } | ||
354 | else if (lp->phy_type == MII_DP83848_ID) { /* National Semiconductor DP83848 PHY */ | ||
355 | read_phy(lp->phy_address, MII_DPMICR_REG, &dsintr); | ||
356 | dsintr = dsintr & ~0x3; /* clear bits 0, 1 */ | ||
357 | write_phy(lp->phy_address, MII_DPMICR_REG, dsintr); | ||
358 | read_phy(lp->phy_address, MII_DPMISR_REG, &dsintr); | ||
359 | dsintr = dsintr & ~0x3c; /* clear bits 2..5 */ | ||
360 | write_phy(lp->phy_address, MII_DPMISR_REG, dsintr); | ||
361 | } | ||
326 | 362 | ||
327 | disable_mdi(); | 363 | disable_mdi(); |
328 | spin_unlock_irq(&lp->lock); | 364 | spin_unlock_irq(&lp->lock); |
@@ -535,8 +571,8 @@ static void at91ether_sethashtable(struct net_device *dev) | |||
535 | mc_filter[bitnr >> 5] |= 1 << (bitnr & 31); | 571 | mc_filter[bitnr >> 5] |= 1 << (bitnr & 31); |
536 | } | 572 | } |
537 | 573 | ||
538 | at91_emac_write(AT91_EMAC_HSH, mc_filter[0]); | 574 | at91_emac_write(AT91_EMAC_HSL, mc_filter[0]); |
539 | at91_emac_write(AT91_EMAC_HSL, mc_filter[1]); | 575 | at91_emac_write(AT91_EMAC_HSH, mc_filter[1]); |
540 | } | 576 | } |
541 | 577 | ||
542 | /* | 578 | /* |
@@ -1062,10 +1098,16 @@ static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_add | |||
1062 | printk(KERN_INFO "%s: Broadcom BCM5221 PHY\n", dev->name); | 1098 | printk(KERN_INFO "%s: Broadcom BCM5221 PHY\n", dev->name); |
1063 | else if (phy_type == MII_DP83847_ID) | 1099 | else if (phy_type == MII_DP83847_ID) |
1064 | printk(KERN_INFO "%s: National Semiconductor DP83847 PHY\n", dev->name); | 1100 | printk(KERN_INFO "%s: National Semiconductor DP83847 PHY\n", dev->name); |
1101 | else if (phy_type == MII_DP83848_ID) | ||
1102 | printk(KERN_INFO "%s: National Semiconductor DP83848 PHY\n", dev->name); | ||
1065 | else if (phy_type == MII_AC101L_ID) | 1103 | else if (phy_type == MII_AC101L_ID) |
1066 | printk(KERN_INFO "%s: Altima AC101L PHY\n", dev->name); | 1104 | printk(KERN_INFO "%s: Altima AC101L PHY\n", dev->name); |
1067 | else if (phy_type == MII_KS8721_ID) | 1105 | else if (phy_type == MII_KS8721_ID) |
1068 | printk(KERN_INFO "%s: Micrel KS8721 PHY\n", dev->name); | 1106 | printk(KERN_INFO "%s: Micrel KS8721 PHY\n", dev->name); |
1107 | else if (phy_type == MII_T78Q21x3_ID) | ||
1108 | printk(KERN_INFO "%s: Teridian 78Q21x3 PHY\n", dev->name); | ||
1109 | else if (phy_type == MII_LAN83C185_ID) | ||
1110 | printk(KERN_INFO "%s: SMSC LAN83C185 PHY\n", dev->name); | ||
1069 | 1111 | ||
1070 | return 0; | 1112 | return 0; |
1071 | } | 1113 | } |
@@ -1103,8 +1145,11 @@ static int __init at91ether_probe(struct platform_device *pdev) | |||
1103 | case MII_RTL8201_ID: /* Realtek RTL8201: PHY_ID1 = 0, PHY_ID2 = 0x8201 */ | 1145 | case MII_RTL8201_ID: /* Realtek RTL8201: PHY_ID1 = 0, PHY_ID2 = 0x8201 */ |
1104 | case MII_BCM5221_ID: /* Broadcom BCM5221: PHY_ID1 = 0x40, PHY_ID2 = 0x61e0 */ | 1146 | case MII_BCM5221_ID: /* Broadcom BCM5221: PHY_ID1 = 0x40, PHY_ID2 = 0x61e0 */ |
1105 | case MII_DP83847_ID: /* National Semiconductor DP83847: */ | 1147 | case MII_DP83847_ID: /* National Semiconductor DP83847: */ |
1148 | case MII_DP83848_ID: /* National Semiconductor DP83848: */ | ||
1106 | case MII_AC101L_ID: /* Altima AC101L: PHY_ID1 = 0x22, PHY_ID2 = 0x5520 */ | 1149 | case MII_AC101L_ID: /* Altima AC101L: PHY_ID1 = 0x22, PHY_ID2 = 0x5520 */ |
1107 | case MII_KS8721_ID: /* Micrel KS8721: PHY_ID1 = 0x22, PHY_ID2 = 0x1610 */ | 1150 | case MII_KS8721_ID: /* Micrel KS8721: PHY_ID1 = 0x22, PHY_ID2 = 0x1610 */ |
1151 | case MII_T78Q21x3_ID: /* Teridian 78Q21x3: PHY_ID1 = 0x0E, PHY_ID2 = 7237 */ | ||
1152 | case MII_LAN83C185_ID: /* SMSC LAN83C185: PHY_ID1 = 0x0007, PHY_ID2 = 0xC0A1 */ | ||
1108 | detected = at91ether_setup(phy_id, phy_address, pdev, ether_clk); | 1153 | detected = at91ether_setup(phy_id, phy_address, pdev, ether_clk); |
1109 | break; | 1154 | break; |
1110 | } | 1155 | } |
diff --git a/drivers/net/arm/at91_ether.h b/drivers/net/arm/at91_ether.h index b6b665de2ea0..a38fd2d053a6 100644 --- a/drivers/net/arm/at91_ether.h +++ b/drivers/net/arm/at91_ether.h | |||
@@ -17,39 +17,46 @@ | |||
17 | 17 | ||
18 | 18 | ||
19 | /* Davicom 9161 PHY */ | 19 | /* Davicom 9161 PHY */ |
20 | #define MII_DM9161_ID 0x0181b880 | 20 | #define MII_DM9161_ID 0x0181b880 |
21 | #define MII_DM9161A_ID 0x0181b8a0 | 21 | #define MII_DM9161A_ID 0x0181b8a0 |
22 | 22 | #define MII_DSCR_REG 16 | |
23 | /* Davicom specific registers */ | 23 | #define MII_DSCSR_REG 17 |
24 | #define MII_DSCR_REG 16 | 24 | #define MII_DSINTR_REG 21 |
25 | #define MII_DSCSR_REG 17 | ||
26 | #define MII_DSINTR_REG 21 | ||
27 | 25 | ||
28 | /* Intel LXT971A PHY */ | 26 | /* Intel LXT971A PHY */ |
29 | #define MII_LXT971A_ID 0x001378E0 | 27 | #define MII_LXT971A_ID 0x001378E0 |
30 | 28 | #define MII_ISINTE_REG 18 | |
31 | /* Intel specific registers */ | 29 | #define MII_ISINTS_REG 19 |
32 | #define MII_ISINTE_REG 18 | 30 | #define MII_LEDCTRL_REG 20 |
33 | #define MII_ISINTS_REG 19 | ||
34 | #define MII_LEDCTRL_REG 20 | ||
35 | 31 | ||
36 | /* Realtek RTL8201 PHY */ | 32 | /* Realtek RTL8201 PHY */ |
37 | #define MII_RTL8201_ID 0x00008200 | 33 | #define MII_RTL8201_ID 0x00008200 |
38 | 34 | ||
39 | /* Broadcom BCM5221 PHY */ | 35 | /* Broadcom BCM5221 PHY */ |
40 | #define MII_BCM5221_ID 0x004061e0 | 36 | #define MII_BCM5221_ID 0x004061e0 |
41 | 37 | #define MII_BCMINTR_REG 26 | |
42 | /* Broadcom specific registers */ | ||
43 | #define MII_BCMINTR_REG 26 | ||
44 | 38 | ||
45 | /* National Semiconductor DP83847 */ | 39 | /* National Semiconductor DP83847 */ |
46 | #define MII_DP83847_ID 0x20005c30 | 40 | #define MII_DP83847_ID 0x20005c30 |
41 | |||
42 | /* National Semiconductor DP83848 */ | ||
43 | #define MII_DP83848_ID 0x20005c90 | ||
44 | #define MII_DPPHYSTS_REG 16 | ||
45 | #define MII_DPMICR_REG 17 | ||
46 | #define MII_DPMISR_REG 18 | ||
47 | 47 | ||
48 | /* Altima AC101L PHY */ | 48 | /* Altima AC101L PHY */ |
49 | #define MII_AC101L_ID 0x00225520 | 49 | #define MII_AC101L_ID 0x00225520 |
50 | 50 | ||
51 | /* Micrel KS8721 PHY */ | 51 | /* Micrel KS8721 PHY */ |
52 | #define MII_KS8721_ID 0x00221610 | 52 | #define MII_KS8721_ID 0x00221610 |
53 | |||
54 | /* Teridian 78Q2123/78Q2133 */ | ||
55 | #define MII_T78Q21x3_ID 0x000e7230 | ||
56 | #define MII_T78Q21INT_REG 17 | ||
57 | |||
58 | /* SMSC LAN83C185 */ | ||
59 | #define MII_LAN83C185_ID 0x0007C0A0 | ||
53 | 60 | ||
54 | /* ........................................................................ */ | 61 | /* ........................................................................ */ |
55 | 62 | ||
diff --git a/drivers/net/atl1/atl1_ethtool.c b/drivers/net/atl1/atl1_ethtool.c index c11c27798e5c..1f616c5c1473 100644 --- a/drivers/net/atl1/atl1_ethtool.c +++ b/drivers/net/atl1/atl1_ethtool.c | |||
@@ -156,8 +156,7 @@ static int atl1_set_settings(struct net_device *netdev, | |||
156 | u16 old_media_type = hw->media_type; | 156 | u16 old_media_type = hw->media_type; |
157 | 157 | ||
158 | if (netif_running(adapter->netdev)) { | 158 | if (netif_running(adapter->netdev)) { |
159 | printk(KERN_DEBUG "%s: ethtool shutting down adapter\n", | 159 | dev_dbg(&adapter->pdev->dev, "ethtool shutting down adapter\n"); |
160 | atl1_driver_name); | ||
161 | atl1_down(adapter); | 160 | atl1_down(adapter); |
162 | } | 161 | } |
163 | 162 | ||
@@ -166,9 +165,8 @@ static int atl1_set_settings(struct net_device *netdev, | |||
166 | else { | 165 | else { |
167 | if (ecmd->speed == SPEED_1000) { | 166 | if (ecmd->speed == SPEED_1000) { |
168 | if (ecmd->duplex != DUPLEX_FULL) { | 167 | if (ecmd->duplex != DUPLEX_FULL) { |
169 | printk(KERN_WARNING | 168 | dev_warn(&adapter->pdev->dev, |
170 | "%s: can't force to 1000M half duplex\n", | 169 | "can't force to 1000M half duplex\n"); |
171 | atl1_driver_name); | ||
172 | ret_val = -EINVAL; | 170 | ret_val = -EINVAL; |
173 | goto exit_sset; | 171 | goto exit_sset; |
174 | } | 172 | } |
@@ -206,9 +204,8 @@ static int atl1_set_settings(struct net_device *netdev, | |||
206 | } | 204 | } |
207 | if (atl1_phy_setup_autoneg_adv(hw)) { | 205 | if (atl1_phy_setup_autoneg_adv(hw)) { |
208 | ret_val = -EINVAL; | 206 | ret_val = -EINVAL; |
209 | printk(KERN_WARNING | 207 | dev_warn(&adapter->pdev->dev, |
210 | "%s: invalid ethtool speed/duplex setting\n", | 208 | "invalid ethtool speed/duplex setting\n"); |
211 | atl1_driver_name); | ||
212 | goto exit_sset; | 209 | goto exit_sset; |
213 | } | 210 | } |
214 | if (hw->media_type == MEDIA_TYPE_AUTO_SENSOR || | 211 | if (hw->media_type == MEDIA_TYPE_AUTO_SENSOR || |
@@ -239,12 +236,10 @@ exit_sset: | |||
239 | hw->media_type = old_media_type; | 236 | hw->media_type = old_media_type; |
240 | 237 | ||
241 | if (netif_running(adapter->netdev)) { | 238 | if (netif_running(adapter->netdev)) { |
242 | printk(KERN_DEBUG "%s: ethtool starting adapter\n", | 239 | dev_dbg(&adapter->pdev->dev, "ethtool starting adapter\n"); |
243 | atl1_driver_name); | ||
244 | atl1_up(adapter); | 240 | atl1_up(adapter); |
245 | } else if (!ret_val) { | 241 | } else if (!ret_val) { |
246 | printk(KERN_DEBUG "%s: ethtool resetting adapter\n", | 242 | dev_dbg(&adapter->pdev->dev, "ethtool resetting adapter\n"); |
247 | atl1_driver_name); | ||
248 | atl1_reset(adapter); | 243 | atl1_reset(adapter); |
249 | } | 244 | } |
250 | return ret_val; | 245 | return ret_val; |
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c index 69482e0d849b..ef886bdeac13 100644 --- a/drivers/net/atl1/atl1_hw.c +++ b/drivers/net/atl1/atl1_hw.c | |||
@@ -2,20 +2,20 @@ | |||
2 | * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved. | 2 | * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved. |
3 | * Copyright(c) 2006 Chris Snook <csnook@redhat.com> | 3 | * Copyright(c) 2006 Chris Snook <csnook@redhat.com> |
4 | * Copyright(c) 2006 Jay Cliburn <jcliburn@gmail.com> | 4 | * Copyright(c) 2006 Jay Cliburn <jcliburn@gmail.com> |
5 | * | 5 | * |
6 | * Derived from Intel e1000 driver | 6 | * Derived from Intel e1000 driver |
7 | * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved. | 7 | * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved. |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify it | 9 | * This program is free software; you can redistribute it and/or modify it |
10 | * under the terms of the GNU General Public License as published by the Free | 10 | * under the terms of the GNU General Public License as published by the Free |
11 | * Software Foundation; either version 2 of the License, or (at your option) | 11 | * Software Foundation; either version 2 of the License, or (at your option) |
12 | * any later version. | 12 | * any later version. |
13 | * | 13 | * |
14 | * This program is distributed in the hope that it will be useful, but WITHOUT | 14 | * This program is distributed in the hope that it will be useful, but WITHOUT |
15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | 16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
17 | * more details. | 17 | * more details. |
18 | * | 18 | * |
19 | * You should have received a copy of the GNU General Public License along with | 19 | * You should have received a copy of the GNU General Public License along with |
20 | * this program; if not, write to the Free Software Foundation, Inc., 59 | 20 | * this program; if not, write to the Free Software Foundation, Inc., 59 |
21 | * Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 21 | * Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
@@ -38,12 +38,13 @@ | |||
38 | */ | 38 | */ |
39 | s32 atl1_reset_hw(struct atl1_hw *hw) | 39 | s32 atl1_reset_hw(struct atl1_hw *hw) |
40 | { | 40 | { |
41 | struct pci_dev *pdev = hw->back->pdev; | ||
41 | u32 icr; | 42 | u32 icr; |
42 | int i; | 43 | int i; |
43 | 44 | ||
44 | /* | 45 | /* |
45 | * Clear Interrupt mask to stop board from generating | 46 | * Clear Interrupt mask to stop board from generating |
46 | * interrupts & Clear any pending interrupt events | 47 | * interrupts & Clear any pending interrupt events |
47 | */ | 48 | */ |
48 | /* | 49 | /* |
49 | * iowrite32(0, hw->hw_addr + REG_IMR); | 50 | * iowrite32(0, hw->hw_addr + REG_IMR); |
@@ -74,7 +75,7 @@ s32 atl1_reset_hw(struct atl1_hw *hw) | |||
74 | } | 75 | } |
75 | 76 | ||
76 | if (icr) { | 77 | if (icr) { |
77 | printk (KERN_DEBUG "icr = %x\n", icr); | 78 | dev_dbg(&pdev->dev, "ICR = 0x%x\n", icr); |
78 | return icr; | 79 | return icr; |
79 | } | 80 | } |
80 | 81 | ||
@@ -136,8 +137,8 @@ s32 atl1_read_phy_reg(struct atl1_hw *hw, u16 reg_addr, u16 *phy_data) | |||
136 | int i; | 137 | int i; |
137 | 138 | ||
138 | val = ((u32) (reg_addr & MDIO_REG_ADDR_MASK)) << MDIO_REG_ADDR_SHIFT | | 139 | val = ((u32) (reg_addr & MDIO_REG_ADDR_MASK)) << MDIO_REG_ADDR_SHIFT | |
139 | MDIO_START | MDIO_SUP_PREAMBLE | MDIO_RW | MDIO_CLK_25_4 << | 140 | MDIO_START | MDIO_SUP_PREAMBLE | MDIO_RW | MDIO_CLK_25_4 << |
140 | MDIO_CLK_SEL_SHIFT; | 141 | MDIO_CLK_SEL_SHIFT; |
141 | iowrite32(val, hw->hw_addr + REG_MDIO_CTRL); | 142 | iowrite32(val, hw->hw_addr + REG_MDIO_CTRL); |
142 | ioread32(hw->hw_addr + REG_MDIO_CTRL); | 143 | ioread32(hw->hw_addr + REG_MDIO_CTRL); |
143 | 144 | ||
@@ -204,7 +205,7 @@ static bool atl1_spi_read(struct atl1_hw *hw, u32 addr, u32 *buf) | |||
204 | 205 | ||
205 | /* | 206 | /* |
206 | * get_permanent_address | 207 | * get_permanent_address |
207 | * return 0 if get valid mac address, | 208 | * return 0 if get valid mac address, |
208 | */ | 209 | */ |
209 | static int atl1_get_permanent_address(struct atl1_hw *hw) | 210 | static int atl1_get_permanent_address(struct atl1_hw *hw) |
210 | { | 211 | { |
@@ -301,7 +302,7 @@ static int atl1_get_permanent_address(struct atl1_hw *hw) | |||
301 | } | 302 | } |
302 | 303 | ||
303 | /* | 304 | /* |
304 | * Reads the adapter's MAC address from the EEPROM | 305 | * Reads the adapter's MAC address from the EEPROM |
305 | * hw - Struct containing variables accessed by shared code | 306 | * hw - Struct containing variables accessed by shared code |
306 | */ | 307 | */ |
307 | s32 atl1_read_mac_addr(struct atl1_hw *hw) | 308 | s32 atl1_read_mac_addr(struct atl1_hw *hw) |
@@ -437,6 +438,7 @@ s32 atl1_phy_enter_power_saving(struct atl1_hw *hw) | |||
437 | */ | 438 | */ |
438 | static s32 atl1_phy_reset(struct atl1_hw *hw) | 439 | static s32 atl1_phy_reset(struct atl1_hw *hw) |
439 | { | 440 | { |
441 | struct pci_dev *pdev = hw->back->pdev; | ||
440 | s32 ret_val; | 442 | s32 ret_val; |
441 | u16 phy_data; | 443 | u16 phy_data; |
442 | 444 | ||
@@ -468,8 +470,7 @@ static s32 atl1_phy_reset(struct atl1_hw *hw) | |||
468 | u32 val; | 470 | u32 val; |
469 | int i; | 471 | int i; |
470 | /* pcie serdes link may be down! */ | 472 | /* pcie serdes link may be down! */ |
471 | printk(KERN_DEBUG "%s: autoneg caused pcie phy link down\n", | 473 | dev_dbg(&pdev->dev, "pcie phy link down\n"); |
472 | atl1_driver_name); | ||
473 | 474 | ||
474 | for (i = 0; i < 25; i++) { | 475 | for (i = 0; i < 25; i++) { |
475 | msleep(1); | 476 | msleep(1); |
@@ -479,9 +480,7 @@ static s32 atl1_phy_reset(struct atl1_hw *hw) | |||
479 | } | 480 | } |
480 | 481 | ||
481 | if ((val & (MDIO_START | MDIO_BUSY)) != 0) { | 482 | if ((val & (MDIO_START | MDIO_BUSY)) != 0) { |
482 | printk(KERN_WARNING | 483 | dev_warn(&pdev->dev, "pcie link down at least 25ms\n"); |
483 | "%s: pcie link down at least for 25ms\n", | ||
484 | atl1_driver_name); | ||
485 | return ret_val; | 484 | return ret_val; |
486 | } | 485 | } |
487 | } | 486 | } |
@@ -571,6 +570,7 @@ s32 atl1_phy_setup_autoneg_adv(struct atl1_hw *hw) | |||
571 | */ | 570 | */ |
572 | static s32 atl1_setup_link(struct atl1_hw *hw) | 571 | static s32 atl1_setup_link(struct atl1_hw *hw) |
573 | { | 572 | { |
573 | struct pci_dev *pdev = hw->back->pdev; | ||
574 | s32 ret_val; | 574 | s32 ret_val; |
575 | 575 | ||
576 | /* | 576 | /* |
@@ -581,15 +581,13 @@ static s32 atl1_setup_link(struct atl1_hw *hw) | |||
581 | */ | 581 | */ |
582 | ret_val = atl1_phy_setup_autoneg_adv(hw); | 582 | ret_val = atl1_phy_setup_autoneg_adv(hw); |
583 | if (ret_val) { | 583 | if (ret_val) { |
584 | printk(KERN_DEBUG "%s: error setting up autonegotiation\n", | 584 | dev_dbg(&pdev->dev, "error setting up autonegotiation\n"); |
585 | atl1_driver_name); | ||
586 | return ret_val; | 585 | return ret_val; |
587 | } | 586 | } |
588 | /* SW.Reset , En-Auto-Neg if needed */ | 587 | /* SW.Reset , En-Auto-Neg if needed */ |
589 | ret_val = atl1_phy_reset(hw); | 588 | ret_val = atl1_phy_reset(hw); |
590 | if (ret_val) { | 589 | if (ret_val) { |
591 | printk(KERN_DEBUG "%s: error resetting the phy\n", | 590 | dev_dbg(&pdev->dev, "error resetting phy\n"); |
592 | atl1_driver_name); | ||
593 | return ret_val; | 591 | return ret_val; |
594 | } | 592 | } |
595 | hw->phy_configured = true; | 593 | hw->phy_configured = true; |
@@ -631,7 +629,7 @@ static void atl1_init_flash_opcode(struct atl1_hw *hw) | |||
631 | * Performs basic configuration of the adapter. | 629 | * Performs basic configuration of the adapter. |
632 | * hw - Struct containing variables accessed by shared code | 630 | * hw - Struct containing variables accessed by shared code |
633 | * Assumes that the controller has previously been reset and is in a | 631 | * Assumes that the controller has previously been reset and is in a |
634 | * post-reset uninitialized state. Initializes multicast table, | 632 | * post-reset uninitialized state. Initializes multicast table, |
635 | * and Calls routines to setup link | 633 | * and Calls routines to setup link |
636 | * Leaves the transmit and receive units disabled and uninitialized. | 634 | * Leaves the transmit and receive units disabled and uninitialized. |
637 | */ | 635 | */ |
@@ -669,6 +667,7 @@ s32 atl1_init_hw(struct atl1_hw *hw) | |||
669 | */ | 667 | */ |
670 | s32 atl1_get_speed_and_duplex(struct atl1_hw *hw, u16 *speed, u16 *duplex) | 668 | s32 atl1_get_speed_and_duplex(struct atl1_hw *hw, u16 *speed, u16 *duplex) |
671 | { | 669 | { |
670 | struct pci_dev *pdev = hw->back->pdev; | ||
672 | s32 ret_val; | 671 | s32 ret_val; |
673 | u16 phy_data; | 672 | u16 phy_data; |
674 | 673 | ||
@@ -691,8 +690,7 @@ s32 atl1_get_speed_and_duplex(struct atl1_hw *hw, u16 *speed, u16 *duplex) | |||
691 | *speed = SPEED_10; | 690 | *speed = SPEED_10; |
692 | break; | 691 | break; |
693 | default: | 692 | default: |
694 | printk(KERN_DEBUG "%s: error getting speed\n", | 693 | dev_dbg(&pdev->dev, "error getting speed\n"); |
695 | atl1_driver_name); | ||
696 | return ATL1_ERR_PHY_SPEED; | 694 | return ATL1_ERR_PHY_SPEED; |
697 | break; | 695 | break; |
698 | } | 696 | } |
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index 4b1d4d153ecf..d28f88bbdd5f 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c | |||
@@ -188,8 +188,7 @@ s32 atl1_setup_ring_resources(struct atl1_adapter *adapter) | |||
188 | size = sizeof(struct atl1_buffer) * (tpd_ring->count + rfd_ring->count); | 188 | size = sizeof(struct atl1_buffer) * (tpd_ring->count + rfd_ring->count); |
189 | tpd_ring->buffer_info = kzalloc(size, GFP_KERNEL); | 189 | tpd_ring->buffer_info = kzalloc(size, GFP_KERNEL); |
190 | if (unlikely(!tpd_ring->buffer_info)) { | 190 | if (unlikely(!tpd_ring->buffer_info)) { |
191 | printk(KERN_WARNING "%s: kzalloc failed , size = D%d\n", | 191 | dev_err(&pdev->dev, "kzalloc failed , size = D%d\n", size); |
192 | atl1_driver_name, size); | ||
193 | goto err_nomem; | 192 | goto err_nomem; |
194 | } | 193 | } |
195 | rfd_ring->buffer_info = | 194 | rfd_ring->buffer_info = |
@@ -207,9 +206,7 @@ s32 atl1_setup_ring_resources(struct atl1_adapter *adapter) | |||
207 | ring_header->desc = pci_alloc_consistent(pdev, ring_header->size, | 206 | ring_header->desc = pci_alloc_consistent(pdev, ring_header->size, |
208 | &ring_header->dma); | 207 | &ring_header->dma); |
209 | if (unlikely(!ring_header->desc)) { | 208 | if (unlikely(!ring_header->desc)) { |
210 | printk(KERN_WARNING | 209 | dev_err(&pdev->dev, "pci_alloc_consistent failed\n"); |
211 | "%s: pci_alloc_consistent failed, size = D%d\n", | ||
212 | atl1_driver_name, size); | ||
213 | goto err_nomem; | 210 | goto err_nomem; |
214 | } | 211 | } |
215 | 212 | ||
@@ -373,8 +370,7 @@ static void atl1_rx_checksum(struct atl1_adapter *adapter, | |||
373 | if (rrd->err_flg & (ERR_FLAG_CRC | ERR_FLAG_TRUNC | | 370 | if (rrd->err_flg & (ERR_FLAG_CRC | ERR_FLAG_TRUNC | |
374 | ERR_FLAG_CODE | ERR_FLAG_OV)) { | 371 | ERR_FLAG_CODE | ERR_FLAG_OV)) { |
375 | adapter->hw_csum_err++; | 372 | adapter->hw_csum_err++; |
376 | printk(KERN_DEBUG "%s: rx checksum error\n", | 373 | dev_dbg(&adapter->pdev->dev, "rx checksum error\n"); |
377 | atl1_driver_name); | ||
378 | return; | 374 | return; |
379 | } | 375 | } |
380 | } | 376 | } |
@@ -393,8 +389,9 @@ static void atl1_rx_checksum(struct atl1_adapter *adapter, | |||
393 | } | 389 | } |
394 | 390 | ||
395 | /* IPv4, but hardware thinks its checksum is wrong */ | 391 | /* IPv4, but hardware thinks its checksum is wrong */ |
396 | printk(KERN_DEBUG "%s: hw csum wrong pkt_flag:%x, err_flag:%x\n", | 392 | dev_dbg(&adapter->pdev->dev, |
397 | atl1_driver_name, rrd->pkt_flg, rrd->err_flg); | 393 | "hw csum wrong, pkt_flag:%x, err_flag:%x\n", |
394 | rrd->pkt_flg, rrd->err_flg); | ||
398 | skb->ip_summed = CHECKSUM_COMPLETE; | 395 | skb->ip_summed = CHECKSUM_COMPLETE; |
399 | skb->csum = htons(rrd->xsz.xsum_sz.rx_chksum); | 396 | skb->csum = htons(rrd->xsz.xsum_sz.rx_chksum); |
400 | adapter->hw_csum_err++; | 397 | adapter->hw_csum_err++; |
@@ -507,14 +504,13 @@ chk_rrd: | |||
507 | /* rrd seems to be bad */ | 504 | /* rrd seems to be bad */ |
508 | if (unlikely(i-- > 0)) { | 505 | if (unlikely(i-- > 0)) { |
509 | /* rrd may not be DMAed completely */ | 506 | /* rrd may not be DMAed completely */ |
510 | printk(KERN_DEBUG | 507 | dev_dbg(&adapter->pdev->dev, |
511 | "%s: RRD may not be DMAed completely\n", | 508 | "incomplete RRD DMA transfer\n"); |
512 | atl1_driver_name); | ||
513 | udelay(1); | 509 | udelay(1); |
514 | goto chk_rrd; | 510 | goto chk_rrd; |
515 | } | 511 | } |
516 | /* bad rrd */ | 512 | /* bad rrd */ |
517 | printk(KERN_DEBUG "%s: bad RRD\n", atl1_driver_name); | 513 | dev_dbg(&adapter->pdev->dev, "bad RRD\n"); |
518 | /* see if update RFD index */ | 514 | /* see if update RFD index */ |
519 | if (rrd->num_buf > 1) { | 515 | if (rrd->num_buf > 1) { |
520 | u16 num_buf; | 516 | u16 num_buf; |
@@ -685,8 +681,8 @@ static void atl1_check_for_link(struct atl1_adapter *adapter) | |||
685 | /* notify upper layer link down ASAP */ | 681 | /* notify upper layer link down ASAP */ |
686 | if (!(phy_data & BMSR_LSTATUS)) { /* Link Down */ | 682 | if (!(phy_data & BMSR_LSTATUS)) { /* Link Down */ |
687 | if (netif_carrier_ok(netdev)) { /* old link state: Up */ | 683 | if (netif_carrier_ok(netdev)) { /* old link state: Up */ |
688 | printk(KERN_INFO "%s: %s link is down\n", | 684 | dev_info(&adapter->pdev->dev, "%s link is down\n", |
689 | atl1_driver_name, netdev->name); | 685 | netdev->name); |
690 | adapter->link_speed = SPEED_0; | 686 | adapter->link_speed = SPEED_0; |
691 | netif_carrier_off(netdev); | 687 | netif_carrier_off(netdev); |
692 | netif_stop_queue(netdev); | 688 | netif_stop_queue(netdev); |
@@ -731,8 +727,8 @@ static irqreturn_t atl1_intr(int irq, void *data) | |||
731 | 727 | ||
732 | /* check if PCIE PHY Link down */ | 728 | /* check if PCIE PHY Link down */ |
733 | if (status & ISR_PHY_LINKDOWN) { | 729 | if (status & ISR_PHY_LINKDOWN) { |
734 | printk(KERN_DEBUG "%s: pcie phy link down %x\n", | 730 | dev_dbg(&adapter->pdev->dev, "pcie phy link down %x\n", |
735 | atl1_driver_name, status); | 731 | status); |
736 | if (netif_running(adapter->netdev)) { /* reset MAC */ | 732 | if (netif_running(adapter->netdev)) { /* reset MAC */ |
737 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); | 733 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); |
738 | schedule_work(&adapter->pcie_dma_to_rst_task); | 734 | schedule_work(&adapter->pcie_dma_to_rst_task); |
@@ -742,9 +738,9 @@ static irqreturn_t atl1_intr(int irq, void *data) | |||
742 | 738 | ||
743 | /* check if DMA read/write error ? */ | 739 | /* check if DMA read/write error ? */ |
744 | if (status & (ISR_DMAR_TO_RST | ISR_DMAW_TO_RST)) { | 740 | if (status & (ISR_DMAR_TO_RST | ISR_DMAW_TO_RST)) { |
745 | printk(KERN_DEBUG | 741 | dev_dbg(&adapter->pdev->dev, |
746 | "%s: pcie DMA r/w error (status = 0x%x)\n", | 742 | "pcie DMA r/w error (status = 0x%x)\n", |
747 | atl1_driver_name, status); | 743 | status); |
748 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); | 744 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); |
749 | schedule_work(&adapter->pcie_dma_to_rst_task); | 745 | schedule_work(&adapter->pcie_dma_to_rst_task); |
750 | return IRQ_HANDLED; | 746 | return IRQ_HANDLED; |
@@ -762,14 +758,13 @@ static irqreturn_t atl1_intr(int irq, void *data) | |||
762 | 758 | ||
763 | /* rx exception */ | 759 | /* rx exception */ |
764 | if (unlikely(status & (ISR_RXF_OV | ISR_RFD_UNRUN | | 760 | if (unlikely(status & (ISR_RXF_OV | ISR_RFD_UNRUN | |
761 | ISR_RRD_OV | ISR_HOST_RFD_UNRUN | | ||
762 | ISR_HOST_RRD_OV | ISR_CMB_RX))) { | ||
763 | if (status & (ISR_RXF_OV | ISR_RFD_UNRUN | | ||
765 | ISR_RRD_OV | ISR_HOST_RFD_UNRUN | | 764 | ISR_RRD_OV | ISR_HOST_RFD_UNRUN | |
766 | ISR_HOST_RRD_OV | ISR_CMB_RX))) { | 765 | ISR_HOST_RRD_OV)) |
767 | if (status & | 766 | dev_dbg(&adapter->pdev->dev, |
768 | (ISR_RXF_OV | ISR_RFD_UNRUN | ISR_RRD_OV | | 767 | "rx exception, ISR = 0x%x\n", status); |
769 | ISR_HOST_RFD_UNRUN | ISR_HOST_RRD_OV)) | ||
770 | printk(KERN_INFO | ||
771 | "%s: rx exception: status = 0x%x\n", | ||
772 | atl1_driver_name, status); | ||
773 | atl1_intr_rx(adapter); | 768 | atl1_intr_rx(adapter); |
774 | } | 769 | } |
775 | 770 | ||
@@ -874,8 +869,7 @@ static u32 atl1_check_link(struct atl1_adapter *adapter) | |||
874 | atl1_read_phy_reg(hw, MII_BMSR, &phy_data); | 869 | atl1_read_phy_reg(hw, MII_BMSR, &phy_data); |
875 | if (!(phy_data & BMSR_LSTATUS)) { /* link down */ | 870 | if (!(phy_data & BMSR_LSTATUS)) { /* link down */ |
876 | if (netif_carrier_ok(netdev)) { /* old link state: Up */ | 871 | if (netif_carrier_ok(netdev)) { /* old link state: Up */ |
877 | printk(KERN_INFO "%s: link is down\n", | 872 | dev_info(&adapter->pdev->dev, "link is down\n"); |
878 | atl1_driver_name); | ||
879 | adapter->link_speed = SPEED_0; | 873 | adapter->link_speed = SPEED_0; |
880 | netif_carrier_off(netdev); | 874 | netif_carrier_off(netdev); |
881 | netif_stop_queue(netdev); | 875 | netif_stop_queue(netdev); |
@@ -918,11 +912,11 @@ static u32 atl1_check_link(struct atl1_adapter *adapter) | |||
918 | adapter->link_speed = speed; | 912 | adapter->link_speed = speed; |
919 | adapter->link_duplex = duplex; | 913 | adapter->link_duplex = duplex; |
920 | atl1_setup_mac_ctrl(adapter); | 914 | atl1_setup_mac_ctrl(adapter); |
921 | printk(KERN_INFO "%s: %s link is up %d Mbps %s\n", | 915 | dev_info(&adapter->pdev->dev, |
922 | atl1_driver_name, netdev->name, | 916 | "%s link is up %d Mbps %s\n", |
923 | adapter->link_speed, | 917 | netdev->name, adapter->link_speed, |
924 | adapter->link_duplex == | 918 | adapter->link_duplex == FULL_DUPLEX ? |
925 | FULL_DUPLEX ? "full duplex" : "half duplex"); | 919 | "full duplex" : "half duplex"); |
926 | } | 920 | } |
927 | if (!netif_carrier_ok(netdev)) { /* Link down -> Up */ | 921 | if (!netif_carrier_ok(netdev)) { /* Link down -> Up */ |
928 | netif_carrier_on(netdev); | 922 | netif_carrier_on(netdev); |
@@ -1330,8 +1324,8 @@ static int atl1_tx_csum(struct atl1_adapter *adapter, struct sk_buff *skb, | |||
1330 | cso = skb_transport_offset(skb); | 1324 | cso = skb_transport_offset(skb); |
1331 | css = cso + skb->csum_offset; | 1325 | css = cso + skb->csum_offset; |
1332 | if (unlikely(cso & 0x1)) { | 1326 | if (unlikely(cso & 0x1)) { |
1333 | printk(KERN_DEBUG "%s: payload offset != even number\n", | 1327 | dev_dbg(&adapter->pdev->dev, |
1334 | atl1_driver_name); | 1328 | "payload offset not an even number\n"); |
1335 | return -1; | 1329 | return -1; |
1336 | } | 1330 | } |
1337 | csum->csumpl |= (cso & CSUM_PARAM_PLOADOFFSET_MASK) << | 1331 | csum->csumpl |= (cso & CSUM_PARAM_PLOADOFFSET_MASK) << |
@@ -1579,7 +1573,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1579 | if (!spin_trylock(&adapter->lock)) { | 1573 | if (!spin_trylock(&adapter->lock)) { |
1580 | /* Can't get lock - tell upper layer to requeue */ | 1574 | /* Can't get lock - tell upper layer to requeue */ |
1581 | local_irq_restore(flags); | 1575 | local_irq_restore(flags); |
1582 | printk(KERN_DEBUG "%s: TX locked\n", atl1_driver_name); | 1576 | dev_dbg(&adapter->pdev->dev, "tx locked\n"); |
1583 | return NETDEV_TX_LOCKED; | 1577 | return NETDEV_TX_LOCKED; |
1584 | } | 1578 | } |
1585 | 1579 | ||
@@ -1587,7 +1581,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1587 | /* not enough descriptors */ | 1581 | /* not enough descriptors */ |
1588 | netif_stop_queue(netdev); | 1582 | netif_stop_queue(netdev); |
1589 | spin_unlock_irqrestore(&adapter->lock, flags); | 1583 | spin_unlock_irqrestore(&adapter->lock, flags); |
1590 | printk(KERN_DEBUG "%s: TX busy\n", atl1_driver_name); | 1584 | dev_dbg(&adapter->pdev->dev, "tx busy\n"); |
1591 | return NETDEV_TX_BUSY; | 1585 | return NETDEV_TX_BUSY; |
1592 | } | 1586 | } |
1593 | 1587 | ||
@@ -1841,8 +1835,7 @@ static int atl1_change_mtu(struct net_device *netdev, int new_mtu) | |||
1841 | 1835 | ||
1842 | if ((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) || | 1836 | if ((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) || |
1843 | (max_frame > MAX_JUMBO_FRAME_SIZE)) { | 1837 | (max_frame > MAX_JUMBO_FRAME_SIZE)) { |
1844 | printk(KERN_WARNING "%s: invalid MTU setting\n", | 1838 | dev_warn(&adapter->pdev->dev, "invalid MTU setting\n"); |
1845 | atl1_driver_name); | ||
1846 | return -EINVAL; | 1839 | return -EINVAL; |
1847 | } | 1840 | } |
1848 | 1841 | ||
@@ -2136,9 +2129,7 @@ static int __devinit atl1_probe(struct pci_dev *pdev, | |||
2136 | if (err) { | 2129 | if (err) { |
2137 | err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | 2130 | err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); |
2138 | if (err) { | 2131 | if (err) { |
2139 | printk(KERN_DEBUG | 2132 | dev_err(&pdev->dev, "no usable DMA configuration\n"); |
2140 | "%s: no usable DMA configuration, aborting\n", | ||
2141 | atl1_driver_name); | ||
2142 | goto err_dma; | 2133 | goto err_dma; |
2143 | } | 2134 | } |
2144 | pci_using_64 = false; | 2135 | pci_using_64 = false; |
@@ -2175,7 +2166,9 @@ static int __devinit atl1_probe(struct pci_dev *pdev, | |||
2175 | goto err_pci_iomap; | 2166 | goto err_pci_iomap; |
2176 | } | 2167 | } |
2177 | /* get device revision number */ | 2168 | /* get device revision number */ |
2178 | adapter->hw.dev_rev = ioread16(adapter->hw.hw_addr + (REG_MASTER_CTRL + 2)); | 2169 | adapter->hw.dev_rev = ioread16(adapter->hw.hw_addr + |
2170 | (REG_MASTER_CTRL + 2)); | ||
2171 | dev_info(&pdev->dev, "version %s\n", DRIVER_VERSION); | ||
2179 | 2172 | ||
2180 | /* set default ring resource counts */ | 2173 | /* set default ring resource counts */ |
2181 | adapter->rfd_ring.count = adapter->rrd_ring.count = ATL1_DEFAULT_RFD; | 2174 | adapter->rfd_ring.count = adapter->rrd_ring.count = ATL1_DEFAULT_RFD; |
@@ -2466,8 +2459,6 @@ static void __exit atl1_exit_module(void) | |||
2466 | */ | 2459 | */ |
2467 | static int __init atl1_init_module(void) | 2460 | static int __init atl1_init_module(void) |
2468 | { | 2461 | { |
2469 | printk(KERN_INFO "%s - version %s\n", atl1_driver_string, DRIVER_VERSION); | ||
2470 | printk(KERN_INFO "%s\n", atl1_copyright); | ||
2471 | return pci_register_driver(&atl1_driver); | 2462 | return pci_register_driver(&atl1_driver); |
2472 | } | 2463 | } |
2473 | 2464 | ||
diff --git a/drivers/net/atl1/atl1_param.c b/drivers/net/atl1/atl1_param.c index bcd0bd891722..4246bb9bd50e 100644 --- a/drivers/net/atl1/atl1_param.c +++ b/drivers/net/atl1/atl1_param.c | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include <linux/types.h> | 24 | #include <linux/types.h> |
25 | #include <linux/moduleparam.h> | 25 | #include <linux/moduleparam.h> |
26 | #include <linux/pci.h> | ||
26 | #include "atl1.h" | 27 | #include "atl1.h" |
27 | 28 | ||
28 | /* | 29 | /* |
@@ -93,7 +94,7 @@ struct atl1_option { | |||
93 | } arg; | 94 | } arg; |
94 | }; | 95 | }; |
95 | 96 | ||
96 | static int __devinit atl1_validate_option(int *value, struct atl1_option *opt) | 97 | static int __devinit atl1_validate_option(int *value, struct atl1_option *opt, struct pci_dev *pdev) |
97 | { | 98 | { |
98 | if (*value == OPTION_UNSET) { | 99 | if (*value == OPTION_UNSET) { |
99 | *value = opt->def; | 100 | *value = opt->def; |
@@ -104,19 +105,17 @@ static int __devinit atl1_validate_option(int *value, struct atl1_option *opt) | |||
104 | case enable_option: | 105 | case enable_option: |
105 | switch (*value) { | 106 | switch (*value) { |
106 | case OPTION_ENABLED: | 107 | case OPTION_ENABLED: |
107 | printk(KERN_INFO "%s: %s Enabled\n", atl1_driver_name, | 108 | dev_info(&pdev->dev, "%s enabled\n", opt->name); |
108 | opt->name); | ||
109 | return 0; | 109 | return 0; |
110 | case OPTION_DISABLED: | 110 | case OPTION_DISABLED: |
111 | printk(KERN_INFO "%s: %s Disabled\n", atl1_driver_name, | 111 | dev_info(&pdev->dev, "%s disabled\n", opt->name); |
112 | opt->name); | ||
113 | return 0; | 112 | return 0; |
114 | } | 113 | } |
115 | break; | 114 | break; |
116 | case range_option: | 115 | case range_option: |
117 | if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) { | 116 | if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) { |
118 | printk(KERN_INFO "%s: %s set to %i\n", | 117 | dev_info(&pdev->dev, "%s set to %i\n", opt->name, |
119 | atl1_driver_name, opt->name, *value); | 118 | *value); |
120 | return 0; | 119 | return 0; |
121 | } | 120 | } |
122 | break; | 121 | break; |
@@ -128,8 +127,8 @@ static int __devinit atl1_validate_option(int *value, struct atl1_option *opt) | |||
128 | ent = &opt->arg.l.p[i]; | 127 | ent = &opt->arg.l.p[i]; |
129 | if (*value == ent->i) { | 128 | if (*value == ent->i) { |
130 | if (ent->str[0] != '\0') | 129 | if (ent->str[0] != '\0') |
131 | printk(KERN_INFO "%s: %s\n", | 130 | dev_info(&pdev->dev, "%s\n", |
132 | atl1_driver_name, ent->str); | 131 | ent->str); |
133 | return 0; | 132 | return 0; |
134 | } | 133 | } |
135 | } | 134 | } |
@@ -140,8 +139,8 @@ static int __devinit atl1_validate_option(int *value, struct atl1_option *opt) | |||
140 | break; | 139 | break; |
141 | } | 140 | } |
142 | 141 | ||
143 | printk(KERN_INFO "%s: invalid %s specified (%i) %s\n", | 142 | dev_info(&pdev->dev, "invalid %s specified (%i) %s\n", |
144 | atl1_driver_name, opt->name, *value, opt->err); | 143 | opt->name, *value, opt->err); |
145 | *value = opt->def; | 144 | *value = opt->def; |
146 | return -1; | 145 | return -1; |
147 | } | 146 | } |
@@ -157,12 +156,11 @@ static int __devinit atl1_validate_option(int *value, struct atl1_option *opt) | |||
157 | */ | 156 | */ |
158 | void __devinit atl1_check_options(struct atl1_adapter *adapter) | 157 | void __devinit atl1_check_options(struct atl1_adapter *adapter) |
159 | { | 158 | { |
159 | struct pci_dev *pdev = adapter->pdev; | ||
160 | int bd = adapter->bd_number; | 160 | int bd = adapter->bd_number; |
161 | if (bd >= ATL1_MAX_NIC) { | 161 | if (bd >= ATL1_MAX_NIC) { |
162 | printk(KERN_NOTICE "%s: warning: no configuration for board #%i\n", | 162 | dev_notice(&pdev->dev, "no configuration for board#%i\n", bd); |
163 | atl1_driver_name, bd); | 163 | dev_notice(&pdev->dev, "using defaults for all values\n"); |
164 | printk(KERN_NOTICE "%s: using defaults for all values\n", | ||
165 | atl1_driver_name); | ||
166 | } | 164 | } |
167 | { /* Interrupt Moderate Timer */ | 165 | { /* Interrupt Moderate Timer */ |
168 | struct atl1_option opt = { | 166 | struct atl1_option opt = { |
@@ -177,7 +175,7 @@ void __devinit atl1_check_options(struct atl1_adapter *adapter) | |||
177 | int val; | 175 | int val; |
178 | if (num_int_mod_timer > bd) { | 176 | if (num_int_mod_timer > bd) { |
179 | val = int_mod_timer[bd]; | 177 | val = int_mod_timer[bd]; |
180 | atl1_validate_option(&val, &opt); | 178 | atl1_validate_option(&val, &opt, pdev); |
181 | adapter->imt = (u16) val; | 179 | adapter->imt = (u16) val; |
182 | } else | 180 | } else |
183 | adapter->imt = (u16) (opt.def); | 181 | adapter->imt = (u16) (opt.def); |
@@ -197,7 +195,7 @@ void __devinit atl1_check_options(struct atl1_adapter *adapter) | |||
197 | int val; | 195 | int val; |
198 | if (num_flash_vendor > bd) { | 196 | if (num_flash_vendor > bd) { |
199 | val = flash_vendor[bd]; | 197 | val = flash_vendor[bd]; |
200 | atl1_validate_option(&val, &opt); | 198 | atl1_validate_option(&val, &opt, pdev); |
201 | adapter->hw.flash_vendor = (u8) val; | 199 | adapter->hw.flash_vendor = (u8) val; |
202 | } else | 200 | } else |
203 | adapter->hw.flash_vendor = (u8) (opt.def); | 201 | adapter->hw.flash_vendor = (u8) (opt.def); |
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index 8cc1174e7f64..264fa0e2e075 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -77,9 +77,6 @@ | |||
77 | 77 | ||
78 | #define DM9000_PHY 0x40 /* PHY address 0x01 */ | 78 | #define DM9000_PHY 0x40 /* PHY address 0x01 */ |
79 | 79 | ||
80 | #define TRUE 1 | ||
81 | #define FALSE 0 | ||
82 | |||
83 | #define CARDNAME "dm9000" | 80 | #define CARDNAME "dm9000" |
84 | #define PFX CARDNAME ": " | 81 | #define PFX CARDNAME ": " |
85 | 82 | ||
@@ -601,7 +598,7 @@ dm9000_probe(struct platform_device *pdev) | |||
601 | printk("%s: not found (%d).\n", CARDNAME, ret); | 598 | printk("%s: not found (%d).\n", CARDNAME, ret); |
602 | 599 | ||
603 | dm9000_release_board(pdev, db); | 600 | dm9000_release_board(pdev, db); |
604 | kfree(ndev); | 601 | free_netdev(ndev); |
605 | 602 | ||
606 | return ret; | 603 | return ret; |
607 | } | 604 | } |
@@ -896,7 +893,7 @@ dm9000_rx(struct net_device *dev) | |||
896 | struct dm9000_rxhdr rxhdr; | 893 | struct dm9000_rxhdr rxhdr; |
897 | struct sk_buff *skb; | 894 | struct sk_buff *skb; |
898 | u8 rxbyte, *rdptr; | 895 | u8 rxbyte, *rdptr; |
899 | int GoodPacket; | 896 | bool GoodPacket; |
900 | int RxLen; | 897 | int RxLen; |
901 | 898 | ||
902 | /* Check packet ready or not */ | 899 | /* Check packet ready or not */ |
@@ -918,7 +915,7 @@ dm9000_rx(struct net_device *dev) | |||
918 | return; | 915 | return; |
919 | 916 | ||
920 | /* A packet ready now & Get status/length */ | 917 | /* A packet ready now & Get status/length */ |
921 | GoodPacket = TRUE; | 918 | GoodPacket = true; |
922 | writeb(DM9000_MRCMD, db->io_addr); | 919 | writeb(DM9000_MRCMD, db->io_addr); |
923 | 920 | ||
924 | (db->inblk)(db->io_data, &rxhdr, sizeof(rxhdr)); | 921 | (db->inblk)(db->io_data, &rxhdr, sizeof(rxhdr)); |
@@ -927,7 +924,7 @@ dm9000_rx(struct net_device *dev) | |||
927 | 924 | ||
928 | /* Packet Status check */ | 925 | /* Packet Status check */ |
929 | if (RxLen < 0x40) { | 926 | if (RxLen < 0x40) { |
930 | GoodPacket = FALSE; | 927 | GoodPacket = false; |
931 | PRINTK1("Bad Packet received (runt)\n"); | 928 | PRINTK1("Bad Packet received (runt)\n"); |
932 | } | 929 | } |
933 | 930 | ||
@@ -936,7 +933,7 @@ dm9000_rx(struct net_device *dev) | |||
936 | } | 933 | } |
937 | 934 | ||
938 | if (rxhdr.RxStatus & 0xbf00) { | 935 | if (rxhdr.RxStatus & 0xbf00) { |
939 | GoodPacket = FALSE; | 936 | GoodPacket = false; |
940 | if (rxhdr.RxStatus & 0x100) { | 937 | if (rxhdr.RxStatus & 0x100) { |
941 | PRINTK1("fifo error\n"); | 938 | PRINTK1("fifo error\n"); |
942 | db->stats.rx_fifo_errors++; | 939 | db->stats.rx_fifo_errors++; |
@@ -1193,7 +1190,7 @@ dm9000_drv_remove(struct platform_device *pdev) | |||
1193 | 1190 | ||
1194 | unregister_netdev(ndev); | 1191 | unregister_netdev(ndev); |
1195 | dm9000_release_board(pdev, (board_info_t *) ndev->priv); | 1192 | dm9000_release_board(pdev, (board_info_t *) ndev->priv); |
1196 | kfree(ndev); /* free device structure */ | 1193 | free_netdev(ndev); /* free device structure */ |
1197 | 1194 | ||
1198 | PRINTK1("clean_module() exit\n"); | 1195 | PRINTK1("clean_module() exit\n"); |
1199 | 1196 | ||
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index a1bd2d861d92..f6e0cb1ada1f 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -1803,10 +1803,10 @@ static inline int ehea_hash_skb(struct sk_buff *skb, int num_qps) | |||
1803 | u32 tmp; | 1803 | u32 tmp; |
1804 | 1804 | ||
1805 | if ((skb->protocol == htons(ETH_P_IP)) && | 1805 | if ((skb->protocol == htons(ETH_P_IP)) && |
1806 | (skb->nh.iph->protocol == IPPROTO_TCP)) { | 1806 | (ip_hdr(skb)->protocol == IPPROTO_TCP)) { |
1807 | tcp = (struct tcphdr*)(skb->nh.raw + (skb->nh.iph->ihl * 4)); | 1807 | tcp = (struct tcphdr*)(skb_network_header(skb) + (ip_hdr(skb)->ihl * 4)); |
1808 | tmp = (tcp->source + (tcp->dest << 16)) % 31; | 1808 | tmp = (tcp->source + (tcp->dest << 16)) % 31; |
1809 | tmp += skb->nh.iph->daddr % 31; | 1809 | tmp += ip_hdr(skb)->daddr % 31; |
1810 | return tmp % num_qps; | 1810 | return tmp % num_qps; |
1811 | } | 1811 | } |
1812 | else | 1812 | else |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index 16e3c4315e82..5d14be7405a3 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -290,6 +290,8 @@ MODULE_PARM_DESC(myri10ge_wcfifo, "Enable WC Fifo when WC is enabled\n"); | |||
290 | 290 | ||
291 | #define myri10ge_pio_copy(to,from,size) __iowrite64_copy(to,from,size/8) | 291 | #define myri10ge_pio_copy(to,from,size) __iowrite64_copy(to,from,size/8) |
292 | 292 | ||
293 | static void myri10ge_set_multicast_list(struct net_device *dev); | ||
294 | |||
293 | static inline void put_be32(__be32 val, __be32 __iomem * p) | 295 | static inline void put_be32(__be32 val, __be32 __iomem * p) |
294 | { | 296 | { |
295 | __raw_writel((__force __u32) val, (__force void __iomem *)p); | 297 | __raw_writel((__force __u32) val, (__force void __iomem *)p); |
@@ -353,6 +355,8 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd, | |||
353 | return 0; | 355 | return 0; |
354 | } else if (result == MXGEFW_CMD_UNKNOWN) { | 356 | } else if (result == MXGEFW_CMD_UNKNOWN) { |
355 | return -ENOSYS; | 357 | return -ENOSYS; |
358 | } else if (result == MXGEFW_CMD_ERROR_UNALIGNED) { | ||
359 | return -E2BIG; | ||
356 | } else { | 360 | } else { |
357 | dev_err(&mgp->pdev->dev, | 361 | dev_err(&mgp->pdev->dev, |
358 | "command %d failed, result = %d\n", | 362 | "command %d failed, result = %d\n", |
@@ -712,14 +716,78 @@ myri10ge_change_promisc(struct myri10ge_priv *mgp, int promisc, int atomic) | |||
712 | mgp->dev->name); | 716 | mgp->dev->name); |
713 | } | 717 | } |
714 | 718 | ||
715 | static int myri10ge_reset(struct myri10ge_priv *mgp) | 719 | static int myri10ge_dma_test(struct myri10ge_priv *mgp, int test_type) |
716 | { | 720 | { |
717 | struct myri10ge_cmd cmd; | 721 | struct myri10ge_cmd cmd; |
718 | int status; | 722 | int status; |
719 | size_t bytes; | ||
720 | u32 len; | 723 | u32 len; |
721 | struct page *dmatest_page; | 724 | struct page *dmatest_page; |
722 | dma_addr_t dmatest_bus; | 725 | dma_addr_t dmatest_bus; |
726 | char *test = " "; | ||
727 | |||
728 | dmatest_page = alloc_page(GFP_KERNEL); | ||
729 | if (!dmatest_page) | ||
730 | return -ENOMEM; | ||
731 | dmatest_bus = pci_map_page(mgp->pdev, dmatest_page, 0, PAGE_SIZE, | ||
732 | DMA_BIDIRECTIONAL); | ||
733 | |||
734 | /* Run a small DMA test. | ||
735 | * The magic multipliers to the length tell the firmware | ||
736 | * to do DMA read, write, or read+write tests. The | ||
737 | * results are returned in cmd.data0. The upper 16 | ||
738 | * bits or the return is the number of transfers completed. | ||
739 | * The lower 16 bits is the time in 0.5us ticks that the | ||
740 | * transfers took to complete. | ||
741 | */ | ||
742 | |||
743 | len = mgp->tx.boundary; | ||
744 | |||
745 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus); | ||
746 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus); | ||
747 | cmd.data2 = len * 0x10000; | ||
748 | status = myri10ge_send_cmd(mgp, test_type, &cmd, 0); | ||
749 | if (status != 0) { | ||
750 | test = "read"; | ||
751 | goto abort; | ||
752 | } | ||
753 | mgp->read_dma = ((cmd.data0 >> 16) * len * 2) / (cmd.data0 & 0xffff); | ||
754 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus); | ||
755 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus); | ||
756 | cmd.data2 = len * 0x1; | ||
757 | status = myri10ge_send_cmd(mgp, test_type, &cmd, 0); | ||
758 | if (status != 0) { | ||
759 | test = "write"; | ||
760 | goto abort; | ||
761 | } | ||
762 | mgp->write_dma = ((cmd.data0 >> 16) * len * 2) / (cmd.data0 & 0xffff); | ||
763 | |||
764 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus); | ||
765 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus); | ||
766 | cmd.data2 = len * 0x10001; | ||
767 | status = myri10ge_send_cmd(mgp, test_type, &cmd, 0); | ||
768 | if (status != 0) { | ||
769 | test = "read/write"; | ||
770 | goto abort; | ||
771 | } | ||
772 | mgp->read_write_dma = ((cmd.data0 >> 16) * len * 2 * 2) / | ||
773 | (cmd.data0 & 0xffff); | ||
774 | |||
775 | abort: | ||
776 | pci_unmap_page(mgp->pdev, dmatest_bus, PAGE_SIZE, DMA_BIDIRECTIONAL); | ||
777 | put_page(dmatest_page); | ||
778 | |||
779 | if (status != 0 && test_type != MXGEFW_CMD_UNALIGNED_TEST) | ||
780 | dev_warn(&mgp->pdev->dev, "DMA %s benchmark failed: %d\n", | ||
781 | test, status); | ||
782 | |||
783 | return status; | ||
784 | } | ||
785 | |||
786 | static int myri10ge_reset(struct myri10ge_priv *mgp) | ||
787 | { | ||
788 | struct myri10ge_cmd cmd; | ||
789 | int status; | ||
790 | size_t bytes; | ||
723 | 791 | ||
724 | /* try to send a reset command to the card to see if it | 792 | /* try to send a reset command to the card to see if it |
725 | * is alive */ | 793 | * is alive */ |
@@ -729,11 +797,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
729 | dev_err(&mgp->pdev->dev, "failed reset\n"); | 797 | dev_err(&mgp->pdev->dev, "failed reset\n"); |
730 | return -ENXIO; | 798 | return -ENXIO; |
731 | } | 799 | } |
732 | dmatest_page = alloc_page(GFP_KERNEL); | 800 | |
733 | if (!dmatest_page) | 801 | (void)myri10ge_dma_test(mgp, MXGEFW_DMA_TEST); |
734 | return -ENOMEM; | ||
735 | dmatest_bus = pci_map_page(mgp->pdev, dmatest_page, 0, PAGE_SIZE, | ||
736 | DMA_BIDIRECTIONAL); | ||
737 | 802 | ||
738 | /* Now exchange information about interrupts */ | 803 | /* Now exchange information about interrupts */ |
739 | 804 | ||
@@ -761,52 +826,6 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
761 | } | 826 | } |
762 | put_be32(htonl(mgp->intr_coal_delay), mgp->intr_coal_delay_ptr); | 827 | put_be32(htonl(mgp->intr_coal_delay), mgp->intr_coal_delay_ptr); |
763 | 828 | ||
764 | /* Run a small DMA test. | ||
765 | * The magic multipliers to the length tell the firmware | ||
766 | * to do DMA read, write, or read+write tests. The | ||
767 | * results are returned in cmd.data0. The upper 16 | ||
768 | * bits or the return is the number of transfers completed. | ||
769 | * The lower 16 bits is the time in 0.5us ticks that the | ||
770 | * transfers took to complete. | ||
771 | */ | ||
772 | |||
773 | len = mgp->tx.boundary; | ||
774 | |||
775 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus); | ||
776 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus); | ||
777 | cmd.data2 = len * 0x10000; | ||
778 | status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); | ||
779 | if (status == 0) | ||
780 | mgp->read_dma = ((cmd.data0 >> 16) * len * 2) / | ||
781 | (cmd.data0 & 0xffff); | ||
782 | else | ||
783 | dev_warn(&mgp->pdev->dev, "DMA read benchmark failed: %d\n", | ||
784 | status); | ||
785 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus); | ||
786 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus); | ||
787 | cmd.data2 = len * 0x1; | ||
788 | status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); | ||
789 | if (status == 0) | ||
790 | mgp->write_dma = ((cmd.data0 >> 16) * len * 2) / | ||
791 | (cmd.data0 & 0xffff); | ||
792 | else | ||
793 | dev_warn(&mgp->pdev->dev, "DMA write benchmark failed: %d\n", | ||
794 | status); | ||
795 | |||
796 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus); | ||
797 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus); | ||
798 | cmd.data2 = len * 0x10001; | ||
799 | status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); | ||
800 | if (status == 0) | ||
801 | mgp->read_write_dma = ((cmd.data0 >> 16) * len * 2 * 2) / | ||
802 | (cmd.data0 & 0xffff); | ||
803 | else | ||
804 | dev_warn(&mgp->pdev->dev, | ||
805 | "DMA read/write benchmark failed: %d\n", status); | ||
806 | |||
807 | pci_unmap_page(mgp->pdev, dmatest_bus, PAGE_SIZE, DMA_BIDIRECTIONAL); | ||
808 | put_page(dmatest_page); | ||
809 | |||
810 | memset(mgp->rx_done.entry, 0, bytes); | 829 | memset(mgp->rx_done.entry, 0, bytes); |
811 | 830 | ||
812 | /* reset mcp/driver shared state back to 0 */ | 831 | /* reset mcp/driver shared state back to 0 */ |
@@ -820,10 +839,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
820 | mgp->rx_done.cnt = 0; | 839 | mgp->rx_done.cnt = 0; |
821 | mgp->link_changes = 0; | 840 | mgp->link_changes = 0; |
822 | status = myri10ge_update_mac_address(mgp, mgp->dev->dev_addr); | 841 | status = myri10ge_update_mac_address(mgp, mgp->dev->dev_addr); |
823 | myri10ge_change_promisc(mgp, 0, 0); | ||
824 | myri10ge_change_pause(mgp, mgp->pause); | 842 | myri10ge_change_pause(mgp, mgp->pause); |
825 | if (mgp->adopted_rx_filter_bug) | 843 | myri10ge_set_multicast_list(mgp->dev); |
826 | (void)myri10ge_send_cmd(mgp, MXGEFW_ENABLE_ALLMULTI, &cmd, 1); | ||
827 | return status; | 844 | return status; |
828 | } | 845 | } |
829 | 846 | ||
@@ -1355,7 +1372,9 @@ static const char myri10ge_gstrings_stats[][ETH_GSTRING_LEN] = { | |||
1355 | "tx_req", "tx_done", "rx_small_cnt", "rx_big_cnt", | 1372 | "tx_req", "tx_done", "rx_small_cnt", "rx_big_cnt", |
1356 | "wake_queue", "stop_queue", "watchdog_resets", "tx_linearized", | 1373 | "wake_queue", "stop_queue", "watchdog_resets", "tx_linearized", |
1357 | "link_changes", "link_up", "dropped_link_overflow", | 1374 | "link_changes", "link_up", "dropped_link_overflow", |
1358 | "dropped_link_error_or_filtered", "dropped_multicast_filtered", | 1375 | "dropped_link_error_or_filtered", |
1376 | "dropped_pause", "dropped_bad_phy", "dropped_bad_crc32", | ||
1377 | "dropped_unicast_filtered", "dropped_multicast_filtered", | ||
1359 | "dropped_runt", "dropped_overrun", "dropped_no_small_buffer", | 1378 | "dropped_runt", "dropped_overrun", "dropped_no_small_buffer", |
1360 | "dropped_no_big_buffer" | 1379 | "dropped_no_big_buffer" |
1361 | }; | 1380 | }; |
@@ -1412,6 +1431,11 @@ myri10ge_get_ethtool_stats(struct net_device *netdev, | |||
1412 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_link_overflow); | 1431 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_link_overflow); |
1413 | data[i++] = | 1432 | data[i++] = |
1414 | (unsigned int)ntohl(mgp->fw_stats->dropped_link_error_or_filtered); | 1433 | (unsigned int)ntohl(mgp->fw_stats->dropped_link_error_or_filtered); |
1434 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_pause); | ||
1435 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_bad_phy); | ||
1436 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_bad_crc32); | ||
1437 | data[i++] = | ||
1438 | (unsigned int)ntohl(mgp->fw_stats->dropped_unicast_filtered); | ||
1415 | data[i++] = | 1439 | data[i++] = |
1416 | (unsigned int)ntohl(mgp->fw_stats->dropped_multicast_filtered); | 1440 | (unsigned int)ntohl(mgp->fw_stats->dropped_multicast_filtered); |
1417 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_runt); | 1441 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_runt); |
@@ -2276,7 +2300,7 @@ static void myri10ge_set_multicast_list(struct net_device *dev) | |||
2276 | myri10ge_change_promisc(mgp, dev->flags & IFF_PROMISC, 1); | 2300 | myri10ge_change_promisc(mgp, dev->flags & IFF_PROMISC, 1); |
2277 | 2301 | ||
2278 | /* This firmware is known to not support multicast */ | 2302 | /* This firmware is known to not support multicast */ |
2279 | if (!mgp->fw_multicast_support || mgp->adopted_rx_filter_bug) | 2303 | if (!mgp->fw_multicast_support) |
2280 | return; | 2304 | return; |
2281 | 2305 | ||
2282 | /* Disable multicast filtering */ | 2306 | /* Disable multicast filtering */ |
@@ -2288,7 +2312,7 @@ static void myri10ge_set_multicast_list(struct net_device *dev) | |||
2288 | goto abort; | 2312 | goto abort; |
2289 | } | 2313 | } |
2290 | 2314 | ||
2291 | if (dev->flags & IFF_ALLMULTI) { | 2315 | if ((dev->flags & IFF_ALLMULTI) || mgp->adopted_rx_filter_bug) { |
2292 | /* request to disable multicast filtering, so quit here */ | 2316 | /* request to disable multicast filtering, so quit here */ |
2293 | return; | 2317 | return; |
2294 | } | 2318 | } |
@@ -2461,8 +2485,6 @@ static void myri10ge_enable_ecrc(struct myri10ge_priv *mgp) | |||
2461 | err_cap |= PCI_ERR_CAP_ECRC_GENE; | 2485 | err_cap |= PCI_ERR_CAP_ECRC_GENE; |
2462 | pci_write_config_dword(bridge, cap + PCI_ERR_CAP, err_cap); | 2486 | pci_write_config_dword(bridge, cap + PCI_ERR_CAP, err_cap); |
2463 | dev_info(dev, "Enabled ECRC on upstream bridge %s\n", pci_name(bridge)); | 2487 | dev_info(dev, "Enabled ECRC on upstream bridge %s\n", pci_name(bridge)); |
2464 | mgp->tx.boundary = 4096; | ||
2465 | mgp->fw_name = myri10ge_fw_aligned; | ||
2466 | } | 2488 | } |
2467 | 2489 | ||
2468 | /* | 2490 | /* |
@@ -2484,22 +2506,70 @@ static void myri10ge_enable_ecrc(struct myri10ge_priv *mgp) | |||
2484 | * firmware image, and set tx.boundary to 4KB. | 2506 | * firmware image, and set tx.boundary to 4KB. |
2485 | */ | 2507 | */ |
2486 | 2508 | ||
2487 | #define PCI_DEVICE_ID_INTEL_E5000_PCIE23 0x25f7 | 2509 | static void myri10ge_firmware_probe(struct myri10ge_priv *mgp) |
2488 | #define PCI_DEVICE_ID_INTEL_E5000_PCIE47 0x25fa | ||
2489 | #define PCI_DEVICE_ID_INTEL_6300ESB_PCIEE1 0x3510 | ||
2490 | #define PCI_DEVICE_ID_INTEL_6300ESB_PCIEE4 0x351b | ||
2491 | #define PCI_DEVICE_ID_INTEL_E3000_PCIE 0x2779 | ||
2492 | #define PCI_DEVICE_ID_INTEL_E3010_PCIE 0x277a | ||
2493 | #define PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_FIRST 0x140 | ||
2494 | #define PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_LAST 0x142 | ||
2495 | |||
2496 | static void myri10ge_select_firmware(struct myri10ge_priv *mgp) | ||
2497 | { | 2510 | { |
2498 | struct pci_dev *bridge = mgp->pdev->bus->self; | 2511 | struct pci_dev *pdev = mgp->pdev; |
2512 | struct device *dev = &pdev->dev; | ||
2513 | int cap, status; | ||
2514 | u16 val; | ||
2515 | |||
2516 | mgp->tx.boundary = 4096; | ||
2517 | /* | ||
2518 | * Verify the max read request size was set to 4KB | ||
2519 | * before trying the test with 4KB. | ||
2520 | */ | ||
2521 | cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); | ||
2522 | if (cap < 64) { | ||
2523 | dev_err(dev, "Bad PCI_CAP_ID_EXP location %d\n", cap); | ||
2524 | goto abort; | ||
2525 | } | ||
2526 | status = pci_read_config_word(pdev, cap + PCI_EXP_DEVCTL, &val); | ||
2527 | if (status != 0) { | ||
2528 | dev_err(dev, "Couldn't read max read req size: %d\n", status); | ||
2529 | goto abort; | ||
2530 | } | ||
2531 | if ((val & (5 << 12)) != (5 << 12)) { | ||
2532 | dev_warn(dev, "Max Read Request size != 4096 (0x%x)\n", val); | ||
2533 | mgp->tx.boundary = 2048; | ||
2534 | } | ||
2535 | /* | ||
2536 | * load the optimized firmware (which assumes aligned PCIe | ||
2537 | * completions) in order to see if it works on this host. | ||
2538 | */ | ||
2539 | mgp->fw_name = myri10ge_fw_aligned; | ||
2540 | status = myri10ge_load_firmware(mgp); | ||
2541 | if (status != 0) { | ||
2542 | goto abort; | ||
2543 | } | ||
2544 | |||
2545 | /* | ||
2546 | * Enable ECRC if possible | ||
2547 | */ | ||
2548 | myri10ge_enable_ecrc(mgp); | ||
2549 | |||
2550 | /* | ||
2551 | * Run a DMA test which watches for unaligned completions and | ||
2552 | * aborts on the first one seen. | ||
2553 | */ | ||
2499 | 2554 | ||
2555 | status = myri10ge_dma_test(mgp, MXGEFW_CMD_UNALIGNED_TEST); | ||
2556 | if (status == 0) | ||
2557 | return; /* keep the aligned firmware */ | ||
2558 | |||
2559 | if (status != -E2BIG) | ||
2560 | dev_warn(dev, "DMA test failed: %d\n", status); | ||
2561 | if (status == -ENOSYS) | ||
2562 | dev_warn(dev, "Falling back to ethp! " | ||
2563 | "Please install up to date fw\n"); | ||
2564 | abort: | ||
2565 | /* fall back to using the unaligned firmware */ | ||
2500 | mgp->tx.boundary = 2048; | 2566 | mgp->tx.boundary = 2048; |
2501 | mgp->fw_name = myri10ge_fw_unaligned; | 2567 | mgp->fw_name = myri10ge_fw_unaligned; |
2502 | 2568 | ||
2569 | } | ||
2570 | |||
2571 | static void myri10ge_select_firmware(struct myri10ge_priv *mgp) | ||
2572 | { | ||
2503 | if (myri10ge_force_firmware == 0) { | 2573 | if (myri10ge_force_firmware == 0) { |
2504 | int link_width, exp_cap; | 2574 | int link_width, exp_cap; |
2505 | u16 lnk; | 2575 | u16 lnk; |
@@ -2508,8 +2578,6 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp) | |||
2508 | pci_read_config_word(mgp->pdev, exp_cap + PCI_EXP_LNKSTA, &lnk); | 2578 | pci_read_config_word(mgp->pdev, exp_cap + PCI_EXP_LNKSTA, &lnk); |
2509 | link_width = (lnk >> 4) & 0x3f; | 2579 | link_width = (lnk >> 4) & 0x3f; |
2510 | 2580 | ||
2511 | myri10ge_enable_ecrc(mgp); | ||
2512 | |||
2513 | /* Check to see if Link is less than 8 or if the | 2581 | /* Check to see if Link is less than 8 or if the |
2514 | * upstream bridge is known to provide aligned | 2582 | * upstream bridge is known to provide aligned |
2515 | * completions */ | 2583 | * completions */ |
@@ -2518,46 +2586,8 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp) | |||
2518 | link_width); | 2586 | link_width); |
2519 | mgp->tx.boundary = 4096; | 2587 | mgp->tx.boundary = 4096; |
2520 | mgp->fw_name = myri10ge_fw_aligned; | 2588 | mgp->fw_name = myri10ge_fw_aligned; |
2521 | } else if (bridge && | 2589 | } else { |
2522 | /* ServerWorks HT2000/HT1000 */ | 2590 | myri10ge_firmware_probe(mgp); |
2523 | ((bridge->vendor == PCI_VENDOR_ID_SERVERWORKS | ||
2524 | && bridge->device == | ||
2525 | PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE) | ||
2526 | /* ServerWorks HT2100 */ | ||
2527 | || (bridge->vendor == PCI_VENDOR_ID_SERVERWORKS | ||
2528 | && bridge->device >= | ||
2529 | PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_FIRST | ||
2530 | && bridge->device <= | ||
2531 | PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_LAST) | ||
2532 | /* All Intel E3000/E3010 PCIE ports */ | ||
2533 | || (bridge->vendor == PCI_VENDOR_ID_INTEL | ||
2534 | && (bridge->device == | ||
2535 | PCI_DEVICE_ID_INTEL_E3000_PCIE | ||
2536 | || bridge->device == | ||
2537 | PCI_DEVICE_ID_INTEL_E3010_PCIE)) | ||
2538 | /* All Intel 6310/6311/6321ESB PCIE ports */ | ||
2539 | || (bridge->vendor == PCI_VENDOR_ID_INTEL | ||
2540 | && bridge->device >= | ||
2541 | PCI_DEVICE_ID_INTEL_6300ESB_PCIEE1 | ||
2542 | && bridge->device <= | ||
2543 | PCI_DEVICE_ID_INTEL_6300ESB_PCIEE4) | ||
2544 | /* All Intel E5000 PCIE ports */ | ||
2545 | || (bridge->vendor == PCI_VENDOR_ID_INTEL | ||
2546 | && bridge->device >= | ||
2547 | PCI_DEVICE_ID_INTEL_E5000_PCIE23 | ||
2548 | && bridge->device <= | ||
2549 | PCI_DEVICE_ID_INTEL_E5000_PCIE47))) { | ||
2550 | dev_info(&mgp->pdev->dev, | ||
2551 | "Assuming aligned completions (0x%x:0x%x)\n", | ||
2552 | bridge->vendor, bridge->device); | ||
2553 | mgp->tx.boundary = 4096; | ||
2554 | mgp->fw_name = myri10ge_fw_aligned; | ||
2555 | } else if (bridge && | ||
2556 | bridge->vendor == PCI_VENDOR_ID_SGI && | ||
2557 | bridge->device == 0x4002 /* TIOCE pcie-port */ ) { | ||
2558 | /* this pcie bridge does not support 4K rdma request */ | ||
2559 | mgp->tx.boundary = 2048; | ||
2560 | mgp->fw_name = myri10ge_fw_aligned; | ||
2561 | } | 2591 | } |
2562 | } else { | 2592 | } else { |
2563 | if (myri10ge_force_firmware == 1) { | 2593 | if (myri10ge_force_firmware == 1) { |
@@ -2825,7 +2855,6 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2825 | status = -ENODEV; | 2855 | status = -ENODEV; |
2826 | goto abort_with_netdev; | 2856 | goto abort_with_netdev; |
2827 | } | 2857 | } |
2828 | myri10ge_select_firmware(mgp); | ||
2829 | 2858 | ||
2830 | /* Find the vendor-specific cap so we can check | 2859 | /* Find the vendor-specific cap so we can check |
2831 | * the reboot register later on */ | 2860 | * the reboot register later on */ |
@@ -2919,6 +2948,8 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2919 | goto abort_with_ioremap; | 2948 | goto abort_with_ioremap; |
2920 | memset(mgp->rx_done.entry, 0, bytes); | 2949 | memset(mgp->rx_done.entry, 0, bytes); |
2921 | 2950 | ||
2951 | myri10ge_select_firmware(mgp); | ||
2952 | |||
2922 | status = myri10ge_load_firmware(mgp); | 2953 | status = myri10ge_load_firmware(mgp); |
2923 | if (status != 0) { | 2954 | if (status != 0) { |
2924 | dev_err(&pdev->dev, "failed to load firmware\n"); | 2955 | dev_err(&pdev->dev, "failed to load firmware\n"); |
diff --git a/drivers/net/myri10ge/myri10ge_mcp.h b/drivers/net/myri10ge/myri10ge_mcp.h index 29463b301a84..a1d2a22296a9 100644 --- a/drivers/net/myri10ge/myri10ge_mcp.h +++ b/drivers/net/myri10ge/myri10ge_mcp.h | |||
@@ -200,6 +200,13 @@ enum myri10ge_mcp_cmd_type { | |||
200 | /* data0, data1 = bus addr, | 200 | /* data0, data1 = bus addr, |
201 | * data2 = sizeof(struct mcp_irq_data) from driver point of view, allows | 201 | * data2 = sizeof(struct mcp_irq_data) from driver point of view, allows |
202 | * adding new stuff to mcp_irq_data without changing the ABI */ | 202 | * adding new stuff to mcp_irq_data without changing the ABI */ |
203 | |||
204 | MXGEFW_CMD_UNALIGNED_TEST, | ||
205 | /* same than DMA_TEST (same args) but abort with UNALIGNED on unaligned | ||
206 | * chipset */ | ||
207 | |||
208 | MXGEFW_CMD_UNALIGNED_STATUS | ||
209 | /* return data = boolean, true if the chipset is known to be unaligned */ | ||
203 | }; | 210 | }; |
204 | 211 | ||
205 | enum myri10ge_mcp_cmd_status { | 212 | enum myri10ge_mcp_cmd_status { |
@@ -212,18 +219,27 @@ enum myri10ge_mcp_cmd_status { | |||
212 | MXGEFW_CMD_ERROR_HASH_ERROR, | 219 | MXGEFW_CMD_ERROR_HASH_ERROR, |
213 | MXGEFW_CMD_ERROR_BAD_PORT, | 220 | MXGEFW_CMD_ERROR_BAD_PORT, |
214 | MXGEFW_CMD_ERROR_RESOURCES, | 221 | MXGEFW_CMD_ERROR_RESOURCES, |
215 | MXGEFW_CMD_ERROR_MULTICAST | 222 | MXGEFW_CMD_ERROR_MULTICAST, |
223 | MXGEFW_CMD_ERROR_UNALIGNED | ||
216 | }; | 224 | }; |
217 | 225 | ||
218 | #define MXGEFW_OLD_IRQ_DATA_LEN 40 | 226 | #define MXGEFW_OLD_IRQ_DATA_LEN 40 |
219 | 227 | ||
220 | struct mcp_irq_data { | 228 | struct mcp_irq_data { |
221 | /* add new counters at the beginning */ | 229 | /* add new counters at the beginning */ |
222 | __be32 future_use[5]; | 230 | __be32 future_use[1]; |
231 | __be32 dropped_pause; | ||
232 | __be32 dropped_unicast_filtered; | ||
233 | __be32 dropped_bad_crc32; | ||
234 | __be32 dropped_bad_phy; | ||
223 | __be32 dropped_multicast_filtered; | 235 | __be32 dropped_multicast_filtered; |
224 | /* 40 Bytes */ | 236 | /* 40 Bytes */ |
225 | __be32 send_done_count; | 237 | __be32 send_done_count; |
226 | 238 | ||
239 | #define MXGEFW_LINK_DOWN 0 | ||
240 | #define MXGEFW_LINK_UP 1 | ||
241 | #define MXGEFW_LINK_MYRINET 2 | ||
242 | #define MXGEFW_LINK_UNKNOWN 3 | ||
227 | __be32 link_up; | 243 | __be32 link_up; |
228 | __be32 dropped_link_overflow; | 244 | __be32 dropped_link_overflow; |
229 | __be32 dropped_link_error_or_filtered; | 245 | __be32 dropped_link_error_or_filtered; |
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index a8d7ff2c96ac..223e0e6264ba 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
@@ -81,6 +81,8 @@ static const int multicast_filter_limit = 100; | |||
81 | Setting to > 1518 effectively disables this feature. */ | 81 | Setting to > 1518 effectively disables this feature. */ |
82 | static int rx_copybreak; | 82 | static int rx_copybreak; |
83 | 83 | ||
84 | static int dspcfg_workaround = 1; | ||
85 | |||
84 | /* Used to pass the media type, etc. | 86 | /* Used to pass the media type, etc. |
85 | Both 'options[]' and 'full_duplex[]' should exist for driver | 87 | Both 'options[]' and 'full_duplex[]' should exist for driver |
86 | interoperability. | 88 | interoperability. |
@@ -139,12 +141,14 @@ MODULE_LICENSE("GPL"); | |||
139 | module_param(mtu, int, 0); | 141 | module_param(mtu, int, 0); |
140 | module_param(debug, int, 0); | 142 | module_param(debug, int, 0); |
141 | module_param(rx_copybreak, int, 0); | 143 | module_param(rx_copybreak, int, 0); |
144 | module_param(dspcfg_workaround, int, 1); | ||
142 | module_param_array(options, int, NULL, 0); | 145 | module_param_array(options, int, NULL, 0); |
143 | module_param_array(full_duplex, int, NULL, 0); | 146 | module_param_array(full_duplex, int, NULL, 0); |
144 | MODULE_PARM_DESC(mtu, "DP8381x MTU (all boards)"); | 147 | MODULE_PARM_DESC(mtu, "DP8381x MTU (all boards)"); |
145 | MODULE_PARM_DESC(debug, "DP8381x default debug level"); | 148 | MODULE_PARM_DESC(debug, "DP8381x default debug level"); |
146 | MODULE_PARM_DESC(rx_copybreak, | 149 | MODULE_PARM_DESC(rx_copybreak, |
147 | "DP8381x copy breakpoint for copy-only-tiny-frames"); | 150 | "DP8381x copy breakpoint for copy-only-tiny-frames"); |
151 | MODULE_PARM_DESC(dspcfg_workaround, "DP8381x: control DspCfg workaround"); | ||
148 | MODULE_PARM_DESC(options, | 152 | MODULE_PARM_DESC(options, |
149 | "DP8381x: Bits 0-3: media type, bit 17: full duplex"); | 153 | "DP8381x: Bits 0-3: media type, bit 17: full duplex"); |
150 | MODULE_PARM_DESC(full_duplex, "DP8381x full duplex setting(s) (1)"); | 154 | MODULE_PARM_DESC(full_duplex, "DP8381x full duplex setting(s) (1)"); |
@@ -590,6 +594,7 @@ struct netdev_private { | |||
590 | u32 srr; | 594 | u32 srr; |
591 | /* expected DSPCFG value */ | 595 | /* expected DSPCFG value */ |
592 | u16 dspcfg; | 596 | u16 dspcfg; |
597 | int dspcfg_workaround; | ||
593 | /* parms saved in ethtool format */ | 598 | /* parms saved in ethtool format */ |
594 | u16 speed; /* The forced speed, 10Mb, 100Mb, gigabit */ | 599 | u16 speed; /* The forced speed, 10Mb, 100Mb, gigabit */ |
595 | u8 duplex; /* Duplex, half or full */ | 600 | u8 duplex; /* Duplex, half or full */ |
@@ -656,6 +661,56 @@ static int netdev_get_regs(struct net_device *dev, u8 *buf); | |||
656 | static int netdev_get_eeprom(struct net_device *dev, u8 *buf); | 661 | static int netdev_get_eeprom(struct net_device *dev, u8 *buf); |
657 | static const struct ethtool_ops ethtool_ops; | 662 | static const struct ethtool_ops ethtool_ops; |
658 | 663 | ||
664 | #define NATSEMI_ATTR(_name) \ | ||
665 | static ssize_t natsemi_show_##_name(struct device *dev, \ | ||
666 | struct device_attribute *attr, char *buf); \ | ||
667 | static ssize_t natsemi_set_##_name(struct device *dev, \ | ||
668 | struct device_attribute *attr, \ | ||
669 | const char *buf, size_t count); \ | ||
670 | static DEVICE_ATTR(_name, 0644, natsemi_show_##_name, natsemi_set_##_name) | ||
671 | |||
672 | #define NATSEMI_CREATE_FILE(_dev, _name) \ | ||
673 | device_create_file(&_dev->dev, &dev_attr_##_name) | ||
674 | #define NATSEMI_REMOVE_FILE(_dev, _name) \ | ||
675 | device_create_file(&_dev->dev, &dev_attr_##_name) | ||
676 | |||
677 | NATSEMI_ATTR(dspcfg_workaround); | ||
678 | |||
679 | static ssize_t natsemi_show_dspcfg_workaround(struct device *dev, | ||
680 | struct device_attribute *attr, | ||
681 | char *buf) | ||
682 | { | ||
683 | struct netdev_private *np = netdev_priv(to_net_dev(dev)); | ||
684 | |||
685 | return sprintf(buf, "%s\n", np->dspcfg_workaround ? "on" : "off"); | ||
686 | } | ||
687 | |||
688 | static ssize_t natsemi_set_dspcfg_workaround(struct device *dev, | ||
689 | struct device_attribute *attr, | ||
690 | const char *buf, size_t count) | ||
691 | { | ||
692 | struct netdev_private *np = netdev_priv(to_net_dev(dev)); | ||
693 | int new_setting; | ||
694 | u32 flags; | ||
695 | |||
696 | /* Find out the new setting */ | ||
697 | if (!strncmp("on", buf, count - 1) || !strncmp("1", buf, count - 1)) | ||
698 | new_setting = 1; | ||
699 | else if (!strncmp("off", buf, count - 1) | ||
700 | || !strncmp("0", buf, count - 1)) | ||
701 | new_setting = 0; | ||
702 | else | ||
703 | return count; | ||
704 | |||
705 | spin_lock_irqsave(&np->lock, flags); | ||
706 | |||
707 | np->dspcfg_workaround = new_setting; | ||
708 | |||
709 | spin_unlock_irqrestore(&np->lock, flags); | ||
710 | |||
711 | return count; | ||
712 | } | ||
713 | |||
659 | static inline void __iomem *ns_ioaddr(struct net_device *dev) | 714 | static inline void __iomem *ns_ioaddr(struct net_device *dev) |
660 | { | 715 | { |
661 | return (void __iomem *) dev->base_addr; | 716 | return (void __iomem *) dev->base_addr; |
@@ -820,6 +875,7 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev, | |||
820 | np->ignore_phy = 1; | 875 | np->ignore_phy = 1; |
821 | else | 876 | else |
822 | np->ignore_phy = 0; | 877 | np->ignore_phy = 0; |
878 | np->dspcfg_workaround = dspcfg_workaround; | ||
823 | 879 | ||
824 | /* Initial port: | 880 | /* Initial port: |
825 | * - If configured to ignore the PHY set up for external. | 881 | * - If configured to ignore the PHY set up for external. |
@@ -899,6 +955,9 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev, | |||
899 | if (i) | 955 | if (i) |
900 | goto err_register_netdev; | 956 | goto err_register_netdev; |
901 | 957 | ||
958 | if (NATSEMI_CREATE_FILE(pdev, dspcfg_workaround)) | ||
959 | goto err_create_file; | ||
960 | |||
902 | if (netif_msg_drv(np)) { | 961 | if (netif_msg_drv(np)) { |
903 | printk(KERN_INFO "natsemi %s: %s at %#08lx (%s), ", | 962 | printk(KERN_INFO "natsemi %s: %s at %#08lx (%s), ", |
904 | dev->name, natsemi_pci_info[chip_idx].name, iostart, | 963 | dev->name, natsemi_pci_info[chip_idx].name, iostart, |
@@ -915,6 +974,9 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev, | |||
915 | } | 974 | } |
916 | return 0; | 975 | return 0; |
917 | 976 | ||
977 | err_create_file: | ||
978 | unregister_netdev(dev); | ||
979 | |||
918 | err_register_netdev: | 980 | err_register_netdev: |
919 | iounmap(ioaddr); | 981 | iounmap(ioaddr); |
920 | 982 | ||
@@ -1727,7 +1789,8 @@ static void init_registers(struct net_device *dev) | |||
1727 | * It seems that a reference set for this chip went out with incorrect info, | 1789 | * It seems that a reference set for this chip went out with incorrect info, |
1728 | * and there exist boards that aren't quite right. An unexpected voltage | 1790 | * and there exist boards that aren't quite right. An unexpected voltage |
1729 | * drop can cause the PHY to get itself in a weird state (basically reset). | 1791 | * drop can cause the PHY to get itself in a weird state (basically reset). |
1730 | * NOTE: this only seems to affect revC chips. | 1792 | * NOTE: this only seems to affect revC chips. The user can disable |
1793 | * this check via dspcfg_workaround sysfs option. | ||
1731 | * 3) check of death of the RX path due to OOM | 1794 | * 3) check of death of the RX path due to OOM |
1732 | */ | 1795 | */ |
1733 | static void netdev_timer(unsigned long data) | 1796 | static void netdev_timer(unsigned long data) |
@@ -1753,10 +1816,10 @@ static void netdev_timer(unsigned long data) | |||
1753 | writew(1, ioaddr+PGSEL); | 1816 | writew(1, ioaddr+PGSEL); |
1754 | dspcfg = readw(ioaddr+DSPCFG); | 1817 | dspcfg = readw(ioaddr+DSPCFG); |
1755 | writew(0, ioaddr+PGSEL); | 1818 | writew(0, ioaddr+PGSEL); |
1756 | if (dspcfg != np->dspcfg) { | 1819 | if (np->dspcfg_workaround && dspcfg != np->dspcfg) { |
1757 | if (!netif_queue_stopped(dev)) { | 1820 | if (!netif_queue_stopped(dev)) { |
1758 | spin_unlock_irq(&np->lock); | 1821 | spin_unlock_irq(&np->lock); |
1759 | if (netif_msg_hw(np)) | 1822 | if (netif_msg_drv(np)) |
1760 | printk(KERN_NOTICE "%s: possible phy reset: " | 1823 | printk(KERN_NOTICE "%s: possible phy reset: " |
1761 | "re-initializing\n", dev->name); | 1824 | "re-initializing\n", dev->name); |
1762 | disable_irq(dev->irq); | 1825 | disable_irq(dev->irq); |
@@ -3157,6 +3220,7 @@ static void __devexit natsemi_remove1 (struct pci_dev *pdev) | |||
3157 | struct net_device *dev = pci_get_drvdata(pdev); | 3220 | struct net_device *dev = pci_get_drvdata(pdev); |
3158 | void __iomem * ioaddr = ns_ioaddr(dev); | 3221 | void __iomem * ioaddr = ns_ioaddr(dev); |
3159 | 3222 | ||
3223 | NATSEMI_REMOVE_FILE(pdev, dspcfg_workaround); | ||
3160 | unregister_netdev (dev); | 3224 | unregister_netdev (dev); |
3161 | pci_release_regions (pdev); | 3225 | pci_release_regions (pdev); |
3162 | iounmap(ioaddr); | 3226 | iounmap(ioaddr); |
diff --git a/drivers/net/ne.c b/drivers/net/ne.c index a5c4199e2754..c9f74bf5f491 100644 --- a/drivers/net/ne.c +++ b/drivers/net/ne.c | |||
@@ -51,14 +51,11 @@ static const char version2[] = | |||
51 | #include <linux/netdevice.h> | 51 | #include <linux/netdevice.h> |
52 | #include <linux/etherdevice.h> | 52 | #include <linux/etherdevice.h> |
53 | #include <linux/jiffies.h> | 53 | #include <linux/jiffies.h> |
54 | #include <linux/platform_device.h> | ||
54 | 55 | ||
55 | #include <asm/system.h> | 56 | #include <asm/system.h> |
56 | #include <asm/io.h> | 57 | #include <asm/io.h> |
57 | 58 | ||
58 | #if defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938) | ||
59 | #include <asm/tx4938/rbtx4938.h> | ||
60 | #endif | ||
61 | |||
62 | #include "8390.h" | 59 | #include "8390.h" |
63 | 60 | ||
64 | #define DRV_NAME "ne" | 61 | #define DRV_NAME "ne" |
@@ -77,8 +74,13 @@ static const char version2[] = | |||
77 | /* Do we have a non std. amount of memory? (in units of 256 byte pages) */ | 74 | /* Do we have a non std. amount of memory? (in units of 256 byte pages) */ |
78 | /* #define PACKETBUF_MEMSIZE 0x40 */ | 75 | /* #define PACKETBUF_MEMSIZE 0x40 */ |
79 | 76 | ||
77 | #if !defined(MODULE) && (defined(CONFIG_ISA) || defined(CONFIG_M32R)) | ||
78 | /* Do we need a portlist for the ISA auto-probe ? */ | ||
79 | #define NEEDS_PORTLIST | ||
80 | #endif | ||
81 | |||
80 | /* A zero-terminated list of I/O addresses to be probed at boot. */ | 82 | /* A zero-terminated list of I/O addresses to be probed at boot. */ |
81 | #ifndef MODULE | 83 | #ifdef NEEDS_PORTLIST |
82 | static unsigned int netcard_portlist[] __initdata = { | 84 | static unsigned int netcard_portlist[] __initdata = { |
83 | 0x300, 0x280, 0x320, 0x340, 0x360, 0x380, 0 | 85 | 0x300, 0x280, 0x320, 0x340, 0x360, 0x380, 0 |
84 | }; | 86 | }; |
@@ -146,7 +148,7 @@ bad_clone_list[] __initdata = { | |||
146 | # define DCR_VAL 0x49 | 148 | # define DCR_VAL 0x49 |
147 | #endif | 149 | #endif |
148 | 150 | ||
149 | static int ne_probe1(struct net_device *dev, int ioaddr); | 151 | static int ne_probe1(struct net_device *dev, unsigned long ioaddr); |
150 | static int ne_probe_isapnp(struct net_device *dev); | 152 | static int ne_probe_isapnp(struct net_device *dev); |
151 | 153 | ||
152 | static int ne_open(struct net_device *dev); | 154 | static int ne_open(struct net_device *dev); |
@@ -184,8 +186,8 @@ static void ne_block_output(struct net_device *dev, const int count, | |||
184 | 186 | ||
185 | static int __init do_ne_probe(struct net_device *dev) | 187 | static int __init do_ne_probe(struct net_device *dev) |
186 | { | 188 | { |
187 | unsigned int base_addr = dev->base_addr; | 189 | unsigned long base_addr = dev->base_addr; |
188 | #ifndef MODULE | 190 | #ifdef NEEDS_PORTLIST |
189 | int orig_irq = dev->irq; | 191 | int orig_irq = dev->irq; |
190 | #endif | 192 | #endif |
191 | 193 | ||
@@ -201,7 +203,7 @@ static int __init do_ne_probe(struct net_device *dev) | |||
201 | if (isapnp_present() && (ne_probe_isapnp(dev) == 0)) | 203 | if (isapnp_present() && (ne_probe_isapnp(dev) == 0)) |
202 | return 0; | 204 | return 0; |
203 | 205 | ||
204 | #ifndef MODULE | 206 | #ifdef NEEDS_PORTLIST |
205 | /* Last resort. The semi-risky ISA auto-probe. */ | 207 | /* Last resort. The semi-risky ISA auto-probe. */ |
206 | for (base_addr = 0; netcard_portlist[base_addr] != 0; base_addr++) { | 208 | for (base_addr = 0; netcard_portlist[base_addr] != 0; base_addr++) { |
207 | int ioaddr = netcard_portlist[base_addr]; | 209 | int ioaddr = netcard_portlist[base_addr]; |
@@ -226,10 +228,6 @@ struct net_device * __init ne_probe(int unit) | |||
226 | sprintf(dev->name, "eth%d", unit); | 228 | sprintf(dev->name, "eth%d", unit); |
227 | netdev_boot_setup_check(dev); | 229 | netdev_boot_setup_check(dev); |
228 | 230 | ||
229 | #ifdef CONFIG_TOSHIBA_RBTX4938 | ||
230 | dev->base_addr = RBTX4938_RTL_8019_BASE; | ||
231 | dev->irq = RBTX4938_RTL_8019_IRQ; | ||
232 | #endif | ||
233 | err = do_ne_probe(dev); | 231 | err = do_ne_probe(dev); |
234 | if (err) | 232 | if (err) |
235 | goto out; | 233 | goto out; |
@@ -285,7 +283,7 @@ static int __init ne_probe_isapnp(struct net_device *dev) | |||
285 | return -ENODEV; | 283 | return -ENODEV; |
286 | } | 284 | } |
287 | 285 | ||
288 | static int __init ne_probe1(struct net_device *dev, int ioaddr) | 286 | static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr) |
289 | { | 287 | { |
290 | int i; | 288 | int i; |
291 | unsigned char SA_prom[32]; | 289 | unsigned char SA_prom[32]; |
@@ -324,7 +322,7 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr) | |||
324 | if (ei_debug && version_printed++ == 0) | 322 | if (ei_debug && version_printed++ == 0) |
325 | printk(KERN_INFO "%s" KERN_INFO "%s", version1, version2); | 323 | printk(KERN_INFO "%s" KERN_INFO "%s", version1, version2); |
326 | 324 | ||
327 | printk(KERN_INFO "NE*000 ethercard probe at %#3x:", ioaddr); | 325 | printk(KERN_INFO "NE*000 ethercard probe at %#3lx:", ioaddr); |
328 | 326 | ||
329 | /* A user with a poor card that fails to ack the reset, or that | 327 | /* A user with a poor card that fails to ack the reset, or that |
330 | does not have a valid 0x57,0x57 signature can still use this | 328 | does not have a valid 0x57,0x57 signature can still use this |
@@ -516,8 +514,7 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr) | |||
516 | } | 514 | } |
517 | #endif | 515 | #endif |
518 | 516 | ||
519 | printk("\n%s: %s found at %#x, using IRQ %d.\n", | 517 | printk("\n"); |
520 | dev->name, name, ioaddr, dev->irq); | ||
521 | 518 | ||
522 | ei_status.name = name; | 519 | ei_status.name = name; |
523 | ei_status.tx_start_page = start_page; | 520 | ei_status.tx_start_page = start_page; |
@@ -547,6 +544,8 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr) | |||
547 | ret = register_netdev(dev); | 544 | ret = register_netdev(dev); |
548 | if (ret) | 545 | if (ret) |
549 | goto out_irq; | 546 | goto out_irq; |
547 | printk(KERN_INFO "%s: %s found at %#lx, using IRQ %d.\n", | ||
548 | dev->name, name, ioaddr, dev->irq); | ||
550 | return 0; | 549 | return 0; |
551 | 550 | ||
552 | out_irq: | 551 | out_irq: |
@@ -807,6 +806,87 @@ retry: | |||
807 | return; | 806 | return; |
808 | } | 807 | } |
809 | 808 | ||
809 | static int __init ne_drv_probe(struct platform_device *pdev) | ||
810 | { | ||
811 | struct net_device *dev; | ||
812 | struct resource *res; | ||
813 | int err, irq; | ||
814 | |||
815 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | ||
816 | irq = platform_get_irq(pdev, 0); | ||
817 | if (!res || irq < 0) | ||
818 | return -ENODEV; | ||
819 | |||
820 | dev = alloc_ei_netdev(); | ||
821 | if (!dev) | ||
822 | return -ENOMEM; | ||
823 | dev->irq = irq; | ||
824 | dev->base_addr = res->start; | ||
825 | err = do_ne_probe(dev); | ||
826 | if (err) { | ||
827 | free_netdev(dev); | ||
828 | return err; | ||
829 | } | ||
830 | platform_set_drvdata(pdev, dev); | ||
831 | return 0; | ||
832 | } | ||
833 | |||
834 | static int __exit ne_drv_remove(struct platform_device *pdev) | ||
835 | { | ||
836 | struct net_device *dev = platform_get_drvdata(pdev); | ||
837 | |||
838 | unregister_netdev(dev); | ||
839 | free_irq(dev->irq, dev); | ||
840 | release_region(dev->base_addr, NE_IO_EXTENT); | ||
841 | free_netdev(dev); | ||
842 | return 0; | ||
843 | } | ||
844 | |||
845 | #ifdef CONFIG_PM | ||
846 | static int ne_drv_suspend(struct platform_device *pdev, pm_message_t state) | ||
847 | { | ||
848 | struct net_device *dev = platform_get_drvdata(pdev); | ||
849 | |||
850 | if (netif_running(dev)) | ||
851 | netif_device_detach(dev); | ||
852 | return 0; | ||
853 | } | ||
854 | |||
855 | static int ne_drv_resume(struct platform_device *pdev) | ||
856 | { | ||
857 | struct net_device *dev = platform_get_drvdata(pdev); | ||
858 | |||
859 | if (netif_running(dev)) { | ||
860 | ne_reset_8390(dev); | ||
861 | NS8390_init(dev, 1); | ||
862 | netif_device_attach(dev); | ||
863 | } | ||
864 | return 0; | ||
865 | } | ||
866 | #else | ||
867 | #define ne_drv_suspend NULL | ||
868 | #define ne_drv_resume NULL | ||
869 | #endif | ||
870 | |||
871 | static struct platform_driver ne_driver = { | ||
872 | .remove = __exit_p(ne_drv_remove), | ||
873 | .suspend = ne_drv_suspend, | ||
874 | .resume = ne_drv_resume, | ||
875 | .driver = { | ||
876 | .name = DRV_NAME, | ||
877 | .owner = THIS_MODULE, | ||
878 | }, | ||
879 | }; | ||
880 | |||
881 | static int __init ne_init(void) | ||
882 | { | ||
883 | return platform_driver_probe(&ne_driver, ne_drv_probe); | ||
884 | } | ||
885 | |||
886 | static void __exit ne_exit(void) | ||
887 | { | ||
888 | platform_driver_unregister(&ne_driver); | ||
889 | } | ||
810 | 890 | ||
811 | #ifdef MODULE | 891 | #ifdef MODULE |
812 | #define MAX_NE_CARDS 4 /* Max number of NE cards per module */ | 892 | #define MAX_NE_CARDS 4 /* Max number of NE cards per module */ |
@@ -832,6 +912,7 @@ ISA device autoprobes on a running machine are not recommended anyway. */ | |||
832 | int __init init_module(void) | 912 | int __init init_module(void) |
833 | { | 913 | { |
834 | int this_dev, found = 0; | 914 | int this_dev, found = 0; |
915 | int plat_found = !ne_init(); | ||
835 | 916 | ||
836 | for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) { | 917 | for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) { |
837 | struct net_device *dev = alloc_ei_netdev(); | 918 | struct net_device *dev = alloc_ei_netdev(); |
@@ -845,7 +926,7 @@ int __init init_module(void) | |||
845 | continue; | 926 | continue; |
846 | } | 927 | } |
847 | free_netdev(dev); | 928 | free_netdev(dev); |
848 | if (found) | 929 | if (found || plat_found) |
849 | break; | 930 | break; |
850 | if (io[this_dev] != 0) | 931 | if (io[this_dev] != 0) |
851 | printk(KERN_WARNING "ne.c: No NE*000 card found at i/o = %#x\n", io[this_dev]); | 932 | printk(KERN_WARNING "ne.c: No NE*000 card found at i/o = %#x\n", io[this_dev]); |
@@ -853,7 +934,7 @@ int __init init_module(void) | |||
853 | printk(KERN_NOTICE "ne.c: You must supply \"io=0xNNN\" value(s) for ISA cards.\n"); | 934 | printk(KERN_NOTICE "ne.c: You must supply \"io=0xNNN\" value(s) for ISA cards.\n"); |
854 | return -ENXIO; | 935 | return -ENXIO; |
855 | } | 936 | } |
856 | if (found) | 937 | if (found || plat_found) |
857 | return 0; | 938 | return 0; |
858 | return -ENODEV; | 939 | return -ENODEV; |
859 | } | 940 | } |
@@ -871,6 +952,7 @@ void __exit cleanup_module(void) | |||
871 | { | 952 | { |
872 | int this_dev; | 953 | int this_dev; |
873 | 954 | ||
955 | ne_exit(); | ||
874 | for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) { | 956 | for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) { |
875 | struct net_device *dev = dev_ne[this_dev]; | 957 | struct net_device *dev = dev_ne[this_dev]; |
876 | if (dev) { | 958 | if (dev) { |
@@ -880,4 +962,7 @@ void __exit cleanup_module(void) | |||
880 | } | 962 | } |
881 | } | 963 | } |
882 | } | 964 | } |
965 | #else /* MODULE */ | ||
966 | module_init(ne_init); | ||
967 | module_exit(ne_exit); | ||
883 | #endif /* MODULE */ | 968 | #endif /* MODULE */ |
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index 07eb9b24a97f..bc7f3dee6e5b 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c | |||
@@ -33,6 +33,8 @@ | |||
33 | #include <linux/tcp.h> | 33 | #include <linux/tcp.h> |
34 | #include <net/checksum.h> | 34 | #include <net/checksum.h> |
35 | 35 | ||
36 | #include <asm/irq.h> | ||
37 | |||
36 | #include "pasemi_mac.h" | 38 | #include "pasemi_mac.h" |
37 | 39 | ||
38 | 40 | ||
@@ -51,6 +53,16 @@ | |||
51 | #define RX_RING_SIZE 512 | 53 | #define RX_RING_SIZE 512 |
52 | #define TX_RING_SIZE 512 | 54 | #define TX_RING_SIZE 512 |
53 | 55 | ||
56 | #define DEFAULT_MSG_ENABLE \ | ||
57 | (NETIF_MSG_DRV | \ | ||
58 | NETIF_MSG_PROBE | \ | ||
59 | NETIF_MSG_LINK | \ | ||
60 | NETIF_MSG_TIMER | \ | ||
61 | NETIF_MSG_IFDOWN | \ | ||
62 | NETIF_MSG_IFUP | \ | ||
63 | NETIF_MSG_RX_ERR | \ | ||
64 | NETIF_MSG_TX_ERR) | ||
65 | |||
54 | #define TX_DESC(mac, num) ((mac)->tx->desc[(num) & (TX_RING_SIZE-1)]) | 66 | #define TX_DESC(mac, num) ((mac)->tx->desc[(num) & (TX_RING_SIZE-1)]) |
55 | #define TX_DESC_INFO(mac, num) ((mac)->tx->desc_info[(num) & (TX_RING_SIZE-1)]) | 67 | #define TX_DESC_INFO(mac, num) ((mac)->tx->desc_info[(num) & (TX_RING_SIZE-1)]) |
56 | #define RX_DESC(mac, num) ((mac)->rx->desc[(num) & (RX_RING_SIZE-1)]) | 68 | #define RX_DESC(mac, num) ((mac)->rx->desc[(num) & (RX_RING_SIZE-1)]) |
@@ -59,11 +71,13 @@ | |||
59 | 71 | ||
60 | #define BUF_SIZE 1646 /* 1500 MTU + ETH_HLEN + VLAN_HLEN + 2 64B cachelines */ | 72 | #define BUF_SIZE 1646 /* 1500 MTU + ETH_HLEN + VLAN_HLEN + 2 64B cachelines */ |
61 | 73 | ||
62 | /* XXXOJN these should come out of the device tree some day */ | 74 | MODULE_LICENSE("GPL"); |
63 | #define PAS_DMA_CAP_BASE 0xe00d0040 | 75 | MODULE_AUTHOR ("Olof Johansson <olof@lixom.net>"); |
64 | #define PAS_DMA_CAP_SIZE 0x100 | 76 | MODULE_DESCRIPTION("PA Semi PWRficient Ethernet driver"); |
65 | #define PAS_DMA_COM_BASE 0xe00d0100 | 77 | |
66 | #define PAS_DMA_COM_SIZE 0x100 | 78 | static int debug = -1; /* -1 == use DEFAULT_MSG_ENABLE as value */ |
79 | module_param(debug, int, 0); | ||
80 | MODULE_PARM_DESC(debug, "PA Semi MAC bitmapped debugging message enable value"); | ||
67 | 81 | ||
68 | static struct pasdma_status *dma_status; | 82 | static struct pasdma_status *dma_status; |
69 | 83 | ||
@@ -80,7 +94,12 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac) | |||
80 | return -ENOENT; | 94 | return -ENOENT; |
81 | } | 95 | } |
82 | 96 | ||
83 | maddr = of_get_property(dn, "mac-address", NULL); | 97 | maddr = of_get_property(dn, "local-mac-address", NULL); |
98 | |||
99 | /* Fall back to mac-address for older firmware */ | ||
100 | if (maddr == NULL) | ||
101 | maddr = of_get_property(dn, "mac-address", NULL); | ||
102 | |||
84 | if (maddr == NULL) { | 103 | if (maddr == NULL) { |
85 | dev_warn(&pdev->dev, | 104 | dev_warn(&pdev->dev, |
86 | "no mac address in device tree, not configuring\n"); | 105 | "no mac address in device tree, not configuring\n"); |
@@ -277,8 +296,8 @@ static void pasemi_mac_free_rx_resources(struct net_device *dev) | |||
277 | for (i = 0; i < RX_RING_SIZE; i++) { | 296 | for (i = 0; i < RX_RING_SIZE; i++) { |
278 | info = &RX_DESC_INFO(mac, i); | 297 | info = &RX_DESC_INFO(mac, i); |
279 | dp = &RX_DESC(mac, i); | 298 | dp = &RX_DESC(mac, i); |
280 | if (info->dma) { | 299 | if (info->skb) { |
281 | if (info->skb) { | 300 | if (info->dma) { |
282 | pci_unmap_single(mac->dma_pdev, | 301 | pci_unmap_single(mac->dma_pdev, |
283 | info->dma, | 302 | info->dma, |
284 | info->skb->len, | 303 | info->skb->len, |
@@ -309,82 +328,120 @@ static void pasemi_mac_replenish_rx_ring(struct net_device *dev) | |||
309 | struct pasemi_mac *mac = netdev_priv(dev); | 328 | struct pasemi_mac *mac = netdev_priv(dev); |
310 | unsigned int i; | 329 | unsigned int i; |
311 | int start = mac->rx->next_to_fill; | 330 | int start = mac->rx->next_to_fill; |
312 | unsigned int count; | 331 | unsigned int limit, count; |
313 | 332 | ||
314 | count = (mac->rx->next_to_clean + RX_RING_SIZE - | 333 | limit = (mac->rx->next_to_clean + RX_RING_SIZE - |
315 | mac->rx->next_to_fill) & (RX_RING_SIZE - 1); | 334 | mac->rx->next_to_fill) & (RX_RING_SIZE - 1); |
316 | 335 | ||
317 | /* Check to see if we're doing first-time setup */ | 336 | /* Check to see if we're doing first-time setup */ |
318 | if (unlikely(mac->rx->next_to_clean == 0 && mac->rx->next_to_fill == 0)) | 337 | if (unlikely(mac->rx->next_to_clean == 0 && mac->rx->next_to_fill == 0)) |
319 | count = RX_RING_SIZE; | 338 | limit = RX_RING_SIZE; |
320 | 339 | ||
321 | if (count <= 0) | 340 | if (limit <= 0) |
322 | return; | 341 | return; |
323 | 342 | ||
324 | for (i = start; i < start + count; i++) { | 343 | i = start; |
344 | for (count = limit; count; count--) { | ||
325 | struct pasemi_mac_buffer *info = &RX_DESC_INFO(mac, i); | 345 | struct pasemi_mac_buffer *info = &RX_DESC_INFO(mac, i); |
326 | u64 *buff = &RX_BUFF(mac, i); | 346 | u64 *buff = &RX_BUFF(mac, i); |
327 | struct sk_buff *skb; | 347 | struct sk_buff *skb; |
328 | dma_addr_t dma; | 348 | dma_addr_t dma; |
329 | 349 | ||
330 | skb = dev_alloc_skb(BUF_SIZE); | 350 | /* skb might still be in there for recycle on short receives */ |
351 | if (info->skb) | ||
352 | skb = info->skb; | ||
353 | else | ||
354 | skb = dev_alloc_skb(BUF_SIZE); | ||
331 | 355 | ||
332 | if (!skb) { | 356 | if (unlikely(!skb)) |
333 | count = i - start; | ||
334 | break; | 357 | break; |
335 | } | ||
336 | 358 | ||
337 | dma = pci_map_single(mac->dma_pdev, skb->data, skb->len, | 359 | dma = pci_map_single(mac->dma_pdev, skb->data, skb->len, |
338 | PCI_DMA_FROMDEVICE); | 360 | PCI_DMA_FROMDEVICE); |
339 | 361 | ||
340 | if (dma_mapping_error(dma)) { | 362 | if (unlikely(dma_mapping_error(dma))) { |
341 | dev_kfree_skb_irq(info->skb); | 363 | dev_kfree_skb_irq(info->skb); |
342 | count = i - start; | ||
343 | break; | 364 | break; |
344 | } | 365 | } |
345 | 366 | ||
346 | info->skb = skb; | 367 | info->skb = skb; |
347 | info->dma = dma; | 368 | info->dma = dma; |
348 | *buff = XCT_RXB_LEN(BUF_SIZE) | XCT_RXB_ADDR(dma); | 369 | *buff = XCT_RXB_LEN(BUF_SIZE) | XCT_RXB_ADDR(dma); |
370 | i++; | ||
349 | } | 371 | } |
350 | 372 | ||
351 | wmb(); | 373 | wmb(); |
352 | 374 | ||
353 | pci_write_config_dword(mac->dma_pdev, | 375 | pci_write_config_dword(mac->dma_pdev, |
354 | PAS_DMA_RXCHAN_INCR(mac->dma_rxch), | 376 | PAS_DMA_RXCHAN_INCR(mac->dma_rxch), |
355 | count); | 377 | limit - count); |
356 | pci_write_config_dword(mac->dma_pdev, | 378 | pci_write_config_dword(mac->dma_pdev, |
357 | PAS_DMA_RXINT_INCR(mac->dma_if), | 379 | PAS_DMA_RXINT_INCR(mac->dma_if), |
358 | count); | 380 | limit - count); |
359 | 381 | ||
360 | mac->rx->next_to_fill += count; | 382 | mac->rx->next_to_fill += limit - count; |
361 | } | 383 | } |
362 | 384 | ||
385 | static void pasemi_mac_restart_rx_intr(struct pasemi_mac *mac) | ||
386 | { | ||
387 | unsigned int reg, stat; | ||
388 | /* Re-enable packet count interrupts: finally | ||
389 | * ack the packet count interrupt we got in rx_intr. | ||
390 | */ | ||
391 | |||
392 | pci_read_config_dword(mac->iob_pdev, | ||
393 | PAS_IOB_DMA_RXCH_STAT(mac->dma_rxch), | ||
394 | &stat); | ||
395 | |||
396 | reg = PAS_IOB_DMA_RXCH_RESET_PCNT(stat & PAS_IOB_DMA_RXCH_STAT_CNTDEL_M) | ||
397 | | PAS_IOB_DMA_RXCH_RESET_PINTC; | ||
398 | |||
399 | pci_write_config_dword(mac->iob_pdev, | ||
400 | PAS_IOB_DMA_RXCH_RESET(mac->dma_rxch), | ||
401 | reg); | ||
402 | } | ||
403 | |||
404 | static void pasemi_mac_restart_tx_intr(struct pasemi_mac *mac) | ||
405 | { | ||
406 | unsigned int reg, stat; | ||
407 | |||
408 | /* Re-enable packet count interrupts */ | ||
409 | pci_read_config_dword(mac->iob_pdev, | ||
410 | PAS_IOB_DMA_TXCH_STAT(mac->dma_txch), &stat); | ||
411 | |||
412 | reg = PAS_IOB_DMA_TXCH_RESET_PCNT(stat & PAS_IOB_DMA_TXCH_STAT_CNTDEL_M) | ||
413 | | PAS_IOB_DMA_TXCH_RESET_PINTC; | ||
414 | |||
415 | pci_write_config_dword(mac->iob_pdev, | ||
416 | PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), reg); | ||
417 | } | ||
418 | |||
419 | |||
363 | static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit) | 420 | static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit) |
364 | { | 421 | { |
365 | unsigned int i; | 422 | unsigned int n; |
366 | int start, count; | 423 | int count; |
424 | struct pas_dma_xct_descr *dp; | ||
425 | struct pasemi_mac_buffer *info; | ||
426 | struct sk_buff *skb; | ||
427 | unsigned int i, len; | ||
428 | u64 macrx; | ||
429 | dma_addr_t dma; | ||
367 | 430 | ||
368 | spin_lock(&mac->rx->lock); | 431 | spin_lock(&mac->rx->lock); |
369 | 432 | ||
370 | start = mac->rx->next_to_clean; | 433 | n = mac->rx->next_to_clean; |
371 | count = 0; | ||
372 | 434 | ||
373 | for (i = start; i < (start + RX_RING_SIZE) && count < limit; i++) { | 435 | for (count = limit; count; count--) { |
374 | struct pas_dma_xct_descr *dp; | ||
375 | struct pasemi_mac_buffer *info; | ||
376 | struct sk_buff *skb; | ||
377 | unsigned int j, len; | ||
378 | dma_addr_t dma; | ||
379 | 436 | ||
380 | rmb(); | 437 | rmb(); |
381 | 438 | ||
382 | dp = &RX_DESC(mac, i); | 439 | dp = &RX_DESC(mac, n); |
440 | macrx = dp->macrx; | ||
383 | 441 | ||
384 | if (!(dp->macrx & XCT_MACRX_O)) | 442 | if (!(macrx & XCT_MACRX_O)) |
385 | break; | 443 | break; |
386 | 444 | ||
387 | count++; | ||
388 | 445 | ||
389 | info = NULL; | 446 | info = NULL; |
390 | 447 | ||
@@ -396,29 +453,42 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit) | |||
396 | */ | 453 | */ |
397 | 454 | ||
398 | dma = (dp->ptr & XCT_PTR_ADDR_M); | 455 | dma = (dp->ptr & XCT_PTR_ADDR_M); |
399 | for (j = start; j < (start + RX_RING_SIZE); j++) { | 456 | for (i = n; i < (n + RX_RING_SIZE); i++) { |
400 | info = &RX_DESC_INFO(mac, j); | 457 | info = &RX_DESC_INFO(mac, i); |
401 | if (info->dma == dma) | 458 | if (info->dma == dma) |
402 | break; | 459 | break; |
403 | } | 460 | } |
404 | 461 | ||
405 | BUG_ON(!info); | 462 | skb = info->skb; |
406 | BUG_ON(info->dma != dma); | 463 | info->dma = 0; |
407 | 464 | ||
408 | pci_unmap_single(mac->dma_pdev, info->dma, info->skb->len, | 465 | pci_unmap_single(mac->dma_pdev, dma, skb->len, |
409 | PCI_DMA_FROMDEVICE); | 466 | PCI_DMA_FROMDEVICE); |
410 | 467 | ||
411 | skb = info->skb; | 468 | len = (macrx & XCT_MACRX_LLEN_M) >> XCT_MACRX_LLEN_S; |
412 | 469 | ||
413 | len = (dp->macrx & XCT_MACRX_LLEN_M) >> XCT_MACRX_LLEN_S; | 470 | if (len < 256) { |
471 | struct sk_buff *new_skb = | ||
472 | netdev_alloc_skb(mac->netdev, len + NET_IP_ALIGN); | ||
473 | if (new_skb) { | ||
474 | skb_reserve(new_skb, NET_IP_ALIGN); | ||
475 | memcpy(new_skb->data - NET_IP_ALIGN, | ||
476 | skb->data - NET_IP_ALIGN, | ||
477 | len + NET_IP_ALIGN); | ||
478 | /* save the skb in buffer_info as good */ | ||
479 | skb = new_skb; | ||
480 | } | ||
481 | /* else just continue with the old one */ | ||
482 | } else | ||
483 | info->skb = NULL; | ||
414 | 484 | ||
415 | skb_put(skb, len); | 485 | skb_put(skb, len); |
416 | 486 | ||
417 | skb->protocol = eth_type_trans(skb, mac->netdev); | 487 | skb->protocol = eth_type_trans(skb, mac->netdev); |
418 | 488 | ||
419 | if ((dp->macrx & XCT_MACRX_HTY_M) == XCT_MACRX_HTY_IPV4_OK) { | 489 | if ((macrx & XCT_MACRX_HTY_M) == XCT_MACRX_HTY_IPV4_OK) { |
420 | skb->ip_summed = CHECKSUM_COMPLETE; | 490 | skb->ip_summed = CHECKSUM_COMPLETE; |
421 | skb->csum = (dp->macrx & XCT_MACRX_CSUM_M) >> | 491 | skb->csum = (macrx & XCT_MACRX_CSUM_M) >> |
422 | XCT_MACRX_CSUM_S; | 492 | XCT_MACRX_CSUM_S; |
423 | } else | 493 | } else |
424 | skb->ip_summed = CHECKSUM_NONE; | 494 | skb->ip_summed = CHECKSUM_NONE; |
@@ -428,13 +498,13 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit) | |||
428 | 498 | ||
429 | netif_receive_skb(skb); | 499 | netif_receive_skb(skb); |
430 | 500 | ||
431 | info->dma = 0; | ||
432 | info->skb = NULL; | ||
433 | dp->ptr = 0; | 501 | dp->ptr = 0; |
434 | dp->macrx = 0; | 502 | dp->macrx = 0; |
503 | |||
504 | n++; | ||
435 | } | 505 | } |
436 | 506 | ||
437 | mac->rx->next_to_clean += count; | 507 | mac->rx->next_to_clean += limit - count; |
438 | pasemi_mac_replenish_rx_ring(mac->netdev); | 508 | pasemi_mac_replenish_rx_ring(mac->netdev); |
439 | 509 | ||
440 | spin_unlock(&mac->rx->lock); | 510 | spin_unlock(&mac->rx->lock); |
@@ -476,6 +546,8 @@ static int pasemi_mac_clean_tx(struct pasemi_mac *mac) | |||
476 | mac->tx->next_to_clean += count; | 546 | mac->tx->next_to_clean += count; |
477 | spin_unlock_irqrestore(&mac->tx->lock, flags); | 547 | spin_unlock_irqrestore(&mac->tx->lock, flags); |
478 | 548 | ||
549 | netif_wake_queue(mac->netdev); | ||
550 | |||
479 | return count; | 551 | return count; |
480 | } | 552 | } |
481 | 553 | ||
@@ -486,18 +558,28 @@ static irqreturn_t pasemi_mac_rx_intr(int irq, void *data) | |||
486 | struct pasemi_mac *mac = netdev_priv(dev); | 558 | struct pasemi_mac *mac = netdev_priv(dev); |
487 | unsigned int reg; | 559 | unsigned int reg; |
488 | 560 | ||
489 | if (!(*mac->rx_status & PAS_STATUS_INT)) | 561 | if (!(*mac->rx_status & PAS_STATUS_CAUSE_M)) |
490 | return IRQ_NONE; | 562 | return IRQ_NONE; |
491 | 563 | ||
492 | netif_rx_schedule(dev); | 564 | if (*mac->rx_status & PAS_STATUS_ERROR) |
493 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_COM_TIMEOUTCFG, | 565 | printk("rx_status reported error\n"); |
494 | PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(0)); | 566 | |
567 | /* Don't reset packet count so it won't fire again but clear | ||
568 | * all others. | ||
569 | */ | ||
570 | |||
571 | pci_read_config_dword(mac->dma_pdev, PAS_DMA_RXINT_RCMDSTA(mac->dma_if), ®); | ||
495 | 572 | ||
496 | reg = PAS_IOB_DMA_RXCH_RESET_PINTC | PAS_IOB_DMA_RXCH_RESET_SINTC | | 573 | reg = 0; |
497 | PAS_IOB_DMA_RXCH_RESET_DINTC; | 574 | if (*mac->rx_status & PAS_STATUS_SOFT) |
575 | reg |= PAS_IOB_DMA_RXCH_RESET_SINTC; | ||
576 | if (*mac->rx_status & PAS_STATUS_ERROR) | ||
577 | reg |= PAS_IOB_DMA_RXCH_RESET_DINTC; | ||
498 | if (*mac->rx_status & PAS_STATUS_TIMER) | 578 | if (*mac->rx_status & PAS_STATUS_TIMER) |
499 | reg |= PAS_IOB_DMA_RXCH_RESET_TINTC; | 579 | reg |= PAS_IOB_DMA_RXCH_RESET_TINTC; |
500 | 580 | ||
581 | netif_rx_schedule(dev); | ||
582 | |||
501 | pci_write_config_dword(mac->iob_pdev, | 583 | pci_write_config_dword(mac->iob_pdev, |
502 | PAS_IOB_DMA_RXCH_RESET(mac->dma_rxch), reg); | 584 | PAS_IOB_DMA_RXCH_RESET(mac->dma_rxch), reg); |
503 | 585 | ||
@@ -510,31 +592,137 @@ static irqreturn_t pasemi_mac_tx_intr(int irq, void *data) | |||
510 | struct net_device *dev = data; | 592 | struct net_device *dev = data; |
511 | struct pasemi_mac *mac = netdev_priv(dev); | 593 | struct pasemi_mac *mac = netdev_priv(dev); |
512 | unsigned int reg; | 594 | unsigned int reg; |
513 | int was_full; | ||
514 | 595 | ||
515 | was_full = mac->tx->next_to_clean - mac->tx->next_to_use == TX_RING_SIZE; | 596 | if (!(*mac->tx_status & PAS_STATUS_CAUSE_M)) |
516 | |||
517 | if (!(*mac->tx_status & PAS_STATUS_INT)) | ||
518 | return IRQ_NONE; | 597 | return IRQ_NONE; |
519 | 598 | ||
520 | pasemi_mac_clean_tx(mac); | 599 | pasemi_mac_clean_tx(mac); |
521 | 600 | ||
522 | reg = PAS_IOB_DMA_TXCH_RESET_PINTC | PAS_IOB_DMA_TXCH_RESET_SINTC; | 601 | reg = PAS_IOB_DMA_TXCH_RESET_PINTC; |
523 | if (*mac->tx_status & PAS_STATUS_TIMER) | 602 | |
524 | reg |= PAS_IOB_DMA_TXCH_RESET_TINTC; | 603 | if (*mac->tx_status & PAS_STATUS_SOFT) |
604 | reg |= PAS_IOB_DMA_TXCH_RESET_SINTC; | ||
605 | if (*mac->tx_status & PAS_STATUS_ERROR) | ||
606 | reg |= PAS_IOB_DMA_TXCH_RESET_DINTC; | ||
525 | 607 | ||
526 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), | 608 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), |
527 | reg); | 609 | reg); |
528 | 610 | ||
529 | if (was_full) | ||
530 | netif_wake_queue(dev); | ||
531 | |||
532 | return IRQ_HANDLED; | 611 | return IRQ_HANDLED; |
533 | } | 612 | } |
534 | 613 | ||
614 | static void pasemi_adjust_link(struct net_device *dev) | ||
615 | { | ||
616 | struct pasemi_mac *mac = netdev_priv(dev); | ||
617 | int msg; | ||
618 | unsigned int flags; | ||
619 | unsigned int new_flags; | ||
620 | |||
621 | if (!mac->phydev->link) { | ||
622 | /* If no link, MAC speed settings don't matter. Just report | ||
623 | * link down and return. | ||
624 | */ | ||
625 | if (mac->link && netif_msg_link(mac)) | ||
626 | printk(KERN_INFO "%s: Link is down.\n", dev->name); | ||
627 | |||
628 | netif_carrier_off(dev); | ||
629 | mac->link = 0; | ||
630 | |||
631 | return; | ||
632 | } else | ||
633 | netif_carrier_on(dev); | ||
634 | |||
635 | pci_read_config_dword(mac->pdev, PAS_MAC_CFG_PCFG, &flags); | ||
636 | new_flags = flags & ~(PAS_MAC_CFG_PCFG_HD | PAS_MAC_CFG_PCFG_SPD_M | | ||
637 | PAS_MAC_CFG_PCFG_TSR_M); | ||
638 | |||
639 | if (!mac->phydev->duplex) | ||
640 | new_flags |= PAS_MAC_CFG_PCFG_HD; | ||
641 | |||
642 | switch (mac->phydev->speed) { | ||
643 | case 1000: | ||
644 | new_flags |= PAS_MAC_CFG_PCFG_SPD_1G | | ||
645 | PAS_MAC_CFG_PCFG_TSR_1G; | ||
646 | break; | ||
647 | case 100: | ||
648 | new_flags |= PAS_MAC_CFG_PCFG_SPD_100M | | ||
649 | PAS_MAC_CFG_PCFG_TSR_100M; | ||
650 | break; | ||
651 | case 10: | ||
652 | new_flags |= PAS_MAC_CFG_PCFG_SPD_10M | | ||
653 | PAS_MAC_CFG_PCFG_TSR_10M; | ||
654 | break; | ||
655 | default: | ||
656 | printk("Unsupported speed %d\n", mac->phydev->speed); | ||
657 | } | ||
658 | |||
659 | /* Print on link or speed/duplex change */ | ||
660 | msg = mac->link != mac->phydev->link || flags != new_flags; | ||
661 | |||
662 | mac->duplex = mac->phydev->duplex; | ||
663 | mac->speed = mac->phydev->speed; | ||
664 | mac->link = mac->phydev->link; | ||
665 | |||
666 | if (new_flags != flags) | ||
667 | pci_write_config_dword(mac->pdev, PAS_MAC_CFG_PCFG, new_flags); | ||
668 | |||
669 | if (msg && netif_msg_link(mac)) | ||
670 | printk(KERN_INFO "%s: Link is up at %d Mbps, %s duplex.\n", | ||
671 | dev->name, mac->speed, mac->duplex ? "full" : "half"); | ||
672 | } | ||
673 | |||
674 | static int pasemi_mac_phy_init(struct net_device *dev) | ||
675 | { | ||
676 | struct pasemi_mac *mac = netdev_priv(dev); | ||
677 | struct device_node *dn, *phy_dn; | ||
678 | struct phy_device *phydev; | ||
679 | unsigned int phy_id; | ||
680 | const phandle *ph; | ||
681 | const unsigned int *prop; | ||
682 | struct resource r; | ||
683 | int ret; | ||
684 | |||
685 | dn = pci_device_to_OF_node(mac->pdev); | ||
686 | ph = of_get_property(dn, "phy-handle", NULL); | ||
687 | if (!ph) | ||
688 | return -ENODEV; | ||
689 | phy_dn = of_find_node_by_phandle(*ph); | ||
690 | |||
691 | prop = of_get_property(phy_dn, "reg", NULL); | ||
692 | ret = of_address_to_resource(phy_dn->parent, 0, &r); | ||
693 | if (ret) | ||
694 | goto err; | ||
695 | |||
696 | phy_id = *prop; | ||
697 | snprintf(mac->phy_id, BUS_ID_SIZE, PHY_ID_FMT, (int)r.start, phy_id); | ||
698 | |||
699 | of_node_put(phy_dn); | ||
700 | |||
701 | mac->link = 0; | ||
702 | mac->speed = 0; | ||
703 | mac->duplex = -1; | ||
704 | |||
705 | phydev = phy_connect(dev, mac->phy_id, &pasemi_adjust_link, 0, PHY_INTERFACE_MODE_SGMII); | ||
706 | |||
707 | if (IS_ERR(phydev)) { | ||
708 | printk(KERN_ERR "%s: Could not attach to phy\n", dev->name); | ||
709 | return PTR_ERR(phydev); | ||
710 | } | ||
711 | |||
712 | mac->phydev = phydev; | ||
713 | |||
714 | return 0; | ||
715 | |||
716 | err: | ||
717 | of_node_put(phy_dn); | ||
718 | return -ENODEV; | ||
719 | } | ||
720 | |||
721 | |||
535 | static int pasemi_mac_open(struct net_device *dev) | 722 | static int pasemi_mac_open(struct net_device *dev) |
536 | { | 723 | { |
537 | struct pasemi_mac *mac = netdev_priv(dev); | 724 | struct pasemi_mac *mac = netdev_priv(dev); |
725 | int base_irq; | ||
538 | unsigned int flags; | 726 | unsigned int flags; |
539 | int ret; | 727 | int ret; |
540 | 728 | ||
@@ -558,10 +746,18 @@ static int pasemi_mac_open(struct net_device *dev) | |||
558 | flags |= PAS_MAC_CFG_PCFG_TSR_1G | PAS_MAC_CFG_PCFG_SPD_1G; | 746 | flags |= PAS_MAC_CFG_PCFG_TSR_1G | PAS_MAC_CFG_PCFG_SPD_1G; |
559 | 747 | ||
560 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_RXCH_CFG(mac->dma_rxch), | 748 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_RXCH_CFG(mac->dma_rxch), |
561 | PAS_IOB_DMA_RXCH_CFG_CNTTH(30)); | 749 | PAS_IOB_DMA_RXCH_CFG_CNTTH(1)); |
562 | 750 | ||
751 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_TXCH_CFG(mac->dma_txch), | ||
752 | PAS_IOB_DMA_TXCH_CFG_CNTTH(32)); | ||
753 | |||
754 | /* Clear out any residual packet count state from firmware */ | ||
755 | pasemi_mac_restart_rx_intr(mac); | ||
756 | pasemi_mac_restart_tx_intr(mac); | ||
757 | |||
758 | /* 0xffffff is max value, about 16ms */ | ||
563 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_COM_TIMEOUTCFG, | 759 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_COM_TIMEOUTCFG, |
564 | PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(1000000)); | 760 | PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(0xffffff)); |
565 | 761 | ||
566 | pci_write_config_dword(mac->pdev, PAS_MAC_CFG_PCFG, flags); | 762 | pci_write_config_dword(mac->pdev, PAS_MAC_CFG_PCFG, flags); |
567 | 763 | ||
@@ -595,31 +791,50 @@ static int pasemi_mac_open(struct net_device *dev) | |||
595 | 791 | ||
596 | pasemi_mac_replenish_rx_ring(dev); | 792 | pasemi_mac_replenish_rx_ring(dev); |
597 | 793 | ||
794 | ret = pasemi_mac_phy_init(dev); | ||
795 | /* Some configs don't have PHYs (XAUI etc), so don't complain about | ||
796 | * failed init due to -ENODEV. | ||
797 | */ | ||
798 | if (ret && ret != -ENODEV) | ||
799 | dev_warn(&mac->pdev->dev, "phy init failed: %d\n", ret); | ||
800 | |||
598 | netif_start_queue(dev); | 801 | netif_start_queue(dev); |
599 | netif_poll_enable(dev); | 802 | netif_poll_enable(dev); |
600 | 803 | ||
601 | ret = request_irq(mac->dma_pdev->irq + mac->dma_txch, | 804 | /* Interrupts are a bit different for our DMA controller: While |
602 | &pasemi_mac_tx_intr, IRQF_DISABLED, | 805 | * it's got one a regular PCI device header, the interrupt there |
806 | * is really the base of the range it's using. Each tx and rx | ||
807 | * channel has it's own interrupt source. | ||
808 | */ | ||
809 | |||
810 | base_irq = virq_to_hw(mac->dma_pdev->irq); | ||
811 | |||
812 | mac->tx_irq = irq_create_mapping(NULL, base_irq + mac->dma_txch); | ||
813 | mac->rx_irq = irq_create_mapping(NULL, base_irq + 20 + mac->dma_txch); | ||
814 | |||
815 | ret = request_irq(mac->tx_irq, &pasemi_mac_tx_intr, IRQF_DISABLED, | ||
603 | mac->tx->irq_name, dev); | 816 | mac->tx->irq_name, dev); |
604 | if (ret) { | 817 | if (ret) { |
605 | dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", | 818 | dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", |
606 | mac->dma_pdev->irq + mac->dma_txch, ret); | 819 | base_irq + mac->dma_txch, ret); |
607 | goto out_tx_int; | 820 | goto out_tx_int; |
608 | } | 821 | } |
609 | 822 | ||
610 | ret = request_irq(mac->dma_pdev->irq + 20 + mac->dma_rxch, | 823 | ret = request_irq(mac->rx_irq, &pasemi_mac_rx_intr, IRQF_DISABLED, |
611 | &pasemi_mac_rx_intr, IRQF_DISABLED, | ||
612 | mac->rx->irq_name, dev); | 824 | mac->rx->irq_name, dev); |
613 | if (ret) { | 825 | if (ret) { |
614 | dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", | 826 | dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", |
615 | mac->dma_pdev->irq + 20 + mac->dma_rxch, ret); | 827 | base_irq + 20 + mac->dma_rxch, ret); |
616 | goto out_rx_int; | 828 | goto out_rx_int; |
617 | } | 829 | } |
618 | 830 | ||
831 | if (mac->phydev) | ||
832 | phy_start(mac->phydev); | ||
833 | |||
619 | return 0; | 834 | return 0; |
620 | 835 | ||
621 | out_rx_int: | 836 | out_rx_int: |
622 | free_irq(mac->dma_pdev->irq + mac->dma_txch, dev); | 837 | free_irq(mac->tx_irq, dev); |
623 | out_tx_int: | 838 | out_tx_int: |
624 | netif_poll_disable(dev); | 839 | netif_poll_disable(dev); |
625 | netif_stop_queue(dev); | 840 | netif_stop_queue(dev); |
@@ -639,6 +854,11 @@ static int pasemi_mac_close(struct net_device *dev) | |||
639 | unsigned int stat; | 854 | unsigned int stat; |
640 | int retries; | 855 | int retries; |
641 | 856 | ||
857 | if (mac->phydev) { | ||
858 | phy_stop(mac->phydev); | ||
859 | phy_disconnect(mac->phydev); | ||
860 | } | ||
861 | |||
642 | netif_stop_queue(dev); | 862 | netif_stop_queue(dev); |
643 | 863 | ||
644 | /* Clean out any pending buffers */ | 864 | /* Clean out any pending buffers */ |
@@ -660,40 +880,37 @@ static int pasemi_mac_close(struct net_device *dev) | |||
660 | pci_read_config_dword(mac->dma_pdev, | 880 | pci_read_config_dword(mac->dma_pdev, |
661 | PAS_DMA_TXCHAN_TCMDSTA(mac->dma_txch), | 881 | PAS_DMA_TXCHAN_TCMDSTA(mac->dma_txch), |
662 | &stat); | 882 | &stat); |
663 | if (stat & PAS_DMA_TXCHAN_TCMDSTA_ACT) | 883 | if (!(stat & PAS_DMA_TXCHAN_TCMDSTA_ACT)) |
664 | break; | 884 | break; |
665 | cond_resched(); | 885 | cond_resched(); |
666 | } | 886 | } |
667 | 887 | ||
668 | if (!(stat & PAS_DMA_TXCHAN_TCMDSTA_ACT)) { | 888 | if (stat & PAS_DMA_TXCHAN_TCMDSTA_ACT) |
669 | dev_err(&mac->dma_pdev->dev, "Failed to stop tx channel\n"); | 889 | dev_err(&mac->dma_pdev->dev, "Failed to stop tx channel\n"); |
670 | } | ||
671 | 890 | ||
672 | for (retries = 0; retries < MAX_RETRIES; retries++) { | 891 | for (retries = 0; retries < MAX_RETRIES; retries++) { |
673 | pci_read_config_dword(mac->dma_pdev, | 892 | pci_read_config_dword(mac->dma_pdev, |
674 | PAS_DMA_RXCHAN_CCMDSTA(mac->dma_rxch), | 893 | PAS_DMA_RXCHAN_CCMDSTA(mac->dma_rxch), |
675 | &stat); | 894 | &stat); |
676 | if (stat & PAS_DMA_RXCHAN_CCMDSTA_ACT) | 895 | if (!(stat & PAS_DMA_RXCHAN_CCMDSTA_ACT)) |
677 | break; | 896 | break; |
678 | cond_resched(); | 897 | cond_resched(); |
679 | } | 898 | } |
680 | 899 | ||
681 | if (!(stat & PAS_DMA_RXCHAN_CCMDSTA_ACT)) { | 900 | if (stat & PAS_DMA_RXCHAN_CCMDSTA_ACT) |
682 | dev_err(&mac->dma_pdev->dev, "Failed to stop rx channel\n"); | 901 | dev_err(&mac->dma_pdev->dev, "Failed to stop rx channel\n"); |
683 | } | ||
684 | 902 | ||
685 | for (retries = 0; retries < MAX_RETRIES; retries++) { | 903 | for (retries = 0; retries < MAX_RETRIES; retries++) { |
686 | pci_read_config_dword(mac->dma_pdev, | 904 | pci_read_config_dword(mac->dma_pdev, |
687 | PAS_DMA_RXINT_RCMDSTA(mac->dma_if), | 905 | PAS_DMA_RXINT_RCMDSTA(mac->dma_if), |
688 | &stat); | 906 | &stat); |
689 | if (stat & PAS_DMA_RXINT_RCMDSTA_ACT) | 907 | if (!(stat & PAS_DMA_RXINT_RCMDSTA_ACT)) |
690 | break; | 908 | break; |
691 | cond_resched(); | 909 | cond_resched(); |
692 | } | 910 | } |
693 | 911 | ||
694 | if (!(stat & PAS_DMA_RXINT_RCMDSTA_ACT)) { | 912 | if (stat & PAS_DMA_RXINT_RCMDSTA_ACT) |
695 | dev_err(&mac->dma_pdev->dev, "Failed to stop rx interface\n"); | 913 | dev_err(&mac->dma_pdev->dev, "Failed to stop rx interface\n"); |
696 | } | ||
697 | 914 | ||
698 | /* Then, disable the channel. This must be done separately from | 915 | /* Then, disable the channel. This must be done separately from |
699 | * stopping, since you can't disable when active. | 916 | * stopping, since you can't disable when active. |
@@ -706,8 +923,8 @@ static int pasemi_mac_close(struct net_device *dev) | |||
706 | pci_write_config_dword(mac->dma_pdev, | 923 | pci_write_config_dword(mac->dma_pdev, |
707 | PAS_DMA_RXINT_RCMDSTA(mac->dma_if), 0); | 924 | PAS_DMA_RXINT_RCMDSTA(mac->dma_if), 0); |
708 | 925 | ||
709 | free_irq(mac->dma_pdev->irq + mac->dma_txch, dev); | 926 | free_irq(mac->tx_irq, dev); |
710 | free_irq(mac->dma_pdev->irq + 20 + mac->dma_rxch, dev); | 927 | free_irq(mac->rx_irq, dev); |
711 | 928 | ||
712 | /* Free resources */ | 929 | /* Free resources */ |
713 | pasemi_mac_free_rx_resources(dev); | 930 | pasemi_mac_free_rx_resources(dev); |
@@ -802,6 +1019,7 @@ static struct net_device_stats *pasemi_mac_get_stats(struct net_device *dev) | |||
802 | return &mac->stats; | 1019 | return &mac->stats; |
803 | } | 1020 | } |
804 | 1021 | ||
1022 | |||
805 | static void pasemi_mac_set_rx_mode(struct net_device *dev) | 1023 | static void pasemi_mac_set_rx_mode(struct net_device *dev) |
806 | { | 1024 | { |
807 | struct pasemi_mac *mac = netdev_priv(dev); | 1025 | struct pasemi_mac *mac = netdev_priv(dev); |
@@ -826,18 +1044,17 @@ static int pasemi_mac_poll(struct net_device *dev, int *budget) | |||
826 | 1044 | ||
827 | pkts = pasemi_mac_clean_rx(mac, limit); | 1045 | pkts = pasemi_mac_clean_rx(mac, limit); |
828 | 1046 | ||
1047 | dev->quota -= pkts; | ||
1048 | *budget -= pkts; | ||
1049 | |||
829 | if (pkts < limit) { | 1050 | if (pkts < limit) { |
830 | /* all done, no more packets present */ | 1051 | /* all done, no more packets present */ |
831 | netif_rx_complete(dev); | 1052 | netif_rx_complete(dev); |
832 | 1053 | ||
833 | /* re-enable receive interrupts */ | 1054 | pasemi_mac_restart_rx_intr(mac); |
834 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_COM_TIMEOUTCFG, | ||
835 | PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(1000000)); | ||
836 | return 0; | 1055 | return 0; |
837 | } else { | 1056 | } else { |
838 | /* used up our quantum, so reschedule */ | 1057 | /* used up our quantum, so reschedule */ |
839 | dev->quota -= pkts; | ||
840 | *budget -= pkts; | ||
841 | return 1; | 1058 | return 1; |
842 | } | 1059 | } |
843 | } | 1060 | } |
@@ -937,6 +1154,11 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
937 | mac->rx_status = &dma_status->rx_sta[mac->dma_rxch]; | 1154 | mac->rx_status = &dma_status->rx_sta[mac->dma_rxch]; |
938 | mac->tx_status = &dma_status->tx_sta[mac->dma_txch]; | 1155 | mac->tx_status = &dma_status->tx_sta[mac->dma_txch]; |
939 | 1156 | ||
1157 | mac->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); | ||
1158 | |||
1159 | /* Enable most messages by default */ | ||
1160 | mac->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1; | ||
1161 | |||
940 | err = register_netdev(dev); | 1162 | err = register_netdev(dev); |
941 | 1163 | ||
942 | if (err) { | 1164 | if (err) { |
@@ -1011,9 +1233,5 @@ int pasemi_mac_init_module(void) | |||
1011 | return pci_register_driver(&pasemi_mac_driver); | 1233 | return pci_register_driver(&pasemi_mac_driver); |
1012 | } | 1234 | } |
1013 | 1235 | ||
1014 | MODULE_LICENSE("GPL"); | ||
1015 | MODULE_AUTHOR ("Olof Johansson <olof@lixom.net>"); | ||
1016 | MODULE_DESCRIPTION("PA Semi PWRficient Ethernet driver"); | ||
1017 | |||
1018 | module_init(pasemi_mac_init_module); | 1236 | module_init(pasemi_mac_init_module); |
1019 | module_exit(pasemi_mac_cleanup_module); | 1237 | module_exit(pasemi_mac_cleanup_module); |
diff --git a/drivers/net/pasemi_mac.h b/drivers/net/pasemi_mac.h index c3e37e46a18a..8bc0cea8b145 100644 --- a/drivers/net/pasemi_mac.h +++ b/drivers/net/pasemi_mac.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/ethtool.h> | 24 | #include <linux/ethtool.h> |
25 | #include <linux/netdevice.h> | 25 | #include <linux/netdevice.h> |
26 | #include <linux/spinlock.h> | 26 | #include <linux/spinlock.h> |
27 | #include <linux/phy.h> | ||
27 | 28 | ||
28 | struct pasemi_mac_txring { | 29 | struct pasemi_mac_txring { |
29 | spinlock_t lock; | 30 | spinlock_t lock; |
@@ -54,6 +55,7 @@ struct pasemi_mac { | |||
54 | struct pci_dev *pdev; | 55 | struct pci_dev *pdev; |
55 | struct pci_dev *dma_pdev; | 56 | struct pci_dev *dma_pdev; |
56 | struct pci_dev *iob_pdev; | 57 | struct pci_dev *iob_pdev; |
58 | struct phy_device *phydev; | ||
57 | struct net_device_stats stats; | 59 | struct net_device_stats stats; |
58 | 60 | ||
59 | /* Pointer to the cacheable per-channel status registers */ | 61 | /* Pointer to the cacheable per-channel status registers */ |
@@ -73,6 +75,14 @@ struct pasemi_mac { | |||
73 | 75 | ||
74 | struct pasemi_mac_txring *tx; | 76 | struct pasemi_mac_txring *tx; |
75 | struct pasemi_mac_rxring *rx; | 77 | struct pasemi_mac_rxring *rx; |
78 | unsigned long tx_irq; | ||
79 | unsigned long rx_irq; | ||
80 | int link; | ||
81 | int speed; | ||
82 | int duplex; | ||
83 | |||
84 | unsigned int msg_enable; | ||
85 | char phy_id[BUS_ID_SIZE]; | ||
76 | }; | 86 | }; |
77 | 87 | ||
78 | /* Software status descriptor (desc_info) */ | 88 | /* Software status descriptor (desc_info) */ |
@@ -193,11 +203,15 @@ enum { | |||
193 | #define PAS_DMA_RXINT_RCMDSTA(i) (0x200+(i)*_PAS_DMA_RXINT_STRIDE) | 203 | #define PAS_DMA_RXINT_RCMDSTA(i) (0x200+(i)*_PAS_DMA_RXINT_STRIDE) |
194 | #define PAS_DMA_RXINT_RCMDSTA_EN 0x00000001 | 204 | #define PAS_DMA_RXINT_RCMDSTA_EN 0x00000001 |
195 | #define PAS_DMA_RXINT_RCMDSTA_ST 0x00000002 | 205 | #define PAS_DMA_RXINT_RCMDSTA_ST 0x00000002 |
196 | #define PAS_DMA_RXINT_RCMDSTA_OO 0x00000100 | 206 | #define PAS_DMA_RXINT_RCMDSTA_MBT 0x00000008 |
197 | #define PAS_DMA_RXINT_RCMDSTA_BP 0x00000200 | 207 | #define PAS_DMA_RXINT_RCMDSTA_MDR 0x00000010 |
198 | #define PAS_DMA_RXINT_RCMDSTA_DR 0x00000400 | 208 | #define PAS_DMA_RXINT_RCMDSTA_MOO 0x00000020 |
209 | #define PAS_DMA_RXINT_RCMDSTA_MBP 0x00000040 | ||
199 | #define PAS_DMA_RXINT_RCMDSTA_BT 0x00000800 | 210 | #define PAS_DMA_RXINT_RCMDSTA_BT 0x00000800 |
200 | #define PAS_DMA_RXINT_RCMDSTA_TB 0x00001000 | 211 | #define PAS_DMA_RXINT_RCMDSTA_DR 0x00001000 |
212 | #define PAS_DMA_RXINT_RCMDSTA_OO 0x00002000 | ||
213 | #define PAS_DMA_RXINT_RCMDSTA_BP 0x00004000 | ||
214 | #define PAS_DMA_RXINT_RCMDSTA_TB 0x00008000 | ||
201 | #define PAS_DMA_RXINT_RCMDSTA_ACT 0x00010000 | 215 | #define PAS_DMA_RXINT_RCMDSTA_ACT 0x00010000 |
202 | #define PAS_DMA_RXINT_RCMDSTA_DROPS_M 0xfffe0000 | 216 | #define PAS_DMA_RXINT_RCMDSTA_DROPS_M 0xfffe0000 |
203 | #define PAS_DMA_RXINT_RCMDSTA_DROPS_S 17 | 217 | #define PAS_DMA_RXINT_RCMDSTA_DROPS_S 17 |
@@ -297,6 +311,7 @@ enum { | |||
297 | #define PAS_STATUS_DCNT_S 16 | 311 | #define PAS_STATUS_DCNT_S 16 |
298 | #define PAS_STATUS_BPCNT_M 0x0000ffff00000000ull | 312 | #define PAS_STATUS_BPCNT_M 0x0000ffff00000000ull |
299 | #define PAS_STATUS_BPCNT_S 32 | 313 | #define PAS_STATUS_BPCNT_S 32 |
314 | #define PAS_STATUS_CAUSE_M 0xf000000000000000ull | ||
300 | #define PAS_STATUS_TIMER 0x1000000000000000ull | 315 | #define PAS_STATUS_TIMER 0x1000000000000000ull |
301 | #define PAS_STATUS_ERROR 0x2000000000000000ull | 316 | #define PAS_STATUS_ERROR 0x2000000000000000ull |
302 | #define PAS_STATUS_SOFT 0x4000000000000000ull | 317 | #define PAS_STATUS_SOFT 0x4000000000000000ull |
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 809ec440b8eb..258d6f396186 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -1420,7 +1420,7 @@ set_addresses(struct net_device *dev) | |||
1420 | kio_addr_t ioaddr = dev->base_addr; | 1420 | kio_addr_t ioaddr = dev->base_addr; |
1421 | local_info_t *lp = netdev_priv(dev); | 1421 | local_info_t *lp = netdev_priv(dev); |
1422 | struct dev_mc_list *dmi = dev->mc_list; | 1422 | struct dev_mc_list *dmi = dev->mc_list; |
1423 | char *addr; | 1423 | unsigned char *addr; |
1424 | int i,j,k,n; | 1424 | int i,j,k,n; |
1425 | 1425 | ||
1426 | SelectPage(k=0x50); | 1426 | SelectPage(k=0x50); |
@@ -1429,6 +1429,9 @@ set_addresses(struct net_device *dev) | |||
1429 | if (++n > 9) | 1429 | if (++n > 9) |
1430 | break; | 1430 | break; |
1431 | i = 0; | 1431 | i = 0; |
1432 | if (n > 1 && n <= dev->mc_count && dmi) { | ||
1433 | dmi = dmi->next; | ||
1434 | } | ||
1432 | } | 1435 | } |
1433 | if (j > 15) { | 1436 | if (j > 15) { |
1434 | j = 8; | 1437 | j = 8; |
@@ -1436,10 +1439,9 @@ set_addresses(struct net_device *dev) | |||
1436 | SelectPage(k); | 1439 | SelectPage(k); |
1437 | } | 1440 | } |
1438 | 1441 | ||
1439 | if (n && n <= dev->mc_count && dmi) { | 1442 | if (n && n <= dev->mc_count && dmi) |
1440 | addr = dmi->dmi_addr; | 1443 | addr = dmi->dmi_addr; |
1441 | dmi = dmi->next; | 1444 | else |
1442 | } else | ||
1443 | addr = dev->dev_addr; | 1445 | addr = dev->dev_addr; |
1444 | 1446 | ||
1445 | if (lp->mohawk) | 1447 | if (lp->mohawk) |
@@ -1465,10 +1467,10 @@ set_multicast_list(struct net_device *dev) | |||
1465 | if (dev->flags & IFF_PROMISC) { /* snoop */ | 1467 | if (dev->flags & IFF_PROMISC) { /* snoop */ |
1466 | PutByte(XIRCREG42_SWC1, 0x06); /* set MPE and PME */ | 1468 | PutByte(XIRCREG42_SWC1, 0x06); /* set MPE and PME */ |
1467 | } else if (dev->mc_count > 9 || (dev->flags & IFF_ALLMULTI)) { | 1469 | } else if (dev->mc_count > 9 || (dev->flags & IFF_ALLMULTI)) { |
1468 | PutByte(XIRCREG42_SWC1, 0x06); /* set MPE */ | 1470 | PutByte(XIRCREG42_SWC1, 0x02); /* set MPE */ |
1469 | } else if (dev->mc_count) { | 1471 | } else if (dev->mc_count) { |
1470 | /* the chip can filter 9 addresses perfectly */ | 1472 | /* the chip can filter 9 addresses perfectly */ |
1471 | PutByte(XIRCREG42_SWC1, 0x00); | 1473 | PutByte(XIRCREG42_SWC1, 0x01); |
1472 | SelectPage(0x40); | 1474 | SelectPage(0x40); |
1473 | PutByte(XIRCREG40_CMD0, Offline); | 1475 | PutByte(XIRCREG40_CMD0, Offline); |
1474 | set_addresses(dev); | 1476 | set_addresses(dev); |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 21afe108d3cb..b07da1054add 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -135,10 +135,13 @@ static void skge_get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
135 | /* Wake on Lan only supported on Yukon chips with rev 1 or above */ | 135 | /* Wake on Lan only supported on Yukon chips with rev 1 or above */ |
136 | static u32 wol_supported(const struct skge_hw *hw) | 136 | static u32 wol_supported(const struct skge_hw *hw) |
137 | { | 137 | { |
138 | if (hw->chip_id == CHIP_ID_YUKON && hw->chip_rev != 0) | 138 | if (hw->chip_id == CHIP_ID_GENESIS) |
139 | return WAKE_MAGIC | WAKE_PHY; | ||
140 | else | ||
141 | return 0; | 139 | return 0; |
140 | |||
141 | if (hw->chip_id == CHIP_ID_YUKON && hw->chip_rev == 0) | ||
142 | return 0; | ||
143 | |||
144 | return WAKE_MAGIC | WAKE_PHY; | ||
142 | } | 145 | } |
143 | 146 | ||
144 | static u32 pci_wake_enabled(struct pci_dev *dev) | 147 | static u32 pci_wake_enabled(struct pci_dev *dev) |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 238c2ca34da6..a307310f13f5 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -124,10 +124,7 @@ static const struct pci_device_id sky2_id_table[] = { | |||
124 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, /* 88E8050 */ | 124 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, /* 88E8050 */ |
125 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4362) }, /* 88E8053 */ | 125 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4362) }, /* 88E8053 */ |
126 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4363) }, /* 88E8055 */ | 126 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4363) }, /* 88E8055 */ |
127 | #ifdef broken | ||
128 | /* This device causes data corruption problems that are not resolved */ | ||
129 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4364) }, /* 88E8056 */ | 127 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4364) }, /* 88E8056 */ |
130 | #endif | ||
131 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4366) }, /* 88EC036 */ | 128 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4366) }, /* 88EC036 */ |
132 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4367) }, /* 88EC032 */ | 129 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4367) }, /* 88EC032 */ |
133 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) }, /* 88EC034 */ | 130 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) }, /* 88EC034 */ |
@@ -3581,10 +3578,21 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
3581 | goto err_out; | 3578 | goto err_out; |
3582 | } | 3579 | } |
3583 | 3580 | ||
3581 | /* Some Gigabyte motherboards have 88e8056 but cause problems | ||
3582 | * There is some unresolved hardware related problem that causes | ||
3583 | * descriptor errors and receive data corruption. | ||
3584 | */ | ||
3585 | if (pdev->vendor == PCI_VENDOR_ID_MARVELL && | ||
3586 | pdev->device == 0x4364 && pdev->subsystem_vendor == 0x1458) { | ||
3587 | dev_err(&pdev->dev, | ||
3588 | "88E8056 on Gigabyte motherboards not supported\n"); | ||
3589 | goto err_out_disable; | ||
3590 | } | ||
3591 | |||
3584 | err = pci_request_regions(pdev, DRV_NAME); | 3592 | err = pci_request_regions(pdev, DRV_NAME); |
3585 | if (err) { | 3593 | if (err) { |
3586 | dev_err(&pdev->dev, "cannot obtain PCI resources\n"); | 3594 | dev_err(&pdev->dev, "cannot obtain PCI resources\n"); |
3587 | goto err_out; | 3595 | goto err_out_disable; |
3588 | } | 3596 | } |
3589 | 3597 | ||
3590 | pci_set_master(pdev); | 3598 | pci_set_master(pdev); |
@@ -3721,6 +3729,7 @@ err_out_free_hw: | |||
3721 | kfree(hw); | 3729 | kfree(hw); |
3722 | err_out_free_regions: | 3730 | err_out_free_regions: |
3723 | pci_release_regions(pdev); | 3731 | pci_release_regions(pdev); |
3732 | err_out_disable: | ||
3724 | pci_disable_device(pdev); | 3733 | pci_disable_device(pdev); |
3725 | err_out: | 3734 | err_out: |
3726 | return err; | 3735 | return err; |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index 7053026d6c76..111f23d05764 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -279,6 +279,40 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
279 | #define SMC_insw(a, r, p, l) insw((a) + (r), p, l) | 279 | #define SMC_insw(a, r, p, l) insw((a) + (r), p, l) |
280 | #define SMC_outsw(a, r, p, l) outsw((a) + (r), p, l) | 280 | #define SMC_outsw(a, r, p, l) outsw((a) + (r), p, l) |
281 | 281 | ||
282 | #elif defined(CONFIG_SUPERH) | ||
283 | |||
284 | #if defined(CONFIG_SH_7780_SOLUTION_ENGINE) || defined(CONFIG_SH_7722_SOLUTION_ENGINE) | ||
285 | #define SMC_CAN_USE_8BIT 0 | ||
286 | #define SMC_CAN_USE_16BIT 1 | ||
287 | #define SMC_CAN_USE_32BIT 0 | ||
288 | #define SMC_IO_SHIFT 0 | ||
289 | #define SMC_NOWAIT 1 | ||
290 | |||
291 | #define SMC_inb(a, r) (inw((a) + ((r)&~1)) >> (8*(r%2)))&0xff | ||
292 | #define SMC_inw(a, r) inw((a) + (r)) | ||
293 | #define SMC_outb(v, a, r) outw(((inw((a)+((r)&~1))*(0xff<<8*(r%2)))) | ((v)<<(8*(r&2)))), (a) + ((r)&~1)) | ||
294 | |||
295 | #define SMC_outw(v, a, r) outw(v, (a) + (r)) | ||
296 | #define SMC_insw(a, r, p, l) insw((a) + (r), p, l) | ||
297 | #define SMC_outsw(a, r, p, l) outsw((a) + (r), p, l) | ||
298 | |||
299 | #else /* BOARDS */ | ||
300 | |||
301 | #define SMC_CAN_USE_8BIT 1 | ||
302 | #define SMC_CAN_USE_16BIT 1 | ||
303 | #define SMC_CAN_USE_32BIT 1 | ||
304 | |||
305 | #define SMC_inb(a, r) inb((a) + (r)) | ||
306 | #define SMC_inw(a, r) inw((a) + (r)) | ||
307 | #define SMC_outb(v, a, r) outb(v, (a) + (r)) | ||
308 | #define SMC_outw(v, a, r) outw(v, (a) + (r)) | ||
309 | #define SMC_insw(a, r, p, l) insw((a) + (r), p, l) | ||
310 | #define SMC_outsw(a, r, p, l) outsw((a) + (r), p, l) | ||
311 | |||
312 | #endif /* BOARDS */ | ||
313 | |||
314 | #define set_irq_type(irq, type) do {} while (0) | ||
315 | |||
282 | #elif defined(CONFIG_M32R) | 316 | #elif defined(CONFIG_M32R) |
283 | 317 | ||
284 | #define SMC_CAN_USE_8BIT 0 | 318 | #define SMC_CAN_USE_8BIT 0 |
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c index f1e2dfc795a2..463d600ed83d 100644 --- a/drivers/net/tc35815.c +++ b/drivers/net/tc35815.c | |||
@@ -540,7 +540,6 @@ static struct sk_buff *alloc_rxbuf_skb(struct net_device *dev, | |||
540 | skb = dev_alloc_skb(RX_BUF_SIZE); | 540 | skb = dev_alloc_skb(RX_BUF_SIZE); |
541 | if (!skb) | 541 | if (!skb) |
542 | return NULL; | 542 | return NULL; |
543 | skb->dev = dev; | ||
544 | *dma_handle = pci_map_single(hwdev, skb->data, RX_BUF_SIZE, | 543 | *dma_handle = pci_map_single(hwdev, skb->data, RX_BUF_SIZE, |
545 | PCI_DMA_FROMDEVICE); | 544 | PCI_DMA_FROMDEVICE); |
546 | if (pci_dma_mapping_error(*dma_handle)) { | 545 | if (pci_dma_mapping_error(*dma_handle)) { |
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index 0184614517f9..e273347dc606 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -267,7 +267,7 @@ config IPW2200_DEBUG | |||
267 | 267 | ||
268 | config LIBERTAS_USB | 268 | config LIBERTAS_USB |
269 | tristate "Marvell Libertas 8388 802.11a/b/g cards" | 269 | tristate "Marvell Libertas 8388 802.11a/b/g cards" |
270 | depends on NET_RADIO && USB | 270 | depends on USB && WLAN_80211 |
271 | select FW_LOADER | 271 | select FW_LOADER |
272 | ---help--- | 272 | ---help--- |
273 | A driver for Marvell Libertas 8388 USB devices. | 273 | A driver for Marvell Libertas 8388 USB devices. |
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c index cba64e4cfcd4..f770018fe1d5 100644 --- a/drivers/s390/cio/qdio.c +++ b/drivers/s390/cio/qdio.c | |||
@@ -996,18 +996,25 @@ __qdio_outbound_processing(struct qdio_q *q) | |||
996 | if (qdio_has_outbound_q_moved(q)) | 996 | if (qdio_has_outbound_q_moved(q)) |
997 | qdio_kick_outbound_handler(q); | 997 | qdio_kick_outbound_handler(q); |
998 | 998 | ||
999 | if (q->is_iqdio_q) { | 999 | if (q->queue_type == QDIO_ZFCP_QFMT) { |
1000 | if ((!q->hydra_gives_outbound_pcis) && | ||
1001 | (!qdio_is_outbound_q_done(q))) | ||
1002 | qdio_mark_q(q); | ||
1003 | } | ||
1004 | else if (((!q->is_iqdio_q) && (!q->is_pci_out)) || | ||
1005 | (q->queue_type == QDIO_IQDIO_QFMT_ASYNCH)) { | ||
1000 | /* | 1006 | /* |
1001 | * for asynchronous queues, we better check, if the sent | 1007 | * make sure buffer switch from PRIMED to EMPTY is noticed |
1002 | * buffer is already switched from PRIMED to EMPTY. | 1008 | * and outbound_handler is called |
1003 | */ | 1009 | */ |
1004 | if ((q->queue_type == QDIO_IQDIO_QFMT_ASYNCH) && | 1010 | if (qdio_is_outbound_q_done(q)) { |
1005 | !qdio_is_outbound_q_done(q)) | 1011 | del_timer(&q->timer); |
1006 | qdio_mark_q(q); | 1012 | } else { |
1007 | 1013 | if (!timer_pending(&q->timer)) | |
1008 | } else if (!q->hydra_gives_outbound_pcis) | 1014 | mod_timer(&q->timer, jiffies + |
1009 | if (!qdio_is_outbound_q_done(q)) | 1015 | QDIO_FORCE_CHECK_TIMEOUT); |
1010 | qdio_mark_q(q); | 1016 | } |
1017 | } | ||
1011 | 1018 | ||
1012 | qdio_release_q(q); | 1019 | qdio_release_q(q); |
1013 | } | 1020 | } |
@@ -1826,6 +1833,7 @@ qdio_fill_qs(struct qdio_irq *irq_ptr, struct ccw_device *cdev, | |||
1826 | q->queue_type = QDIO_IQDIO_QFMT_ASYNCH; | 1833 | q->queue_type = QDIO_IQDIO_QFMT_ASYNCH; |
1827 | q->int_parm=int_parm; | 1834 | q->int_parm=int_parm; |
1828 | q->is_input_q=0; | 1835 | q->is_input_q=0; |
1836 | q->is_pci_out = 0; | ||
1829 | q->schid = irq_ptr->schid; | 1837 | q->schid = irq_ptr->schid; |
1830 | q->cdev = cdev; | 1838 | q->cdev = cdev; |
1831 | q->irq_ptr = irq_ptr; | 1839 | q->irq_ptr = irq_ptr; |
@@ -1838,6 +1846,10 @@ qdio_fill_qs(struct qdio_irq *irq_ptr, struct ccw_device *cdev, | |||
1838 | q->tasklet.data=(unsigned long)q; | 1846 | q->tasklet.data=(unsigned long)q; |
1839 | q->tasklet.func=(void(*)(unsigned long)) | 1847 | q->tasklet.func=(void(*)(unsigned long)) |
1840 | &qdio_outbound_processing; | 1848 | &qdio_outbound_processing; |
1849 | q->timer.function=(void(*)(unsigned long)) | ||
1850 | &qdio_outbound_processing; | ||
1851 | q->timer.data = (long)q; | ||
1852 | init_timer(&q->timer); | ||
1841 | 1853 | ||
1842 | atomic_set(&q->busy_siga_counter,0); | 1854 | atomic_set(&q->busy_siga_counter,0); |
1843 | q->timing.busy_start=0; | 1855 | q->timing.busy_start=0; |
@@ -2635,6 +2647,7 @@ qdio_shutdown(struct ccw_device *cdev, int how) | |||
2635 | 2647 | ||
2636 | for (i=0;i<irq_ptr->no_output_qs;i++) { | 2648 | for (i=0;i<irq_ptr->no_output_qs;i++) { |
2637 | tasklet_kill(&irq_ptr->output_qs[i]->tasklet); | 2649 | tasklet_kill(&irq_ptr->output_qs[i]->tasklet); |
2650 | del_timer(&irq_ptr->output_qs[i]->timer); | ||
2638 | wait_event_interruptible_timeout(cdev->private->wait_q, | 2651 | wait_event_interruptible_timeout(cdev->private->wait_q, |
2639 | !atomic_read(&irq_ptr-> | 2652 | !atomic_read(&irq_ptr-> |
2640 | output_qs[i]-> | 2653 | output_qs[i]-> |
@@ -3458,6 +3471,10 @@ do_qdio_handle_outbound(struct qdio_q *q, unsigned int callflags, | |||
3458 | qdio_perf_stat_inc(&perf_stats.outbound_cnt); | 3471 | qdio_perf_stat_inc(&perf_stats.outbound_cnt); |
3459 | return; | 3472 | return; |
3460 | } | 3473 | } |
3474 | if (callflags & QDIO_FLAG_PCI_OUT) | ||
3475 | q->is_pci_out = 1; | ||
3476 | else | ||
3477 | q->is_pci_out = 0; | ||
3461 | if (q->is_iqdio_q) { | 3478 | if (q->is_iqdio_q) { |
3462 | /* one siga for every sbal */ | 3479 | /* one siga for every sbal */ |
3463 | while (count--) | 3480 | while (count--) |
diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h index 2895392eaae4..6d7aad18f6f0 100644 --- a/drivers/s390/cio/qdio.h +++ b/drivers/s390/cio/qdio.h | |||
@@ -60,6 +60,7 @@ | |||
60 | #define QDIO_ACTIVATE_TIMEOUT ((5*HZ)>>10) | 60 | #define QDIO_ACTIVATE_TIMEOUT ((5*HZ)>>10) |
61 | #define QDIO_CLEANUP_CLEAR_TIMEOUT (20*HZ) | 61 | #define QDIO_CLEANUP_CLEAR_TIMEOUT (20*HZ) |
62 | #define QDIO_CLEANUP_HALT_TIMEOUT (10*HZ) | 62 | #define QDIO_CLEANUP_HALT_TIMEOUT (10*HZ) |
63 | #define QDIO_FORCE_CHECK_TIMEOUT (10*HZ) | ||
63 | 64 | ||
64 | enum qdio_irq_states { | 65 | enum qdio_irq_states { |
65 | QDIO_IRQ_STATE_INACTIVE, | 66 | QDIO_IRQ_STATE_INACTIVE, |
@@ -511,8 +512,8 @@ struct qdio_q { | |||
511 | 512 | ||
512 | void *irq_ptr; | 513 | void *irq_ptr; |
513 | 514 | ||
514 | #ifdef QDIO_USE_TIMERS_FOR_POLLING | ||
515 | struct timer_list timer; | 515 | struct timer_list timer; |
516 | #ifdef QDIO_USE_TIMERS_FOR_POLLING | ||
516 | atomic_t timer_already_set; | 517 | atomic_t timer_already_set; |
517 | spinlock_t timer_lock; | 518 | spinlock_t timer_lock; |
518 | #else /* QDIO_USE_TIMERS_FOR_POLLING */ | 519 | #else /* QDIO_USE_TIMERS_FOR_POLLING */ |
@@ -558,6 +559,7 @@ struct qdio_q { | |||
558 | } timing; | 559 | } timing; |
559 | atomic_t busy_siga_counter; | 560 | atomic_t busy_siga_counter; |
560 | unsigned int queue_type; | 561 | unsigned int queue_type; |
562 | unsigned int is_pci_out; | ||
561 | 563 | ||
562 | /* leave this member at the end. won't be cleared in qdio_fill_qs */ | 564 | /* leave this member at the end. won't be cleared in qdio_fill_qs */ |
563 | struct slib *slib; /* a page is allocated under this pointer, | 565 | struct slib *slib; /* a page is allocated under this pointer, |
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index e10e85e85c84..c358764f3264 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c | |||
@@ -1862,12 +1862,14 @@ static void netiucv_remove_connection(struct iucv_connection *conn) | |||
1862 | write_lock_bh(&iucv_connection_rwlock); | 1862 | write_lock_bh(&iucv_connection_rwlock); |
1863 | list_del_init(&conn->list); | 1863 | list_del_init(&conn->list); |
1864 | write_unlock_bh(&iucv_connection_rwlock); | 1864 | write_unlock_bh(&iucv_connection_rwlock); |
1865 | fsm_deltimer(&conn->timer); | ||
1866 | netiucv_purge_skb_queue(&conn->collect_queue); | ||
1865 | if (conn->path) { | 1867 | if (conn->path) { |
1866 | iucv_path_sever(conn->path, iucvMagic); | 1868 | iucv_path_sever(conn->path, iucvMagic); |
1867 | kfree(conn->path); | 1869 | kfree(conn->path); |
1868 | conn->path = NULL; | 1870 | conn->path = NULL; |
1869 | } | 1871 | } |
1870 | fsm_deltimer(&conn->timer); | 1872 | netiucv_purge_skb_queue(&conn->commit_queue); |
1871 | kfree_fsm(conn->fsm); | 1873 | kfree_fsm(conn->fsm); |
1872 | kfree_skb(conn->rx_buff); | 1874 | kfree_skb(conn->rx_buff); |
1873 | kfree_skb(conn->tx_buff); | 1875 | kfree_skb(conn->tx_buff); |
@@ -2115,7 +2117,6 @@ static void __exit netiucv_exit(void) | |||
2115 | while (!list_empty(&iucv_connection_list)) { | 2117 | while (!list_empty(&iucv_connection_list)) { |
2116 | cp = list_entry(iucv_connection_list.next, | 2118 | cp = list_entry(iucv_connection_list.next, |
2117 | struct iucv_connection, list); | 2119 | struct iucv_connection, list); |
2118 | list_del(&cp->list); | ||
2119 | ndev = cp->netdev; | 2120 | ndev = cp->netdev; |
2120 | priv = netdev_priv(ndev); | 2121 | priv = netdev_priv(ndev); |
2121 | dev = priv->dev; | 2122 | dev = priv->dev; |
diff --git a/drivers/s390/net/qeth_eddp.c b/drivers/s390/net/qeth_eddp.c index dd7034fbfff8..4640f32daae5 100644 --- a/drivers/s390/net/qeth_eddp.c +++ b/drivers/s390/net/qeth_eddp.c | |||
@@ -620,10 +620,10 @@ qeth_eddp_create_context_tcp(struct qeth_card *card, struct sk_buff *skb, | |||
620 | 620 | ||
621 | struct qeth_eddp_context * | 621 | struct qeth_eddp_context * |
622 | qeth_eddp_create_context(struct qeth_card *card, struct sk_buff *skb, | 622 | qeth_eddp_create_context(struct qeth_card *card, struct sk_buff *skb, |
623 | struct qeth_hdr *qhdr) | 623 | struct qeth_hdr *qhdr, unsigned char sk_protocol) |
624 | { | 624 | { |
625 | QETH_DBF_TEXT(trace, 5, "creddpc"); | 625 | QETH_DBF_TEXT(trace, 5, "creddpc"); |
626 | switch (skb->sk->sk_protocol){ | 626 | switch (sk_protocol) { |
627 | case IPPROTO_TCP: | 627 | case IPPROTO_TCP: |
628 | return qeth_eddp_create_context_tcp(card, skb, qhdr); | 628 | return qeth_eddp_create_context_tcp(card, skb, qhdr); |
629 | default: | 629 | default: |
diff --git a/drivers/s390/net/qeth_eddp.h b/drivers/s390/net/qeth_eddp.h index 103768d3bab2..52910c9252c0 100644 --- a/drivers/s390/net/qeth_eddp.h +++ b/drivers/s390/net/qeth_eddp.h | |||
@@ -34,7 +34,8 @@ struct qeth_eddp_context_reference { | |||
34 | }; | 34 | }; |
35 | 35 | ||
36 | extern struct qeth_eddp_context * | 36 | extern struct qeth_eddp_context * |
37 | qeth_eddp_create_context(struct qeth_card *,struct sk_buff *,struct qeth_hdr *); | 37 | qeth_eddp_create_context(struct qeth_card *,struct sk_buff *, |
38 | struct qeth_hdr *, unsigned char); | ||
38 | 39 | ||
39 | extern void | 40 | extern void |
40 | qeth_eddp_put_context(struct qeth_eddp_context *); | 41 | qeth_eddp_put_context(struct qeth_eddp_context *); |
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 6fd8870551d3..29d176036e5c 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -1682,6 +1682,21 @@ qeth_put_reply(struct qeth_reply *reply) | |||
1682 | kfree(reply); | 1682 | kfree(reply); |
1683 | } | 1683 | } |
1684 | 1684 | ||
1685 | static void | ||
1686 | qeth_issue_ipa_msg(struct qeth_ipa_cmd *cmd, struct qeth_card *card) | ||
1687 | { | ||
1688 | int rc; | ||
1689 | int com; | ||
1690 | char * ipa_name; | ||
1691 | |||
1692 | com = cmd->hdr.command; | ||
1693 | rc = cmd->hdr.return_code; | ||
1694 | ipa_name = qeth_get_ipa_cmd_name(com); | ||
1695 | |||
1696 | PRINT_ERR("%s(x%X) for %s returned x%X \"%s\"\n", ipa_name, com, | ||
1697 | QETH_CARD_IFNAME(card), rc, qeth_get_ipa_msg(rc)); | ||
1698 | } | ||
1699 | |||
1685 | static struct qeth_ipa_cmd * | 1700 | static struct qeth_ipa_cmd * |
1686 | qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob) | 1701 | qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob) |
1687 | { | 1702 | { |
@@ -1690,8 +1705,11 @@ qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob) | |||
1690 | QETH_DBF_TEXT(trace,5,"chkipad"); | 1705 | QETH_DBF_TEXT(trace,5,"chkipad"); |
1691 | if (IS_IPA(iob->data)){ | 1706 | if (IS_IPA(iob->data)){ |
1692 | cmd = (struct qeth_ipa_cmd *) PDU_ENCAPSULATION(iob->data); | 1707 | cmd = (struct qeth_ipa_cmd *) PDU_ENCAPSULATION(iob->data); |
1693 | if (IS_IPA_REPLY(cmd)) | 1708 | if (IS_IPA_REPLY(cmd)) { |
1709 | if (cmd->hdr.return_code) | ||
1710 | qeth_issue_ipa_msg(cmd, card); | ||
1694 | return cmd; | 1711 | return cmd; |
1712 | } | ||
1695 | else { | 1713 | else { |
1696 | switch (cmd->hdr.command) { | 1714 | switch (cmd->hdr.command) { |
1697 | case IPA_CMD_STOPLAN: | 1715 | case IPA_CMD_STOPLAN: |
@@ -2816,6 +2834,7 @@ qeth_flush_buffers(struct qeth_qdio_out_q *queue, int under_int, | |||
2816 | struct qeth_qdio_out_buffer *buf; | 2834 | struct qeth_qdio_out_buffer *buf; |
2817 | int rc; | 2835 | int rc; |
2818 | int i; | 2836 | int i; |
2837 | unsigned int qdio_flags; | ||
2819 | 2838 | ||
2820 | QETH_DBF_TEXT(trace, 6, "flushbuf"); | 2839 | QETH_DBF_TEXT(trace, 6, "flushbuf"); |
2821 | 2840 | ||
@@ -2859,13 +2878,13 @@ qeth_flush_buffers(struct qeth_qdio_out_q *queue, int under_int, | |||
2859 | queue->card->perf_stats.outbound_do_qdio_start_time = | 2878 | queue->card->perf_stats.outbound_do_qdio_start_time = |
2860 | qeth_get_micros(); | 2879 | qeth_get_micros(); |
2861 | } | 2880 | } |
2881 | qdio_flags = QDIO_FLAG_SYNC_OUTPUT; | ||
2862 | if (under_int) | 2882 | if (under_int) |
2863 | rc = do_QDIO(CARD_DDEV(queue->card), | 2883 | qdio_flags |= QDIO_FLAG_UNDER_INTERRUPT; |
2864 | QDIO_FLAG_SYNC_OUTPUT | QDIO_FLAG_UNDER_INTERRUPT, | 2884 | if (atomic_read(&queue->set_pci_flags_count)) |
2865 | queue->queue_no, index, count, NULL); | 2885 | qdio_flags |= QDIO_FLAG_PCI_OUT; |
2866 | else | 2886 | rc = do_QDIO(CARD_DDEV(queue->card), qdio_flags, |
2867 | rc = do_QDIO(CARD_DDEV(queue->card), QDIO_FLAG_SYNC_OUTPUT, | 2887 | queue->queue_no, index, count, NULL); |
2868 | queue->queue_no, index, count, NULL); | ||
2869 | if (queue->card->options.performance_stats) | 2888 | if (queue->card->options.performance_stats) |
2870 | queue->card->perf_stats.outbound_do_qdio_time += | 2889 | queue->card->perf_stats.outbound_do_qdio_time += |
2871 | qeth_get_micros() - | 2890 | qeth_get_micros() - |
@@ -4490,7 +4509,8 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb) | |||
4490 | qeth_fill_header(card, hdr, new_skb, ipv, cast_type); | 4509 | qeth_fill_header(card, hdr, new_skb, ipv, cast_type); |
4491 | } | 4510 | } |
4492 | if (large_send == QETH_LARGE_SEND_EDDP) { | 4511 | if (large_send == QETH_LARGE_SEND_EDDP) { |
4493 | ctx = qeth_eddp_create_context(card, new_skb, hdr); | 4512 | ctx = qeth_eddp_create_context(card, new_skb, hdr, |
4513 | skb->sk->sk_protocol); | ||
4494 | if (ctx == NULL) { | 4514 | if (ctx == NULL) { |
4495 | __qeth_free_new_skb(skb, new_skb); | 4515 | __qeth_free_new_skb(skb, new_skb); |
4496 | PRINT_WARN("could not create eddp context\n"); | 4516 | PRINT_WARN("could not create eddp context\n"); |
@@ -5948,9 +5968,6 @@ qeth_layer2_send_setmac_cb(struct qeth_card *card, | |||
5948 | cmd = (struct qeth_ipa_cmd *) data; | 5968 | cmd = (struct qeth_ipa_cmd *) data; |
5949 | if (cmd->hdr.return_code) { | 5969 | if (cmd->hdr.return_code) { |
5950 | QETH_DBF_TEXT_(trace, 2, "L2er%x", cmd->hdr.return_code); | 5970 | QETH_DBF_TEXT_(trace, 2, "L2er%x", cmd->hdr.return_code); |
5951 | PRINT_WARN("Error in registering MAC address on " \ | ||
5952 | "device %s: x%x\n", CARD_BUS_ID(card), | ||
5953 | cmd->hdr.return_code); | ||
5954 | card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; | 5971 | card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; |
5955 | cmd->hdr.return_code = -EIO; | 5972 | cmd->hdr.return_code = -EIO; |
5956 | } else { | 5973 | } else { |
@@ -5985,9 +6002,6 @@ qeth_layer2_send_delmac_cb(struct qeth_card *card, | |||
5985 | QETH_DBF_TEXT(trace, 2, "L2Dmaccb"); | 6002 | QETH_DBF_TEXT(trace, 2, "L2Dmaccb"); |
5986 | cmd = (struct qeth_ipa_cmd *) data; | 6003 | cmd = (struct qeth_ipa_cmd *) data; |
5987 | if (cmd->hdr.return_code) { | 6004 | if (cmd->hdr.return_code) { |
5988 | PRINT_WARN("Error in deregistering MAC address on " \ | ||
5989 | "device %s: x%x\n", CARD_BUS_ID(card), | ||
5990 | cmd->hdr.return_code); | ||
5991 | QETH_DBF_TEXT_(trace, 2, "err%d", cmd->hdr.return_code); | 6005 | QETH_DBF_TEXT_(trace, 2, "err%d", cmd->hdr.return_code); |
5992 | cmd->hdr.return_code = -EIO; | 6006 | cmd->hdr.return_code = -EIO; |
5993 | return 0; | 6007 | return 0; |
@@ -6651,7 +6665,7 @@ qeth_setadpparms_change_macaddr_cb(struct qeth_card *card, | |||
6651 | QETH_DBF_TEXT(trace,4,"chgmaccb"); | 6665 | QETH_DBF_TEXT(trace,4,"chgmaccb"); |
6652 | 6666 | ||
6653 | cmd = (struct qeth_ipa_cmd *) data; | 6667 | cmd = (struct qeth_ipa_cmd *) data; |
6654 | if (!card->options.layer2 || card->info.guestlan || | 6668 | if (!card->options.layer2 || |
6655 | !(card->info.mac_bits & QETH_LAYER2_MAC_READ)) { | 6669 | !(card->info.mac_bits & QETH_LAYER2_MAC_READ)) { |
6656 | memcpy(card->dev->dev_addr, | 6670 | memcpy(card->dev->dev_addr, |
6657 | &cmd->data.setadapterparms.data.change_addr.addr, | 6671 | &cmd->data.setadapterparms.data.change_addr.addr, |
@@ -8497,6 +8511,7 @@ __qeth_reboot_event_card(struct device *dev, void *data) | |||
8497 | card = (struct qeth_card *) dev->driver_data; | 8511 | card = (struct qeth_card *) dev->driver_data; |
8498 | qeth_clear_ip_list(card, 0, 0); | 8512 | qeth_clear_ip_list(card, 0, 0); |
8499 | qeth_qdio_clear_card(card, 0); | 8513 | qeth_qdio_clear_card(card, 0); |
8514 | qeth_clear_qdio_buffers(card); | ||
8500 | return 0; | 8515 | return 0; |
8501 | } | 8516 | } |
8502 | 8517 | ||
diff --git a/drivers/s390/net/qeth_mpc.c b/drivers/s390/net/qeth_mpc.c index 77c83209d70e..f54fdfdbf06f 100644 --- a/drivers/s390/net/qeth_mpc.c +++ b/drivers/s390/net/qeth_mpc.c | |||
@@ -157,12 +157,113 @@ unsigned char READ_CCW[]={ | |||
157 | }; | 157 | }; |
158 | 158 | ||
159 | 159 | ||
160 | struct ipa_rc_msg { | ||
161 | enum qeth_ipa_return_codes rc; | ||
162 | char *msg; | ||
163 | }; | ||
160 | 164 | ||
165 | struct ipa_rc_msg qeth_ipa_rc_msg[] = { | ||
166 | {IPA_RC_SUCCESS, "success"}, | ||
167 | {IPA_RC_NOTSUPP, "Command not supported"}, | ||
168 | {IPA_RC_IP_TABLE_FULL, "Add Addr IP Table Full - ipv6"}, | ||
169 | {IPA_RC_UNKNOWN_ERROR, "IPA command failed - reason unknown"}, | ||
170 | {IPA_RC_UNSUPPORTED_COMMAND, "Command not supported"}, | ||
171 | {IPA_RC_DUP_IPV6_REMOTE,"ipv6 address already registered remote"}, | ||
172 | {IPA_RC_DUP_IPV6_HOME, "ipv6 address already registered"}, | ||
173 | {IPA_RC_UNREGISTERED_ADDR, "Address not registered"}, | ||
174 | {IPA_RC_NO_ID_AVAILABLE, "No identifiers available"}, | ||
175 | {IPA_RC_ID_NOT_FOUND, "Identifier not found"}, | ||
176 | {IPA_RC_INVALID_IP_VERSION, "IP version incorrect"}, | ||
177 | {IPA_RC_LAN_FRAME_MISMATCH, "LAN and frame mismatch"}, | ||
178 | {IPA_RC_L2_UNSUPPORTED_CMD, "Unsupported layer 2 command"}, | ||
179 | {IPA_RC_L2_DUP_MAC, "Duplicate MAC address"}, | ||
180 | {IPA_RC_L2_ADDR_TABLE_FULL, "Layer2 address table full"}, | ||
181 | {IPA_RC_L2_DUP_LAYER3_MAC, "Duplicate with layer 3 MAC"}, | ||
182 | {IPA_RC_L2_GMAC_NOT_FOUND, "GMAC not found"}, | ||
183 | {IPA_RC_L2_MAC_NOT_FOUND, "L2 mac address not found"}, | ||
184 | {IPA_RC_L2_INVALID_VLAN_ID, "L2 invalid vlan id"}, | ||
185 | {IPA_RC_L2_DUP_VLAN_ID, "L2 duplicate vlan id"}, | ||
186 | {IPA_RC_L2_VLAN_ID_NOT_FOUND, "L2 vlan id not found"}, | ||
187 | {IPA_RC_DATA_MISMATCH, "Data field mismatch (v4/v6 mixed)"}, | ||
188 | {IPA_RC_INVALID_MTU_SIZE, "Invalid MTU size"}, | ||
189 | {IPA_RC_INVALID_LANTYPE, "Invalid LAN type"}, | ||
190 | {IPA_RC_INVALID_LANNUM, "Invalid LAN num"}, | ||
191 | {IPA_RC_DUPLICATE_IP_ADDRESS, "Address already registered"}, | ||
192 | {IPA_RC_IP_ADDR_TABLE_FULL, "IP address table full"}, | ||
193 | {IPA_RC_LAN_PORT_STATE_ERROR, "LAN port state error"}, | ||
194 | {IPA_RC_SETIP_NO_STARTLAN, "Setip no startlan received"}, | ||
195 | {IPA_RC_SETIP_ALREADY_RECEIVED, "Setip already received"}, | ||
196 | {IPA_RC_IP_ADDR_ALREADY_USED, "IP address already in use on LAN"}, | ||
197 | {IPA_RC_MULTICAST_FULL, "No task available, multicast full"}, | ||
198 | {IPA_RC_SETIP_INVALID_VERSION, "SETIP invalid IP version"}, | ||
199 | {IPA_RC_UNSUPPORTED_SUBCMD, "Unsupported assist subcommand"}, | ||
200 | {IPA_RC_ARP_ASSIST_NO_ENABLE, "Only partial success, no enable"}, | ||
201 | {IPA_RC_PRIMARY_ALREADY_DEFINED,"Primary already defined"}, | ||
202 | {IPA_RC_SECOND_ALREADY_DEFINED, "Secondary already defined"}, | ||
203 | {IPA_RC_INVALID_SETRTG_INDICATOR,"Invalid SETRTG indicator"}, | ||
204 | {IPA_RC_MC_ADDR_ALREADY_DEFINED,"Multicast address already defined"}, | ||
205 | {IPA_RC_LAN_OFFLINE, "STRTLAN_LAN_DISABLED - LAN offline"}, | ||
206 | {IPA_RC_INVALID_IP_VERSION2, "Invalid IP version"}, | ||
207 | {IPA_RC_FFFF, "Unknown Error"} | ||
208 | }; | ||
161 | 209 | ||
162 | 210 | ||
163 | 211 | ||
212 | char * | ||
213 | qeth_get_ipa_msg(enum qeth_ipa_return_codes rc) | ||
214 | { | ||
215 | int x = 0; | ||
216 | qeth_ipa_rc_msg[sizeof(qeth_ipa_rc_msg) / | ||
217 | sizeof(struct ipa_rc_msg) - 1].rc = rc; | ||
218 | while(qeth_ipa_rc_msg[x].rc != rc) | ||
219 | x++; | ||
220 | return qeth_ipa_rc_msg[x].msg; | ||
221 | } | ||
164 | 222 | ||
165 | 223 | ||
224 | struct ipa_cmd_names { | ||
225 | enum qeth_ipa_cmds cmd; | ||
226 | char *name; | ||
227 | }; | ||
228 | |||
229 | struct ipa_cmd_names qeth_ipa_cmd_names[] = { | ||
230 | {IPA_CMD_STARTLAN, "startlan"}, | ||
231 | {IPA_CMD_STOPLAN, "stoplan"}, | ||
232 | {IPA_CMD_SETVMAC, "setvmac"}, | ||
233 | {IPA_CMD_DELVMAC, "delvmca"}, | ||
234 | {IPA_CMD_SETGMAC, "setgmac"}, | ||
235 | {IPA_CMD_DELGMAC, "delgmac"}, | ||
236 | {IPA_CMD_SETVLAN, "setvlan"}, | ||
237 | {IPA_CMD_DELVLAN, "delvlan"}, | ||
238 | {IPA_CMD_SETCCID, "setccid"}, | ||
239 | {IPA_CMD_DELCCID, "delccid"}, | ||
240 | {IPA_CMD_MODCCID, "setip"}, | ||
241 | {IPA_CMD_SETIP, "setip"}, | ||
242 | {IPA_CMD_QIPASSIST, "qipassist"}, | ||
243 | {IPA_CMD_SETASSPARMS, "setassparms"}, | ||
244 | {IPA_CMD_SETIPM, "setipm"}, | ||
245 | {IPA_CMD_DELIPM, "delipm"}, | ||
246 | {IPA_CMD_SETRTG, "setrtg"}, | ||
247 | {IPA_CMD_DELIP, "delip"}, | ||
248 | {IPA_CMD_SETADAPTERPARMS, "setadapterparms"}, | ||
249 | {IPA_CMD_SET_DIAG_ASS, "set_diag_ass"}, | ||
250 | {IPA_CMD_CREATE_ADDR, "create_addr"}, | ||
251 | {IPA_CMD_DESTROY_ADDR, "destroy_addr"}, | ||
252 | {IPA_CMD_REGISTER_LOCAL_ADDR, "register_local_addr"}, | ||
253 | {IPA_CMD_UNREGISTER_LOCAL_ADDR, "unregister_local_addr"}, | ||
254 | {IPA_CMD_UNKNOWN, "unknown"}, | ||
255 | }; | ||
166 | 256 | ||
257 | char * | ||
258 | qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd) | ||
259 | { | ||
260 | int x = 0; | ||
261 | qeth_ipa_cmd_names[ | ||
262 | sizeof(qeth_ipa_cmd_names)/ | ||
263 | sizeof(struct ipa_cmd_names)-1].cmd = cmd; | ||
264 | while(qeth_ipa_cmd_names[x].cmd != cmd) | ||
265 | x++; | ||
266 | return qeth_ipa_cmd_names[x].name; | ||
267 | } | ||
167 | 268 | ||
168 | 269 | ||
diff --git a/drivers/s390/net/qeth_mpc.h b/drivers/s390/net/qeth_mpc.h index d74bc43da72a..1d8083c91765 100644 --- a/drivers/s390/net/qeth_mpc.h +++ b/drivers/s390/net/qeth_mpc.h | |||
@@ -25,14 +25,14 @@ extern unsigned char IPA_PDU_HEADER[]; | |||
25 | 25 | ||
26 | #define IPA_CMD_LENGTH (IPA_PDU_HEADER_SIZE + sizeof(struct qeth_ipa_cmd)) | 26 | #define IPA_CMD_LENGTH (IPA_PDU_HEADER_SIZE + sizeof(struct qeth_ipa_cmd)) |
27 | 27 | ||
28 | #define QETH_SEQ_NO_LENGTH 4 | 28 | #define QETH_SEQ_NO_LENGTH 4 |
29 | #define QETH_MPC_TOKEN_LENGTH 4 | 29 | #define QETH_MPC_TOKEN_LENGTH 4 |
30 | #define QETH_MCL_LENGTH 4 | 30 | #define QETH_MCL_LENGTH 4 |
31 | #define OSA_ADDR_LEN 6 | 31 | #define OSA_ADDR_LEN 6 |
32 | 32 | ||
33 | #define QETH_TIMEOUT (10 * HZ) | 33 | #define QETH_TIMEOUT (10 * HZ) |
34 | #define QETH_IPA_TIMEOUT (45 * HZ) | 34 | #define QETH_IPA_TIMEOUT (45 * HZ) |
35 | #define QETH_IDX_COMMAND_SEQNO 0xffff0000 | 35 | #define QETH_IDX_COMMAND_SEQNO 0xffff0000 |
36 | #define SR_INFO_LEN 16 | 36 | #define SR_INFO_LEN 16 |
37 | 37 | ||
38 | #define QETH_CLEAR_CHANNEL_PARM -10 | 38 | #define QETH_CLEAR_CHANNEL_PARM -10 |
@@ -93,79 +93,107 @@ enum qeth_checksum_types { | |||
93 | */ | 93 | */ |
94 | #define RESET_ROUTING_FLAG 0x10 /* indicate that routing type shall be set */ | 94 | #define RESET_ROUTING_FLAG 0x10 /* indicate that routing type shall be set */ |
95 | enum qeth_routing_types { | 95 | enum qeth_routing_types { |
96 | NO_ROUTER = 0, /* TODO: set to bit flag used in IPA Command */ | 96 | NO_ROUTER = 0, /* TODO: set to bit flag used in IPA Command */ |
97 | PRIMARY_ROUTER = 1, | 97 | PRIMARY_ROUTER = 1, |
98 | SECONDARY_ROUTER = 2, | 98 | SECONDARY_ROUTER = 2, |
99 | MULTICAST_ROUTER = 3, | 99 | MULTICAST_ROUTER = 3, |
100 | PRIMARY_CONNECTOR = 4, | 100 | PRIMARY_CONNECTOR = 4, |
101 | SECONDARY_CONNECTOR = 5, | 101 | SECONDARY_CONNECTOR = 5, |
102 | }; | 102 | }; |
103 | 103 | ||
104 | |||
105 | /* IPA Commands */ | 104 | /* IPA Commands */ |
106 | enum qeth_ipa_cmds { | 105 | enum qeth_ipa_cmds { |
107 | IPA_CMD_STARTLAN = 0x01, | 106 | IPA_CMD_STARTLAN = 0x01, |
108 | IPA_CMD_STOPLAN = 0x02, | 107 | IPA_CMD_STOPLAN = 0x02, |
109 | IPA_CMD_SETVMAC = 0x21, | 108 | IPA_CMD_SETVMAC = 0x21, |
110 | IPA_CMD_DELVMAC = 0x22, | 109 | IPA_CMD_DELVMAC = 0x22, |
111 | IPA_CMD_SETGMAC = 0x23, | 110 | IPA_CMD_SETGMAC = 0x23, |
112 | IPA_CMD_DELGMAC = 0x24, | 111 | IPA_CMD_DELGMAC = 0x24, |
113 | IPA_CMD_SETVLAN = 0x25, | 112 | IPA_CMD_SETVLAN = 0x25, |
114 | IPA_CMD_DELVLAN = 0x26, | 113 | IPA_CMD_DELVLAN = 0x26, |
115 | IPA_CMD_SETCCID = 0x41, | 114 | IPA_CMD_SETCCID = 0x41, |
116 | IPA_CMD_DELCCID = 0x42, | 115 | IPA_CMD_DELCCID = 0x42, |
117 | IPA_CMD_MODCCID = 0x43, | 116 | IPA_CMD_MODCCID = 0x43, |
118 | IPA_CMD_SETIP = 0xb1, | 117 | IPA_CMD_SETIP = 0xb1, |
119 | IPA_CMD_DELIP = 0xb7, | 118 | IPA_CMD_QIPASSIST = 0xb2, |
120 | IPA_CMD_QIPASSIST = 0xb2, | 119 | IPA_CMD_SETASSPARMS = 0xb3, |
121 | IPA_CMD_SETASSPARMS = 0xb3, | 120 | IPA_CMD_SETIPM = 0xb4, |
122 | IPA_CMD_SETIPM = 0xb4, | 121 | IPA_CMD_DELIPM = 0xb5, |
123 | IPA_CMD_DELIPM = 0xb5, | 122 | IPA_CMD_SETRTG = 0xb6, |
124 | IPA_CMD_SETRTG = 0xb6, | 123 | IPA_CMD_DELIP = 0xb7, |
125 | IPA_CMD_SETADAPTERPARMS = 0xb8, | 124 | IPA_CMD_SETADAPTERPARMS = 0xb8, |
126 | IPA_CMD_IPFRAME = 0xb9, | 125 | IPA_CMD_SET_DIAG_ASS = 0xb9, |
127 | IPA_CMD_ADD_ADDR_ENTRY = 0xc1, | 126 | IPA_CMD_CREATE_ADDR = 0xc3, |
128 | IPA_CMD_DELETE_ADDR_ENTRY = 0xc2, | 127 | IPA_CMD_DESTROY_ADDR = 0xc4, |
129 | IPA_CMD_CREATE_ADDR = 0xc3, | 128 | IPA_CMD_REGISTER_LOCAL_ADDR = 0xd1, |
130 | IPA_CMD_DESTROY_ADDR = 0xc4, | 129 | IPA_CMD_UNREGISTER_LOCAL_ADDR = 0xd2, |
131 | IPA_CMD_REGISTER_LOCAL_ADDR = 0xd1, | 130 | IPA_CMD_UNKNOWN = 0x00 |
132 | IPA_CMD_UNREGISTER_LOCAL_ADDR = 0xd2, | ||
133 | }; | 131 | }; |
134 | 132 | ||
135 | enum qeth_ip_ass_cmds { | 133 | enum qeth_ip_ass_cmds { |
136 | IPA_CMD_ASS_START = 0x0001, | 134 | IPA_CMD_ASS_START = 0x0001, |
137 | IPA_CMD_ASS_STOP = 0x0002, | 135 | IPA_CMD_ASS_STOP = 0x0002, |
138 | IPA_CMD_ASS_CONFIGURE = 0x0003, | 136 | IPA_CMD_ASS_CONFIGURE = 0x0003, |
139 | IPA_CMD_ASS_ENABLE = 0x0004, | 137 | IPA_CMD_ASS_ENABLE = 0x0004, |
140 | }; | 138 | }; |
141 | 139 | ||
142 | enum qeth_arp_process_subcmds { | 140 | enum qeth_arp_process_subcmds { |
143 | IPA_CMD_ASS_ARP_SET_NO_ENTRIES = 0x0003, | 141 | IPA_CMD_ASS_ARP_SET_NO_ENTRIES = 0x0003, |
144 | IPA_CMD_ASS_ARP_QUERY_CACHE = 0x0004, | 142 | IPA_CMD_ASS_ARP_QUERY_CACHE = 0x0004, |
145 | IPA_CMD_ASS_ARP_ADD_ENTRY = 0x0005, | 143 | IPA_CMD_ASS_ARP_ADD_ENTRY = 0x0005, |
146 | IPA_CMD_ASS_ARP_REMOVE_ENTRY = 0x0006, | 144 | IPA_CMD_ASS_ARP_REMOVE_ENTRY = 0x0006, |
147 | IPA_CMD_ASS_ARP_FLUSH_CACHE = 0x0007, | 145 | IPA_CMD_ASS_ARP_FLUSH_CACHE = 0x0007, |
148 | IPA_CMD_ASS_ARP_QUERY_INFO = 0x0104, | 146 | IPA_CMD_ASS_ARP_QUERY_INFO = 0x0104, |
149 | IPA_CMD_ASS_ARP_QUERY_STATS = 0x0204, | 147 | IPA_CMD_ASS_ARP_QUERY_STATS = 0x0204, |
150 | }; | 148 | }; |
151 | 149 | ||
152 | /* Return Codes for IPA Commands */ | 150 | |
151 | /* Return Codes for IPA Commands | ||
152 | * according to OSA card Specs */ | ||
153 | |||
153 | enum qeth_ipa_return_codes { | 154 | enum qeth_ipa_return_codes { |
154 | IPA_RC_SUCCESS = 0x0000, | 155 | IPA_RC_SUCCESS = 0x0000, |
155 | IPA_RC_NOTSUPP = 0x0001, | 156 | IPA_RC_NOTSUPP = 0x0001, |
156 | IPA_RC_NO_ACCESS = 0x0002, | 157 | IPA_RC_IP_TABLE_FULL = 0x0002, |
157 | IPA_RC_FAILED = 0x0003, | 158 | IPA_RC_UNKNOWN_ERROR = 0x0003, |
158 | IPA_RC_DATA_MISMATCH = 0xe001, | 159 | IPA_RC_UNSUPPORTED_COMMAND = 0x0004, |
159 | IPA_RC_INVALID_LAN_TYPE = 0xe003, | 160 | IPA_RC_DUP_IPV6_REMOTE = 0x0008, |
160 | IPA_RC_INVALID_LAN_NO = 0xe004, | 161 | IPA_RC_DUP_IPV6_HOME = 0x0010, |
161 | IPA_RC_IPADDR_ALREADY_REG = 0xe005, | 162 | IPA_RC_UNREGISTERED_ADDR = 0x0011, |
162 | IPA_RC_IPADDR_TABLE_FULL = 0xe006, | 163 | IPA_RC_NO_ID_AVAILABLE = 0x0012, |
163 | IPA_RC_IPADDR_ALREADY_USED = 0xe00a, | 164 | IPA_RC_ID_NOT_FOUND = 0x0013, |
164 | IPA_RC_ASSNO_NOT_SUPP = 0xe00d, | 165 | IPA_RC_INVALID_IP_VERSION = 0x0020, |
165 | IPA_RC_ASSCMD_START_FAILED = 0xe00e, | 166 | IPA_RC_LAN_FRAME_MISMATCH = 0x0040, |
166 | IPA_RC_ASSCMD_PART_SUCCESS = 0xe00f, | 167 | IPA_RC_L2_UNSUPPORTED_CMD = 0x2003, |
167 | IPA_RC_IPADDR_NOT_DEFINED = 0xe010, | 168 | IPA_RC_L2_DUP_MAC = 0x2005, |
168 | IPA_RC_LAN_OFFLINE = 0xe080, | 169 | IPA_RC_L2_ADDR_TABLE_FULL = 0x2006, |
170 | IPA_RC_L2_DUP_LAYER3_MAC = 0x200a, | ||
171 | IPA_RC_L2_GMAC_NOT_FOUND = 0x200b, | ||
172 | IPA_RC_L2_MAC_NOT_FOUND = 0x2010, | ||
173 | IPA_RC_L2_INVALID_VLAN_ID = 0x2015, | ||
174 | IPA_RC_L2_DUP_VLAN_ID = 0x2016, | ||
175 | IPA_RC_L2_VLAN_ID_NOT_FOUND = 0x2017, | ||
176 | IPA_RC_DATA_MISMATCH = 0xe001, | ||
177 | IPA_RC_INVALID_MTU_SIZE = 0xe002, | ||
178 | IPA_RC_INVALID_LANTYPE = 0xe003, | ||
179 | IPA_RC_INVALID_LANNUM = 0xe004, | ||
180 | IPA_RC_DUPLICATE_IP_ADDRESS = 0xe005, | ||
181 | IPA_RC_IP_ADDR_TABLE_FULL = 0xe006, | ||
182 | IPA_RC_LAN_PORT_STATE_ERROR = 0xe007, | ||
183 | IPA_RC_SETIP_NO_STARTLAN = 0xe008, | ||
184 | IPA_RC_SETIP_ALREADY_RECEIVED = 0xe009, | ||
185 | IPA_RC_IP_ADDR_ALREADY_USED = 0xe00a, | ||
186 | IPA_RC_MULTICAST_FULL = 0xe00b, | ||
187 | IPA_RC_SETIP_INVALID_VERSION = 0xe00d, | ||
188 | IPA_RC_UNSUPPORTED_SUBCMD = 0xe00e, | ||
189 | IPA_RC_ARP_ASSIST_NO_ENABLE = 0xe00f, | ||
190 | IPA_RC_PRIMARY_ALREADY_DEFINED = 0xe010, | ||
191 | IPA_RC_SECOND_ALREADY_DEFINED = 0xe011, | ||
192 | IPA_RC_INVALID_SETRTG_INDICATOR = 0xe012, | ||
193 | IPA_RC_MC_ADDR_ALREADY_DEFINED = 0xe013, | ||
194 | IPA_RC_LAN_OFFLINE = 0xe080, | ||
195 | IPA_RC_INVALID_IP_VERSION2 = 0xf001, | ||
196 | IPA_RC_FFFF = 0xffff | ||
169 | }; | 197 | }; |
170 | 198 | ||
171 | /* IPA function flags; each flag marks availability of respective function */ | 199 | /* IPA function flags; each flag marks availability of respective function */ |
@@ -183,7 +211,9 @@ enum qeth_ipa_funcs { | |||
183 | IPA_SETADAPTERPARMS = 0x00000400L, | 211 | IPA_SETADAPTERPARMS = 0x00000400L, |
184 | IPA_VLAN_PRIO = 0x00000800L, | 212 | IPA_VLAN_PRIO = 0x00000800L, |
185 | IPA_PASSTHRU = 0x00001000L, | 213 | IPA_PASSTHRU = 0x00001000L, |
214 | IPA_FLUSH_ARP_SUPPORT = 0x00002000L, | ||
186 | IPA_FULL_VLAN = 0x00004000L, | 215 | IPA_FULL_VLAN = 0x00004000L, |
216 | IPA_INBOUND_PASSTHRU = 0x00008000L, | ||
187 | IPA_SOURCE_MAC = 0x00010000L, | 217 | IPA_SOURCE_MAC = 0x00010000L, |
188 | IPA_OSA_MC_ROUTER = 0x00020000L, | 218 | IPA_OSA_MC_ROUTER = 0x00020000L, |
189 | IPA_QUERY_ARP_ASSIST = 0x00040000L, | 219 | IPA_QUERY_ARP_ASSIST = 0x00040000L, |
@@ -204,31 +234,30 @@ enum qeth_ipa_setdelip_flags { | |||
204 | /* SETADAPTER IPA Command: ****************************************************/ | 234 | /* SETADAPTER IPA Command: ****************************************************/ |
205 | enum qeth_ipa_setadp_cmd { | 235 | enum qeth_ipa_setadp_cmd { |
206 | IPA_SETADP_QUERY_COMMANDS_SUPPORTED = 0x01, | 236 | IPA_SETADP_QUERY_COMMANDS_SUPPORTED = 0x01, |
207 | IPA_SETADP_ALTER_MAC_ADDRESS = 0x02, | 237 | IPA_SETADP_ALTER_MAC_ADDRESS = 0x02, |
208 | IPA_SETADP_ADD_DELETE_GROUP_ADDRESS = 0x04, | 238 | IPA_SETADP_ADD_DELETE_GROUP_ADDRESS = 0x04, |
209 | IPA_SETADP_ADD_DELETE_FUNCTIONAL_ADDR = 0x08, | 239 | IPA_SETADP_ADD_DELETE_FUNCTIONAL_ADDR = 0x08, |
210 | IPA_SETADP_SET_ADDRESSING_MODE = 0x10, | 240 | IPA_SETADP_SET_ADDRESSING_MODE = 0x10, |
211 | IPA_SETADP_SET_CONFIG_PARMS = 0x20, | 241 | IPA_SETADP_SET_CONFIG_PARMS = 0x20, |
212 | IPA_SETADP_SET_CONFIG_PARMS_EXTENDED = 0x40, | 242 | IPA_SETADP_SET_CONFIG_PARMS_EXTENDED = 0x40, |
213 | IPA_SETADP_SET_BROADCAST_MODE = 0x80, | 243 | IPA_SETADP_SET_BROADCAST_MODE = 0x80, |
214 | IPA_SETADP_SEND_OSA_MESSAGE = 0x0100, | 244 | IPA_SETADP_SEND_OSA_MESSAGE = 0x0100, |
215 | IPA_SETADP_SET_SNMP_CONTROL = 0x0200, | 245 | IPA_SETADP_SET_SNMP_CONTROL = 0x0200, |
216 | IPA_SETADP_READ_SNMP_PARMS = 0x0400, | 246 | IPA_SETADP_QUERY_CARD_INFO = 0x0400, |
217 | IPA_SETADP_SET_PROMISC_MODE = 0x0800, | 247 | IPA_SETADP_SET_PROMISC_MODE = 0x0800, |
218 | IPA_SETADP_QUERY_CARD_INFO = 0x1000, | ||
219 | }; | 248 | }; |
220 | enum qeth_ipa_mac_ops { | 249 | enum qeth_ipa_mac_ops { |
221 | CHANGE_ADDR_READ_MAC = 0, | 250 | CHANGE_ADDR_READ_MAC = 0, |
222 | CHANGE_ADDR_REPLACE_MAC = 1, | 251 | CHANGE_ADDR_REPLACE_MAC = 1, |
223 | CHANGE_ADDR_ADD_MAC = 2, | 252 | CHANGE_ADDR_ADD_MAC = 2, |
224 | CHANGE_ADDR_DEL_MAC = 4, | 253 | CHANGE_ADDR_DEL_MAC = 4, |
225 | CHANGE_ADDR_RESET_MAC = 8, | 254 | CHANGE_ADDR_RESET_MAC = 8, |
226 | }; | 255 | }; |
227 | enum qeth_ipa_addr_ops { | 256 | enum qeth_ipa_addr_ops { |
228 | CHANGE_ADDR_READ_ADDR = 0, | 257 | CHANGE_ADDR_READ_ADDR = 0, |
229 | CHANGE_ADDR_ADD_ADDR = 1, | 258 | CHANGE_ADDR_ADD_ADDR = 1, |
230 | CHANGE_ADDR_DEL_ADDR = 2, | 259 | CHANGE_ADDR_DEL_ADDR = 2, |
231 | CHANGE_ADDR_FLUSH_ADDR_TABLE = 4, | 260 | CHANGE_ADDR_FLUSH_ADDR_TABLE = 4, |
232 | }; | 261 | }; |
233 | enum qeth_ipa_promisc_modes { | 262 | enum qeth_ipa_promisc_modes { |
234 | SET_PROMISC_MODE_OFF = 0, | 263 | SET_PROMISC_MODE_OFF = 0, |
@@ -407,15 +436,15 @@ struct qeth_ipacmd_hdr { | |||
407 | struct qeth_ipa_cmd { | 436 | struct qeth_ipa_cmd { |
408 | struct qeth_ipacmd_hdr hdr; | 437 | struct qeth_ipacmd_hdr hdr; |
409 | union { | 438 | union { |
410 | struct qeth_ipacmd_setdelip4 setdelip4; | 439 | struct qeth_ipacmd_setdelip4 setdelip4; |
411 | struct qeth_ipacmd_setdelip6 setdelip6; | 440 | struct qeth_ipacmd_setdelip6 setdelip6; |
412 | struct qeth_ipacmd_setdelipm setdelipm; | 441 | struct qeth_ipacmd_setdelipm setdelipm; |
413 | struct qeth_ipacmd_setassparms setassparms; | 442 | struct qeth_ipacmd_setassparms setassparms; |
414 | struct qeth_ipacmd_layer2setdelmac setdelmac; | 443 | struct qeth_ipacmd_layer2setdelmac setdelmac; |
415 | struct qeth_ipacmd_layer2setdelvlan setdelvlan; | 444 | struct qeth_ipacmd_layer2setdelvlan setdelvlan; |
416 | struct qeth_create_destroy_address create_destroy_addr; | 445 | struct qeth_create_destroy_address create_destroy_addr; |
417 | struct qeth_ipacmd_setadpparms setadapterparms; | 446 | struct qeth_ipacmd_setadpparms setadapterparms; |
418 | struct qeth_set_routing setrtg; | 447 | struct qeth_set_routing setrtg; |
419 | } data; | 448 | } data; |
420 | } __attribute__ ((packed)); | 449 | } __attribute__ ((packed)); |
421 | 450 | ||
@@ -433,6 +462,12 @@ enum qeth_ipa_arp_return_codes { | |||
433 | QETH_IPA_ARP_RC_Q_NO_DATA = 0x0008, | 462 | QETH_IPA_ARP_RC_Q_NO_DATA = 0x0008, |
434 | }; | 463 | }; |
435 | 464 | ||
465 | |||
466 | extern char * | ||
467 | qeth_get_ipa_msg(enum qeth_ipa_return_codes rc); | ||
468 | extern char * | ||
469 | qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd); | ||
470 | |||
436 | #define QETH_SETASS_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \ | 471 | #define QETH_SETASS_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \ |
437 | sizeof(struct qeth_ipacmd_setassparms_hdr)) | 472 | sizeof(struct qeth_ipacmd_setassparms_hdr)) |
438 | #define QETH_IPA_ARP_DATA_POS(buffer) (buffer + IPA_PDU_HEADER_SIZE + \ | 473 | #define QETH_IPA_ARP_DATA_POS(buffer) (buffer + IPA_PDU_HEADER_SIZE + \ |
@@ -521,7 +556,7 @@ extern unsigned char DM_ACT[]; | |||
521 | extern unsigned char IDX_ACTIVATE_READ[]; | 556 | extern unsigned char IDX_ACTIVATE_READ[]; |
522 | extern unsigned char IDX_ACTIVATE_WRITE[]; | 557 | extern unsigned char IDX_ACTIVATE_WRITE[]; |
523 | 558 | ||
524 | #define IDX_ACTIVATE_SIZE 0x22 | 559 | #define IDX_ACTIVATE_SIZE 0x22 |
525 | #define QETH_IDX_ACT_ISSUER_RM_TOKEN(buffer) (buffer+0x0c) | 560 | #define QETH_IDX_ACT_ISSUER_RM_TOKEN(buffer) (buffer+0x0c) |
526 | #define QETH_IDX_NO_PORTNAME_REQUIRED(buffer) ((buffer)[0x0b]&0x80) | 561 | #define QETH_IDX_NO_PORTNAME_REQUIRED(buffer) ((buffer)[0x0b]&0x80) |
527 | #define QETH_IDX_ACT_FUNC_LEVEL(buffer) (buffer+0x10) | 562 | #define QETH_IDX_ACT_FUNC_LEVEL(buffer) (buffer+0x10) |
diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c index d518419cd0c6..65ffc21afc37 100644 --- a/drivers/s390/net/qeth_sys.c +++ b/drivers/s390/net/qeth_sys.c | |||
@@ -384,8 +384,6 @@ qeth_dev_route_store(struct qeth_card *card, struct qeth_routing_info *route, | |||
384 | route->type = PRIMARY_CONNECTOR; | 384 | route->type = PRIMARY_CONNECTOR; |
385 | } else if (!strcmp(tmp, "secondary_connector")) { | 385 | } else if (!strcmp(tmp, "secondary_connector")) { |
386 | route->type = SECONDARY_CONNECTOR; | 386 | route->type = SECONDARY_CONNECTOR; |
387 | } else if (!strcmp(tmp, "multicast_router")) { | ||
388 | route->type = MULTICAST_ROUTER; | ||
389 | } else if (!strcmp(tmp, "primary_router")) { | 387 | } else if (!strcmp(tmp, "primary_router")) { |
390 | route->type = PRIMARY_ROUTER; | 388 | route->type = PRIMARY_ROUTER; |
391 | } else if (!strcmp(tmp, "secondary_router")) { | 389 | } else if (!strcmp(tmp, "secondary_router")) { |