diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-11 12:26:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-11 12:26:39 -0500 |
commit | 388f7ef720a982f49925e7b4e96f216f208f8c03 (patch) | |
tree | 75bfe3290db6d99232f56eadaf41a51197c5ba7c /drivers | |
parent | d5eebf428ac91ad12d316a391b734670d61480d8 (diff) | |
parent | 560c22fe1fc8b3523ef422da4f1cf04aa22d1471 (diff) |
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/Kconfig | 2 | ||||
-rw-r--r-- | drivers/net/forcedeth.c | 231 | ||||
-rw-r--r-- | drivers/net/gianfar_mii.c | 2 | ||||
-rw-r--r-- | drivers/net/gt96100eth.c | 10 | ||||
-rw-r--r-- | drivers/net/ibmveth.c | 2 | ||||
-rw-r--r-- | drivers/net/saa9730.c | 613 | ||||
-rw-r--r-- | drivers/net/smc91x.h | 32 | ||||
-rw-r--r-- | drivers/net/wireless/Kconfig | 2 | ||||
-rw-r--r-- | drivers/net/wireless/atmel.c | 88 | ||||
-rw-r--r-- | drivers/net/wireless/atmel.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/atmel_cs.c | 176 | ||||
-rw-r--r-- | drivers/net/wireless/atmel_pci.c | 2 | ||||
-rw-r--r-- | drivers/s390/net/lcs.c | 4 | ||||
-rw-r--r-- | drivers/s390/net/qeth.h | 77 | ||||
-rw-r--r-- | drivers/s390/net/qeth_main.c | 261 | ||||
-rw-r--r-- | drivers/s390/net/qeth_mpc.c | 2 | ||||
-rw-r--r-- | drivers/s390/net/qeth_mpc.h | 13 | ||||
-rw-r--r-- | drivers/s390/net/qeth_sys.c | 8 | ||||
-rw-r--r-- | drivers/s390/net/qeth_tso.h | 2 |
19 files changed, 850 insertions, 681 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 5c69d57f8548..ebd7313d7fc1 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -812,7 +812,7 @@ config SMC91X | |||
812 | tristate "SMC 91C9x/91C1xxx support" | 812 | tristate "SMC 91C9x/91C1xxx support" |
813 | select CRC32 | 813 | select CRC32 |
814 | select MII | 814 | select MII |
815 | depends on NET_ETHERNET && (ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH) | 815 | depends on NET_ETHERNET && (ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH || SOC_AU1X00) |
816 | help | 816 | help |
817 | This is a driver for SMC's 91x series of Ethernet chipsets, | 817 | This is a driver for SMC's 91x series of Ethernet chipsets, |
818 | including the SMC91C94 and the SMC91C111. Say Y if you want it | 818 | including the SMC91C94 and the SMC91C111. Say Y if you want it |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 22aec6ed80f5..525624fc03b4 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -80,7 +80,7 @@ | |||
80 | * into nv_close, otherwise reenabling for wol can | 80 | * into nv_close, otherwise reenabling for wol can |
81 | * cause DMA to kfree'd memory. | 81 | * cause DMA to kfree'd memory. |
82 | * 0.31: 14 Nov 2004: ethtool support for getting/setting link | 82 | * 0.31: 14 Nov 2004: ethtool support for getting/setting link |
83 | * capabilities. | 83 | * capabilities. |
84 | * 0.32: 16 Apr 2005: RX_ERROR4 handling added. | 84 | * 0.32: 16 Apr 2005: RX_ERROR4 handling added. |
85 | * 0.33: 16 May 2005: Support for MCP51 added. | 85 | * 0.33: 16 May 2005: Support for MCP51 added. |
86 | * 0.34: 18 Jun 2005: Add DEV_NEED_LINKTIMER to all nForce nics. | 86 | * 0.34: 18 Jun 2005: Add DEV_NEED_LINKTIMER to all nForce nics. |
@@ -89,14 +89,17 @@ | |||
89 | * 0.37: 10 Jul 2005: Additional ethtool support, cleanup of pci id list | 89 | * 0.37: 10 Jul 2005: Additional ethtool support, cleanup of pci id list |
90 | * 0.38: 16 Jul 2005: tx irq rewrite: Use global flags instead of | 90 | * 0.38: 16 Jul 2005: tx irq rewrite: Use global flags instead of |
91 | * per-packet flags. | 91 | * per-packet flags. |
92 | * 0.39: 18 Jul 2005: Add 64bit descriptor support. | 92 | * 0.39: 18 Jul 2005: Add 64bit descriptor support. |
93 | * 0.40: 19 Jul 2005: Add support for mac address change. | 93 | * 0.40: 19 Jul 2005: Add support for mac address change. |
94 | * 0.41: 30 Jul 2005: Write back original MAC in nv_close instead | 94 | * 0.41: 30 Jul 2005: Write back original MAC in nv_close instead |
95 | * of nv_remove | 95 | * of nv_remove |
96 | * 0.42: 06 Aug 2005: Fix lack of link speed initialization | 96 | * 0.42: 06 Aug 2005: Fix lack of link speed initialization |
97 | * in the second (and later) nv_open call | 97 | * in the second (and later) nv_open call |
98 | * 0.43: 10 Aug 2005: Add support for tx checksum. | 98 | * 0.43: 10 Aug 2005: Add support for tx checksum. |
99 | * 0.44: 20 Aug 2005: Add support for scatter gather and segmentation. | 99 | * 0.44: 20 Aug 2005: Add support for scatter gather and segmentation. |
100 | * 0.45: 18 Sep 2005: Remove nv_stop/start_rx from every link check | ||
101 | * 0.46: 20 Oct 2005: Add irq optimization modes. | ||
102 | * 0.47: 26 Oct 2005: Add phyaddr 0 in phy scan. | ||
100 | * | 103 | * |
101 | * Known bugs: | 104 | * Known bugs: |
102 | * We suspect that on some hardware no TX done interrupts are generated. | 105 | * We suspect that on some hardware no TX done interrupts are generated. |
@@ -108,7 +111,7 @@ | |||
108 | * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few | 111 | * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few |
109 | * superfluous timer interrupts from the nic. | 112 | * superfluous timer interrupts from the nic. |
110 | */ | 113 | */ |
111 | #define FORCEDETH_VERSION "0.44" | 114 | #define FORCEDETH_VERSION "0.47" |
112 | #define DRV_NAME "forcedeth" | 115 | #define DRV_NAME "forcedeth" |
113 | 116 | ||
114 | #include <linux/module.h> | 117 | #include <linux/module.h> |
@@ -163,7 +166,8 @@ enum { | |||
163 | #define NVREG_IRQ_LINK 0x0040 | 166 | #define NVREG_IRQ_LINK 0x0040 |
164 | #define NVREG_IRQ_TX_ERROR 0x0080 | 167 | #define NVREG_IRQ_TX_ERROR 0x0080 |
165 | #define NVREG_IRQ_TX1 0x0100 | 168 | #define NVREG_IRQ_TX1 0x0100 |
166 | #define NVREG_IRQMASK_WANTED 0x00df | 169 | #define NVREG_IRQMASK_THROUGHPUT 0x00df |
170 | #define NVREG_IRQMASK_CPU 0x0040 | ||
167 | 171 | ||
168 | #define NVREG_IRQ_UNKNOWN (~(NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_TX_ERR| \ | 172 | #define NVREG_IRQ_UNKNOWN (~(NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_TX_ERR| \ |
169 | NVREG_IRQ_TX_OK|NVREG_IRQ_TIMER|NVREG_IRQ_LINK|NVREG_IRQ_TX_ERROR| \ | 173 | NVREG_IRQ_TX_OK|NVREG_IRQ_TIMER|NVREG_IRQ_LINK|NVREG_IRQ_TX_ERROR| \ |
@@ -177,7 +181,8 @@ enum { | |||
177 | * NVREG_POLL_DEFAULT=97 would result in an interval length of 1 ms | 181 | * NVREG_POLL_DEFAULT=97 would result in an interval length of 1 ms |
178 | */ | 182 | */ |
179 | NvRegPollingInterval = 0x00c, | 183 | NvRegPollingInterval = 0x00c, |
180 | #define NVREG_POLL_DEFAULT 970 | 184 | #define NVREG_POLL_DEFAULT_THROUGHPUT 970 |
185 | #define NVREG_POLL_DEFAULT_CPU 13 | ||
181 | NvRegMisc1 = 0x080, | 186 | NvRegMisc1 = 0x080, |
182 | #define NVREG_MISC1_HD 0x02 | 187 | #define NVREG_MISC1_HD 0x02 |
183 | #define NVREG_MISC1_FORCE 0x3b0f3c | 188 | #define NVREG_MISC1_FORCE 0x3b0f3c |
@@ -538,6 +543,25 @@ struct fe_priv { | |||
538 | */ | 543 | */ |
539 | static int max_interrupt_work = 5; | 544 | static int max_interrupt_work = 5; |
540 | 545 | ||
546 | /* | ||
547 | * Optimization can be either throuput mode or cpu mode | ||
548 | * | ||
549 | * Throughput Mode: Every tx and rx packet will generate an interrupt. | ||
550 | * CPU Mode: Interrupts are controlled by a timer. | ||
551 | */ | ||
552 | #define NV_OPTIMIZATION_MODE_THROUGHPUT 0 | ||
553 | #define NV_OPTIMIZATION_MODE_CPU 1 | ||
554 | static int optimization_mode = NV_OPTIMIZATION_MODE_THROUGHPUT; | ||
555 | |||
556 | /* | ||
557 | * Poll interval for timer irq | ||
558 | * | ||
559 | * This interval determines how frequent an interrupt is generated. | ||
560 | * The is value is determined by [(time_in_micro_secs * 100) / (2^10)] | ||
561 | * Min = 0, and Max = 65535 | ||
562 | */ | ||
563 | static int poll_interval = -1; | ||
564 | |||
541 | static inline struct fe_priv *get_nvpriv(struct net_device *dev) | 565 | static inline struct fe_priv *get_nvpriv(struct net_device *dev) |
542 | { | 566 | { |
543 | return netdev_priv(dev); | 567 | return netdev_priv(dev); |
@@ -1328,67 +1352,71 @@ static void nv_rx_process(struct net_device *dev) | |||
1328 | if (!(Flags & NV_RX_DESCRIPTORVALID)) | 1352 | if (!(Flags & NV_RX_DESCRIPTORVALID)) |
1329 | goto next_pkt; | 1353 | goto next_pkt; |
1330 | 1354 | ||
1331 | if (Flags & NV_RX_MISSEDFRAME) { | 1355 | if (Flags & NV_RX_ERROR) { |
1332 | np->stats.rx_missed_errors++; | 1356 | if (Flags & NV_RX_MISSEDFRAME) { |
1333 | np->stats.rx_errors++; | 1357 | np->stats.rx_missed_errors++; |
1334 | goto next_pkt; | ||
1335 | } | ||
1336 | if (Flags & (NV_RX_ERROR1|NV_RX_ERROR2|NV_RX_ERROR3)) { | ||
1337 | np->stats.rx_errors++; | ||
1338 | goto next_pkt; | ||
1339 | } | ||
1340 | if (Flags & NV_RX_CRCERR) { | ||
1341 | np->stats.rx_crc_errors++; | ||
1342 | np->stats.rx_errors++; | ||
1343 | goto next_pkt; | ||
1344 | } | ||
1345 | if (Flags & NV_RX_OVERFLOW) { | ||
1346 | np->stats.rx_over_errors++; | ||
1347 | np->stats.rx_errors++; | ||
1348 | goto next_pkt; | ||
1349 | } | ||
1350 | if (Flags & NV_RX_ERROR4) { | ||
1351 | len = nv_getlen(dev, np->rx_skbuff[i]->data, len); | ||
1352 | if (len < 0) { | ||
1353 | np->stats.rx_errors++; | 1358 | np->stats.rx_errors++; |
1354 | goto next_pkt; | 1359 | goto next_pkt; |
1355 | } | 1360 | } |
1356 | } | 1361 | if (Flags & (NV_RX_ERROR1|NV_RX_ERROR2|NV_RX_ERROR3)) { |
1357 | /* framing errors are soft errors. */ | 1362 | np->stats.rx_errors++; |
1358 | if (Flags & NV_RX_FRAMINGERR) { | 1363 | goto next_pkt; |
1359 | if (Flags & NV_RX_SUBSTRACT1) { | 1364 | } |
1360 | len--; | 1365 | if (Flags & NV_RX_CRCERR) { |
1366 | np->stats.rx_crc_errors++; | ||
1367 | np->stats.rx_errors++; | ||
1368 | goto next_pkt; | ||
1369 | } | ||
1370 | if (Flags & NV_RX_OVERFLOW) { | ||
1371 | np->stats.rx_over_errors++; | ||
1372 | np->stats.rx_errors++; | ||
1373 | goto next_pkt; | ||
1374 | } | ||
1375 | if (Flags & NV_RX_ERROR4) { | ||
1376 | len = nv_getlen(dev, np->rx_skbuff[i]->data, len); | ||
1377 | if (len < 0) { | ||
1378 | np->stats.rx_errors++; | ||
1379 | goto next_pkt; | ||
1380 | } | ||
1381 | } | ||
1382 | /* framing errors are soft errors. */ | ||
1383 | if (Flags & NV_RX_FRAMINGERR) { | ||
1384 | if (Flags & NV_RX_SUBSTRACT1) { | ||
1385 | len--; | ||
1386 | } | ||
1361 | } | 1387 | } |
1362 | } | 1388 | } |
1363 | } else { | 1389 | } else { |
1364 | if (!(Flags & NV_RX2_DESCRIPTORVALID)) | 1390 | if (!(Flags & NV_RX2_DESCRIPTORVALID)) |
1365 | goto next_pkt; | 1391 | goto next_pkt; |
1366 | 1392 | ||
1367 | if (Flags & (NV_RX2_ERROR1|NV_RX2_ERROR2|NV_RX2_ERROR3)) { | 1393 | if (Flags & NV_RX2_ERROR) { |
1368 | np->stats.rx_errors++; | 1394 | if (Flags & (NV_RX2_ERROR1|NV_RX2_ERROR2|NV_RX2_ERROR3)) { |
1369 | goto next_pkt; | ||
1370 | } | ||
1371 | if (Flags & NV_RX2_CRCERR) { | ||
1372 | np->stats.rx_crc_errors++; | ||
1373 | np->stats.rx_errors++; | ||
1374 | goto next_pkt; | ||
1375 | } | ||
1376 | if (Flags & NV_RX2_OVERFLOW) { | ||
1377 | np->stats.rx_over_errors++; | ||
1378 | np->stats.rx_errors++; | ||
1379 | goto next_pkt; | ||
1380 | } | ||
1381 | if (Flags & NV_RX2_ERROR4) { | ||
1382 | len = nv_getlen(dev, np->rx_skbuff[i]->data, len); | ||
1383 | if (len < 0) { | ||
1384 | np->stats.rx_errors++; | 1395 | np->stats.rx_errors++; |
1385 | goto next_pkt; | 1396 | goto next_pkt; |
1386 | } | 1397 | } |
1387 | } | 1398 | if (Flags & NV_RX2_CRCERR) { |
1388 | /* framing errors are soft errors */ | 1399 | np->stats.rx_crc_errors++; |
1389 | if (Flags & NV_RX2_FRAMINGERR) { | 1400 | np->stats.rx_errors++; |
1390 | if (Flags & NV_RX2_SUBSTRACT1) { | 1401 | goto next_pkt; |
1391 | len--; | 1402 | } |
1403 | if (Flags & NV_RX2_OVERFLOW) { | ||
1404 | np->stats.rx_over_errors++; | ||
1405 | np->stats.rx_errors++; | ||
1406 | goto next_pkt; | ||
1407 | } | ||
1408 | if (Flags & NV_RX2_ERROR4) { | ||
1409 | len = nv_getlen(dev, np->rx_skbuff[i]->data, len); | ||
1410 | if (len < 0) { | ||
1411 | np->stats.rx_errors++; | ||
1412 | goto next_pkt; | ||
1413 | } | ||
1414 | } | ||
1415 | /* framing errors are soft errors */ | ||
1416 | if (Flags & NV_RX2_FRAMINGERR) { | ||
1417 | if (Flags & NV_RX2_SUBSTRACT1) { | ||
1418 | len--; | ||
1419 | } | ||
1392 | } | 1420 | } |
1393 | } | 1421 | } |
1394 | Flags &= NV_RX2_CHECKSUMMASK; | 1422 | Flags &= NV_RX2_CHECKSUMMASK; |
@@ -1612,6 +1640,17 @@ static void nv_set_multicast(struct net_device *dev) | |||
1612 | spin_unlock_irq(&np->lock); | 1640 | spin_unlock_irq(&np->lock); |
1613 | } | 1641 | } |
1614 | 1642 | ||
1643 | /** | ||
1644 | * nv_update_linkspeed: Setup the MAC according to the link partner | ||
1645 | * @dev: Network device to be configured | ||
1646 | * | ||
1647 | * The function queries the PHY and checks if there is a link partner. | ||
1648 | * If yes, then it sets up the MAC accordingly. Otherwise, the MAC is | ||
1649 | * set to 10 MBit HD. | ||
1650 | * | ||
1651 | * The function returns 0 if there is no link partner and 1 if there is | ||
1652 | * a good link partner. | ||
1653 | */ | ||
1615 | static int nv_update_linkspeed(struct net_device *dev) | 1654 | static int nv_update_linkspeed(struct net_device *dev) |
1616 | { | 1655 | { |
1617 | struct fe_priv *np = netdev_priv(dev); | 1656 | struct fe_priv *np = netdev_priv(dev); |
@@ -1751,13 +1790,11 @@ set_speed: | |||
1751 | static void nv_linkchange(struct net_device *dev) | 1790 | static void nv_linkchange(struct net_device *dev) |
1752 | { | 1791 | { |
1753 | if (nv_update_linkspeed(dev)) { | 1792 | if (nv_update_linkspeed(dev)) { |
1754 | if (netif_carrier_ok(dev)) { | 1793 | if (!netif_carrier_ok(dev)) { |
1755 | nv_stop_rx(dev); | ||
1756 | } else { | ||
1757 | netif_carrier_on(dev); | 1794 | netif_carrier_on(dev); |
1758 | printk(KERN_INFO "%s: link up.\n", dev->name); | 1795 | printk(KERN_INFO "%s: link up.\n", dev->name); |
1796 | nv_start_rx(dev); | ||
1759 | } | 1797 | } |
1760 | nv_start_rx(dev); | ||
1761 | } else { | 1798 | } else { |
1762 | if (netif_carrier_ok(dev)) { | 1799 | if (netif_carrier_ok(dev)) { |
1763 | netif_carrier_off(dev); | 1800 | netif_carrier_off(dev); |
@@ -1799,22 +1836,18 @@ static irqreturn_t nv_nic_irq(int foo, void *data, struct pt_regs *regs) | |||
1799 | if (!(events & np->irqmask)) | 1836 | if (!(events & np->irqmask)) |
1800 | break; | 1837 | break; |
1801 | 1838 | ||
1802 | if (events & (NVREG_IRQ_TX1|NVREG_IRQ_TX_OK|NVREG_IRQ_TX_ERROR|NVREG_IRQ_TX_ERR)) { | 1839 | spin_lock(&np->lock); |
1840 | nv_tx_done(dev); | ||
1841 | spin_unlock(&np->lock); | ||
1842 | |||
1843 | nv_rx_process(dev); | ||
1844 | if (nv_alloc_rx(dev)) { | ||
1803 | spin_lock(&np->lock); | 1845 | spin_lock(&np->lock); |
1804 | nv_tx_done(dev); | 1846 | if (!np->in_shutdown) |
1847 | mod_timer(&np->oom_kick, jiffies + OOM_REFILL); | ||
1805 | spin_unlock(&np->lock); | 1848 | spin_unlock(&np->lock); |
1806 | } | 1849 | } |
1807 | 1850 | ||
1808 | if (events & (NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF)) { | ||
1809 | nv_rx_process(dev); | ||
1810 | if (nv_alloc_rx(dev)) { | ||
1811 | spin_lock(&np->lock); | ||
1812 | if (!np->in_shutdown) | ||
1813 | mod_timer(&np->oom_kick, jiffies + OOM_REFILL); | ||
1814 | spin_unlock(&np->lock); | ||
1815 | } | ||
1816 | } | ||
1817 | |||
1818 | if (events & NVREG_IRQ_LINK) { | 1851 | if (events & NVREG_IRQ_LINK) { |
1819 | spin_lock(&np->lock); | 1852 | spin_lock(&np->lock); |
1820 | nv_link_irq(dev); | 1853 | nv_link_irq(dev); |
@@ -2216,7 +2249,14 @@ static int nv_open(struct net_device *dev) | |||
2216 | writel(NVREG_RNDSEED_FORCE | (i&NVREG_RNDSEED_MASK), base + NvRegRandomSeed); | 2249 | writel(NVREG_RNDSEED_FORCE | (i&NVREG_RNDSEED_MASK), base + NvRegRandomSeed); |
2217 | writel(NVREG_UNKSETUP1_VAL, base + NvRegUnknownSetupReg1); | 2250 | writel(NVREG_UNKSETUP1_VAL, base + NvRegUnknownSetupReg1); |
2218 | writel(NVREG_UNKSETUP2_VAL, base + NvRegUnknownSetupReg2); | 2251 | writel(NVREG_UNKSETUP2_VAL, base + NvRegUnknownSetupReg2); |
2219 | writel(NVREG_POLL_DEFAULT, base + NvRegPollingInterval); | 2252 | if (poll_interval == -1) { |
2253 | if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) | ||
2254 | writel(NVREG_POLL_DEFAULT_THROUGHPUT, base + NvRegPollingInterval); | ||
2255 | else | ||
2256 | writel(NVREG_POLL_DEFAULT_CPU, base + NvRegPollingInterval); | ||
2257 | } | ||
2258 | else | ||
2259 | writel(poll_interval & 0xFFFF, base + NvRegPollingInterval); | ||
2220 | writel(NVREG_UNKSETUP6_VAL, base + NvRegUnknownSetupReg6); | 2260 | writel(NVREG_UNKSETUP6_VAL, base + NvRegUnknownSetupReg6); |
2221 | writel((np->phyaddr << NVREG_ADAPTCTL_PHYSHIFT)|NVREG_ADAPTCTL_PHYVALID|NVREG_ADAPTCTL_RUNNING, | 2261 | writel((np->phyaddr << NVREG_ADAPTCTL_PHYSHIFT)|NVREG_ADAPTCTL_PHYVALID|NVREG_ADAPTCTL_RUNNING, |
2222 | base + NvRegAdapterControl); | 2262 | base + NvRegAdapterControl); |
@@ -2501,7 +2541,11 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2501 | } else { | 2541 | } else { |
2502 | np->tx_flags = NV_TX2_VALID; | 2542 | np->tx_flags = NV_TX2_VALID; |
2503 | } | 2543 | } |
2504 | np->irqmask = NVREG_IRQMASK_WANTED; | 2544 | if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) |
2545 | np->irqmask = NVREG_IRQMASK_THROUGHPUT; | ||
2546 | else | ||
2547 | np->irqmask = NVREG_IRQMASK_CPU; | ||
2548 | |||
2505 | if (id->driver_data & DEV_NEED_TIMERIRQ) | 2549 | if (id->driver_data & DEV_NEED_TIMERIRQ) |
2506 | np->irqmask |= NVREG_IRQ_TIMER; | 2550 | np->irqmask |= NVREG_IRQ_TIMER; |
2507 | if (id->driver_data & DEV_NEED_LINKTIMER) { | 2551 | if (id->driver_data & DEV_NEED_LINKTIMER) { |
@@ -2514,16 +2558,17 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2514 | } | 2558 | } |
2515 | 2559 | ||
2516 | /* find a suitable phy */ | 2560 | /* find a suitable phy */ |
2517 | for (i = 1; i < 32; i++) { | 2561 | for (i = 1; i <= 32; i++) { |
2518 | int id1, id2; | 2562 | int id1, id2; |
2563 | int phyaddr = i & 0x1F; | ||
2519 | 2564 | ||
2520 | spin_lock_irq(&np->lock); | 2565 | spin_lock_irq(&np->lock); |
2521 | id1 = mii_rw(dev, i, MII_PHYSID1, MII_READ); | 2566 | id1 = mii_rw(dev, phyaddr, MII_PHYSID1, MII_READ); |
2522 | spin_unlock_irq(&np->lock); | 2567 | spin_unlock_irq(&np->lock); |
2523 | if (id1 < 0 || id1 == 0xffff) | 2568 | if (id1 < 0 || id1 == 0xffff) |
2524 | continue; | 2569 | continue; |
2525 | spin_lock_irq(&np->lock); | 2570 | spin_lock_irq(&np->lock); |
2526 | id2 = mii_rw(dev, i, MII_PHYSID2, MII_READ); | 2571 | id2 = mii_rw(dev, phyaddr, MII_PHYSID2, MII_READ); |
2527 | spin_unlock_irq(&np->lock); | 2572 | spin_unlock_irq(&np->lock); |
2528 | if (id2 < 0 || id2 == 0xffff) | 2573 | if (id2 < 0 || id2 == 0xffff) |
2529 | continue; | 2574 | continue; |
@@ -2531,23 +2576,19 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2531 | id1 = (id1 & PHYID1_OUI_MASK) << PHYID1_OUI_SHFT; | 2576 | id1 = (id1 & PHYID1_OUI_MASK) << PHYID1_OUI_SHFT; |
2532 | id2 = (id2 & PHYID2_OUI_MASK) >> PHYID2_OUI_SHFT; | 2577 | id2 = (id2 & PHYID2_OUI_MASK) >> PHYID2_OUI_SHFT; |
2533 | dprintk(KERN_DEBUG "%s: open: Found PHY %04x:%04x at address %d.\n", | 2578 | dprintk(KERN_DEBUG "%s: open: Found PHY %04x:%04x at address %d.\n", |
2534 | pci_name(pci_dev), id1, id2, i); | 2579 | pci_name(pci_dev), id1, id2, phyaddr); |
2535 | np->phyaddr = i; | 2580 | np->phyaddr = phyaddr; |
2536 | np->phy_oui = id1 | id2; | 2581 | np->phy_oui = id1 | id2; |
2537 | break; | 2582 | break; |
2538 | } | 2583 | } |
2539 | if (i == 32) { | 2584 | if (i == 33) { |
2540 | /* PHY in isolate mode? No phy attached and user wants to | ||
2541 | * test loopback? Very odd, but can be correct. | ||
2542 | */ | ||
2543 | printk(KERN_INFO "%s: open: Could not find a valid PHY.\n", | 2585 | printk(KERN_INFO "%s: open: Could not find a valid PHY.\n", |
2544 | pci_name(pci_dev)); | 2586 | pci_name(pci_dev)); |
2545 | } | 2587 | goto out_freering; |
2546 | |||
2547 | if (i != 32) { | ||
2548 | /* reset it */ | ||
2549 | phy_init(dev); | ||
2550 | } | 2588 | } |
2589 | |||
2590 | /* reset it */ | ||
2591 | phy_init(dev); | ||
2551 | 2592 | ||
2552 | /* set default link speed settings */ | 2593 | /* set default link speed settings */ |
2553 | np->linkspeed = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; | 2594 | np->linkspeed = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
@@ -2689,6 +2730,10 @@ static void __exit exit_nic(void) | |||
2689 | 2730 | ||
2690 | module_param(max_interrupt_work, int, 0); | 2731 | module_param(max_interrupt_work, int, 0); |
2691 | MODULE_PARM_DESC(max_interrupt_work, "forcedeth maximum events handled per interrupt"); | 2732 | MODULE_PARM_DESC(max_interrupt_work, "forcedeth maximum events handled per interrupt"); |
2733 | module_param(optimization_mode, int, 0); | ||
2734 | MODULE_PARM_DESC(optimization_mode, "In throughput mode (0), every tx & rx packet will generate an interrupt. In CPU mode (1), interrupts are controlled by a timer."); | ||
2735 | module_param(poll_interval, int, 0); | ||
2736 | MODULE_PARM_DESC(poll_interval, "Interval determines how frequent timer interrupt is generated by [(time_in_micro_secs * 100) / (2^10)]. Min is 0 and Max is 65535."); | ||
2692 | 2737 | ||
2693 | MODULE_AUTHOR("Manfred Spraul <manfred@colorfullife.com>"); | 2738 | MODULE_AUTHOR("Manfred Spraul <manfred@colorfullife.com>"); |
2694 | MODULE_DESCRIPTION("Reverse Engineered nForce ethernet driver"); | 2739 | MODULE_DESCRIPTION("Reverse Engineered nForce ethernet driver"); |
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c index 7263395d78bb..9544279e8bcd 100644 --- a/drivers/net/gianfar_mii.c +++ b/drivers/net/gianfar_mii.c | |||
@@ -133,7 +133,7 @@ int gfar_mdio_probe(struct device *dev) | |||
133 | if (NULL == dev) | 133 | if (NULL == dev) |
134 | return -EINVAL; | 134 | return -EINVAL; |
135 | 135 | ||
136 | new_bus = kmalloc(sizeof(struct mii_bus), GFP_KERNEL); | 136 | new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL); |
137 | 137 | ||
138 | if (NULL == new_bus) | 138 | if (NULL == new_bus) |
139 | return -ENOMEM; | 139 | return -ENOMEM; |
diff --git a/drivers/net/gt96100eth.c b/drivers/net/gt96100eth.c index 666cfbbcf6d9..5958a6314723 100644 --- a/drivers/net/gt96100eth.c +++ b/drivers/net/gt96100eth.c | |||
@@ -72,8 +72,6 @@ static void dump_tx_desc(int dbg_lvl, struct net_device *dev, int i); | |||
72 | static void dump_rx_desc(int dbg_lvl, struct net_device *dev, int i); | 72 | static void dump_rx_desc(int dbg_lvl, struct net_device *dev, int i); |
73 | static void dump_skb(int dbg_lvl, struct net_device *dev, | 73 | static void dump_skb(int dbg_lvl, struct net_device *dev, |
74 | struct sk_buff *skb); | 74 | struct sk_buff *skb); |
75 | static void dump_hw_addr(int dbg_lvl, struct net_device *dev, | ||
76 | const char* pfx, unsigned char* addr_str); | ||
77 | static void update_stats(struct gt96100_private *gp); | 75 | static void update_stats(struct gt96100_private *gp); |
78 | static void abort(struct net_device *dev, u32 abort_bits); | 76 | static void abort(struct net_device *dev, u32 abort_bits); |
79 | static void hard_stop(struct net_device *dev); | 77 | static void hard_stop(struct net_device *dev); |
@@ -334,13 +332,13 @@ dump_MII(int dbg_lvl, struct net_device *dev) | |||
334 | 332 | ||
335 | static void | 333 | static void |
336 | dump_hw_addr(int dbg_lvl, struct net_device *dev, const char* pfx, | 334 | dump_hw_addr(int dbg_lvl, struct net_device *dev, const char* pfx, |
337 | unsigned char* addr_str) | 335 | const char* func, unsigned char* addr_str) |
338 | { | 336 | { |
339 | int i; | 337 | int i; |
340 | char buf[100], octet[5]; | 338 | char buf[100], octet[5]; |
341 | 339 | ||
342 | if (dbg_lvl <= GT96100_DEBUG) { | 340 | if (dbg_lvl <= GT96100_DEBUG) { |
343 | strcpy(buf, pfx); | 341 | sprintf(buf, pfx, func); |
344 | for (i = 0; i < 6; i++) { | 342 | for (i = 0; i < 6; i++) { |
345 | sprintf(octet, "%2.2x%s", | 343 | sprintf(octet, "%2.2x%s", |
346 | addr_str[i], i<5 ? ":" : "\n"); | 344 | addr_str[i], i<5 ? ":" : "\n"); |
@@ -708,7 +706,7 @@ static int __init gt96100_probe1(struct pci_dev *pci, int port_num) | |||
708 | 706 | ||
709 | info("%s found at 0x%x, irq %d\n", | 707 | info("%s found at 0x%x, irq %d\n", |
710 | chip_name(gp->chip_rev), gtif->iobase, gtif->irq); | 708 | chip_name(gp->chip_rev), gtif->iobase, gtif->irq); |
711 | dump_hw_addr(0, dev, "HW Address ", dev->dev_addr); | 709 | dump_hw_addr(0, dev, "%s: HW Address ", __FUNCTION__, dev->dev_addr); |
712 | info("%s chip revision=%d\n", chip_name(gp->chip_rev), gp->chip_rev); | 710 | info("%s chip revision=%d\n", chip_name(gp->chip_rev), gp->chip_rev); |
713 | info("%s ethernet port %d\n", chip_name(gp->chip_rev), gp->port_num); | 711 | info("%s ethernet port %d\n", chip_name(gp->chip_rev), gp->port_num); |
714 | info("external PHY ID1=0x%04x, ID2=0x%04x\n", phy_id1, phy_id2); | 712 | info("external PHY ID1=0x%04x, ID2=0x%04x\n", phy_id1, phy_id2); |
@@ -1488,7 +1486,7 @@ gt96100_set_rx_mode(struct net_device *dev) | |||
1488 | gt96100_add_hash_entry(dev, dev->dev_addr); | 1486 | gt96100_add_hash_entry(dev, dev->dev_addr); |
1489 | 1487 | ||
1490 | for (mcptr = dev->mc_list; mcptr; mcptr = mcptr->next) { | 1488 | for (mcptr = dev->mc_list; mcptr; mcptr = mcptr->next) { |
1491 | dump_hw_addr(2, dev, __FUNCTION__ ": addr=", | 1489 | dump_hw_addr(2, dev, "%s: addr=", __FUNCTION__, |
1492 | mcptr->dmi_addr); | 1490 | mcptr->dmi_addr); |
1493 | gt96100_add_hash_entry(dev, mcptr->dmi_addr); | 1491 | gt96100_add_hash_entry(dev, mcptr->dmi_addr); |
1494 | } | 1492 | } |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index be191d80ef9c..ceb98fd398af 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -58,7 +58,7 @@ | |||
58 | 58 | ||
59 | #include "ibmveth.h" | 59 | #include "ibmveth.h" |
60 | 60 | ||
61 | #define DEBUG 1 | 61 | #undef DEBUG |
62 | 62 | ||
63 | #define ibmveth_printk(fmt, args...) \ | 63 | #define ibmveth_printk(fmt, args...) \ |
64 | printk(KERN_INFO "%s: " fmt, __FILE__, ## args) | 64 | printk(KERN_INFO "%s: " fmt, __FILE__, ## args) |
diff --git a/drivers/net/saa9730.c b/drivers/net/saa9730.c index 110e777f206e..b2acedbefa8f 100644 --- a/drivers/net/saa9730.c +++ b/drivers/net/saa9730.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * Carsten Langgaard, carstenl@mips.com | 2 | * Copyright (C) 2000, 2005 MIPS Technologies, Inc. All rights reserved. |
3 | * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. | 3 | * Authors: Carsten Langgaard <carstenl@mips.com> |
4 | * | 4 | * Maciej W. Rozycki <macro@mips.com> |
5 | * ######################################################################## | 5 | * Copyright (C) 2004 Ralf Baechle <ralf@linux-mips.org> |
6 | * | 6 | * |
7 | * This program is free software; you can distribute it and/or modify it | 7 | * This program is free software; you can distribute it and/or modify it |
8 | * under the terms of the GNU General Public License (Version 2) as | 8 | * under the terms of the GNU General Public License (Version 2) as |
@@ -17,15 +17,13 @@ | |||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | 17 | * with this program; if not, write to the Free Software Foundation, Inc., |
18 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | 18 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. |
19 | * | 19 | * |
20 | * ######################################################################## | ||
21 | * | ||
22 | * SAA9730 ethernet driver. | 20 | * SAA9730 ethernet driver. |
23 | * | 21 | * |
24 | * Changes: | 22 | * Changes: |
25 | * Angelo Dell'Aera <buffer@antifork.org> : Conversion to the new PCI API (pci_driver). | 23 | * Angelo Dell'Aera <buffer@antifork.org> : Conversion to the new PCI API |
26 | * Conversion to spinlocks. | 24 | * (pci_driver). |
27 | * Error handling fixes. | 25 | * Conversion to spinlocks. |
28 | * | 26 | * Error handling fixes. |
29 | */ | 27 | */ |
30 | 28 | ||
31 | #include <linux/init.h> | 29 | #include <linux/init.h> |
@@ -36,8 +34,11 @@ | |||
36 | #include <linux/skbuff.h> | 34 | #include <linux/skbuff.h> |
37 | #include <linux/pci.h> | 35 | #include <linux/pci.h> |
38 | #include <linux/spinlock.h> | 36 | #include <linux/spinlock.h> |
37 | #include <linux/types.h> | ||
39 | 38 | ||
40 | #include <asm/addrspace.h> | 39 | #include <asm/addrspace.h> |
40 | #include <asm/io.h> | ||
41 | |||
41 | #include <asm/mips-boards/prom.h> | 42 | #include <asm/mips-boards/prom.h> |
42 | 43 | ||
43 | #include "saa9730.h" | 44 | #include "saa9730.h" |
@@ -51,8 +52,8 @@ int lan_saa9730_debug; | |||
51 | #define DRV_MODULE_NAME "saa9730" | 52 | #define DRV_MODULE_NAME "saa9730" |
52 | 53 | ||
53 | static struct pci_device_id saa9730_pci_tbl[] = { | 54 | static struct pci_device_id saa9730_pci_tbl[] = { |
54 | { PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA9370, | 55 | { PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA9730, |
55 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, | 56 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
56 | { 0, } | 57 | { 0, } |
57 | }; | 58 | }; |
58 | 59 | ||
@@ -61,50 +62,48 @@ MODULE_DEVICE_TABLE(pci, saa9730_pci_tbl); | |||
61 | /* Non-zero only if the current card is a PCI with BIOS-set IRQ. */ | 62 | /* Non-zero only if the current card is a PCI with BIOS-set IRQ. */ |
62 | static unsigned int pci_irq_line; | 63 | static unsigned int pci_irq_line; |
63 | 64 | ||
64 | #define INL(a) inl((unsigned long)a) | ||
65 | #define OUTL(x,a) outl(x,(unsigned long)a) | ||
66 | |||
67 | static void evm_saa9730_enable_lan_int(struct lan_saa9730_private *lp) | 65 | static void evm_saa9730_enable_lan_int(struct lan_saa9730_private *lp) |
68 | { | 66 | { |
69 | OUTL(INL(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, | 67 | outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, |
70 | &lp->evm_saa9730_regs->InterruptBlock1); | 68 | &lp->evm_saa9730_regs->InterruptBlock1); |
71 | OUTL(INL(&lp->evm_saa9730_regs->InterruptStatus1) | EVM_LAN_INT, | 69 | outl(readl(&lp->evm_saa9730_regs->InterruptStatus1) | EVM_LAN_INT, |
72 | &lp->evm_saa9730_regs->InterruptStatus1); | 70 | &lp->evm_saa9730_regs->InterruptStatus1); |
73 | OUTL(INL(&lp->evm_saa9730_regs->InterruptEnable1) | EVM_LAN_INT | | 71 | outl(readl(&lp->evm_saa9730_regs->InterruptEnable1) | EVM_LAN_INT | |
74 | EVM_MASTER_EN, &lp->evm_saa9730_regs->InterruptEnable1); | 72 | EVM_MASTER_EN, &lp->evm_saa9730_regs->InterruptEnable1); |
75 | } | 73 | } |
74 | |||
76 | static void evm_saa9730_disable_lan_int(struct lan_saa9730_private *lp) | 75 | static void evm_saa9730_disable_lan_int(struct lan_saa9730_private *lp) |
77 | { | 76 | { |
78 | OUTL(INL(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, | 77 | outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, |
79 | &lp->evm_saa9730_regs->InterruptBlock1); | 78 | &lp->evm_saa9730_regs->InterruptBlock1); |
80 | OUTL(INL(&lp->evm_saa9730_regs->InterruptEnable1) & ~EVM_LAN_INT, | 79 | outl(readl(&lp->evm_saa9730_regs->InterruptEnable1) & ~EVM_LAN_INT, |
81 | &lp->evm_saa9730_regs->InterruptEnable1); | 80 | &lp->evm_saa9730_regs->InterruptEnable1); |
82 | } | 81 | } |
83 | 82 | ||
84 | static void evm_saa9730_clear_lan_int(struct lan_saa9730_private *lp) | 83 | static void evm_saa9730_clear_lan_int(struct lan_saa9730_private *lp) |
85 | { | 84 | { |
86 | OUTL(EVM_LAN_INT, &lp->evm_saa9730_regs->InterruptStatus1); | 85 | outl(EVM_LAN_INT, &lp->evm_saa9730_regs->InterruptStatus1); |
87 | } | 86 | } |
88 | 87 | ||
89 | static void evm_saa9730_block_lan_int(struct lan_saa9730_private *lp) | 88 | static void evm_saa9730_block_lan_int(struct lan_saa9730_private *lp) |
90 | { | 89 | { |
91 | OUTL(INL(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, | 90 | outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, |
92 | &lp->evm_saa9730_regs->InterruptBlock1); | 91 | &lp->evm_saa9730_regs->InterruptBlock1); |
93 | } | 92 | } |
94 | 93 | ||
95 | static void evm_saa9730_unblock_lan_int(struct lan_saa9730_private *lp) | 94 | static void evm_saa9730_unblock_lan_int(struct lan_saa9730_private *lp) |
96 | { | 95 | { |
97 | OUTL(INL(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, | 96 | outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, |
98 | &lp->evm_saa9730_regs->InterruptBlock1); | 97 | &lp->evm_saa9730_regs->InterruptBlock1); |
99 | } | 98 | } |
100 | 99 | ||
101 | static void show_saa9730_regs(struct lan_saa9730_private *lp) | 100 | static void __attribute_used__ show_saa9730_regs(struct lan_saa9730_private *lp) |
102 | { | 101 | { |
103 | int i, j; | 102 | int i, j; |
104 | printk("TxmBufferA = %x\n", lp->TxmBuffer[0][0]); | 103 | printk("TxmBufferA = %p\n", lp->TxmBuffer[0][0]); |
105 | printk("TxmBufferB = %x\n", lp->TxmBuffer[1][0]); | 104 | printk("TxmBufferB = %p\n", lp->TxmBuffer[1][0]); |
106 | printk("RcvBufferA = %x\n", lp->RcvBuffer[0][0]); | 105 | printk("RcvBufferA = %p\n", lp->RcvBuffer[0][0]); |
107 | printk("RcvBufferB = %x\n", lp->RcvBuffer[1][0]); | 106 | printk("RcvBufferB = %p\n", lp->RcvBuffer[1][0]); |
108 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { | 107 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { |
109 | for (j = 0; j < LAN_SAA9730_TXM_Q_SIZE; j++) { | 108 | for (j = 0; j < LAN_SAA9730_TXM_Q_SIZE; j++) { |
110 | printk("TxmBuffer[%d][%d] = %x\n", i, j, | 109 | printk("TxmBuffer[%d][%d] = %x\n", i, j, |
@@ -120,13 +119,13 @@ static void show_saa9730_regs(struct lan_saa9730_private *lp) | |||
120 | } | 119 | } |
121 | } | 120 | } |
122 | printk("lp->evm_saa9730_regs->InterruptBlock1 = %x\n", | 121 | printk("lp->evm_saa9730_regs->InterruptBlock1 = %x\n", |
123 | INL(&lp->evm_saa9730_regs->InterruptBlock1)); | 122 | readl(&lp->evm_saa9730_regs->InterruptBlock1)); |
124 | printk("lp->evm_saa9730_regs->InterruptStatus1 = %x\n", | 123 | printk("lp->evm_saa9730_regs->InterruptStatus1 = %x\n", |
125 | INL(&lp->evm_saa9730_regs->InterruptStatus1)); | 124 | readl(&lp->evm_saa9730_regs->InterruptStatus1)); |
126 | printk("lp->evm_saa9730_regs->InterruptEnable1 = %x\n", | 125 | printk("lp->evm_saa9730_regs->InterruptEnable1 = %x\n", |
127 | INL(&lp->evm_saa9730_regs->InterruptEnable1)); | 126 | readl(&lp->evm_saa9730_regs->InterruptEnable1)); |
128 | printk("lp->lan_saa9730_regs->Ok2Use = %x\n", | 127 | printk("lp->lan_saa9730_regs->Ok2Use = %x\n", |
129 | INL(&lp->lan_saa9730_regs->Ok2Use)); | 128 | readl(&lp->lan_saa9730_regs->Ok2Use)); |
130 | printk("lp->NextTxmBufferIndex = %x\n", lp->NextTxmBufferIndex); | 129 | printk("lp->NextTxmBufferIndex = %x\n", lp->NextTxmBufferIndex); |
131 | printk("lp->NextTxmPacketIndex = %x\n", lp->NextTxmPacketIndex); | 130 | printk("lp->NextTxmPacketIndex = %x\n", lp->NextTxmPacketIndex); |
132 | printk("lp->PendingTxmBufferIndex = %x\n", | 131 | printk("lp->PendingTxmBufferIndex = %x\n", |
@@ -134,23 +133,23 @@ static void show_saa9730_regs(struct lan_saa9730_private *lp) | |||
134 | printk("lp->PendingTxmPacketIndex = %x\n", | 133 | printk("lp->PendingTxmPacketIndex = %x\n", |
135 | lp->PendingTxmPacketIndex); | 134 | lp->PendingTxmPacketIndex); |
136 | printk("lp->lan_saa9730_regs->LanDmaCtl = %x\n", | 135 | printk("lp->lan_saa9730_regs->LanDmaCtl = %x\n", |
137 | INL(&lp->lan_saa9730_regs->LanDmaCtl)); | 136 | readl(&lp->lan_saa9730_regs->LanDmaCtl)); |
138 | printk("lp->lan_saa9730_regs->DmaStatus = %x\n", | 137 | printk("lp->lan_saa9730_regs->DmaStatus = %x\n", |
139 | INL(&lp->lan_saa9730_regs->DmaStatus)); | 138 | readl(&lp->lan_saa9730_regs->DmaStatus)); |
140 | printk("lp->lan_saa9730_regs->CamCtl = %x\n", | 139 | printk("lp->lan_saa9730_regs->CamCtl = %x\n", |
141 | INL(&lp->lan_saa9730_regs->CamCtl)); | 140 | readl(&lp->lan_saa9730_regs->CamCtl)); |
142 | printk("lp->lan_saa9730_regs->TxCtl = %x\n", | 141 | printk("lp->lan_saa9730_regs->TxCtl = %x\n", |
143 | INL(&lp->lan_saa9730_regs->TxCtl)); | 142 | readl(&lp->lan_saa9730_regs->TxCtl)); |
144 | printk("lp->lan_saa9730_regs->TxStatus = %x\n", | 143 | printk("lp->lan_saa9730_regs->TxStatus = %x\n", |
145 | INL(&lp->lan_saa9730_regs->TxStatus)); | 144 | readl(&lp->lan_saa9730_regs->TxStatus)); |
146 | printk("lp->lan_saa9730_regs->RxCtl = %x\n", | 145 | printk("lp->lan_saa9730_regs->RxCtl = %x\n", |
147 | INL(&lp->lan_saa9730_regs->RxCtl)); | 146 | readl(&lp->lan_saa9730_regs->RxCtl)); |
148 | printk("lp->lan_saa9730_regs->RxStatus = %x\n", | 147 | printk("lp->lan_saa9730_regs->RxStatus = %x\n", |
149 | INL(&lp->lan_saa9730_regs->RxStatus)); | 148 | readl(&lp->lan_saa9730_regs->RxStatus)); |
150 | for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { | 149 | for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { |
151 | OUTL(i, &lp->lan_saa9730_regs->CamAddress); | 150 | outl(i, &lp->lan_saa9730_regs->CamAddress); |
152 | printk("lp->lan_saa9730_regs->CamData = %x\n", | 151 | printk("lp->lan_saa9730_regs->CamData = %x\n", |
153 | INL(&lp->lan_saa9730_regs->CamData)); | 152 | readl(&lp->lan_saa9730_regs->CamData)); |
154 | } | 153 | } |
155 | printk("lp->stats.tx_packets = %lx\n", lp->stats.tx_packets); | 154 | printk("lp->stats.tx_packets = %lx\n", lp->stats.tx_packets); |
156 | printk("lp->stats.tx_errors = %lx\n", lp->stats.tx_errors); | 155 | printk("lp->stats.tx_errors = %lx\n", lp->stats.tx_errors); |
@@ -178,17 +177,17 @@ static void show_saa9730_regs(struct lan_saa9730_private *lp) | |||
178 | lp->stats.rx_length_errors); | 177 | lp->stats.rx_length_errors); |
179 | 178 | ||
180 | printk("lp->lan_saa9730_regs->DebugPCIMasterAddr = %x\n", | 179 | printk("lp->lan_saa9730_regs->DebugPCIMasterAddr = %x\n", |
181 | INL(&lp->lan_saa9730_regs->DebugPCIMasterAddr)); | 180 | readl(&lp->lan_saa9730_regs->DebugPCIMasterAddr)); |
182 | printk("lp->lan_saa9730_regs->DebugLanTxStateMachine = %x\n", | 181 | printk("lp->lan_saa9730_regs->DebugLanTxStateMachine = %x\n", |
183 | INL(&lp->lan_saa9730_regs->DebugLanTxStateMachine)); | 182 | readl(&lp->lan_saa9730_regs->DebugLanTxStateMachine)); |
184 | printk("lp->lan_saa9730_regs->DebugLanRxStateMachine = %x\n", | 183 | printk("lp->lan_saa9730_regs->DebugLanRxStateMachine = %x\n", |
185 | INL(&lp->lan_saa9730_regs->DebugLanRxStateMachine)); | 184 | readl(&lp->lan_saa9730_regs->DebugLanRxStateMachine)); |
186 | printk("lp->lan_saa9730_regs->DebugLanTxFifoPointers = %x\n", | 185 | printk("lp->lan_saa9730_regs->DebugLanTxFifoPointers = %x\n", |
187 | INL(&lp->lan_saa9730_regs->DebugLanTxFifoPointers)); | 186 | readl(&lp->lan_saa9730_regs->DebugLanTxFifoPointers)); |
188 | printk("lp->lan_saa9730_regs->DebugLanRxFifoPointers = %x\n", | 187 | printk("lp->lan_saa9730_regs->DebugLanRxFifoPointers = %x\n", |
189 | INL(&lp->lan_saa9730_regs->DebugLanRxFifoPointers)); | 188 | readl(&lp->lan_saa9730_regs->DebugLanRxFifoPointers)); |
190 | printk("lp->lan_saa9730_regs->DebugLanCtlStateMachine = %x\n", | 189 | printk("lp->lan_saa9730_regs->DebugLanCtlStateMachine = %x\n", |
191 | INL(&lp->lan_saa9730_regs->DebugLanCtlStateMachine)); | 190 | readl(&lp->lan_saa9730_regs->DebugLanCtlStateMachine)); |
192 | } | 191 | } |
193 | 192 | ||
194 | static void lan_saa9730_buffer_init(struct lan_saa9730_private *lp) | 193 | static void lan_saa9730_buffer_init(struct lan_saa9730_private *lp) |
@@ -214,98 +213,108 @@ static void lan_saa9730_buffer_init(struct lan_saa9730_private *lp) | |||
214 | } | 213 | } |
215 | } | 214 | } |
216 | 215 | ||
217 | static int lan_saa9730_allocate_buffers(struct lan_saa9730_private *lp) | 216 | static void lan_saa9730_free_buffers(struct pci_dev *pdev, |
217 | struct lan_saa9730_private *lp) | ||
218 | { | 218 | { |
219 | unsigned int mem_size; | 219 | pci_free_consistent(pdev, lp->buffer_size, lp->buffer_start, |
220 | void *Pa; | 220 | lp->dma_addr); |
221 | unsigned int i, j, RcvBufferSize, TxmBufferSize; | 221 | } |
222 | unsigned int buffer_start; | ||
223 | 222 | ||
224 | /* | 223 | static int lan_saa9730_allocate_buffers(struct pci_dev *pdev, |
225 | * Allocate all RX and TX packets in one chunk. | 224 | struct lan_saa9730_private *lp) |
226 | * The Rx and Tx packets must be PACKET_SIZE aligned. | 225 | { |
227 | */ | 226 | void *Pa; |
228 | mem_size = ((LAN_SAA9730_RCV_Q_SIZE + LAN_SAA9730_TXM_Q_SIZE) * | 227 | unsigned int i, j, rxoffset, txoffset; |
229 | LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_BUFFERS) + | 228 | int ret; |
230 | LAN_SAA9730_PACKET_SIZE; | ||
231 | buffer_start = | ||
232 | (unsigned int) kmalloc(mem_size, GFP_DMA | GFP_KERNEL); | ||
233 | |||
234 | if (!buffer_start) | ||
235 | return -ENOMEM; | ||
236 | |||
237 | /* | ||
238 | * Set DMA buffer to kseg1 (uncached). | ||
239 | * Make sure to flush before using it uncached. | ||
240 | */ | ||
241 | Pa = (void *) KSEG1ADDR((buffer_start + LAN_SAA9730_PACKET_SIZE) & | ||
242 | ~(LAN_SAA9730_PACKET_SIZE - 1)); | ||
243 | dma_cache_wback_inv((unsigned long) Pa, mem_size); | ||
244 | 229 | ||
245 | /* Initialize buffer space */ | 230 | /* Initialize buffer space */ |
246 | RcvBufferSize = LAN_SAA9730_PACKET_SIZE; | ||
247 | TxmBufferSize = LAN_SAA9730_PACKET_SIZE; | ||
248 | lp->DmaRcvPackets = LAN_SAA9730_RCV_Q_SIZE; | 231 | lp->DmaRcvPackets = LAN_SAA9730_RCV_Q_SIZE; |
249 | lp->DmaTxmPackets = LAN_SAA9730_TXM_Q_SIZE; | 232 | lp->DmaTxmPackets = LAN_SAA9730_TXM_Q_SIZE; |
250 | 233 | ||
234 | /* Initialize Rx Buffer Index */ | ||
235 | lp->NextRcvPacketIndex = 0; | ||
236 | lp->NextRcvBufferIndex = 0; | ||
237 | |||
238 | /* Set current buffer index & next available packet index */ | ||
239 | lp->NextTxmPacketIndex = 0; | ||
240 | lp->NextTxmBufferIndex = 0; | ||
241 | lp->PendingTxmPacketIndex = 0; | ||
242 | lp->PendingTxmBufferIndex = 0; | ||
243 | |||
244 | /* | ||
245 | * Allocate all RX and TX packets in one chunk. | ||
246 | * The Rx and Tx packets must be PACKET_SIZE aligned. | ||
247 | */ | ||
248 | lp->buffer_size = ((LAN_SAA9730_RCV_Q_SIZE + LAN_SAA9730_TXM_Q_SIZE) * | ||
249 | LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_BUFFERS) + | ||
250 | LAN_SAA9730_PACKET_SIZE; | ||
251 | lp->buffer_start = pci_alloc_consistent(pdev, lp->buffer_size, | ||
252 | &lp->dma_addr); | ||
253 | if (!lp->buffer_start) { | ||
254 | ret = -ENOMEM; | ||
255 | goto out; | ||
256 | } | ||
257 | |||
258 | Pa = (void *)ALIGN((unsigned long)lp->buffer_start, | ||
259 | LAN_SAA9730_PACKET_SIZE); | ||
260 | |||
261 | rxoffset = Pa - lp->buffer_start; | ||
262 | |||
251 | /* Init RX buffers */ | 263 | /* Init RX buffers */ |
252 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { | 264 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { |
253 | for (j = 0; j < LAN_SAA9730_RCV_Q_SIZE; j++) { | 265 | for (j = 0; j < LAN_SAA9730_RCV_Q_SIZE; j++) { |
254 | *(unsigned int *) Pa = | 266 | *(unsigned int *) Pa = |
255 | cpu_to_le32(RXSF_READY << | 267 | cpu_to_le32(RXSF_READY << |
256 | RX_STAT_CTL_OWNER_SHF); | 268 | RX_STAT_CTL_OWNER_SHF); |
257 | lp->RcvBuffer[i][j] = (unsigned int) Pa; | 269 | lp->RcvBuffer[i][j] = Pa; |
258 | Pa += RcvBufferSize; | 270 | Pa += LAN_SAA9730_PACKET_SIZE; |
259 | } | 271 | } |
260 | } | 272 | } |
261 | 273 | ||
274 | txoffset = Pa - lp->buffer_start; | ||
275 | |||
262 | /* Init TX buffers */ | 276 | /* Init TX buffers */ |
263 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { | 277 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { |
264 | for (j = 0; j < LAN_SAA9730_TXM_Q_SIZE; j++) { | 278 | for (j = 0; j < LAN_SAA9730_TXM_Q_SIZE; j++) { |
265 | *(unsigned int *) Pa = | 279 | *(unsigned int *) Pa = |
266 | cpu_to_le32(TXSF_EMPTY << | 280 | cpu_to_le32(TXSF_EMPTY << |
267 | TX_STAT_CTL_OWNER_SHF); | 281 | TX_STAT_CTL_OWNER_SHF); |
268 | lp->TxmBuffer[i][j] = (unsigned int) Pa; | 282 | lp->TxmBuffer[i][j] = Pa; |
269 | Pa += TxmBufferSize; | 283 | Pa += LAN_SAA9730_PACKET_SIZE; |
270 | } | 284 | } |
271 | } | 285 | } |
272 | 286 | ||
273 | /* | 287 | /* |
274 | * Set rx buffer A and rx buffer B to point to the first two buffer | 288 | * Set rx buffer A and rx buffer B to point to the first two buffer |
275 | * spaces. | 289 | * spaces. |
276 | */ | 290 | */ |
277 | OUTL(PHYSADDR(lp->RcvBuffer[0][0]), | 291 | outl(lp->dma_addr + rxoffset, |
278 | &lp->lan_saa9730_regs->RxBuffA); | 292 | &lp->lan_saa9730_regs->RxBuffA); |
279 | OUTL(PHYSADDR(lp->RcvBuffer[1][0]), | 293 | outl(lp->dma_addr + rxoffset + |
294 | LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_RCV_Q_SIZE, | ||
280 | &lp->lan_saa9730_regs->RxBuffB); | 295 | &lp->lan_saa9730_regs->RxBuffB); |
281 | 296 | ||
282 | /* Initialize Buffer Index */ | 297 | /* |
283 | lp->NextRcvPacketIndex = 0; | ||
284 | lp->NextRcvToUseIsA = 1; | ||
285 | |||
286 | /* Set current buffer index & next availble packet index */ | ||
287 | lp->NextTxmPacketIndex = 0; | ||
288 | lp->NextTxmBufferIndex = 0; | ||
289 | lp->PendingTxmPacketIndex = 0; | ||
290 | lp->PendingTxmBufferIndex = 0; | ||
291 | |||
292 | /* | ||
293 | * Set txm_buf_a and txm_buf_b to point to the first two buffer | 298 | * Set txm_buf_a and txm_buf_b to point to the first two buffer |
294 | * space | 299 | * space |
295 | */ | 300 | */ |
296 | OUTL(PHYSADDR(lp->TxmBuffer[0][0]), | 301 | outl(lp->dma_addr + txoffset, |
297 | &lp->lan_saa9730_regs->TxBuffA); | 302 | &lp->lan_saa9730_regs->TxBuffA); |
298 | OUTL(PHYSADDR(lp->TxmBuffer[1][0]), | 303 | outl(lp->dma_addr + txoffset + |
304 | LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_TXM_Q_SIZE, | ||
299 | &lp->lan_saa9730_regs->TxBuffB); | 305 | &lp->lan_saa9730_regs->TxBuffB); |
300 | 306 | ||
301 | /* Set packet number */ | 307 | /* Set packet number */ |
302 | OUTL((lp->DmaRcvPackets << PK_COUNT_RX_A_SHF) | | 308 | outl((lp->DmaRcvPackets << PK_COUNT_RX_A_SHF) | |
303 | (lp->DmaRcvPackets << PK_COUNT_RX_B_SHF) | | 309 | (lp->DmaRcvPackets << PK_COUNT_RX_B_SHF) | |
304 | (lp->DmaTxmPackets << PK_COUNT_TX_A_SHF) | | 310 | (lp->DmaTxmPackets << PK_COUNT_TX_A_SHF) | |
305 | (lp->DmaTxmPackets << PK_COUNT_TX_B_SHF), | 311 | (lp->DmaTxmPackets << PK_COUNT_TX_B_SHF), |
306 | &lp->lan_saa9730_regs->PacketCount); | 312 | &lp->lan_saa9730_regs->PacketCount); |
307 | 313 | ||
308 | return 0; | 314 | return 0; |
315 | |||
316 | out: | ||
317 | return ret; | ||
309 | } | 318 | } |
310 | 319 | ||
311 | static int lan_saa9730_cam_load(struct lan_saa9730_private *lp) | 320 | static int lan_saa9730_cam_load(struct lan_saa9730_private *lp) |
@@ -317,8 +326,8 @@ static int lan_saa9730_cam_load(struct lan_saa9730_private *lp) | |||
317 | 326 | ||
318 | for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { | 327 | for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { |
319 | /* First set address to where data is written */ | 328 | /* First set address to where data is written */ |
320 | OUTL(i, &lp->lan_saa9730_regs->CamAddress); | 329 | outl(i, &lp->lan_saa9730_regs->CamAddress); |
321 | OUTL((NetworkAddress[0] << 24) | (NetworkAddress[1] << 16) | 330 | outl((NetworkAddress[0] << 24) | (NetworkAddress[1] << 16) |
322 | | (NetworkAddress[2] << 8) | NetworkAddress[3], | 331 | | (NetworkAddress[2] << 8) | NetworkAddress[3], |
323 | &lp->lan_saa9730_regs->CamData); | 332 | &lp->lan_saa9730_regs->CamData); |
324 | NetworkAddress += 4; | 333 | NetworkAddress += 4; |
@@ -328,8 +337,7 @@ static int lan_saa9730_cam_load(struct lan_saa9730_private *lp) | |||
328 | 337 | ||
329 | static int lan_saa9730_cam_init(struct net_device *dev) | 338 | static int lan_saa9730_cam_init(struct net_device *dev) |
330 | { | 339 | { |
331 | struct lan_saa9730_private *lp = | 340 | struct lan_saa9730_private *lp = netdev_priv(dev); |
332 | (struct lan_saa9730_private *) dev->priv; | ||
333 | unsigned int i; | 341 | unsigned int i; |
334 | 342 | ||
335 | /* Copy MAC-address into all entries. */ | 343 | /* Copy MAC-address into all entries. */ |
@@ -347,7 +355,7 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
347 | 355 | ||
348 | /* Check link status, spin here till station is not busy. */ | 356 | /* Check link status, spin here till station is not busy. */ |
349 | i = 0; | 357 | i = 0; |
350 | while (INL(&lp->lan_saa9730_regs->StationMgmtCtl) & MD_CA_BUSY) { | 358 | while (readl(&lp->lan_saa9730_regs->StationMgmtCtl) & MD_CA_BUSY) { |
351 | i++; | 359 | i++; |
352 | if (i > 100) { | 360 | if (i > 100) { |
353 | printk("Error: lan_saa9730_mii_init: timeout\n"); | 361 | printk("Error: lan_saa9730_mii_init: timeout\n"); |
@@ -357,12 +365,12 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
357 | } | 365 | } |
358 | 366 | ||
359 | /* Now set the control and address register. */ | 367 | /* Now set the control and address register. */ |
360 | OUTL(MD_CA_BUSY | PHY_STATUS | PHY_ADDRESS << MD_CA_PHY_SHF, | 368 | outl(MD_CA_BUSY | PHY_STATUS | PHY_ADDRESS << MD_CA_PHY_SHF, |
361 | &lp->lan_saa9730_regs->StationMgmtCtl); | 369 | &lp->lan_saa9730_regs->StationMgmtCtl); |
362 | 370 | ||
363 | /* check link status, spin here till station is not busy */ | 371 | /* check link status, spin here till station is not busy */ |
364 | i = 0; | 372 | i = 0; |
365 | while (INL(&lp->lan_saa9730_regs->StationMgmtCtl) & MD_CA_BUSY) { | 373 | while (readl(&lp->lan_saa9730_regs->StationMgmtCtl) & MD_CA_BUSY) { |
366 | i++; | 374 | i++; |
367 | if (i > 100) { | 375 | if (i > 100) { |
368 | printk("Error: lan_saa9730_mii_init: timeout\n"); | 376 | printk("Error: lan_saa9730_mii_init: timeout\n"); |
@@ -375,7 +383,7 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
375 | mdelay(1); | 383 | mdelay(1); |
376 | 384 | ||
377 | /* Check the link status. */ | 385 | /* Check the link status. */ |
378 | if (INL(&lp->lan_saa9730_regs->StationMgmtData) & | 386 | if (readl(&lp->lan_saa9730_regs->StationMgmtData) & |
379 | PHY_STATUS_LINK_UP) { | 387 | PHY_STATUS_LINK_UP) { |
380 | /* Link is up. */ | 388 | /* Link is up. */ |
381 | return 0; | 389 | return 0; |
@@ -383,14 +391,14 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
383 | /* Link is down, reset the PHY first. */ | 391 | /* Link is down, reset the PHY first. */ |
384 | 392 | ||
385 | /* set PHY address = 'CONTROL' */ | 393 | /* set PHY address = 'CONTROL' */ |
386 | OUTL(PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | PHY_CONTROL, | 394 | outl(PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | PHY_CONTROL, |
387 | &lp->lan_saa9730_regs->StationMgmtCtl); | 395 | &lp->lan_saa9730_regs->StationMgmtCtl); |
388 | 396 | ||
389 | /* Wait for 1 ms. */ | 397 | /* Wait for 1 ms. */ |
390 | mdelay(1); | 398 | mdelay(1); |
391 | 399 | ||
392 | /* set 'CONTROL' = force reset and renegotiate */ | 400 | /* set 'CONTROL' = force reset and renegotiate */ |
393 | OUTL(PHY_CONTROL_RESET | PHY_CONTROL_AUTO_NEG | | 401 | outl(PHY_CONTROL_RESET | PHY_CONTROL_AUTO_NEG | |
394 | PHY_CONTROL_RESTART_AUTO_NEG, | 402 | PHY_CONTROL_RESTART_AUTO_NEG, |
395 | &lp->lan_saa9730_regs->StationMgmtData); | 403 | &lp->lan_saa9730_regs->StationMgmtData); |
396 | 404 | ||
@@ -398,12 +406,12 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
398 | mdelay(50); | 406 | mdelay(50); |
399 | 407 | ||
400 | /* set 'BUSY' to start operation */ | 408 | /* set 'BUSY' to start operation */ |
401 | OUTL(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | | 409 | outl(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | |
402 | PHY_CONTROL, &lp->lan_saa9730_regs->StationMgmtCtl); | 410 | PHY_CONTROL, &lp->lan_saa9730_regs->StationMgmtCtl); |
403 | 411 | ||
404 | /* await completion */ | 412 | /* await completion */ |
405 | i = 0; | 413 | i = 0; |
406 | while (INL(&lp->lan_saa9730_regs->StationMgmtCtl) & | 414 | while (readl(&lp->lan_saa9730_regs->StationMgmtCtl) & |
407 | MD_CA_BUSY) { | 415 | MD_CA_BUSY) { |
408 | i++; | 416 | i++; |
409 | if (i > 100) { | 417 | if (i > 100) { |
@@ -419,13 +427,13 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
419 | 427 | ||
420 | for (l = 0; l < 2; l++) { | 428 | for (l = 0; l < 2; l++) { |
421 | /* set PHY address = 'STATUS' */ | 429 | /* set PHY address = 'STATUS' */ |
422 | OUTL(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | | 430 | outl(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | |
423 | PHY_STATUS, | 431 | PHY_STATUS, |
424 | &lp->lan_saa9730_regs->StationMgmtCtl); | 432 | &lp->lan_saa9730_regs->StationMgmtCtl); |
425 | 433 | ||
426 | /* await completion */ | 434 | /* await completion */ |
427 | i = 0; | 435 | i = 0; |
428 | while (INL(&lp->lan_saa9730_regs->StationMgmtCtl) & | 436 | while (readl(&lp->lan_saa9730_regs->StationMgmtCtl) & |
429 | MD_CA_BUSY) { | 437 | MD_CA_BUSY) { |
430 | i++; | 438 | i++; |
431 | if (i > 100) { | 439 | if (i > 100) { |
@@ -440,7 +448,7 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
440 | mdelay(3000); | 448 | mdelay(3000); |
441 | 449 | ||
442 | /* check the link status */ | 450 | /* check the link status */ |
443 | if (INL(&lp->lan_saa9730_regs->StationMgmtData) & | 451 | if (readl(&lp->lan_saa9730_regs->StationMgmtData) & |
444 | PHY_STATUS_LINK_UP) { | 452 | PHY_STATUS_LINK_UP) { |
445 | /* link is up */ | 453 | /* link is up */ |
446 | break; | 454 | break; |
@@ -454,7 +462,7 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
454 | static int lan_saa9730_control_init(struct lan_saa9730_private *lp) | 462 | static int lan_saa9730_control_init(struct lan_saa9730_private *lp) |
455 | { | 463 | { |
456 | /* Initialize DMA control register. */ | 464 | /* Initialize DMA control register. */ |
457 | OUTL((LANMB_ANY << DMA_CTL_MAX_XFER_SHF) | | 465 | outl((LANMB_ANY << DMA_CTL_MAX_XFER_SHF) | |
458 | (LANEND_LITTLE << DMA_CTL_ENDIAN_SHF) | | 466 | (LANEND_LITTLE << DMA_CTL_ENDIAN_SHF) | |
459 | (LAN_SAA9730_RCV_Q_INT_THRESHOLD << DMA_CTL_RX_INT_COUNT_SHF) | 467 | (LAN_SAA9730_RCV_Q_INT_THRESHOLD << DMA_CTL_RX_INT_COUNT_SHF) |
460 | | DMA_CTL_RX_INT_TO_EN | DMA_CTL_RX_INT_EN | | 468 | | DMA_CTL_RX_INT_TO_EN | DMA_CTL_RX_INT_EN | |
@@ -462,27 +470,27 @@ static int lan_saa9730_control_init(struct lan_saa9730_private *lp) | |||
462 | &lp->lan_saa9730_regs->LanDmaCtl); | 470 | &lp->lan_saa9730_regs->LanDmaCtl); |
463 | 471 | ||
464 | /* Initial MAC control register. */ | 472 | /* Initial MAC control register. */ |
465 | OUTL((MACCM_MII << MAC_CONTROL_CONN_SHF) | MAC_CONTROL_FULL_DUP, | 473 | outl((MACCM_MII << MAC_CONTROL_CONN_SHF) | MAC_CONTROL_FULL_DUP, |
466 | &lp->lan_saa9730_regs->MacCtl); | 474 | &lp->lan_saa9730_regs->MacCtl); |
467 | 475 | ||
468 | /* Initialize CAM control register. */ | 476 | /* Initialize CAM control register. */ |
469 | OUTL(CAM_CONTROL_COMP_EN | CAM_CONTROL_BROAD_ACC, | 477 | outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_BROAD_ACC, |
470 | &lp->lan_saa9730_regs->CamCtl); | 478 | &lp->lan_saa9730_regs->CamCtl); |
471 | 479 | ||
472 | /* | 480 | /* |
473 | * Initialize CAM enable register, only turn on first entry, should | 481 | * Initialize CAM enable register, only turn on first entry, should |
474 | * contain own addr. | 482 | * contain own addr. |
475 | */ | 483 | */ |
476 | OUTL(0x0001, &lp->lan_saa9730_regs->CamEnable); | 484 | outl(0x0001, &lp->lan_saa9730_regs->CamEnable); |
477 | 485 | ||
478 | /* Initialize Tx control register */ | 486 | /* Initialize Tx control register */ |
479 | OUTL(TX_CTL_EN_COMP, &lp->lan_saa9730_regs->TxCtl); | 487 | outl(TX_CTL_EN_COMP, &lp->lan_saa9730_regs->TxCtl); |
480 | 488 | ||
481 | /* Initialize Rcv control register */ | 489 | /* Initialize Rcv control register */ |
482 | OUTL(RX_CTL_STRIP_CRC, &lp->lan_saa9730_regs->RxCtl); | 490 | outl(RX_CTL_STRIP_CRC, &lp->lan_saa9730_regs->RxCtl); |
483 | 491 | ||
484 | /* Reset DMA engine */ | 492 | /* Reset DMA engine */ |
485 | OUTL(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); | 493 | outl(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); |
486 | 494 | ||
487 | return 0; | 495 | return 0; |
488 | } | 496 | } |
@@ -492,21 +500,21 @@ static int lan_saa9730_stop(struct lan_saa9730_private *lp) | |||
492 | int i; | 500 | int i; |
493 | 501 | ||
494 | /* Stop DMA first */ | 502 | /* Stop DMA first */ |
495 | OUTL(INL(&lp->lan_saa9730_regs->LanDmaCtl) & | 503 | outl(readl(&lp->lan_saa9730_regs->LanDmaCtl) & |
496 | ~(DMA_CTL_EN_TX_DMA | DMA_CTL_EN_RX_DMA), | 504 | ~(DMA_CTL_EN_TX_DMA | DMA_CTL_EN_RX_DMA), |
497 | &lp->lan_saa9730_regs->LanDmaCtl); | 505 | &lp->lan_saa9730_regs->LanDmaCtl); |
498 | 506 | ||
499 | /* Set the SW Reset bits in DMA and MAC control registers */ | 507 | /* Set the SW Reset bits in DMA and MAC control registers */ |
500 | OUTL(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); | 508 | outl(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); |
501 | OUTL(INL(&lp->lan_saa9730_regs->MacCtl) | MAC_CONTROL_RESET, | 509 | outl(readl(&lp->lan_saa9730_regs->MacCtl) | MAC_CONTROL_RESET, |
502 | &lp->lan_saa9730_regs->MacCtl); | 510 | &lp->lan_saa9730_regs->MacCtl); |
503 | 511 | ||
504 | /* | 512 | /* |
505 | * Wait for MAC reset to have finished. The reset bit is auto cleared | 513 | * Wait for MAC reset to have finished. The reset bit is auto cleared |
506 | * when the reset is done. | 514 | * when the reset is done. |
507 | */ | 515 | */ |
508 | i = 0; | 516 | i = 0; |
509 | while (INL(&lp->lan_saa9730_regs->MacCtl) & MAC_CONTROL_RESET) { | 517 | while (readl(&lp->lan_saa9730_regs->MacCtl) & MAC_CONTROL_RESET) { |
510 | i++; | 518 | i++; |
511 | if (i > 100) { | 519 | if (i > 100) { |
512 | printk | 520 | printk |
@@ -524,7 +532,7 @@ static int lan_saa9730_dma_init(struct lan_saa9730_private *lp) | |||
524 | /* Stop lan controller. */ | 532 | /* Stop lan controller. */ |
525 | lan_saa9730_stop(lp); | 533 | lan_saa9730_stop(lp); |
526 | 534 | ||
527 | OUTL(LAN_SAA9730_DEFAULT_TIME_OUT_CNT, | 535 | outl(LAN_SAA9730_DEFAULT_TIME_OUT_CNT, |
528 | &lp->lan_saa9730_regs->Timeout); | 536 | &lp->lan_saa9730_regs->Timeout); |
529 | 537 | ||
530 | return 0; | 538 | return 0; |
@@ -536,28 +544,27 @@ static int lan_saa9730_start(struct lan_saa9730_private *lp) | |||
536 | 544 | ||
537 | /* Initialize Rx Buffer Index */ | 545 | /* Initialize Rx Buffer Index */ |
538 | lp->NextRcvPacketIndex = 0; | 546 | lp->NextRcvPacketIndex = 0; |
539 | lp->NextRcvToUseIsA = 1; | 547 | lp->NextRcvBufferIndex = 0; |
540 | 548 | ||
541 | /* Set current buffer index & next availble packet index */ | 549 | /* Set current buffer index & next available packet index */ |
542 | lp->NextTxmPacketIndex = 0; | 550 | lp->NextTxmPacketIndex = 0; |
543 | lp->NextTxmBufferIndex = 0; | 551 | lp->NextTxmBufferIndex = 0; |
544 | lp->PendingTxmPacketIndex = 0; | 552 | lp->PendingTxmPacketIndex = 0; |
545 | lp->PendingTxmBufferIndex = 0; | 553 | lp->PendingTxmBufferIndex = 0; |
546 | 554 | ||
547 | OUTL(INL(&lp->lan_saa9730_regs->LanDmaCtl) | DMA_CTL_EN_TX_DMA | | 555 | outl(readl(&lp->lan_saa9730_regs->LanDmaCtl) | DMA_CTL_EN_TX_DMA | |
548 | DMA_CTL_EN_RX_DMA, &lp->lan_saa9730_regs->LanDmaCtl); | 556 | DMA_CTL_EN_RX_DMA, &lp->lan_saa9730_regs->LanDmaCtl); |
549 | 557 | ||
550 | /* For Tx, turn on MAC then DMA */ | 558 | /* For Tx, turn on MAC then DMA */ |
551 | OUTL(INL(&lp->lan_saa9730_regs->TxCtl) | TX_CTL_TX_EN, | 559 | outl(readl(&lp->lan_saa9730_regs->TxCtl) | TX_CTL_TX_EN, |
552 | &lp->lan_saa9730_regs->TxCtl); | 560 | &lp->lan_saa9730_regs->TxCtl); |
553 | 561 | ||
554 | /* For Rx, turn on DMA then MAC */ | 562 | /* For Rx, turn on DMA then MAC */ |
555 | OUTL(INL(&lp->lan_saa9730_regs->RxCtl) | RX_CTL_RX_EN, | 563 | outl(readl(&lp->lan_saa9730_regs->RxCtl) | RX_CTL_RX_EN, |
556 | &lp->lan_saa9730_regs->RxCtl); | 564 | &lp->lan_saa9730_regs->RxCtl); |
557 | 565 | ||
558 | /* Set Ok2Use to let hardware owns the buffers */ | 566 | /* Set Ok2Use to let hardware own the buffers. */ |
559 | OUTL(OK2USE_RX_A | OK2USE_RX_B | OK2USE_TX_A | OK2USE_TX_B, | 567 | outl(OK2USE_RX_A | OK2USE_RX_B, &lp->lan_saa9730_regs->Ok2Use); |
560 | &lp->lan_saa9730_regs->Ok2Use); | ||
561 | 568 | ||
562 | return 0; | 569 | return 0; |
563 | } | 570 | } |
@@ -572,8 +579,7 @@ static int lan_saa9730_restart(struct lan_saa9730_private *lp) | |||
572 | 579 | ||
573 | static int lan_saa9730_tx(struct net_device *dev) | 580 | static int lan_saa9730_tx(struct net_device *dev) |
574 | { | 581 | { |
575 | struct lan_saa9730_private *lp = | 582 | struct lan_saa9730_private *lp = netdev_priv(dev); |
576 | (struct lan_saa9730_private *) dev->priv; | ||
577 | unsigned int *pPacket; | 583 | unsigned int *pPacket; |
578 | unsigned int tx_status; | 584 | unsigned int tx_status; |
579 | 585 | ||
@@ -581,13 +587,11 @@ static int lan_saa9730_tx(struct net_device *dev) | |||
581 | printk("lan_saa9730_tx interrupt\n"); | 587 | printk("lan_saa9730_tx interrupt\n"); |
582 | 588 | ||
583 | /* Clear interrupt. */ | 589 | /* Clear interrupt. */ |
584 | OUTL(DMA_STATUS_MAC_TX_INT, &lp->lan_saa9730_regs->DmaStatus); | 590 | outl(DMA_STATUS_MAC_TX_INT, &lp->lan_saa9730_regs->DmaStatus); |
585 | 591 | ||
586 | while (1) { | 592 | while (1) { |
587 | pPacket = | 593 | pPacket = lp->TxmBuffer[lp->PendingTxmBufferIndex] |
588 | (unsigned int *) lp->TxmBuffer[lp-> | 594 | [lp->PendingTxmPacketIndex]; |
589 | PendingTxmBufferIndex] | ||
590 | [lp->PendingTxmPacketIndex]; | ||
591 | 595 | ||
592 | /* Get status of first packet transmitted. */ | 596 | /* Get status of first packet transmitted. */ |
593 | tx_status = le32_to_cpu(*pPacket); | 597 | tx_status = le32_to_cpu(*pPacket); |
@@ -605,23 +609,22 @@ static int lan_saa9730_tx(struct net_device *dev) | |||
605 | lp->stats.tx_errors++; | 609 | lp->stats.tx_errors++; |
606 | if (tx_status & | 610 | if (tx_status & |
607 | (TX_STATUS_EX_COLL << TX_STAT_CTL_STATUS_SHF)) | 611 | (TX_STATUS_EX_COLL << TX_STAT_CTL_STATUS_SHF)) |
608 | lp->stats.tx_aborted_errors++; | 612 | lp->stats.tx_aborted_errors++; |
609 | if (tx_status & | 613 | if (tx_status & |
610 | (TX_STATUS_LATE_COLL << | 614 | (TX_STATUS_LATE_COLL << TX_STAT_CTL_STATUS_SHF)) |
611 | TX_STAT_CTL_STATUS_SHF)) lp->stats. | 615 | lp->stats.tx_window_errors++; |
612 | tx_window_errors++; | ||
613 | if (tx_status & | 616 | if (tx_status & |
614 | (TX_STATUS_L_CARR << TX_STAT_CTL_STATUS_SHF)) | 617 | (TX_STATUS_L_CARR << TX_STAT_CTL_STATUS_SHF)) |
615 | lp->stats.tx_carrier_errors++; | 618 | lp->stats.tx_carrier_errors++; |
616 | if (tx_status & | 619 | if (tx_status & |
617 | (TX_STATUS_UNDER << TX_STAT_CTL_STATUS_SHF)) | 620 | (TX_STATUS_UNDER << TX_STAT_CTL_STATUS_SHF)) |
618 | lp->stats.tx_fifo_errors++; | 621 | lp->stats.tx_fifo_errors++; |
619 | if (tx_status & | 622 | if (tx_status & |
620 | (TX_STATUS_SQ_ERR << TX_STAT_CTL_STATUS_SHF)) | 623 | (TX_STATUS_SQ_ERR << TX_STAT_CTL_STATUS_SHF)) |
621 | lp->stats.tx_heartbeat_errors++; | 624 | lp->stats.tx_heartbeat_errors++; |
622 | 625 | ||
623 | lp->stats.collisions += | 626 | lp->stats.collisions += |
624 | tx_status & TX_STATUS_TX_COLL_MSK; | 627 | tx_status & TX_STATUS_TX_COLL_MSK; |
625 | } | 628 | } |
626 | 629 | ||
627 | /* Free buffer. */ | 630 | /* Free buffer. */ |
@@ -636,21 +639,15 @@ static int lan_saa9730_tx(struct net_device *dev) | |||
636 | } | 639 | } |
637 | } | 640 | } |
638 | 641 | ||
639 | /* Make sure A and B are available to hardware. */ | 642 | /* The tx buffer is no longer full. */ |
640 | OUTL(OK2USE_TX_A | OK2USE_TX_B, &lp->lan_saa9730_regs->Ok2Use); | 643 | netif_wake_queue(dev); |
641 | |||
642 | if (netif_queue_stopped(dev)) { | ||
643 | /* The tx buffer is no longer full. */ | ||
644 | netif_wake_queue(dev); | ||
645 | } | ||
646 | 644 | ||
647 | return 0; | 645 | return 0; |
648 | } | 646 | } |
649 | 647 | ||
650 | static int lan_saa9730_rx(struct net_device *dev) | 648 | static int lan_saa9730_rx(struct net_device *dev) |
651 | { | 649 | { |
652 | struct lan_saa9730_private *lp = | 650 | struct lan_saa9730_private *lp = netdev_priv(dev); |
653 | (struct lan_saa9730_private *) dev->priv; | ||
654 | int len = 0; | 651 | int len = 0; |
655 | struct sk_buff *skb = 0; | 652 | struct sk_buff *skb = 0; |
656 | unsigned int rx_status; | 653 | unsigned int rx_status; |
@@ -663,16 +660,13 @@ static int lan_saa9730_rx(struct net_device *dev) | |||
663 | printk("lan_saa9730_rx interrupt\n"); | 660 | printk("lan_saa9730_rx interrupt\n"); |
664 | 661 | ||
665 | /* Clear receive interrupts. */ | 662 | /* Clear receive interrupts. */ |
666 | OUTL(DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT | | 663 | outl(DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT | |
667 | DMA_STATUS_RX_TO_INT, &lp->lan_saa9730_regs->DmaStatus); | 664 | DMA_STATUS_RX_TO_INT, &lp->lan_saa9730_regs->DmaStatus); |
668 | 665 | ||
669 | /* Address next packet */ | 666 | /* Address next packet */ |
670 | if (lp->NextRcvToUseIsA) | 667 | BufferIndex = lp->NextRcvBufferIndex; |
671 | BufferIndex = 0; | ||
672 | else | ||
673 | BufferIndex = 1; | ||
674 | PacketIndex = lp->NextRcvPacketIndex; | 668 | PacketIndex = lp->NextRcvPacketIndex; |
675 | pPacket = (unsigned int *) lp->RcvBuffer[BufferIndex][PacketIndex]; | 669 | pPacket = lp->RcvBuffer[BufferIndex][PacketIndex]; |
676 | rx_status = le32_to_cpu(*pPacket); | 670 | rx_status = le32_to_cpu(*pPacket); |
677 | 671 | ||
678 | /* Process each packet. */ | 672 | /* Process each packet. */ |
@@ -715,51 +709,39 @@ static int lan_saa9730_rx(struct net_device *dev) | |||
715 | lp->stats.rx_errors++; | 709 | lp->stats.rx_errors++; |
716 | if (rx_status & | 710 | if (rx_status & |
717 | (RX_STATUS_CRC_ERR << RX_STAT_CTL_STATUS_SHF)) | 711 | (RX_STATUS_CRC_ERR << RX_STAT_CTL_STATUS_SHF)) |
718 | lp->stats.rx_crc_errors++; | 712 | lp->stats.rx_crc_errors++; |
719 | if (rx_status & | 713 | if (rx_status & |
720 | (RX_STATUS_ALIGN_ERR << | 714 | (RX_STATUS_ALIGN_ERR << RX_STAT_CTL_STATUS_SHF)) |
721 | RX_STAT_CTL_STATUS_SHF)) lp->stats. | 715 | lp->stats.rx_frame_errors++; |
722 | rx_frame_errors++; | ||
723 | if (rx_status & | 716 | if (rx_status & |
724 | (RX_STATUS_OVERFLOW << RX_STAT_CTL_STATUS_SHF)) | 717 | (RX_STATUS_OVERFLOW << RX_STAT_CTL_STATUS_SHF)) |
725 | lp->stats.rx_fifo_errors++; | 718 | lp->stats.rx_fifo_errors++; |
726 | if (rx_status & | 719 | if (rx_status & |
727 | (RX_STATUS_LONG_ERR << RX_STAT_CTL_STATUS_SHF)) | 720 | (RX_STATUS_LONG_ERR << RX_STAT_CTL_STATUS_SHF)) |
728 | lp->stats.rx_length_errors++; | 721 | lp->stats.rx_length_errors++; |
729 | } | 722 | } |
730 | 723 | ||
731 | /* Indicate we have processed the buffer. */ | 724 | /* Indicate we have processed the buffer. */ |
732 | *pPacket = | 725 | *pPacket = cpu_to_le32(RXSF_READY << RX_STAT_CTL_OWNER_SHF); |
733 | cpu_to_le32(RXSF_READY << RX_STAT_CTL_OWNER_SHF); | 726 | |
727 | /* Make sure A or B is available to hardware as appropriate. */ | ||
728 | outl(BufferIndex ? OK2USE_RX_B : OK2USE_RX_A, | ||
729 | &lp->lan_saa9730_regs->Ok2Use); | ||
734 | 730 | ||
735 | /* Go to next packet in sequence. */ | 731 | /* Go to next packet in sequence. */ |
736 | lp->NextRcvPacketIndex++; | 732 | lp->NextRcvPacketIndex++; |
737 | if (lp->NextRcvPacketIndex >= LAN_SAA9730_RCV_Q_SIZE) { | 733 | if (lp->NextRcvPacketIndex >= LAN_SAA9730_RCV_Q_SIZE) { |
738 | lp->NextRcvPacketIndex = 0; | 734 | lp->NextRcvPacketIndex = 0; |
739 | if (BufferIndex) { | 735 | lp->NextRcvBufferIndex ^= 1; |
740 | lp->NextRcvToUseIsA = 1; | ||
741 | } else { | ||
742 | lp->NextRcvToUseIsA = 0; | ||
743 | } | ||
744 | } | 736 | } |
745 | OUTL(OK2USE_RX_A | OK2USE_RX_B, | ||
746 | &lp->lan_saa9730_regs->Ok2Use); | ||
747 | 737 | ||
748 | /* Address next packet */ | 738 | /* Address next packet */ |
749 | if (lp->NextRcvToUseIsA) | 739 | BufferIndex = lp->NextRcvBufferIndex; |
750 | BufferIndex = 0; | ||
751 | else | ||
752 | BufferIndex = 1; | ||
753 | PacketIndex = lp->NextRcvPacketIndex; | 740 | PacketIndex = lp->NextRcvPacketIndex; |
754 | pPacket = | 741 | pPacket = lp->RcvBuffer[BufferIndex][PacketIndex]; |
755 | (unsigned int *) lp-> | ||
756 | RcvBuffer[BufferIndex][PacketIndex]; | ||
757 | rx_status = le32_to_cpu(*pPacket); | 742 | rx_status = le32_to_cpu(*pPacket); |
758 | } | 743 | } |
759 | 744 | ||
760 | /* Make sure A and B are available to hardware. */ | ||
761 | OUTL(OK2USE_RX_A | OK2USE_RX_B, &lp->lan_saa9730_regs->Ok2Use); | ||
762 | |||
763 | return 0; | 745 | return 0; |
764 | } | 746 | } |
765 | 747 | ||
@@ -767,8 +749,7 @@ static irqreturn_t lan_saa9730_interrupt(const int irq, void *dev_id, | |||
767 | struct pt_regs *regs) | 749 | struct pt_regs *regs) |
768 | { | 750 | { |
769 | struct net_device *dev = (struct net_device *) dev_id; | 751 | struct net_device *dev = (struct net_device *) dev_id; |
770 | struct lan_saa9730_private *lp = | 752 | struct lan_saa9730_private *lp = netdev_priv(dev); |
771 | (struct lan_saa9730_private *) dev->priv; | ||
772 | 753 | ||
773 | if (lan_saa9730_debug > 5) | 754 | if (lan_saa9730_debug > 5) |
774 | printk("lan_saa9730_interrupt\n"); | 755 | printk("lan_saa9730_interrupt\n"); |
@@ -780,11 +761,11 @@ static irqreturn_t lan_saa9730_interrupt(const int irq, void *dev_id, | |||
780 | evm_saa9730_clear_lan_int(lp); | 761 | evm_saa9730_clear_lan_int(lp); |
781 | 762 | ||
782 | /* Service pending transmit interrupts. */ | 763 | /* Service pending transmit interrupts. */ |
783 | if (INL(&lp->lan_saa9730_regs->DmaStatus) & DMA_STATUS_MAC_TX_INT) | 764 | if (readl(&lp->lan_saa9730_regs->DmaStatus) & DMA_STATUS_MAC_TX_INT) |
784 | lan_saa9730_tx(dev); | 765 | lan_saa9730_tx(dev); |
785 | 766 | ||
786 | /* Service pending receive interrupts. */ | 767 | /* Service pending receive interrupts. */ |
787 | if (INL(&lp->lan_saa9730_regs->DmaStatus) & | 768 | if (readl(&lp->lan_saa9730_regs->DmaStatus) & |
788 | (DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT | | 769 | (DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT | |
789 | DMA_STATUS_RX_TO_INT)) lan_saa9730_rx(dev); | 770 | DMA_STATUS_RX_TO_INT)) lan_saa9730_rx(dev); |
790 | 771 | ||
@@ -794,15 +775,9 @@ static irqreturn_t lan_saa9730_interrupt(const int irq, void *dev_id, | |||
794 | return IRQ_HANDLED; | 775 | return IRQ_HANDLED; |
795 | } | 776 | } |
796 | 777 | ||
797 | static int lan_saa9730_open_fail(struct net_device *dev) | ||
798 | { | ||
799 | return -ENODEV; | ||
800 | } | ||
801 | |||
802 | static int lan_saa9730_open(struct net_device *dev) | 778 | static int lan_saa9730_open(struct net_device *dev) |
803 | { | 779 | { |
804 | struct lan_saa9730_private *lp = | 780 | struct lan_saa9730_private *lp = netdev_priv(dev); |
805 | (struct lan_saa9730_private *) dev->priv; | ||
806 | 781 | ||
807 | /* Associate IRQ with lan_saa9730_interrupt */ | 782 | /* Associate IRQ with lan_saa9730_interrupt */ |
808 | if (request_irq(dev->irq, &lan_saa9730_interrupt, 0, "SAA9730 Eth", | 783 | if (request_irq(dev->irq, &lan_saa9730_interrupt, 0, "SAA9730 Eth", |
@@ -834,15 +809,13 @@ static int lan_saa9730_write(struct lan_saa9730_private *lp, | |||
834 | int PacketIndex; | 809 | int PacketIndex; |
835 | 810 | ||
836 | if (lan_saa9730_debug > 5) | 811 | if (lan_saa9730_debug > 5) |
837 | printk("lan_saa9730_write: skb=%08x\n", | 812 | printk("lan_saa9730_write: skb=%p\n", skb); |
838 | (unsigned int) skb); | ||
839 | 813 | ||
840 | BufferIndex = lp->NextTxmBufferIndex; | 814 | BufferIndex = lp->NextTxmBufferIndex; |
841 | PacketIndex = lp->NextTxmPacketIndex; | 815 | PacketIndex = lp->NextTxmPacketIndex; |
842 | 816 | ||
843 | tx_status = | 817 | tx_status = le32_to_cpu(*(unsigned int *)lp->TxmBuffer[BufferIndex] |
844 | le32_to_cpu(*(unsigned int *) lp-> | 818 | [PacketIndex]); |
845 | TxmBuffer[BufferIndex][PacketIndex]); | ||
846 | if ((tx_status & TX_STAT_CTL_OWNER_MSK) != | 819 | if ((tx_status & TX_STAT_CTL_OWNER_MSK) != |
847 | (TXSF_EMPTY << TX_STAT_CTL_OWNER_SHF)) { | 820 | (TXSF_EMPTY << TX_STAT_CTL_OWNER_SHF)) { |
848 | if (lan_saa9730_debug > 4) | 821 | if (lan_saa9730_debug > 4) |
@@ -858,29 +831,29 @@ static int lan_saa9730_write(struct lan_saa9730_private *lp, | |||
858 | lp->NextTxmBufferIndex ^= 1; | 831 | lp->NextTxmBufferIndex ^= 1; |
859 | } | 832 | } |
860 | 833 | ||
861 | pbPacketData = | 834 | pbPacketData = lp->TxmBuffer[BufferIndex][PacketIndex]; |
862 | (unsigned char *) lp->TxmBuffer[BufferIndex][PacketIndex]; | ||
863 | pbPacketData += 4; | 835 | pbPacketData += 4; |
864 | 836 | ||
865 | /* copy the bits */ | 837 | /* copy the bits */ |
866 | memcpy(pbPacketData, pbData, len); | 838 | memcpy(pbPacketData, pbData, len); |
867 | 839 | ||
868 | /* Set transmit status for hardware */ | 840 | /* Set transmit status for hardware */ |
869 | *(unsigned int *) lp->TxmBuffer[BufferIndex][PacketIndex] = | 841 | *(unsigned int *)lp->TxmBuffer[BufferIndex][PacketIndex] = |
870 | cpu_to_le32((TXSF_READY << TX_STAT_CTL_OWNER_SHF) | | 842 | cpu_to_le32((TXSF_READY << TX_STAT_CTL_OWNER_SHF) | |
871 | (TX_STAT_CTL_INT_AFTER_TX << TX_STAT_CTL_FRAME_SHF) | 843 | (TX_STAT_CTL_INT_AFTER_TX << |
872 | | (len << TX_STAT_CTL_LENGTH_SHF)); | 844 | TX_STAT_CTL_FRAME_SHF) | |
873 | 845 | (len << TX_STAT_CTL_LENGTH_SHF)); | |
874 | /* Set hardware tx buffer. */ | 846 | |
875 | OUTL(OK2USE_TX_A | OK2USE_TX_B, &lp->lan_saa9730_regs->Ok2Use); | 847 | /* Make sure A or B is available to hardware as appropriate. */ |
848 | outl(BufferIndex ? OK2USE_TX_B : OK2USE_TX_A, | ||
849 | &lp->lan_saa9730_regs->Ok2Use); | ||
876 | 850 | ||
877 | return 0; | 851 | return 0; |
878 | } | 852 | } |
879 | 853 | ||
880 | static void lan_saa9730_tx_timeout(struct net_device *dev) | 854 | static void lan_saa9730_tx_timeout(struct net_device *dev) |
881 | { | 855 | { |
882 | struct lan_saa9730_private *lp = | 856 | struct lan_saa9730_private *lp = netdev_priv(dev); |
883 | (struct lan_saa9730_private *) dev->priv; | ||
884 | 857 | ||
885 | /* Transmitter timeout, serious problems */ | 858 | /* Transmitter timeout, serious problems */ |
886 | lp->stats.tx_errors++; | 859 | lp->stats.tx_errors++; |
@@ -889,20 +862,19 @@ static void lan_saa9730_tx_timeout(struct net_device *dev) | |||
889 | lan_saa9730_restart(lp); | 862 | lan_saa9730_restart(lp); |
890 | 863 | ||
891 | dev->trans_start = jiffies; | 864 | dev->trans_start = jiffies; |
892 | netif_start_queue(dev); | 865 | netif_wake_queue(dev); |
893 | } | 866 | } |
894 | 867 | ||
895 | static int lan_saa9730_start_xmit(struct sk_buff *skb, | 868 | static int lan_saa9730_start_xmit(struct sk_buff *skb, |
896 | struct net_device *dev) | 869 | struct net_device *dev) |
897 | { | 870 | { |
898 | struct lan_saa9730_private *lp = | 871 | struct lan_saa9730_private *lp = netdev_priv(dev); |
899 | (struct lan_saa9730_private *) dev->priv; | ||
900 | unsigned long flags; | 872 | unsigned long flags; |
901 | int skblen; | 873 | int skblen; |
902 | int len; | 874 | int len; |
903 | 875 | ||
904 | if (lan_saa9730_debug > 4) | 876 | if (lan_saa9730_debug > 4) |
905 | printk("Send packet: skb=%08x\n", (unsigned int) skb); | 877 | printk("Send packet: skb=%p\n", skb); |
906 | 878 | ||
907 | skblen = skb->len; | 879 | skblen = skb->len; |
908 | 880 | ||
@@ -912,8 +884,7 @@ static int lan_saa9730_start_xmit(struct sk_buff *skb, | |||
912 | 884 | ||
913 | if (lan_saa9730_write(lp, skb, skblen)) { | 885 | if (lan_saa9730_write(lp, skb, skblen)) { |
914 | spin_unlock_irqrestore(&lp->lock, flags); | 886 | spin_unlock_irqrestore(&lp->lock, flags); |
915 | printk("Error when writing packet to controller: skb=%08x\n", | 887 | printk("Error when writing packet to controller: skb=%p\n", skb); |
916 | (unsigned int) skb); | ||
917 | netif_stop_queue(dev); | 888 | netif_stop_queue(dev); |
918 | return -1; | 889 | return -1; |
919 | } | 890 | } |
@@ -922,7 +893,7 @@ static int lan_saa9730_start_xmit(struct sk_buff *skb, | |||
922 | lp->stats.tx_packets++; | 893 | lp->stats.tx_packets++; |
923 | 894 | ||
924 | dev->trans_start = jiffies; | 895 | dev->trans_start = jiffies; |
925 | netif_start_queue(dev); | 896 | netif_wake_queue(dev); |
926 | dev_kfree_skb(skb); | 897 | dev_kfree_skb(skb); |
927 | 898 | ||
928 | spin_unlock_irqrestore(&lp->lock, flags); | 899 | spin_unlock_irqrestore(&lp->lock, flags); |
@@ -932,8 +903,7 @@ static int lan_saa9730_start_xmit(struct sk_buff *skb, | |||
932 | 903 | ||
933 | static int lan_saa9730_close(struct net_device *dev) | 904 | static int lan_saa9730_close(struct net_device *dev) |
934 | { | 905 | { |
935 | struct lan_saa9730_private *lp = | 906 | struct lan_saa9730_private *lp = netdev_priv(dev); |
936 | (struct lan_saa9730_private *) dev->priv; | ||
937 | 907 | ||
938 | if (lan_saa9730_debug > 1) | 908 | if (lan_saa9730_debug > 1) |
939 | printk("lan_saa9730_close:\n"); | 909 | printk("lan_saa9730_close:\n"); |
@@ -955,33 +925,31 @@ static int lan_saa9730_close(struct net_device *dev) | |||
955 | static struct net_device_stats *lan_saa9730_get_stats(struct net_device | 925 | static struct net_device_stats *lan_saa9730_get_stats(struct net_device |
956 | *dev) | 926 | *dev) |
957 | { | 927 | { |
958 | struct lan_saa9730_private *lp = | 928 | struct lan_saa9730_private *lp = netdev_priv(dev); |
959 | (struct lan_saa9730_private *) dev->priv; | ||
960 | 929 | ||
961 | return &lp->stats; | 930 | return &lp->stats; |
962 | } | 931 | } |
963 | 932 | ||
964 | static void lan_saa9730_set_multicast(struct net_device *dev) | 933 | static void lan_saa9730_set_multicast(struct net_device *dev) |
965 | { | 934 | { |
966 | struct lan_saa9730_private *lp = | 935 | struct lan_saa9730_private *lp = netdev_priv(dev); |
967 | (struct lan_saa9730_private *) dev->priv; | ||
968 | 936 | ||
969 | /* Stop the controller */ | 937 | /* Stop the controller */ |
970 | lan_saa9730_stop(lp); | 938 | lan_saa9730_stop(lp); |
971 | 939 | ||
972 | if (dev->flags & IFF_PROMISC) { | 940 | if (dev->flags & IFF_PROMISC) { |
973 | /* accept all packets */ | 941 | /* accept all packets */ |
974 | OUTL(CAM_CONTROL_COMP_EN | CAM_CONTROL_STATION_ACC | | 942 | outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_STATION_ACC | |
975 | CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC, | 943 | CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC, |
976 | &lp->lan_saa9730_regs->CamCtl); | 944 | &lp->lan_saa9730_regs->CamCtl); |
977 | } else { | 945 | } else { |
978 | if (dev->flags & IFF_ALLMULTI) { | 946 | if (dev->flags & IFF_ALLMULTI) { |
979 | /* accept all multicast packets */ | 947 | /* accept all multicast packets */ |
980 | OUTL(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC | | 948 | outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC | |
981 | CAM_CONTROL_BROAD_ACC, | 949 | CAM_CONTROL_BROAD_ACC, |
982 | &lp->lan_saa9730_regs->CamCtl); | 950 | &lp->lan_saa9730_regs->CamCtl); |
983 | } else { | 951 | } else { |
984 | /* | 952 | /* |
985 | * Will handle the multicast stuff later. -carstenl | 953 | * Will handle the multicast stuff later. -carstenl |
986 | */ | 954 | */ |
987 | } | 955 | } |
@@ -993,91 +961,86 @@ static void lan_saa9730_set_multicast(struct net_device *dev) | |||
993 | 961 | ||
994 | static void __devexit saa9730_remove_one(struct pci_dev *pdev) | 962 | static void __devexit saa9730_remove_one(struct pci_dev *pdev) |
995 | { | 963 | { |
996 | struct net_device *dev = pci_get_drvdata(pdev); | 964 | struct net_device *dev = pci_get_drvdata(pdev); |
997 | 965 | struct lan_saa9730_private *lp = netdev_priv(dev); | |
998 | if (dev) { | 966 | |
999 | unregister_netdev(dev); | 967 | if (dev) { |
1000 | kfree(dev->priv); | 968 | unregister_netdev(dev); |
1001 | free_netdev(dev); | 969 | lan_saa9730_free_buffers(pdev, lp); |
1002 | pci_release_regions(pdev); | 970 | iounmap(lp->lan_saa9730_regs); |
1003 | pci_disable_device(pdev); | 971 | iounmap(lp->evm_saa9730_regs); |
1004 | pci_set_drvdata(pdev, NULL); | 972 | free_netdev(dev); |
1005 | } | 973 | pci_release_regions(pdev); |
974 | pci_disable_device(pdev); | ||
975 | pci_set_drvdata(pdev, NULL); | ||
976 | } | ||
1006 | } | 977 | } |
1007 | 978 | ||
1008 | 979 | ||
1009 | static int lan_saa9730_init(struct net_device *dev, int ioaddr, int irq) | 980 | static int lan_saa9730_init(struct net_device *dev, struct pci_dev *pdev, |
981 | unsigned long ioaddr, int irq) | ||
1010 | { | 982 | { |
1011 | struct lan_saa9730_private *lp; | 983 | struct lan_saa9730_private *lp = netdev_priv(dev); |
1012 | unsigned char ethernet_addr[6]; | 984 | unsigned char ethernet_addr[6]; |
1013 | int ret = 0; | 985 | int ret; |
1014 | 986 | ||
1015 | dev->open = lan_saa9730_open_fail; | 987 | if (get_ethernet_addr(ethernet_addr)) { |
988 | ret = -ENODEV; | ||
989 | goto out; | ||
990 | } | ||
1016 | 991 | ||
1017 | if (get_ethernet_addr(ethernet_addr)) | ||
1018 | return -ENODEV; | ||
1019 | |||
1020 | memcpy(dev->dev_addr, ethernet_addr, 6); | 992 | memcpy(dev->dev_addr, ethernet_addr, 6); |
1021 | dev->base_addr = ioaddr; | 993 | dev->base_addr = ioaddr; |
1022 | dev->irq = irq; | 994 | dev->irq = irq; |
1023 | |||
1024 | /* | ||
1025 | * Make certain the data structures used by the controller are aligned | ||
1026 | * and DMAble. | ||
1027 | */ | ||
1028 | /* | ||
1029 | * XXX: that is obviously broken - kfree() won't be happy with us. | ||
1030 | */ | ||
1031 | lp = (struct lan_saa9730_private *) (((unsigned long) | ||
1032 | kmalloc(sizeof(*lp) + 7, | ||
1033 | GFP_DMA | GFP_KERNEL) | ||
1034 | + 7) & ~7); | ||
1035 | 995 | ||
1036 | if (!lp) | 996 | lp->pci_dev = pdev; |
1037 | return -ENOMEM; | ||
1038 | |||
1039 | dev->priv = lp; | ||
1040 | memset(lp, 0, sizeof(*lp)); | ||
1041 | 997 | ||
1042 | /* Set SAA9730 LAN base address. */ | 998 | /* Set SAA9730 LAN base address. */ |
1043 | lp->lan_saa9730_regs = (t_lan_saa9730_regmap *) (ioaddr + | 999 | lp->lan_saa9730_regs = ioremap(ioaddr + SAA9730_LAN_REGS_ADDR, |
1044 | SAA9730_LAN_REGS_ADDR); | 1000 | SAA9730_LAN_REGS_SIZE); |
1001 | if (!lp->lan_saa9730_regs) { | ||
1002 | ret = -ENOMEM; | ||
1003 | goto out; | ||
1004 | } | ||
1045 | 1005 | ||
1046 | /* Set SAA9730 EVM base address. */ | 1006 | /* Set SAA9730 EVM base address. */ |
1047 | lp->evm_saa9730_regs = (t_evm_saa9730_regmap *) (ioaddr + | 1007 | lp->evm_saa9730_regs = ioremap(ioaddr + SAA9730_EVM_REGS_ADDR, |
1048 | SAA9730_EVM_REGS_ADDR); | 1008 | SAA9730_EVM_REGS_SIZE); |
1009 | if (!lp->evm_saa9730_regs) { | ||
1010 | ret = -ENOMEM; | ||
1011 | goto out_iounmap_lan; | ||
1012 | } | ||
1049 | 1013 | ||
1050 | /* Allocate LAN RX/TX frame buffer space. */ | 1014 | /* Allocate LAN RX/TX frame buffer space. */ |
1051 | /* FIXME: a leak */ | 1015 | if ((ret = lan_saa9730_allocate_buffers(pdev, lp))) |
1052 | if ((ret = lan_saa9730_allocate_buffers(lp))) | 1016 | goto out_iounmap; |
1053 | goto out; | ||
1054 | 1017 | ||
1055 | /* Stop LAN controller. */ | 1018 | /* Stop LAN controller. */ |
1056 | if ((ret = lan_saa9730_stop(lp))) | 1019 | if ((ret = lan_saa9730_stop(lp))) |
1057 | goto out; | 1020 | goto out_free_consistent; |
1058 | 1021 | ||
1059 | /* Initialize CAM registers. */ | 1022 | /* Initialize CAM registers. */ |
1060 | if ((ret = lan_saa9730_cam_init(dev))) | 1023 | if ((ret = lan_saa9730_cam_init(dev))) |
1061 | goto out; | 1024 | goto out_free_consistent; |
1062 | 1025 | ||
1063 | /* Initialize MII registers. */ | 1026 | /* Initialize MII registers. */ |
1064 | if ((ret = lan_saa9730_mii_init(lp))) | 1027 | if ((ret = lan_saa9730_mii_init(lp))) |
1065 | goto out; | 1028 | goto out_free_consistent; |
1066 | 1029 | ||
1067 | /* Initialize control registers. */ | 1030 | /* Initialize control registers. */ |
1068 | if ((ret = lan_saa9730_control_init(lp))) | 1031 | if ((ret = lan_saa9730_control_init(lp))) |
1069 | goto out; | 1032 | goto out_free_consistent; |
1070 | 1033 | ||
1071 | /* Load CAM registers. */ | 1034 | /* Load CAM registers. */ |
1072 | if ((ret = lan_saa9730_cam_load(lp))) | 1035 | if ((ret = lan_saa9730_cam_load(lp))) |
1073 | goto out; | 1036 | goto out_free_consistent; |
1074 | 1037 | ||
1075 | /* Initialize DMA context registers. */ | 1038 | /* Initialize DMA context registers. */ |
1076 | if ((ret = lan_saa9730_dma_init(lp))) | 1039 | if ((ret = lan_saa9730_dma_init(lp))) |
1077 | goto out; | 1040 | goto out_free_consistent; |
1078 | 1041 | ||
1079 | spin_lock_init(&lp->lock); | 1042 | spin_lock_init(&lp->lock); |
1080 | 1043 | ||
1081 | dev->open = lan_saa9730_open; | 1044 | dev->open = lan_saa9730_open; |
1082 | dev->hard_start_xmit = lan_saa9730_start_xmit; | 1045 | dev->hard_start_xmit = lan_saa9730_start_xmit; |
1083 | dev->stop = lan_saa9730_close; | 1046 | dev->stop = lan_saa9730_close; |
@@ -1086,44 +1049,43 @@ static int lan_saa9730_init(struct net_device *dev, int ioaddr, int irq) | |||
1086 | dev->tx_timeout = lan_saa9730_tx_timeout; | 1049 | dev->tx_timeout = lan_saa9730_tx_timeout; |
1087 | dev->watchdog_timeo = (HZ >> 1); | 1050 | dev->watchdog_timeo = (HZ >> 1); |
1088 | dev->dma = 0; | 1051 | dev->dma = 0; |
1089 | 1052 | ||
1090 | ret = register_netdev(dev); | 1053 | ret = register_netdev (dev); |
1091 | if (ret) | 1054 | if (ret) |
1092 | goto out; | 1055 | goto out_free_consistent; |
1056 | |||
1093 | return 0; | 1057 | return 0; |
1094 | 1058 | ||
1095 | out: | 1059 | out_free_consistent: |
1096 | kfree(dev->priv); | 1060 | lan_saa9730_free_buffers(pdev, lp); |
1061 | out_iounmap: | ||
1062 | iounmap(lp->evm_saa9730_regs); | ||
1063 | out_iounmap_lan: | ||
1064 | iounmap(lp->lan_saa9730_regs); | ||
1065 | out: | ||
1097 | return ret; | 1066 | return ret; |
1098 | } | 1067 | } |
1099 | 1068 | ||
1100 | 1069 | ||
1101 | static int __devinit saa9730_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 1070 | static int __devinit saa9730_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
1102 | { | 1071 | { |
1103 | struct net_device *dev; | 1072 | struct net_device *dev = NULL; |
1104 | unsigned int pci_ioaddr; | 1073 | unsigned long pci_ioaddr; |
1105 | int err; | 1074 | int err; |
1106 | 1075 | ||
1107 | if (lan_saa9730_debug > 1) | 1076 | if (lan_saa9730_debug > 1) |
1108 | printk("saa9730.c: PCI bios is present, checking for devices...\n"); | 1077 | printk("saa9730.c: PCI bios is present, checking for devices...\n"); |
1109 | 1078 | ||
1110 | err = -ENOMEM; | ||
1111 | dev = alloc_etherdev(0); | ||
1112 | if (!dev) | ||
1113 | goto out; | ||
1114 | |||
1115 | SET_MODULE_OWNER(dev); | ||
1116 | |||
1117 | err = pci_enable_device(pdev); | 1079 | err = pci_enable_device(pdev); |
1118 | if (err) { | 1080 | if (err) { |
1119 | printk(KERN_ERR "Cannot enable PCI device, aborting.\n"); | 1081 | printk(KERN_ERR "Cannot enable PCI device, aborting.\n"); |
1120 | goto out1; | 1082 | goto out; |
1121 | } | 1083 | } |
1122 | 1084 | ||
1123 | err = pci_request_regions(pdev, DRV_MODULE_NAME); | 1085 | err = pci_request_regions(pdev, DRV_MODULE_NAME); |
1124 | if (err) { | 1086 | if (err) { |
1125 | printk(KERN_ERR "Cannot obtain PCI resources, aborting.\n"); | 1087 | printk(KERN_ERR "Cannot obtain PCI resources, aborting.\n"); |
1126 | goto out2; | 1088 | goto out_disable_pdev; |
1127 | } | 1089 | } |
1128 | 1090 | ||
1129 | pci_irq_line = pdev->irq; | 1091 | pci_irq_line = pdev->irq; |
@@ -1132,49 +1094,54 @@ static int __devinit saa9730_init_one(struct pci_dev *pdev, const struct pci_dev | |||
1132 | pci_ioaddr = pci_resource_start(pdev, 1); | 1094 | pci_ioaddr = pci_resource_start(pdev, 1); |
1133 | pci_set_master(pdev); | 1095 | pci_set_master(pdev); |
1134 | 1096 | ||
1135 | printk("Found SAA9730 (PCI) at %#x, irq %d.\n", | 1097 | printk("Found SAA9730 (PCI) at %lx, irq %d.\n", |
1136 | pci_ioaddr, pci_irq_line); | 1098 | pci_ioaddr, pci_irq_line); |
1137 | 1099 | ||
1138 | err = lan_saa9730_init(dev, pci_ioaddr, pci_irq_line); | 1100 | dev = alloc_etherdev(sizeof(struct lan_saa9730_private)); |
1101 | if (!dev) | ||
1102 | goto out_disable_pdev; | ||
1103 | |||
1104 | err = lan_saa9730_init(dev, pdev, pci_ioaddr, pci_irq_line); | ||
1139 | if (err) { | 1105 | if (err) { |
1140 | printk("Lan init failed"); | 1106 | printk("LAN init failed"); |
1141 | goto out2; | 1107 | goto out_free_netdev; |
1142 | } | 1108 | } |
1143 | 1109 | ||
1144 | pci_set_drvdata(pdev, dev); | 1110 | pci_set_drvdata(pdev, dev); |
1145 | SET_NETDEV_DEV(dev, &pdev->dev); | 1111 | SET_NETDEV_DEV(dev, &pdev->dev); |
1146 | return 0; | 1112 | return 0; |
1147 | 1113 | ||
1148 | out2: | 1114 | out_free_netdev: |
1149 | pci_disable_device(pdev); | ||
1150 | out1: | ||
1151 | free_netdev(dev); | 1115 | free_netdev(dev); |
1116 | out_disable_pdev: | ||
1117 | pci_disable_device(pdev); | ||
1152 | out: | 1118 | out: |
1119 | pci_set_drvdata(pdev, NULL); | ||
1153 | return err; | 1120 | return err; |
1154 | } | 1121 | } |
1155 | 1122 | ||
1156 | 1123 | ||
1157 | static struct pci_driver saa9730_driver = { | 1124 | static struct pci_driver saa9730_driver = { |
1158 | .name = DRV_MODULE_NAME, | 1125 | .name = DRV_MODULE_NAME, |
1159 | .id_table = saa9730_pci_tbl, | 1126 | .id_table = saa9730_pci_tbl, |
1160 | .probe = saa9730_init_one, | 1127 | .probe = saa9730_init_one, |
1161 | .remove = __devexit_p(saa9730_remove_one), | 1128 | .remove = __devexit_p(saa9730_remove_one), |
1162 | }; | 1129 | }; |
1163 | 1130 | ||
1164 | 1131 | ||
1165 | static int __init saa9730_init(void) | 1132 | static int __init saa9730_init(void) |
1166 | { | 1133 | { |
1167 | return pci_module_init(&saa9730_driver); | 1134 | return pci_module_init(&saa9730_driver); |
1168 | } | 1135 | } |
1169 | 1136 | ||
1170 | static void __exit saa9730_cleanup(void) | 1137 | static void __exit saa9730_cleanup(void) |
1171 | { | 1138 | { |
1172 | pci_unregister_driver(&saa9730_driver); | 1139 | pci_unregister_driver(&saa9730_driver); |
1173 | } | 1140 | } |
1174 | 1141 | ||
1175 | module_init(saa9730_init); | 1142 | module_init(saa9730_init); |
1176 | module_exit(saa9730_cleanup); | 1143 | module_exit(saa9730_cleanup); |
1177 | 1144 | ||
1178 | 1145 | MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>"); | |
1179 | 1146 | MODULE_DESCRIPTION("Philips SAA9730 ethernet driver"); | |
1180 | MODULE_LICENSE("GPL"); | 1147 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index 817f200742c3..a10cd184d597 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -289,6 +289,38 @@ static inline void SMC_outsw (unsigned long a, int r, unsigned char* p, int l) | |||
289 | #define RPC_LSA_DEFAULT RPC_LED_TX_RX | 289 | #define RPC_LSA_DEFAULT RPC_LED_TX_RX |
290 | #define RPC_LSB_DEFAULT RPC_LED_100_10 | 290 | #define RPC_LSB_DEFAULT RPC_LED_100_10 |
291 | 291 | ||
292 | #elif defined(CONFIG_SOC_AU1X00) | ||
293 | |||
294 | #include <au1xxx.h> | ||
295 | |||
296 | /* We can only do 16-bit reads and writes in the static memory space. */ | ||
297 | #define SMC_CAN_USE_8BIT 0 | ||
298 | #define SMC_CAN_USE_16BIT 1 | ||
299 | #define SMC_CAN_USE_32BIT 0 | ||
300 | #define SMC_IO_SHIFT 0 | ||
301 | #define SMC_NOWAIT 1 | ||
302 | |||
303 | #define SMC_inw(a, r) au_readw((unsigned long)((a) + (r))) | ||
304 | #define SMC_insw(a, r, p, l) \ | ||
305 | do { \ | ||
306 | unsigned long _a = (unsigned long)((a) + (r)); \ | ||
307 | int _l = (l); \ | ||
308 | u16 *_p = (u16 *)(p); \ | ||
309 | while (_l-- > 0) \ | ||
310 | *_p++ = au_readw(_a); \ | ||
311 | } while(0) | ||
312 | #define SMC_outw(v, a, r) au_writew(v, (unsigned long)((a) + (r))) | ||
313 | #define SMC_outsw(a, r, p, l) \ | ||
314 | do { \ | ||
315 | unsigned long _a = (unsigned long)((a) + (r)); \ | ||
316 | int _l = (l); \ | ||
317 | const u16 *_p = (const u16 *)(p); \ | ||
318 | while (_l-- > 0) \ | ||
319 | au_writew(*_p++ , _a); \ | ||
320 | } while(0) | ||
321 | |||
322 | #define set_irq_type(irq, type) do {} while (0) | ||
323 | |||
292 | #else | 324 | #else |
293 | 325 | ||
294 | #define SMC_CAN_USE_8BIT 1 | 326 | #define SMC_CAN_USE_8BIT 1 |
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index 7187958e40ca..00e55165b760 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -330,7 +330,7 @@ config PCI_HERMES | |||
330 | 330 | ||
331 | config ATMEL | 331 | config ATMEL |
332 | tristate "Atmel at76c50x chipset 802.11b support" | 332 | tristate "Atmel at76c50x chipset 802.11b support" |
333 | depends on NET_RADIO && EXPERIMENTAL | 333 | depends on NET_RADIO |
334 | select FW_LOADER | 334 | select FW_LOADER |
335 | select CRC32 | 335 | select CRC32 |
336 | ---help--- | 336 | ---help--- |
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index a3e23527fe7f..5e53c5258a33 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -72,7 +72,7 @@ | |||
72 | #include "atmel.h" | 72 | #include "atmel.h" |
73 | 73 | ||
74 | #define DRIVER_MAJOR 0 | 74 | #define DRIVER_MAJOR 0 |
75 | #define DRIVER_MINOR 96 | 75 | #define DRIVER_MINOR 98 |
76 | 76 | ||
77 | MODULE_AUTHOR("Simon Kelley"); | 77 | MODULE_AUTHOR("Simon Kelley"); |
78 | MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); | 78 | MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); |
@@ -1504,7 +1504,7 @@ static int atmel_read_proc(char *page, char **start, off_t off, | |||
1504 | return len; | 1504 | return len; |
1505 | } | 1505 | } |
1506 | 1506 | ||
1507 | struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWType fw_type, | 1507 | struct net_device *init_atmel_card( unsigned short irq, unsigned long port, const AtmelFWType fw_type, |
1508 | struct device *sys_dev, int (*card_present)(void *), void *card) | 1508 | struct device *sys_dev, int (*card_present)(void *), void *card) |
1509 | { | 1509 | { |
1510 | struct net_device *dev; | 1510 | struct net_device *dev; |
@@ -1605,8 +1605,8 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT | |||
1605 | goto err_out_free; | 1605 | goto err_out_free; |
1606 | } | 1606 | } |
1607 | 1607 | ||
1608 | if (priv->bus_type == BUS_TYPE_PCI && | 1608 | if (!request_region(dev->base_addr, 32, |
1609 | !request_region( dev->base_addr, 64, dev->name )) { | 1609 | priv->bus_type == BUS_TYPE_PCCARD ? "atmel_cs" : "atmel_pci")) { |
1610 | goto err_out_irq; | 1610 | goto err_out_irq; |
1611 | } | 1611 | } |
1612 | 1612 | ||
@@ -1622,15 +1622,16 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT | |||
1622 | 1622 | ||
1623 | create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv); | 1623 | create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv); |
1624 | 1624 | ||
1625 | printk(KERN_INFO "%s: Atmel at76c50x wireless. Version %d.%d simon@thekelleys.org.uk\n", | 1625 | printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", |
1626 | dev->name, DRIVER_MAJOR, DRIVER_MINOR); | 1626 | dev->name, DRIVER_MAJOR, DRIVER_MINOR, |
1627 | dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], | ||
1628 | dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] ); | ||
1627 | 1629 | ||
1628 | SET_MODULE_OWNER(dev); | 1630 | SET_MODULE_OWNER(dev); |
1629 | return dev; | 1631 | return dev; |
1630 | 1632 | ||
1631 | err_out_res: | 1633 | err_out_res: |
1632 | if (priv->bus_type == BUS_TYPE_PCI) | 1634 | release_region( dev->base_addr, 32); |
1633 | release_region( dev->base_addr, 64 ); | ||
1634 | err_out_irq: | 1635 | err_out_irq: |
1635 | free_irq(dev->irq, dev); | 1636 | free_irq(dev->irq, dev); |
1636 | err_out_free: | 1637 | err_out_free: |
@@ -1640,7 +1641,7 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT | |||
1640 | 1641 | ||
1641 | EXPORT_SYMBOL(init_atmel_card); | 1642 | EXPORT_SYMBOL(init_atmel_card); |
1642 | 1643 | ||
1643 | void stop_atmel_card(struct net_device *dev, int freeres) | 1644 | void stop_atmel_card(struct net_device *dev) |
1644 | { | 1645 | { |
1645 | struct atmel_private *priv = netdev_priv(dev); | 1646 | struct atmel_private *priv = netdev_priv(dev); |
1646 | 1647 | ||
@@ -1654,10 +1655,7 @@ void stop_atmel_card(struct net_device *dev, int freeres) | |||
1654 | remove_proc_entry("driver/atmel", NULL); | 1655 | remove_proc_entry("driver/atmel", NULL); |
1655 | free_irq(dev->irq, dev); | 1656 | free_irq(dev->irq, dev); |
1656 | kfree(priv->firmware); | 1657 | kfree(priv->firmware); |
1657 | if (freeres) { | 1658 | release_region(dev->base_addr, 32); |
1658 | /* PCMCIA frees this stuff, so only for PCI */ | ||
1659 | release_region(dev->base_addr, 64); | ||
1660 | } | ||
1661 | free_netdev(dev); | 1659 | free_netdev(dev); |
1662 | } | 1660 | } |
1663 | 1661 | ||
@@ -1810,9 +1808,9 @@ static int atmel_set_encode(struct net_device *dev, | |||
1810 | } | 1808 | } |
1811 | if(dwrq->flags & IW_ENCODE_RESTRICTED) | 1809 | if(dwrq->flags & IW_ENCODE_RESTRICTED) |
1812 | priv->exclude_unencrypted = 1; | 1810 | priv->exclude_unencrypted = 1; |
1813 | if(dwrq->flags & IW_ENCODE_OPEN) | 1811 | if(dwrq->flags & IW_ENCODE_OPEN) |
1814 | priv->exclude_unencrypted = 0; | 1812 | priv->exclude_unencrypted = 0; |
1815 | 1813 | ||
1816 | return -EINPROGRESS; /* Call commit handler */ | 1814 | return -EINPROGRESS; /* Call commit handler */ |
1817 | } | 1815 | } |
1818 | 1816 | ||
@@ -1827,11 +1825,12 @@ static int atmel_get_encode(struct net_device *dev, | |||
1827 | 1825 | ||
1828 | if (!priv->wep_is_on) | 1826 | if (!priv->wep_is_on) |
1829 | dwrq->flags = IW_ENCODE_DISABLED; | 1827 | dwrq->flags = IW_ENCODE_DISABLED; |
1830 | else if (priv->exclude_unencrypted) | 1828 | else { |
1831 | dwrq->flags = IW_ENCODE_RESTRICTED; | 1829 | if (priv->exclude_unencrypted) |
1832 | else | 1830 | dwrq->flags = IW_ENCODE_RESTRICTED; |
1833 | dwrq->flags = IW_ENCODE_OPEN; | 1831 | else |
1834 | 1832 | dwrq->flags = IW_ENCODE_OPEN; | |
1833 | } | ||
1835 | /* Which key do we want ? -1 -> tx index */ | 1834 | /* Which key do we want ? -1 -> tx index */ |
1836 | if (index < 0 || index >= 4) | 1835 | if (index < 0 || index >= 4) |
1837 | index = priv->default_key; | 1836 | index = priv->default_key; |
@@ -2645,8 +2644,8 @@ static void handle_beacon_probe(struct atmel_private *priv, u16 capability, u8 c | |||
2645 | } | 2644 | } |
2646 | } | 2645 | } |
2647 | 2646 | ||
2648 | 2647 | ||
2649 | static void send_authentication_request(struct atmel_private *priv, u8 *challenge, int challenge_len) | 2648 | static void send_authentication_request(struct atmel_private *priv, u16 system, u8 *challenge, int challenge_len) |
2650 | { | 2649 | { |
2651 | struct ieee80211_hdr_4addr header; | 2650 | struct ieee80211_hdr_4addr header; |
2652 | struct auth_body auth; | 2651 | struct auth_body auth; |
@@ -2658,14 +2657,11 @@ static void send_authentication_request(struct atmel_private *priv, u8 *challeng | |||
2658 | memcpy(header.addr2, priv->dev->dev_addr, 6); | 2657 | memcpy(header.addr2, priv->dev->dev_addr, 6); |
2659 | memcpy(header.addr3, priv->CurrentBSSID, 6); | 2658 | memcpy(header.addr3, priv->CurrentBSSID, 6); |
2660 | 2659 | ||
2661 | if (priv->wep_is_on) { | 2660 | if (priv->wep_is_on && priv->CurrentAuthentTransactionSeqNum != 1) |
2662 | auth.alg = cpu_to_le16(C80211_MGMT_AAN_SHAREDKEY); | ||
2663 | /* no WEP for authentication frames with TrSeqNo 1 */ | 2661 | /* no WEP for authentication frames with TrSeqNo 1 */ |
2664 | if (priv->CurrentAuthentTransactionSeqNum != 1) | 2662 | header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); |
2665 | header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); | 2663 | |
2666 | } else { | 2664 | auth.alg = cpu_to_le16(system); |
2667 | auth.alg = cpu_to_le16(C80211_MGMT_AAN_OPENSYSTEM); | ||
2668 | } | ||
2669 | 2665 | ||
2670 | auth.status = 0; | 2666 | auth.status = 0; |
2671 | auth.trans_seq = cpu_to_le16(priv->CurrentAuthentTransactionSeqNum); | 2667 | auth.trans_seq = cpu_to_le16(priv->CurrentAuthentTransactionSeqNum); |
@@ -2834,6 +2830,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
2834 | struct auth_body *auth = (struct auth_body *)priv->rx_buf; | 2830 | struct auth_body *auth = (struct auth_body *)priv->rx_buf; |
2835 | u16 status = le16_to_cpu(auth->status); | 2831 | u16 status = le16_to_cpu(auth->status); |
2836 | u16 trans_seq_no = le16_to_cpu(auth->trans_seq); | 2832 | u16 trans_seq_no = le16_to_cpu(auth->trans_seq); |
2833 | u16 system = le16_to_cpu(auth->alg); | ||
2837 | 2834 | ||
2838 | if (status == C80211_MGMT_SC_Success && !priv->wep_is_on) { | 2835 | if (status == C80211_MGMT_SC_Success && !priv->wep_is_on) { |
2839 | /* no WEP */ | 2836 | /* no WEP */ |
@@ -2855,7 +2852,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
2855 | 2852 | ||
2856 | if (trans_seq_no == 0x0002 && | 2853 | if (trans_seq_no == 0x0002 && |
2857 | auth->el_id == C80211_MGMT_ElementID_ChallengeText) { | 2854 | auth->el_id == C80211_MGMT_ElementID_ChallengeText) { |
2858 | send_authentication_request(priv, auth->chall_text, auth->chall_text_len); | 2855 | send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); |
2859 | return; | 2856 | return; |
2860 | } | 2857 | } |
2861 | 2858 | ||
@@ -2872,14 +2869,20 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
2872 | } | 2869 | } |
2873 | } | 2870 | } |
2874 | 2871 | ||
2875 | if (status == C80211_MGMT_SC_AuthAlgNotSupported && priv->connect_to_any_BSS) { | 2872 | if (status == C80211_MGMT_SC_AuthAlgNotSupported) { |
2876 | int bss_index; | 2873 | /* Do opensystem first, then try sharedkey */ |
2877 | 2874 | if (system == C80211_MGMT_AAN_OPENSYSTEM) { | |
2878 | priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80; | 2875 | priv->CurrentAuthentTransactionSeqNum = 0x001; |
2879 | 2876 | send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); | |
2880 | if ((bss_index = retrieve_bss(priv)) != -1) { | 2877 | } else if (priv->connect_to_any_BSS) { |
2881 | atmel_join_bss(priv, bss_index); | 2878 | int bss_index; |
2882 | return; | 2879 | |
2880 | priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80; | ||
2881 | |||
2882 | if ((bss_index = retrieve_bss(priv)) != -1) { | ||
2883 | atmel_join_bss(priv, bss_index); | ||
2884 | return; | ||
2885 | } | ||
2883 | } | 2886 | } |
2884 | } | 2887 | } |
2885 | 2888 | ||
@@ -3205,7 +3208,7 @@ static void atmel_management_timer(u_long a) | |||
3205 | priv->AuthenticationRequestRetryCnt++; | 3208 | priv->AuthenticationRequestRetryCnt++; |
3206 | priv->CurrentAuthentTransactionSeqNum = 0x0001; | 3209 | priv->CurrentAuthentTransactionSeqNum = 0x0001; |
3207 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); | 3210 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); |
3208 | send_authentication_request(priv, NULL, 0); | 3211 | send_authentication_request(priv, C80211_MGMT_AAN_OPENSYSTEM, NULL, 0); |
3209 | } | 3212 | } |
3210 | 3213 | ||
3211 | break; | 3214 | break; |
@@ -3312,7 +3315,7 @@ static void atmel_command_irq(struct atmel_private *priv) | |||
3312 | 3315 | ||
3313 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); | 3316 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); |
3314 | priv->CurrentAuthentTransactionSeqNum = 0x0001; | 3317 | priv->CurrentAuthentTransactionSeqNum = 0x0001; |
3315 | send_authentication_request(priv, NULL, 0); | 3318 | send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); |
3316 | } | 3319 | } |
3317 | return; | 3320 | return; |
3318 | } | 3321 | } |
@@ -3482,11 +3485,6 @@ static int probe_atmel_card(struct net_device *dev) | |||
3482 | printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name); | 3485 | printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name); |
3483 | memcpy(dev->dev_addr, default_mac, 6); | 3486 | memcpy(dev->dev_addr, default_mac, 6); |
3484 | } | 3487 | } |
3485 | printk(KERN_INFO "%s: MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", | ||
3486 | dev->name, | ||
3487 | dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], | ||
3488 | dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] ); | ||
3489 | |||
3490 | } | 3488 | } |
3491 | 3489 | ||
3492 | return rc; | 3490 | return rc; |
diff --git a/drivers/net/wireless/atmel.h b/drivers/net/wireless/atmel.h index 825000edfc2c..b9b3e5b76544 100644 --- a/drivers/net/wireless/atmel.h +++ b/drivers/net/wireless/atmel.h | |||
@@ -35,9 +35,9 @@ typedef enum { | |||
35 | ATMEL_FW_TYPE_506 | 35 | ATMEL_FW_TYPE_506 |
36 | } AtmelFWType; | 36 | } AtmelFWType; |
37 | 37 | ||
38 | struct net_device *init_atmel_card(unsigned short, int, const AtmelFWType, struct device *, | 38 | struct net_device *init_atmel_card(unsigned short, unsigned long, const AtmelFWType, struct device *, |
39 | int (*present_func)(void *), void * ); | 39 | int (*present_func)(void *), void * ); |
40 | void stop_atmel_card( struct net_device *, int ); | 40 | void stop_atmel_card( struct net_device *); |
41 | int atmel_open( struct net_device * ); | 41 | int atmel_open( struct net_device * ); |
42 | 42 | ||
43 | #endif | 43 | #endif |
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 1bd13146c644..17d1fd90f832 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
@@ -63,6 +63,7 @@ | |||
63 | be present but disabled -- but it can then be enabled for specific | 63 | be present but disabled -- but it can then be enabled for specific |
64 | modules at load time with a 'pc_debug=#' option to insmod. | 64 | modules at load time with a 'pc_debug=#' option to insmod. |
65 | */ | 65 | */ |
66 | |||
66 | #ifdef PCMCIA_DEBUG | 67 | #ifdef PCMCIA_DEBUG |
67 | static int pc_debug = PCMCIA_DEBUG; | 68 | static int pc_debug = PCMCIA_DEBUG; |
68 | module_param(pc_debug, int, 0); | 69 | module_param(pc_debug, int, 0); |
@@ -285,41 +286,6 @@ static int card_present(void *arg) | |||
285 | return 0; | 286 | return 0; |
286 | } | 287 | } |
287 | 288 | ||
288 | /* list of cards we know about and their firmware requirements. | ||
289 | Go either by Manfid or version strings. | ||
290 | Cards not in this list will need a firmware parameter to the module | ||
291 | in all probability. Note that the SMC 2632 V2 and V3 have the same | ||
292 | manfids, so we ignore those and use the version1 strings. */ | ||
293 | |||
294 | static struct { | ||
295 | int manf, card; | ||
296 | char *ver1; | ||
297 | AtmelFWType firmware; | ||
298 | char *name; | ||
299 | } card_table[] = { | ||
300 | { 0, 0, "WLAN/802.11b PC CARD", ATMEL_FW_TYPE_502D, "Actiontec 802CAT1" }, | ||
301 | { 0, 0, "ATMEL/AT76C502AR", ATMEL_FW_TYPE_502, "NoName-RFMD" }, | ||
302 | { 0, 0, "ATMEL/AT76C502AR_D", ATMEL_FW_TYPE_502D, "NoName-revD" }, | ||
303 | { 0, 0, "ATMEL/AT76C502AR_E", ATMEL_FW_TYPE_502E, "NoName-revE" }, | ||
304 | { 0, 0, "ATMEL/AT76C504", ATMEL_FW_TYPE_504, "NoName-504" }, | ||
305 | { 0, 0, "ATMEL/AT76C504A", ATMEL_FW_TYPE_504A_2958, "NoName-504a-2958" }, | ||
306 | { 0, 0, "ATMEL/AT76C504_R", ATMEL_FW_TYPE_504_2958, "NoName-504-2958" }, | ||
307 | { MANFID_3COM, 0x0620, NULL, ATMEL_FW_TYPE_502_3COM, "3com 3CRWE62092B" }, | ||
308 | { MANFID_3COM, 0x0696, NULL, ATMEL_FW_TYPE_502_3COM, "3com 3CRSHPW196" }, | ||
309 | { 0, 0, "SMC/2632W-V2", ATMEL_FW_TYPE_502, "SMC 2632W-V2" }, | ||
310 | { 0, 0, "SMC/2632W", ATMEL_FW_TYPE_502D, "SMC 2632W-V3" }, | ||
311 | { 0xd601, 0x0007, NULL, ATMEL_FW_TYPE_502, "Sitecom WLAN-011" }, | ||
312 | { 0x01bf, 0x3302, NULL, ATMEL_FW_TYPE_502E, "Belkin F5D6020-V2" }, | ||
313 | { 0, 0, "BT/Voyager 1020 Laptop Adapter", ATMEL_FW_TYPE_502, "BT Voyager 1020" }, | ||
314 | { 0, 0, "IEEE 802.11b/Wireless LAN PC Card", ATMEL_FW_TYPE_502, "Siemens Gigaset PC Card II" }, | ||
315 | { 0, 0, "IEEE 802.11b/Wireless LAN Card S", ATMEL_FW_TYPE_504_2958, "Siemens Gigaset PC Card II" }, | ||
316 | { 0, 0, "CNet/CNWLC 11Mbps Wireless PC Card V-5", ATMEL_FW_TYPE_502E, "CNet CNWLC-811ARL" }, | ||
317 | { 0, 0, "Wireless/PC_CARD", ATMEL_FW_TYPE_502D, "Planet WL-3552" }, | ||
318 | { 0, 0, "OEM/11Mbps Wireless LAN PC Card V-3", ATMEL_FW_TYPE_502, "OEM 11Mbps WLAN PCMCIA Card" }, | ||
319 | { 0, 0, "11WAVE/11WP611AL-E", ATMEL_FW_TYPE_502E, "11WAVE WaveBuddy" }, | ||
320 | { 0, 0, "LG/LW2100N", ATMEL_FW_TYPE_502E, "LG LW2100N 11Mbps WLAN PCMCIA Card" }, | ||
321 | }; | ||
322 | |||
323 | static void atmel_config(dev_link_t *link) | 289 | static void atmel_config(dev_link_t *link) |
324 | { | 290 | { |
325 | client_handle_t handle; | 291 | client_handle_t handle; |
@@ -328,10 +294,11 @@ static void atmel_config(dev_link_t *link) | |||
328 | local_info_t *dev; | 294 | local_info_t *dev; |
329 | int last_fn, last_ret; | 295 | int last_fn, last_ret; |
330 | u_char buf[64]; | 296 | u_char buf[64]; |
331 | int card_index = -1, done = 0; | 297 | struct pcmcia_device_id *did; |
332 | 298 | ||
333 | handle = link->handle; | 299 | handle = link->handle; |
334 | dev = link->priv; | 300 | dev = link->priv; |
301 | did = handle_to_dev(handle).driver_data; | ||
335 | 302 | ||
336 | DEBUG(0, "atmel_config(0x%p)\n", link); | 303 | DEBUG(0, "atmel_config(0x%p)\n", link); |
337 | 304 | ||
@@ -340,59 +307,6 @@ static void atmel_config(dev_link_t *link) | |||
340 | tuple.TupleDataMax = sizeof(buf); | 307 | tuple.TupleDataMax = sizeof(buf); |
341 | tuple.TupleOffset = 0; | 308 | tuple.TupleOffset = 0; |
342 | 309 | ||
343 | tuple.DesiredTuple = CISTPL_MANFID; | ||
344 | if (pcmcia_get_first_tuple(handle, &tuple) == 0) { | ||
345 | int i; | ||
346 | cistpl_manfid_t *manfid; | ||
347 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | ||
348 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | ||
349 | manfid = &(parse.manfid); | ||
350 | for (i = 0; i < sizeof(card_table)/sizeof(card_table[0]); i++) { | ||
351 | if (!card_table[i].ver1 && | ||
352 | manfid->manf == card_table[i].manf && | ||
353 | manfid->card == card_table[i].card) { | ||
354 | card_index = i; | ||
355 | done = 1; | ||
356 | } | ||
357 | } | ||
358 | } | ||
359 | |||
360 | tuple.DesiredTuple = CISTPL_VERS_1; | ||
361 | if (!done && (pcmcia_get_first_tuple(handle, &tuple) == 0)) { | ||
362 | int i, j, k; | ||
363 | cistpl_vers_1_t *ver1; | ||
364 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | ||
365 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | ||
366 | ver1 = &(parse.version_1); | ||
367 | |||
368 | for (i = 0; i < sizeof(card_table)/sizeof(card_table[0]); i++) { | ||
369 | for (j = 0; j < ver1->ns; j++) { | ||
370 | char *p = card_table[i].ver1; | ||
371 | char *q = &ver1->str[ver1->ofs[j]]; | ||
372 | if (!p) | ||
373 | goto mismatch; | ||
374 | for (k = 0; k < j; k++) { | ||
375 | while ((*p != '\0') && (*p != '/')) p++; | ||
376 | if (*p == '\0') { | ||
377 | if (*q != '\0') | ||
378 | goto mismatch; | ||
379 | } else { | ||
380 | p++; | ||
381 | } | ||
382 | } | ||
383 | while((*q != '\0') && (*p != '\0') && | ||
384 | (*p != '/') && (*p == *q)) p++, q++; | ||
385 | if (((*p != '\0') && *p != '/') || *q != '\0') | ||
386 | goto mismatch; | ||
387 | } | ||
388 | card_index = i; | ||
389 | break; /* done */ | ||
390 | |||
391 | mismatch: | ||
392 | j = 0; /* dummy stmt to shut up compiler */ | ||
393 | } | ||
394 | } | ||
395 | |||
396 | /* | 310 | /* |
397 | This reads the card's CONFIG tuple to find its configuration | 311 | This reads the card's CONFIG tuple to find its configuration |
398 | registers. | 312 | registers. |
@@ -509,12 +423,13 @@ static void atmel_config(dev_link_t *link) | |||
509 | ((local_info_t*)link->priv)->eth_dev = | 423 | ((local_info_t*)link->priv)->eth_dev = |
510 | init_atmel_card(link->irq.AssignedIRQ, | 424 | init_atmel_card(link->irq.AssignedIRQ, |
511 | link->io.BasePort1, | 425 | link->io.BasePort1, |
512 | card_index == -1 ? ATMEL_FW_TYPE_NONE : card_table[card_index].firmware, | 426 | did ? did->driver_info : ATMEL_FW_TYPE_NONE, |
513 | &handle_to_dev(handle), | 427 | &handle_to_dev(handle), |
514 | card_present, | 428 | card_present, |
515 | link); | 429 | link); |
516 | if (!((local_info_t*)link->priv)->eth_dev) | 430 | if (!((local_info_t*)link->priv)->eth_dev) |
517 | goto cs_failed; | 431 | goto cs_failed; |
432 | |||
518 | 433 | ||
519 | /* | 434 | /* |
520 | At this point, the dev_node_t structure(s) need to be | 435 | At this point, the dev_node_t structure(s) need to be |
@@ -523,26 +438,7 @@ static void atmel_config(dev_link_t *link) | |||
523 | strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); | 438 | strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); |
524 | dev->node.major = dev->node.minor = 0; | 439 | dev->node.major = dev->node.minor = 0; |
525 | link->dev = &dev->node; | 440 | link->dev = &dev->node; |
526 | 441 | ||
527 | /* Finally, report what we've done */ | ||
528 | printk(KERN_INFO "%s: %s%sindex 0x%02x: Vcc %d.%d", | ||
529 | dev->node.dev_name, | ||
530 | card_index == -1 ? "" : card_table[card_index].name, | ||
531 | card_index == -1 ? "" : " ", | ||
532 | link->conf.ConfigIndex, | ||
533 | link->conf.Vcc/10, link->conf.Vcc%10); | ||
534 | if (link->conf.Vpp1) | ||
535 | printk(", Vpp %d.%d", link->conf.Vpp1/10, link->conf.Vpp1%10); | ||
536 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | ||
537 | printk(", irq %d", link->irq.AssignedIRQ); | ||
538 | if (link->io.NumPorts1) | ||
539 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | ||
540 | link->io.BasePort1+link->io.NumPorts1-1); | ||
541 | if (link->io.NumPorts2) | ||
542 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
543 | link->io.BasePort2+link->io.NumPorts2-1); | ||
544 | printk("\n"); | ||
545 | |||
546 | link->state &= ~DEV_CONFIG_PENDING; | 442 | link->state &= ~DEV_CONFIG_PENDING; |
547 | return; | 443 | return; |
548 | 444 | ||
@@ -569,7 +465,7 @@ static void atmel_release(dev_link_t *link) | |||
569 | link->dev = NULL; | 465 | link->dev = NULL; |
570 | 466 | ||
571 | if (dev) | 467 | if (dev) |
572 | stop_atmel_card(dev, 0); | 468 | stop_atmel_card(dev); |
573 | ((local_info_t*)link->priv)->eth_dev = NULL; | 469 | ((local_info_t*)link->priv)->eth_dev = NULL; |
574 | 470 | ||
575 | /* Don't bother checking to see if these succeed or not */ | 471 | /* Don't bother checking to see if these succeed or not */ |
@@ -637,25 +533,47 @@ static int atmel_event(event_t event, int priority, | |||
637 | } /* atmel_event */ | 533 | } /* atmel_event */ |
638 | 534 | ||
639 | /*====================================================================*/ | 535 | /*====================================================================*/ |
536 | /* We use the driver_info field to store the correct firmware type for a card. */ | ||
537 | |||
538 | #define PCMCIA_DEVICE_MANF_CARD_INFO(manf, card, info) { \ | ||
539 | .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \ | ||
540 | PCMCIA_DEV_ID_MATCH_CARD_ID, \ | ||
541 | .manf_id = (manf), \ | ||
542 | .card_id = (card), \ | ||
543 | .driver_info = (kernel_ulong_t)(info), } | ||
544 | |||
545 | #define PCMCIA_DEVICE_PROD_ID12_INFO(v1, v2, vh1, vh2, info) { \ | ||
546 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
547 | PCMCIA_DEV_ID_MATCH_PROD_ID2, \ | ||
548 | .prod_id = { (v1), (v2), NULL, NULL }, \ | ||
549 | .prod_id_hash = { (vh1), (vh2), 0, 0 }, \ | ||
550 | .driver_info = (kernel_ulong_t)(info), } | ||
551 | |||
640 | static struct pcmcia_device_id atmel_ids[] = { | 552 | static struct pcmcia_device_id atmel_ids[] = { |
641 | PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0620), | 553 | PCMCIA_DEVICE_MANF_CARD_INFO(0x0101, 0x0620, ATMEL_FW_TYPE_502_3COM), |
642 | PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0696), | 554 | PCMCIA_DEVICE_MANF_CARD_INFO(0x0101, 0x0696, ATMEL_FW_TYPE_502_3COM), |
643 | PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x3302), | 555 | PCMCIA_DEVICE_MANF_CARD_INFO(0x01bf, 0x3302, ATMEL_FW_TYPE_502E), |
644 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0007), | 556 | PCMCIA_DEVICE_MANF_CARD_INFO(0xd601, 0x0007, ATMEL_FW_TYPE_502), |
645 | PCMCIA_DEVICE_PROD_ID12("11WAVE", "11WP611AL-E", 0x9eb2da1f, 0xc9a0d3f9), | 557 | PCMCIA_DEVICE_PROD_ID12_INFO("11WAVE", "11WP611AL-E", 0x9eb2da1f, 0xc9a0d3f9, ATMEL_FW_TYPE_502E), |
646 | PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C502AR", 0xabda4164, 0x41b37e1f), | 558 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR", 0xabda4164, 0x41b37e1f, ATMEL_FW_TYPE_502), |
647 | PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C504", 0xabda4164, 0x5040670a), | 559 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR_D", 0xabda4164, 0x3675d704, ATMEL_FW_TYPE_502D), |
648 | PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C504A", 0xabda4164, 0xe15ed87f), | 560 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR_E", 0xabda4164, 0x4172e792, ATMEL_FW_TYPE_502E), |
649 | PCMCIA_DEVICE_PROD_ID12("BT", "Voyager 1020 Laptop Adapter", 0xae49b86a, 0x1e957cd5), | 561 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504_R", 0xabda4164, 0x917f3d72, ATMEL_FW_TYPE_504_2958), |
650 | PCMCIA_DEVICE_PROD_ID12("CNet", "CNWLC 11Mbps Wireless PC Card V-5", 0xbc477dde, 0x502fae6b), | 562 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504", 0xabda4164, 0x5040670a, ATMEL_FW_TYPE_504), |
651 | PCMCIA_DEVICE_PROD_ID12("IEEE 802.11b", "Wireless LAN PC Card", 0x5b878724, 0x122f1df6), | 563 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504A", 0xabda4164, 0xe15ed87f, ATMEL_FW_TYPE_504A_2958), |
652 | PCMCIA_DEVICE_PROD_ID12("OEM", "11Mbps Wireless LAN PC Card V-3", 0xfea54c90, 0x1c5b0f68), | 564 | PCMCIA_DEVICE_PROD_ID12_INFO("BT", "Voyager 1020 Laptop Adapter", 0xae49b86a, 0x1e957cd5, ATMEL_FW_TYPE_502), |
653 | PCMCIA_DEVICE_PROD_ID12("SMC", "2632W", 0xc4f8b18b, 0x30f38774), | 565 | PCMCIA_DEVICE_PROD_ID12_INFO("CNet", "CNWLC 11Mbps Wireless PC Card V-5", 0xbc477dde, 0x502fae6b, ATMEL_FW_TYPE_502E), |
654 | PCMCIA_DEVICE_PROD_ID12("SMC", "2632W-V2", 0xc4f8b18b, 0x172d1377), | 566 | PCMCIA_DEVICE_PROD_ID12_INFO("IEEE 802.11b", "Wireless LAN PC Card", 0x5b878724, 0x122f1df6, ATMEL_FW_TYPE_502), |
655 | PCMCIA_DEVICE_PROD_ID12("Wireless", "PC", 0xa407ecdd, 0x556e4d7e), | 567 | PCMCIA_DEVICE_PROD_ID12_INFO("IEEE 802.11b", "Wireless LAN Card S", 0x5b878724, 0x5fba533a, ATMEL_FW_TYPE_504_2958), |
656 | PCMCIA_DEVICE_PROD_ID12("WLAN", "802.11b PC CARD", 0x575c516c, 0xb1f6dbc4), | 568 | PCMCIA_DEVICE_PROD_ID12_INFO("OEM", "11Mbps Wireless LAN PC Card V-3", 0xfea54c90, 0x1c5b0f68, ATMEL_FW_TYPE_502), |
569 | PCMCIA_DEVICE_PROD_ID12_INFO("SMC", "2632W", 0xc4f8b18b, 0x30f38774, ATMEL_FW_TYPE_502D), | ||
570 | PCMCIA_DEVICE_PROD_ID12_INFO("SMC", "2632W-V2", 0xc4f8b18b, 0x172d1377, ATMEL_FW_TYPE_502), | ||
571 | PCMCIA_DEVICE_PROD_ID12_INFO("Wireless", "PC_CARD", 0xa407ecdd, 0x119f6314, ATMEL_FW_TYPE_502D), | ||
572 | PCMCIA_DEVICE_PROD_ID12_INFO("WLAN", "802.11b PC CARD", 0x575c516c, 0xb1f6dbc4, ATMEL_FW_TYPE_502D), | ||
573 | PCMCIA_DEVICE_PROD_ID12_INFO("LG", "LW2100N", 0xb474d43a, 0x6b1fec94, ATMEL_FW_TYPE_502E), | ||
657 | PCMCIA_DEVICE_NULL | 574 | PCMCIA_DEVICE_NULL |
658 | }; | 575 | }; |
576 | |||
659 | MODULE_DEVICE_TABLE(pcmcia, atmel_ids); | 577 | MODULE_DEVICE_TABLE(pcmcia, atmel_ids); |
660 | 578 | ||
661 | static struct pcmcia_driver atmel_driver = { | 579 | static struct pcmcia_driver atmel_driver = { |
diff --git a/drivers/net/wireless/atmel_pci.c b/drivers/net/wireless/atmel_pci.c index 2eb00a957bbe..a61b3bc6cccf 100644 --- a/drivers/net/wireless/atmel_pci.c +++ b/drivers/net/wireless/atmel_pci.c | |||
@@ -72,7 +72,7 @@ static int __devinit atmel_pci_probe(struct pci_dev *pdev, | |||
72 | 72 | ||
73 | static void __devexit atmel_pci_remove(struct pci_dev *pdev) | 73 | static void __devexit atmel_pci_remove(struct pci_dev *pdev) |
74 | { | 74 | { |
75 | stop_atmel_card(pci_get_drvdata(pdev), 1); | 75 | stop_atmel_card(pci_get_drvdata(pdev)); |
76 | } | 76 | } |
77 | 77 | ||
78 | static int __init atmel_init_module(void) | 78 | static int __init atmel_init_module(void) |
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index 1c8ad2fcad8a..da8c515743e8 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * Author(s): Original Code written by | 8 | * Author(s): Original Code written by |
9 | * DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) | 9 | * DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) |
10 | * Rewritten by | 10 | * Rewritten by |
11 | * Frank Pavlic (pavlic@de.ibm.com) and | 11 | * Frank Pavlic (fpavlic@de.ibm.com) and |
12 | * Martin Schwidefsky <schwidefsky@de.ibm.com> | 12 | * Martin Schwidefsky <schwidefsky@de.ibm.com> |
13 | * | 13 | * |
14 | * $Revision: 1.99 $ $Date: 2005/05/11 08:10:17 $ | 14 | * $Revision: 1.99 $ $Date: 2005/05/11 08:10:17 $ |
@@ -2342,6 +2342,6 @@ __exit lcs_cleanup_module(void) | |||
2342 | module_init(lcs_init_module); | 2342 | module_init(lcs_init_module); |
2343 | module_exit(lcs_cleanup_module); | 2343 | module_exit(lcs_cleanup_module); |
2344 | 2344 | ||
2345 | MODULE_AUTHOR("Frank Pavlic <pavlic@de.ibm.com>"); | 2345 | MODULE_AUTHOR("Frank Pavlic <fpavlic@de.ibm.com>"); |
2346 | MODULE_LICENSE("GPL"); | 2346 | MODULE_LICENSE("GPL"); |
2347 | 2347 | ||
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h index 38a2441564d7..d238c7ed103b 100644 --- a/drivers/s390/net/qeth.h +++ b/drivers/s390/net/qeth.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/trdevice.h> | 8 | #include <linux/trdevice.h> |
9 | #include <linux/etherdevice.h> | 9 | #include <linux/etherdevice.h> |
10 | #include <linux/if_vlan.h> | 10 | #include <linux/if_vlan.h> |
11 | #include <linux/ctype.h> | ||
11 | 12 | ||
12 | #include <net/ipv6.h> | 13 | #include <net/ipv6.h> |
13 | #include <linux/in6.h> | 14 | #include <linux/in6.h> |
@@ -24,7 +25,7 @@ | |||
24 | 25 | ||
25 | #include "qeth_mpc.h" | 26 | #include "qeth_mpc.h" |
26 | 27 | ||
27 | #define VERSION_QETH_H "$Revision: 1.142 $" | 28 | #define VERSION_QETH_H "$Revision: 1.152 $" |
28 | 29 | ||
29 | #ifdef CONFIG_QETH_IPV6 | 30 | #ifdef CONFIG_QETH_IPV6 |
30 | #define QETH_VERSION_IPV6 ":IPv6" | 31 | #define QETH_VERSION_IPV6 ":IPv6" |
@@ -718,8 +719,6 @@ struct qeth_reply { | |||
718 | atomic_t refcnt; | 719 | atomic_t refcnt; |
719 | }; | 720 | }; |
720 | 721 | ||
721 | #define QETH_BROADCAST_WITH_ECHO 1 | ||
722 | #define QETH_BROADCAST_WITHOUT_ECHO 2 | ||
723 | 722 | ||
724 | struct qeth_card_blkt { | 723 | struct qeth_card_blkt { |
725 | int time_total; | 724 | int time_total; |
@@ -727,8 +726,10 @@ struct qeth_card_blkt { | |||
727 | int inter_packet_jumbo; | 726 | int inter_packet_jumbo; |
728 | }; | 727 | }; |
729 | 728 | ||
730 | 729 | #define QETH_BROADCAST_WITH_ECHO 0x01 | |
731 | 730 | #define QETH_BROADCAST_WITHOUT_ECHO 0x02 | |
731 | #define QETH_LAYER2_MAC_READ 0x01 | ||
732 | #define QETH_LAYER2_MAC_REGISTERED 0x02 | ||
732 | struct qeth_card_info { | 733 | struct qeth_card_info { |
733 | unsigned short unit_addr2; | 734 | unsigned short unit_addr2; |
734 | unsigned short cula; | 735 | unsigned short cula; |
@@ -736,7 +737,7 @@ struct qeth_card_info { | |||
736 | __u16 func_level; | 737 | __u16 func_level; |
737 | char mcl_level[QETH_MCL_LENGTH + 1]; | 738 | char mcl_level[QETH_MCL_LENGTH + 1]; |
738 | int guestlan; | 739 | int guestlan; |
739 | int layer2_mac_registered; | 740 | int mac_bits; |
740 | int portname_required; | 741 | int portname_required; |
741 | int portno; | 742 | int portno; |
742 | char portname[9]; | 743 | char portname[9]; |
@@ -749,6 +750,7 @@ struct qeth_card_info { | |||
749 | int unique_id; | 750 | int unique_id; |
750 | struct qeth_card_blkt blkt; | 751 | struct qeth_card_blkt blkt; |
751 | __u32 csum_mask; | 752 | __u32 csum_mask; |
753 | enum qeth_ipa_promisc_modes promisc_mode; | ||
752 | }; | 754 | }; |
753 | 755 | ||
754 | struct qeth_card_options { | 756 | struct qeth_card_options { |
@@ -775,6 +777,7 @@ struct qeth_card_options { | |||
775 | enum qeth_threads { | 777 | enum qeth_threads { |
776 | QETH_SET_IP_THREAD = 1, | 778 | QETH_SET_IP_THREAD = 1, |
777 | QETH_RECOVER_THREAD = 2, | 779 | QETH_RECOVER_THREAD = 2, |
780 | QETH_SET_PROMISC_MODE_THREAD = 4, | ||
778 | }; | 781 | }; |
779 | 782 | ||
780 | struct qeth_osn_info { | 783 | struct qeth_osn_info { |
@@ -1074,6 +1077,26 @@ qeth_get_qdio_q_format(struct qeth_card *card) | |||
1074 | } | 1077 | } |
1075 | } | 1078 | } |
1076 | 1079 | ||
1080 | static inline int | ||
1081 | qeth_isdigit(char * buf) | ||
1082 | { | ||
1083 | while (*buf) { | ||
1084 | if (!isdigit(*buf++)) | ||
1085 | return 0; | ||
1086 | } | ||
1087 | return 1; | ||
1088 | } | ||
1089 | |||
1090 | static inline int | ||
1091 | qeth_isxdigit(char * buf) | ||
1092 | { | ||
1093 | while (*buf) { | ||
1094 | if (!isxdigit(*buf++)) | ||
1095 | return 0; | ||
1096 | } | ||
1097 | return 1; | ||
1098 | } | ||
1099 | |||
1077 | static inline void | 1100 | static inline void |
1078 | qeth_ipaddr4_to_string(const __u8 *addr, char *buf) | 1101 | qeth_ipaddr4_to_string(const __u8 *addr, char *buf) |
1079 | { | 1102 | { |
@@ -1090,18 +1113,27 @@ qeth_string_to_ipaddr4(const char *buf, __u8 *addr) | |||
1090 | int i; | 1113 | int i; |
1091 | 1114 | ||
1092 | start = buf; | 1115 | start = buf; |
1093 | for (i = 0; i < 3; i++) { | 1116 | for (i = 0; i < 4; i++) { |
1094 | if (!(end = strchr(start, '.'))) | 1117 | if (i == 3) { |
1118 | end = strchr(start,0xa); | ||
1119 | if (end) | ||
1120 | len = end - start; | ||
1121 | else | ||
1122 | len = strlen(start); | ||
1123 | } | ||
1124 | else { | ||
1125 | end = strchr(start, '.'); | ||
1126 | len = end - start; | ||
1127 | } | ||
1128 | if ((len <= 0) || (len > 3)) | ||
1095 | return -EINVAL; | 1129 | return -EINVAL; |
1096 | len = end - start; | ||
1097 | memset(abuf, 0, 4); | 1130 | memset(abuf, 0, 4); |
1098 | strncpy(abuf, start, len); | 1131 | strncpy(abuf, start, len); |
1132 | if (!qeth_isdigit(abuf)) | ||
1133 | return -EINVAL; | ||
1099 | addr[i] = simple_strtoul(abuf, &tmp, 10); | 1134 | addr[i] = simple_strtoul(abuf, &tmp, 10); |
1100 | start = end + 1; | 1135 | start = end + 1; |
1101 | } | 1136 | } |
1102 | memset(abuf, 0, 4); | ||
1103 | strcpy(abuf, start); | ||
1104 | addr[3] = simple_strtoul(abuf, &tmp, 10); | ||
1105 | return 0; | 1137 | return 0; |
1106 | } | 1138 | } |
1107 | 1139 | ||
@@ -1128,18 +1160,27 @@ qeth_string_to_ipaddr6(const char *buf, __u8 *addr) | |||
1128 | 1160 | ||
1129 | tmp_addr = (u16 *)addr; | 1161 | tmp_addr = (u16 *)addr; |
1130 | start = buf; | 1162 | start = buf; |
1131 | for (i = 0; i < 7; i++) { | 1163 | for (i = 0; i < 8; i++) { |
1132 | if (!(end = strchr(start, ':'))) | 1164 | if (i == 7) { |
1165 | end = strchr(start,0xa); | ||
1166 | if (end) | ||
1167 | len = end - start; | ||
1168 | else | ||
1169 | len = strlen(start); | ||
1170 | } | ||
1171 | else { | ||
1172 | end = strchr(start, ':'); | ||
1173 | len = end - start; | ||
1174 | } | ||
1175 | if ((len <= 0) || (len > 4)) | ||
1133 | return -EINVAL; | 1176 | return -EINVAL; |
1134 | len = end - start; | ||
1135 | memset(abuf, 0, 5); | 1177 | memset(abuf, 0, 5); |
1136 | strncpy(abuf, start, len); | 1178 | strncpy(abuf, start, len); |
1179 | if (!qeth_isxdigit(abuf)) | ||
1180 | return -EINVAL; | ||
1137 | tmp_addr[i] = simple_strtoul(abuf, &tmp, 16); | 1181 | tmp_addr[i] = simple_strtoul(abuf, &tmp, 16); |
1138 | start = end + 1; | 1182 | start = end + 1; |
1139 | } | 1183 | } |
1140 | memset(abuf, 0, 5); | ||
1141 | strcpy(abuf, start); | ||
1142 | tmp_addr[7] = simple_strtoul(abuf, &tmp, 16); | ||
1143 | return 0; | 1184 | return 0; |
1144 | } | 1185 | } |
1145 | 1186 | ||
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 692003c9f896..99cceb242ec4 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * linux/drivers/s390/net/qeth_main.c ($Revision: 1.224 $) | 3 | * linux/drivers/s390/net/qeth_main.c ($Revision: 1.242 $) |
4 | * | 4 | * |
5 | * Linux on zSeries OSA Express and HiperSockets support | 5 | * Linux on zSeries OSA Express and HiperSockets support |
6 | * | 6 | * |
@@ -9,10 +9,10 @@ | |||
9 | * Author(s): Original Code written by | 9 | * Author(s): Original Code written by |
10 | * Utz Bacher (utz.bacher@de.ibm.com) | 10 | * Utz Bacher (utz.bacher@de.ibm.com) |
11 | * Rewritten by | 11 | * Rewritten by |
12 | * Frank Pavlic (pavlic@de.ibm.com) and | 12 | * Frank Pavlic (fpavlic@de.ibm.com) and |
13 | * Thomas Spatzier <tspat@de.ibm.com> | 13 | * Thomas Spatzier <tspat@de.ibm.com> |
14 | * | 14 | * |
15 | * $Revision: 1.224 $ $Date: 2005/05/04 20:19:18 $ | 15 | * $Revision: 1.242 $ $Date: 2005/05/04 20:19:18 $ |
16 | * | 16 | * |
17 | * This program is free software; you can redistribute it and/or modify | 17 | * This program is free software; you can redistribute it and/or modify |
18 | * it under the terms of the GNU General Public License as published by | 18 | * it under the terms of the GNU General Public License as published by |
@@ -72,7 +72,7 @@ | |||
72 | #include "qeth_eddp.h" | 72 | #include "qeth_eddp.h" |
73 | #include "qeth_tso.h" | 73 | #include "qeth_tso.h" |
74 | 74 | ||
75 | #define VERSION_QETH_C "$Revision: 1.224 $" | 75 | #define VERSION_QETH_C "$Revision: 1.242 $" |
76 | static const char *version = "qeth S/390 OSA-Express driver"; | 76 | static const char *version = "qeth S/390 OSA-Express driver"; |
77 | 77 | ||
78 | /** | 78 | /** |
@@ -160,6 +160,9 @@ static void | |||
160 | qeth_set_multicast_list(struct net_device *); | 160 | qeth_set_multicast_list(struct net_device *); |
161 | 161 | ||
162 | static void | 162 | static void |
163 | qeth_setadp_promisc_mode(struct qeth_card *); | ||
164 | |||
165 | static void | ||
163 | qeth_notify_processes(void) | 166 | qeth_notify_processes(void) |
164 | { | 167 | { |
165 | /*notify all registered processes */ | 168 | /*notify all registered processes */ |
@@ -602,11 +605,20 @@ __qeth_ref_ip_on_card(struct qeth_card *card, struct qeth_ipaddr *todo, | |||
602 | int found = 0; | 605 | int found = 0; |
603 | 606 | ||
604 | list_for_each_entry(addr, &card->ip_list, entry) { | 607 | list_for_each_entry(addr, &card->ip_list, entry) { |
608 | if (card->options.layer2) { | ||
609 | if ((addr->type == todo->type) && | ||
610 | (memcmp(&addr->mac, &todo->mac, | ||
611 | OSA_ADDR_LEN) == 0)) { | ||
612 | found = 1; | ||
613 | break; | ||
614 | } | ||
615 | continue; | ||
616 | } | ||
605 | if ((addr->proto == QETH_PROT_IPV4) && | 617 | if ((addr->proto == QETH_PROT_IPV4) && |
606 | (todo->proto == QETH_PROT_IPV4) && | 618 | (todo->proto == QETH_PROT_IPV4) && |
607 | (addr->type == todo->type) && | 619 | (addr->type == todo->type) && |
608 | (addr->u.a4.addr == todo->u.a4.addr) && | 620 | (addr->u.a4.addr == todo->u.a4.addr) && |
609 | (addr->u.a4.mask == todo->u.a4.mask) ){ | 621 | (addr->u.a4.mask == todo->u.a4.mask)) { |
610 | found = 1; | 622 | found = 1; |
611 | break; | 623 | break; |
612 | } | 624 | } |
@@ -615,12 +627,12 @@ __qeth_ref_ip_on_card(struct qeth_card *card, struct qeth_ipaddr *todo, | |||
615 | (addr->type == todo->type) && | 627 | (addr->type == todo->type) && |
616 | (addr->u.a6.pfxlen == todo->u.a6.pfxlen) && | 628 | (addr->u.a6.pfxlen == todo->u.a6.pfxlen) && |
617 | (memcmp(&addr->u.a6.addr, &todo->u.a6.addr, | 629 | (memcmp(&addr->u.a6.addr, &todo->u.a6.addr, |
618 | sizeof(struct in6_addr)) == 0)) { | 630 | sizeof(struct in6_addr)) == 0)) { |
619 | found = 1; | 631 | found = 1; |
620 | break; | 632 | break; |
621 | } | 633 | } |
622 | } | 634 | } |
623 | if (found){ | 635 | if (found) { |
624 | addr->users += todo->users; | 636 | addr->users += todo->users; |
625 | if (addr->users <= 0){ | 637 | if (addr->users <= 0){ |
626 | *__addr = addr; | 638 | *__addr = addr; |
@@ -632,7 +644,7 @@ __qeth_ref_ip_on_card(struct qeth_card *card, struct qeth_ipaddr *todo, | |||
632 | return 0; | 644 | return 0; |
633 | } | 645 | } |
634 | } | 646 | } |
635 | if (todo->users > 0){ | 647 | if (todo->users > 0) { |
636 | /* for VIPA and RXIP limit refcount to 1 */ | 648 | /* for VIPA and RXIP limit refcount to 1 */ |
637 | if (todo->type != QETH_IP_TYPE_NORMAL) | 649 | if (todo->type != QETH_IP_TYPE_NORMAL) |
638 | todo->users = 1; | 650 | todo->users = 1; |
@@ -682,12 +694,22 @@ __qeth_insert_ip_todo(struct qeth_card *card, struct qeth_ipaddr *addr, int add) | |||
682 | if ((addr->type == QETH_IP_TYPE_DEL_ALL_MC) && | 694 | if ((addr->type == QETH_IP_TYPE_DEL_ALL_MC) && |
683 | (tmp->type == QETH_IP_TYPE_DEL_ALL_MC)) | 695 | (tmp->type == QETH_IP_TYPE_DEL_ALL_MC)) |
684 | return 0; | 696 | return 0; |
697 | if (card->options.layer2) { | ||
698 | if ((tmp->type == addr->type) && | ||
699 | (tmp->is_multicast == addr->is_multicast) && | ||
700 | (memcmp(&tmp->mac, &addr->mac, | ||
701 | OSA_ADDR_LEN) == 0)) { | ||
702 | found = 1; | ||
703 | break; | ||
704 | } | ||
705 | continue; | ||
706 | } | ||
685 | if ((tmp->proto == QETH_PROT_IPV4) && | 707 | if ((tmp->proto == QETH_PROT_IPV4) && |
686 | (addr->proto == QETH_PROT_IPV4) && | 708 | (addr->proto == QETH_PROT_IPV4) && |
687 | (tmp->type == addr->type) && | 709 | (tmp->type == addr->type) && |
688 | (tmp->is_multicast == addr->is_multicast) && | 710 | (tmp->is_multicast == addr->is_multicast) && |
689 | (tmp->u.a4.addr == addr->u.a4.addr) && | 711 | (tmp->u.a4.addr == addr->u.a4.addr) && |
690 | (tmp->u.a4.mask == addr->u.a4.mask) ){ | 712 | (tmp->u.a4.mask == addr->u.a4.mask)) { |
691 | found = 1; | 713 | found = 1; |
692 | break; | 714 | break; |
693 | } | 715 | } |
@@ -697,7 +719,7 @@ __qeth_insert_ip_todo(struct qeth_card *card, struct qeth_ipaddr *addr, int add) | |||
697 | (tmp->is_multicast == addr->is_multicast) && | 719 | (tmp->is_multicast == addr->is_multicast) && |
698 | (tmp->u.a6.pfxlen == addr->u.a6.pfxlen) && | 720 | (tmp->u.a6.pfxlen == addr->u.a6.pfxlen) && |
699 | (memcmp(&tmp->u.a6.addr, &addr->u.a6.addr, | 721 | (memcmp(&tmp->u.a6.addr, &addr->u.a6.addr, |
700 | sizeof(struct in6_addr)) == 0) ){ | 722 | sizeof(struct in6_addr)) == 0)) { |
701 | found = 1; | 723 | found = 1; |
702 | break; | 724 | break; |
703 | } | 725 | } |
@@ -707,7 +729,7 @@ __qeth_insert_ip_todo(struct qeth_card *card, struct qeth_ipaddr *addr, int add) | |||
707 | tmp->users += addr->users; | 729 | tmp->users += addr->users; |
708 | else | 730 | else |
709 | tmp->users += add? 1:-1; | 731 | tmp->users += add? 1:-1; |
710 | if (tmp->users == 0){ | 732 | if (tmp->users == 0) { |
711 | list_del(&tmp->entry); | 733 | list_del(&tmp->entry); |
712 | kfree(tmp); | 734 | kfree(tmp); |
713 | } | 735 | } |
@@ -738,12 +760,15 @@ qeth_delete_ip(struct qeth_card *card, struct qeth_ipaddr *addr) | |||
738 | unsigned long flags; | 760 | unsigned long flags; |
739 | int rc = 0; | 761 | int rc = 0; |
740 | 762 | ||
741 | QETH_DBF_TEXT(trace,4,"delip"); | 763 | QETH_DBF_TEXT(trace, 4, "delip"); |
742 | if (addr->proto == QETH_PROT_IPV4) | 764 | |
743 | QETH_DBF_HEX(trace,4,&addr->u.a4.addr,4); | 765 | if (card->options.layer2) |
766 | QETH_DBF_HEX(trace, 4, &addr->mac, 6); | ||
767 | else if (addr->proto == QETH_PROT_IPV4) | ||
768 | QETH_DBF_HEX(trace, 4, &addr->u.a4.addr, 4); | ||
744 | else { | 769 | else { |
745 | QETH_DBF_HEX(trace,4,&addr->u.a6.addr,8); | 770 | QETH_DBF_HEX(trace, 4, &addr->u.a6.addr, 8); |
746 | QETH_DBF_HEX(trace,4,((char *)&addr->u.a6.addr)+8,8); | 771 | QETH_DBF_HEX(trace, 4, ((char *)&addr->u.a6.addr) + 8, 8); |
747 | } | 772 | } |
748 | spin_lock_irqsave(&card->ip_lock, flags); | 773 | spin_lock_irqsave(&card->ip_lock, flags); |
749 | rc = __qeth_insert_ip_todo(card, addr, 0); | 774 | rc = __qeth_insert_ip_todo(card, addr, 0); |
@@ -757,12 +782,14 @@ qeth_add_ip(struct qeth_card *card, struct qeth_ipaddr *addr) | |||
757 | unsigned long flags; | 782 | unsigned long flags; |
758 | int rc = 0; | 783 | int rc = 0; |
759 | 784 | ||
760 | QETH_DBF_TEXT(trace,4,"addip"); | 785 | QETH_DBF_TEXT(trace, 4, "addip"); |
761 | if (addr->proto == QETH_PROT_IPV4) | 786 | if (card->options.layer2) |
762 | QETH_DBF_HEX(trace,4,&addr->u.a4.addr,4); | 787 | QETH_DBF_HEX(trace, 4, &addr->mac, 6); |
788 | else if (addr->proto == QETH_PROT_IPV4) | ||
789 | QETH_DBF_HEX(trace, 4, &addr->u.a4.addr, 4); | ||
763 | else { | 790 | else { |
764 | QETH_DBF_HEX(trace,4,&addr->u.a6.addr,8); | 791 | QETH_DBF_HEX(trace, 4, &addr->u.a6.addr, 8); |
765 | QETH_DBF_HEX(trace,4,((char *)&addr->u.a6.addr)+8,8); | 792 | QETH_DBF_HEX(trace, 4, ((char *)&addr->u.a6.addr) + 8, 8); |
766 | } | 793 | } |
767 | spin_lock_irqsave(&card->ip_lock, flags); | 794 | spin_lock_irqsave(&card->ip_lock, flags); |
768 | rc = __qeth_insert_ip_todo(card, addr, 1); | 795 | rc = __qeth_insert_ip_todo(card, addr, 1); |
@@ -775,7 +802,7 @@ __qeth_delete_all_mc(struct qeth_card *card, unsigned long *flags) | |||
775 | { | 802 | { |
776 | struct qeth_ipaddr *addr, *tmp; | 803 | struct qeth_ipaddr *addr, *tmp; |
777 | int rc; | 804 | int rc; |
778 | 805 | again: | |
779 | list_for_each_entry_safe(addr, tmp, &card->ip_list, entry) { | 806 | list_for_each_entry_safe(addr, tmp, &card->ip_list, entry) { |
780 | if (addr->is_multicast) { | 807 | if (addr->is_multicast) { |
781 | spin_unlock_irqrestore(&card->ip_lock, *flags); | 808 | spin_unlock_irqrestore(&card->ip_lock, *flags); |
@@ -784,6 +811,7 @@ __qeth_delete_all_mc(struct qeth_card *card, unsigned long *flags) | |||
784 | if (!rc) { | 811 | if (!rc) { |
785 | list_del(&addr->entry); | 812 | list_del(&addr->entry); |
786 | kfree(addr); | 813 | kfree(addr); |
814 | goto again; | ||
787 | } | 815 | } |
788 | } | 816 | } |
789 | } | 817 | } |
@@ -851,6 +879,7 @@ qeth_set_ip_addr_list(struct qeth_card *card) | |||
851 | 879 | ||
852 | static void qeth_delete_mc_addresses(struct qeth_card *); | 880 | static void qeth_delete_mc_addresses(struct qeth_card *); |
853 | static void qeth_add_multicast_ipv4(struct qeth_card *); | 881 | static void qeth_add_multicast_ipv4(struct qeth_card *); |
882 | static void qeth_layer2_add_multicast(struct qeth_card *); | ||
854 | #ifdef CONFIG_QETH_IPV6 | 883 | #ifdef CONFIG_QETH_IPV6 |
855 | static void qeth_add_multicast_ipv6(struct qeth_card *); | 884 | static void qeth_add_multicast_ipv6(struct qeth_card *); |
856 | #endif | 885 | #endif |
@@ -939,6 +968,24 @@ qeth_register_ip_addresses(void *ptr) | |||
939 | return 0; | 968 | return 0; |
940 | } | 969 | } |
941 | 970 | ||
971 | /* | ||
972 | * Drive the SET_PROMISC_MODE thread | ||
973 | */ | ||
974 | static int | ||
975 | qeth_set_promisc_mode(void *ptr) | ||
976 | { | ||
977 | struct qeth_card *card = (struct qeth_card *) ptr; | ||
978 | |||
979 | daemonize("qeth_setprm"); | ||
980 | QETH_DBF_TEXT(trace,4,"setprm1"); | ||
981 | if (!qeth_do_run_thread(card, QETH_SET_PROMISC_MODE_THREAD)) | ||
982 | return 0; | ||
983 | QETH_DBF_TEXT(trace,4,"setprm2"); | ||
984 | qeth_setadp_promisc_mode(card); | ||
985 | qeth_clear_thread_running_bit(card, QETH_SET_PROMISC_MODE_THREAD); | ||
986 | return 0; | ||
987 | } | ||
988 | |||
942 | static int | 989 | static int |
943 | qeth_recover(void *ptr) | 990 | qeth_recover(void *ptr) |
944 | { | 991 | { |
@@ -1005,6 +1052,8 @@ qeth_start_kernel_thread(struct qeth_card *card) | |||
1005 | 1052 | ||
1006 | if (qeth_do_start_thread(card, QETH_SET_IP_THREAD)) | 1053 | if (qeth_do_start_thread(card, QETH_SET_IP_THREAD)) |
1007 | kernel_thread(qeth_register_ip_addresses, (void *)card,SIGCHLD); | 1054 | kernel_thread(qeth_register_ip_addresses, (void *)card,SIGCHLD); |
1055 | if (qeth_do_start_thread(card, QETH_SET_PROMISC_MODE_THREAD)) | ||
1056 | kernel_thread(qeth_set_promisc_mode, (void *)card, SIGCHLD); | ||
1008 | if (qeth_do_start_thread(card, QETH_RECOVER_THREAD)) | 1057 | if (qeth_do_start_thread(card, QETH_RECOVER_THREAD)) |
1009 | kernel_thread(qeth_recover, (void *) card, SIGCHLD); | 1058 | kernel_thread(qeth_recover, (void *) card, SIGCHLD); |
1010 | } | 1059 | } |
@@ -3749,7 +3798,7 @@ qeth_open(struct net_device *dev) | |||
3749 | 3798 | ||
3750 | if ( (card->info.type != QETH_CARD_TYPE_OSN) && | 3799 | if ( (card->info.type != QETH_CARD_TYPE_OSN) && |
3751 | (card->options.layer2) && | 3800 | (card->options.layer2) && |
3752 | (!card->info.layer2_mac_registered)) { | 3801 | (!(card->info.mac_bits & QETH_LAYER2_MAC_REGISTERED))) { |
3753 | QETH_DBF_TEXT(trace,4,"nomacadr"); | 3802 | QETH_DBF_TEXT(trace,4,"nomacadr"); |
3754 | return -EPERM; | 3803 | return -EPERM; |
3755 | } | 3804 | } |
@@ -4311,6 +4360,8 @@ qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue, | |||
4311 | out: | 4360 | out: |
4312 | if (flush_count) | 4361 | if (flush_count) |
4313 | qeth_flush_buffers(queue, 0, start_index, flush_count); | 4362 | qeth_flush_buffers(queue, 0, start_index, flush_count); |
4363 | else if (!atomic_read(&queue->set_pci_flags_count)) | ||
4364 | atomic_swap(&queue->state, QETH_OUT_Q_LOCKED_FLUSH); | ||
4314 | /* | 4365 | /* |
4315 | * queue->state will go from LOCKED -> UNLOCKED or from | 4366 | * queue->state will go from LOCKED -> UNLOCKED or from |
4316 | * LOCKED_FLUSH -> LOCKED if output_handler wanted to 'notify' us | 4367 | * LOCKED_FLUSH -> LOCKED if output_handler wanted to 'notify' us |
@@ -4975,6 +5026,10 @@ qeth_default_setassparms_cb(struct qeth_card *, struct qeth_reply *, | |||
4975 | unsigned long); | 5026 | unsigned long); |
4976 | 5027 | ||
4977 | static int | 5028 | static int |
5029 | qeth_default_setadapterparms_cb(struct qeth_card *card, | ||
5030 | struct qeth_reply *reply, | ||
5031 | unsigned long data); | ||
5032 | static int | ||
4978 | qeth_send_setassparms(struct qeth_card *, struct qeth_cmd_buffer *, | 5033 | qeth_send_setassparms(struct qeth_card *, struct qeth_cmd_buffer *, |
4979 | __u16, long, | 5034 | __u16, long, |
4980 | int (*reply_cb) | 5035 | int (*reply_cb) |
@@ -5301,8 +5356,7 @@ qeth_free_vlan_addresses4(struct qeth_card *card, unsigned short vid) | |||
5301 | struct qeth_ipaddr *addr; | 5356 | struct qeth_ipaddr *addr; |
5302 | 5357 | ||
5303 | QETH_DBF_TEXT(trace, 4, "frvaddr4"); | 5358 | QETH_DBF_TEXT(trace, 4, "frvaddr4"); |
5304 | if (!card->vlangrp) | 5359 | |
5305 | return; | ||
5306 | rcu_read_lock(); | 5360 | rcu_read_lock(); |
5307 | in_dev = __in_dev_get_rcu(card->vlangrp->vlan_devices[vid]); | 5361 | in_dev = __in_dev_get_rcu(card->vlangrp->vlan_devices[vid]); |
5308 | if (!in_dev) | 5362 | if (!in_dev) |
@@ -5330,8 +5384,7 @@ qeth_free_vlan_addresses6(struct qeth_card *card, unsigned short vid) | |||
5330 | struct qeth_ipaddr *addr; | 5384 | struct qeth_ipaddr *addr; |
5331 | 5385 | ||
5332 | QETH_DBF_TEXT(trace, 4, "frvaddr6"); | 5386 | QETH_DBF_TEXT(trace, 4, "frvaddr6"); |
5333 | if (!card->vlangrp) | 5387 | |
5334 | return; | ||
5335 | in6_dev = in6_dev_get(card->vlangrp->vlan_devices[vid]); | 5388 | in6_dev = in6_dev_get(card->vlangrp->vlan_devices[vid]); |
5336 | if (!in6_dev) | 5389 | if (!in6_dev) |
5337 | return; | 5390 | return; |
@@ -5351,10 +5404,38 @@ qeth_free_vlan_addresses6(struct qeth_card *card, unsigned short vid) | |||
5351 | } | 5404 | } |
5352 | 5405 | ||
5353 | static void | 5406 | static void |
5407 | qeth_free_vlan_addresses(struct qeth_card *card, unsigned short vid) | ||
5408 | { | ||
5409 | if (card->options.layer2 || !card->vlangrp) | ||
5410 | return; | ||
5411 | qeth_free_vlan_addresses4(card, vid); | ||
5412 | qeth_free_vlan_addresses6(card, vid); | ||
5413 | } | ||
5414 | |||
5415 | static int | ||
5416 | qeth_layer2_send_setdelvlan_cb(struct qeth_card *card, | ||
5417 | struct qeth_reply *reply, | ||
5418 | unsigned long data) | ||
5419 | { | ||
5420 | struct qeth_ipa_cmd *cmd; | ||
5421 | |||
5422 | QETH_DBF_TEXT(trace, 2, "L2sdvcb"); | ||
5423 | cmd = (struct qeth_ipa_cmd *) data; | ||
5424 | if (cmd->hdr.return_code) { | ||
5425 | PRINT_ERR("Error in processing VLAN %i on %s: 0x%x. " | ||
5426 | "Continuing\n",cmd->data.setdelvlan.vlan_id, | ||
5427 | QETH_CARD_IFNAME(card), cmd->hdr.return_code); | ||
5428 | QETH_DBF_TEXT_(trace, 2, "L2VL%4x", cmd->hdr.command); | ||
5429 | QETH_DBF_TEXT_(trace, 2, "L2%s", CARD_BUS_ID(card)); | ||
5430 | QETH_DBF_TEXT_(trace, 2, "err%d", cmd->hdr.return_code); | ||
5431 | } | ||
5432 | return 0; | ||
5433 | } | ||
5434 | |||
5435 | static int | ||
5354 | qeth_layer2_send_setdelvlan(struct qeth_card *card, __u16 i, | 5436 | qeth_layer2_send_setdelvlan(struct qeth_card *card, __u16 i, |
5355 | enum qeth_ipa_cmds ipacmd) | 5437 | enum qeth_ipa_cmds ipacmd) |
5356 | { | 5438 | { |
5357 | int rc; | ||
5358 | struct qeth_ipa_cmd *cmd; | 5439 | struct qeth_ipa_cmd *cmd; |
5359 | struct qeth_cmd_buffer *iob; | 5440 | struct qeth_cmd_buffer *iob; |
5360 | 5441 | ||
@@ -5362,15 +5443,8 @@ qeth_layer2_send_setdelvlan(struct qeth_card *card, __u16 i, | |||
5362 | iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4); | 5443 | iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4); |
5363 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 5444 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
5364 | cmd->data.setdelvlan.vlan_id = i; | 5445 | cmd->data.setdelvlan.vlan_id = i; |
5365 | 5446 | return qeth_send_ipa_cmd(card, iob, | |
5366 | rc = qeth_send_ipa_cmd(card, iob, NULL, NULL); | 5447 | qeth_layer2_send_setdelvlan_cb, NULL); |
5367 | if (rc) { | ||
5368 | PRINT_ERR("Error in processing VLAN %i on %s: 0x%x. " | ||
5369 | "Continuing\n",i, QETH_CARD_IFNAME(card), rc); | ||
5370 | QETH_DBF_TEXT_(trace, 2, "L2VL%4x", ipacmd); | ||
5371 | QETH_DBF_TEXT_(trace, 2, "L2%s", CARD_BUS_ID(card)); | ||
5372 | QETH_DBF_TEXT_(trace, 2, "err%d", rc); | ||
5373 | } | ||
5374 | } | 5448 | } |
5375 | 5449 | ||
5376 | static void | 5450 | static void |
@@ -5420,8 +5494,7 @@ qeth_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | |||
5420 | qeth_free_vlan_skbs(card, vid); | 5494 | qeth_free_vlan_skbs(card, vid); |
5421 | spin_lock_irqsave(&card->vlanlock, flags); | 5495 | spin_lock_irqsave(&card->vlanlock, flags); |
5422 | /* unregister IP addresses of vlan device */ | 5496 | /* unregister IP addresses of vlan device */ |
5423 | qeth_free_vlan_addresses4(card, vid); | 5497 | qeth_free_vlan_addresses(card, vid); |
5424 | qeth_free_vlan_addresses6(card, vid); | ||
5425 | if (card->vlangrp) | 5498 | if (card->vlangrp) |
5426 | card->vlangrp->vlan_devices[vid] = NULL; | 5499 | card->vlangrp->vlan_devices[vid] = NULL; |
5427 | spin_unlock_irqrestore(&card->vlanlock, flags); | 5500 | spin_unlock_irqrestore(&card->vlanlock, flags); |
@@ -5430,6 +5503,59 @@ qeth_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | |||
5430 | qeth_set_multicast_list(card->dev); | 5503 | qeth_set_multicast_list(card->dev); |
5431 | } | 5504 | } |
5432 | #endif | 5505 | #endif |
5506 | /** | ||
5507 | * Examine hardware response to SET_PROMISC_MODE | ||
5508 | */ | ||
5509 | static int | ||
5510 | qeth_setadp_promisc_mode_cb(struct qeth_card *card, | ||
5511 | struct qeth_reply *reply, | ||
5512 | unsigned long data) | ||
5513 | { | ||
5514 | struct qeth_ipa_cmd *cmd; | ||
5515 | struct qeth_ipacmd_setadpparms *setparms; | ||
5516 | |||
5517 | QETH_DBF_TEXT(trace,4,"prmadpcb"); | ||
5518 | |||
5519 | cmd = (struct qeth_ipa_cmd *) data; | ||
5520 | setparms = &(cmd->data.setadapterparms); | ||
5521 | |||
5522 | qeth_default_setadapterparms_cb(card, reply, (unsigned long)cmd); | ||
5523 | if (cmd->hdr.return_code) { | ||
5524 | QETH_DBF_TEXT_(trace,4,"prmrc%2.2x",cmd->hdr.return_code); | ||
5525 | setparms->data.mode = SET_PROMISC_MODE_OFF; | ||
5526 | } | ||
5527 | card->info.promisc_mode = setparms->data.mode; | ||
5528 | return 0; | ||
5529 | } | ||
5530 | /* | ||
5531 | * Set promiscuous mode (on or off) (SET_PROMISC_MODE command) | ||
5532 | */ | ||
5533 | static void | ||
5534 | qeth_setadp_promisc_mode(struct qeth_card *card) | ||
5535 | { | ||
5536 | enum qeth_ipa_promisc_modes mode; | ||
5537 | struct net_device *dev = card->dev; | ||
5538 | struct qeth_cmd_buffer *iob; | ||
5539 | struct qeth_ipa_cmd *cmd; | ||
5540 | |||
5541 | QETH_DBF_TEXT(trace, 4, "setprom"); | ||
5542 | |||
5543 | if (((dev->flags & IFF_PROMISC) && | ||
5544 | (card->info.promisc_mode == SET_PROMISC_MODE_ON)) || | ||
5545 | (!(dev->flags & IFF_PROMISC) && | ||
5546 | (card->info.promisc_mode == SET_PROMISC_MODE_OFF))) | ||
5547 | return; | ||
5548 | mode = SET_PROMISC_MODE_OFF; | ||
5549 | if (dev->flags & IFF_PROMISC) | ||
5550 | mode = SET_PROMISC_MODE_ON; | ||
5551 | QETH_DBF_TEXT_(trace, 4, "mode:%x", mode); | ||
5552 | |||
5553 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_PROMISC_MODE, | ||
5554 | sizeof(struct qeth_ipacmd_setadpparms)); | ||
5555 | cmd = (struct qeth_ipa_cmd *)(iob->data + IPA_PDU_HEADER_SIZE); | ||
5556 | cmd->data.setadapterparms.data.mode = mode; | ||
5557 | qeth_send_ipa_cmd(card, iob, qeth_setadp_promisc_mode_cb, NULL); | ||
5558 | } | ||
5433 | 5559 | ||
5434 | /** | 5560 | /** |
5435 | * set multicast address on card | 5561 | * set multicast address on card |
@@ -5444,12 +5570,22 @@ qeth_set_multicast_list(struct net_device *dev) | |||
5444 | 5570 | ||
5445 | QETH_DBF_TEXT(trace,3,"setmulti"); | 5571 | QETH_DBF_TEXT(trace,3,"setmulti"); |
5446 | qeth_delete_mc_addresses(card); | 5572 | qeth_delete_mc_addresses(card); |
5573 | if (card->options.layer2) { | ||
5574 | qeth_layer2_add_multicast(card); | ||
5575 | goto out; | ||
5576 | } | ||
5447 | qeth_add_multicast_ipv4(card); | 5577 | qeth_add_multicast_ipv4(card); |
5448 | #ifdef CONFIG_QETH_IPV6 | 5578 | #ifdef CONFIG_QETH_IPV6 |
5449 | qeth_add_multicast_ipv6(card); | 5579 | qeth_add_multicast_ipv6(card); |
5450 | #endif | 5580 | #endif |
5581 | out: | ||
5451 | if (qeth_set_thread_start_bit(card, QETH_SET_IP_THREAD) == 0) | 5582 | if (qeth_set_thread_start_bit(card, QETH_SET_IP_THREAD) == 0) |
5452 | schedule_work(&card->kernel_thread_starter); | 5583 | schedule_work(&card->kernel_thread_starter); |
5584 | if (!qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE)) | ||
5585 | return; | ||
5586 | if (qeth_set_thread_start_bit(card, QETH_SET_PROMISC_MODE_THREAD)==0) | ||
5587 | schedule_work(&card->kernel_thread_starter); | ||
5588 | |||
5453 | } | 5589 | } |
5454 | 5590 | ||
5455 | static int | 5591 | static int |
@@ -5657,6 +5793,24 @@ qeth_add_multicast_ipv4(struct qeth_card *card) | |||
5657 | in_dev_put(in4_dev); | 5793 | in_dev_put(in4_dev); |
5658 | } | 5794 | } |
5659 | 5795 | ||
5796 | static void | ||
5797 | qeth_layer2_add_multicast(struct qeth_card *card) | ||
5798 | { | ||
5799 | struct qeth_ipaddr *ipm; | ||
5800 | struct dev_mc_list *dm; | ||
5801 | |||
5802 | QETH_DBF_TEXT(trace,4,"L2addmc"); | ||
5803 | for (dm = card->dev->mc_list; dm; dm = dm->next) { | ||
5804 | ipm = qeth_get_addr_buffer(QETH_PROT_IPV4); | ||
5805 | if (!ipm) | ||
5806 | continue; | ||
5807 | memcpy(ipm->mac,dm->dmi_addr,MAX_ADDR_LEN); | ||
5808 | ipm->is_multicast = 1; | ||
5809 | if (!qeth_add_ip(card, ipm)) | ||
5810 | kfree(ipm); | ||
5811 | } | ||
5812 | } | ||
5813 | |||
5660 | #ifdef CONFIG_QETH_IPV6 | 5814 | #ifdef CONFIG_QETH_IPV6 |
5661 | static inline void | 5815 | static inline void |
5662 | qeth_add_mc6(struct qeth_card *card, struct inet6_dev *in6_dev) | 5816 | qeth_add_mc6(struct qeth_card *card, struct inet6_dev *in6_dev) |
@@ -5825,10 +5979,10 @@ qeth_layer2_send_setmac_cb(struct qeth_card *card, | |||
5825 | PRINT_WARN("Error in registering MAC address on " \ | 5979 | PRINT_WARN("Error in registering MAC address on " \ |
5826 | "device %s: x%x\n", CARD_BUS_ID(card), | 5980 | "device %s: x%x\n", CARD_BUS_ID(card), |
5827 | cmd->hdr.return_code); | 5981 | cmd->hdr.return_code); |
5828 | card->info.layer2_mac_registered = 0; | 5982 | card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; |
5829 | cmd->hdr.return_code = -EIO; | 5983 | cmd->hdr.return_code = -EIO; |
5830 | } else { | 5984 | } else { |
5831 | card->info.layer2_mac_registered = 1; | 5985 | card->info.mac_bits |= QETH_LAYER2_MAC_REGISTERED; |
5832 | memcpy(card->dev->dev_addr,cmd->data.setdelmac.mac, | 5986 | memcpy(card->dev->dev_addr,cmd->data.setdelmac.mac, |
5833 | OSA_ADDR_LEN); | 5987 | OSA_ADDR_LEN); |
5834 | PRINT_INFO("MAC address %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x " | 5988 | PRINT_INFO("MAC address %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x " |
@@ -5866,7 +6020,7 @@ qeth_layer2_send_delmac_cb(struct qeth_card *card, | |||
5866 | cmd->hdr.return_code = -EIO; | 6020 | cmd->hdr.return_code = -EIO; |
5867 | return 0; | 6021 | return 0; |
5868 | } | 6022 | } |
5869 | card->info.layer2_mac_registered = 0; | 6023 | card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; |
5870 | 6024 | ||
5871 | return 0; | 6025 | return 0; |
5872 | } | 6026 | } |
@@ -5874,7 +6028,7 @@ static int | |||
5874 | qeth_layer2_send_delmac(struct qeth_card *card, __u8 *mac) | 6028 | qeth_layer2_send_delmac(struct qeth_card *card, __u8 *mac) |
5875 | { | 6029 | { |
5876 | QETH_DBF_TEXT(trace, 2, "L2Delmac"); | 6030 | QETH_DBF_TEXT(trace, 2, "L2Delmac"); |
5877 | if (!card->info.layer2_mac_registered) | 6031 | if (!(card->info.mac_bits & QETH_LAYER2_MAC_REGISTERED)) |
5878 | return 0; | 6032 | return 0; |
5879 | return qeth_layer2_send_setdelmac(card, mac, IPA_CMD_DELVMAC, | 6033 | return qeth_layer2_send_setdelmac(card, mac, IPA_CMD_DELVMAC, |
5880 | qeth_layer2_send_delmac_cb); | 6034 | qeth_layer2_send_delmac_cb); |
@@ -5896,7 +6050,7 @@ qeth_layer2_set_mac_address(struct net_device *dev, void *p) | |||
5896 | card = (struct qeth_card *) dev->priv; | 6050 | card = (struct qeth_card *) dev->priv; |
5897 | 6051 | ||
5898 | if (!card->options.layer2) { | 6052 | if (!card->options.layer2) { |
5899 | PRINT_WARN("Setting MAC address on %s is not supported" | 6053 | PRINT_WARN("Setting MAC address on %s is not supported " |
5900 | "in Layer 3 mode.\n", dev->name); | 6054 | "in Layer 3 mode.\n", dev->name); |
5901 | QETH_DBF_TEXT(trace, 3, "setmcLY3"); | 6055 | QETH_DBF_TEXT(trace, 3, "setmcLY3"); |
5902 | return -EOPNOTSUPP; | 6056 | return -EOPNOTSUPP; |
@@ -6441,6 +6595,8 @@ qeth_default_setadapterparms_cb(struct qeth_card *card, | |||
6441 | return 0; | 6595 | return 0; |
6442 | } | 6596 | } |
6443 | 6597 | ||
6598 | |||
6599 | |||
6444 | static int | 6600 | static int |
6445 | qeth_query_setadapterparms_cb(struct qeth_card *card, struct qeth_reply *reply, | 6601 | qeth_query_setadapterparms_cb(struct qeth_card *card, struct qeth_reply *reply, |
6446 | unsigned long data) | 6602 | unsigned long data) |
@@ -6481,8 +6637,13 @@ qeth_setadpparms_change_macaddr_cb(struct qeth_card *card, | |||
6481 | QETH_DBF_TEXT(trace,4,"chgmaccb"); | 6637 | QETH_DBF_TEXT(trace,4,"chgmaccb"); |
6482 | 6638 | ||
6483 | cmd = (struct qeth_ipa_cmd *) data; | 6639 | cmd = (struct qeth_ipa_cmd *) data; |
6484 | memcpy(card->dev->dev_addr, | 6640 | if (!card->options.layer2 || card->info.guestlan || |
6485 | &cmd->data.setadapterparms.data.change_addr.addr,OSA_ADDR_LEN); | 6641 | !(card->info.mac_bits & QETH_LAYER2_MAC_READ)) { |
6642 | memcpy(card->dev->dev_addr, | ||
6643 | &cmd->data.setadapterparms.data.change_addr.addr, | ||
6644 | OSA_ADDR_LEN); | ||
6645 | card->info.mac_bits |= QETH_LAYER2_MAC_READ; | ||
6646 | } | ||
6486 | qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd); | 6647 | qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd); |
6487 | return 0; | 6648 | return 0; |
6488 | } | 6649 | } |
@@ -6602,6 +6763,12 @@ qeth_layer2_initialize(struct qeth_card *card) | |||
6602 | QETH_DBF_TEXT(setup, 2, "doL2init"); | 6763 | QETH_DBF_TEXT(setup, 2, "doL2init"); |
6603 | QETH_DBF_TEXT_(setup, 2, "doL2%s", CARD_BUS_ID(card)); | 6764 | QETH_DBF_TEXT_(setup, 2, "doL2%s", CARD_BUS_ID(card)); |
6604 | 6765 | ||
6766 | rc = qeth_query_setadapterparms(card); | ||
6767 | if (rc) { | ||
6768 | PRINT_WARN("could not query adapter parameters on device %s: " | ||
6769 | "x%x\n", CARD_BUS_ID(card), rc); | ||
6770 | } | ||
6771 | |||
6605 | rc = qeth_setadpparms_change_macaddr(card); | 6772 | rc = qeth_setadpparms_change_macaddr(card); |
6606 | if (rc) { | 6773 | if (rc) { |
6607 | PRINT_WARN("couldn't get MAC address on " | 6774 | PRINT_WARN("couldn't get MAC address on " |
@@ -8548,7 +8715,7 @@ EXPORT_SYMBOL(qeth_osn_deregister); | |||
8548 | EXPORT_SYMBOL(qeth_osn_assist); | 8715 | EXPORT_SYMBOL(qeth_osn_assist); |
8549 | module_init(qeth_init); | 8716 | module_init(qeth_init); |
8550 | module_exit(qeth_exit); | 8717 | module_exit(qeth_exit); |
8551 | MODULE_AUTHOR("Frank Pavlic <pavlic@de.ibm.com>"); | 8718 | MODULE_AUTHOR("Frank Pavlic <fpavlic@de.ibm.com>"); |
8552 | MODULE_DESCRIPTION("Linux on zSeries OSA Express and HiperSockets support\n" \ | 8719 | MODULE_DESCRIPTION("Linux on zSeries OSA Express and HiperSockets support\n" \ |
8553 | "Copyright 2000,2003 IBM Corporation\n"); | 8720 | "Copyright 2000,2003 IBM Corporation\n"); |
8554 | 8721 | ||
diff --git a/drivers/s390/net/qeth_mpc.c b/drivers/s390/net/qeth_mpc.c index 30e053d3cac2..f0a080a9e515 100644 --- a/drivers/s390/net/qeth_mpc.c +++ b/drivers/s390/net/qeth_mpc.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Linux on zSeries OSA Express and HiperSockets support | 4 | * Linux on zSeries OSA Express and HiperSockets support |
5 | * | 5 | * |
6 | * Copyright 2000,2003 IBM Corporation | 6 | * Copyright 2000,2003 IBM Corporation |
7 | * Author(s): Frank Pavlic <pavlic@de.ibm.com> | 7 | * Author(s): Frank Pavlic <fpavlic@de.ibm.com> |
8 | * Thomas Spatzier <tspat@de.ibm.com> | 8 | * Thomas Spatzier <tspat@de.ibm.com> |
9 | * | 9 | * |
10 | */ | 10 | */ |
diff --git a/drivers/s390/net/qeth_mpc.h b/drivers/s390/net/qeth_mpc.h index 7edc5f1fc0d2..5f71486e708c 100644 --- a/drivers/s390/net/qeth_mpc.h +++ b/drivers/s390/net/qeth_mpc.h | |||
@@ -6,7 +6,7 @@ | |||
6 | * Copyright 2000,2003 IBM Corporation | 6 | * Copyright 2000,2003 IBM Corporation |
7 | * Author(s): Utz Bacher <utz.bacher@de.ibm.com> | 7 | * Author(s): Utz Bacher <utz.bacher@de.ibm.com> |
8 | * Thomas Spatzier <tspat@de.ibm.com> | 8 | * Thomas Spatzier <tspat@de.ibm.com> |
9 | * Frank Pavlic <pavlic@de.ibm.com> | 9 | * Frank Pavlic <fpavlic@de.ibm.com> |
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | #ifndef __QETH_MPC_H__ | 12 | #ifndef __QETH_MPC_H__ |
@@ -14,7 +14,7 @@ | |||
14 | 14 | ||
15 | #include <asm/qeth.h> | 15 | #include <asm/qeth.h> |
16 | 16 | ||
17 | #define VERSION_QETH_MPC_H "$Revision: 1.43 $" | 17 | #define VERSION_QETH_MPC_H "$Revision: 1.44 $" |
18 | 18 | ||
19 | extern const char *VERSION_QETH_MPC_C; | 19 | extern const char *VERSION_QETH_MPC_C; |
20 | 20 | ||
@@ -217,7 +217,7 @@ enum qeth_ipa_setadp_cmd { | |||
217 | IPA_SETADP_SEND_OSA_MESSAGE = 0x0100, | 217 | IPA_SETADP_SEND_OSA_MESSAGE = 0x0100, |
218 | IPA_SETADP_SET_SNMP_CONTROL = 0x0200, | 218 | IPA_SETADP_SET_SNMP_CONTROL = 0x0200, |
219 | IPA_SETADP_READ_SNMP_PARMS = 0x0400, | 219 | IPA_SETADP_READ_SNMP_PARMS = 0x0400, |
220 | IPA_SETADP_WRITE_SNMP_PARMS = 0x0800, | 220 | IPA_SETADP_SET_PROMISC_MODE = 0x0800, |
221 | IPA_SETADP_QUERY_CARD_INFO = 0x1000, | 221 | IPA_SETADP_QUERY_CARD_INFO = 0x1000, |
222 | }; | 222 | }; |
223 | enum qeth_ipa_mac_ops { | 223 | enum qeth_ipa_mac_ops { |
@@ -232,9 +232,12 @@ enum qeth_ipa_addr_ops { | |||
232 | CHANGE_ADDR_ADD_ADDR = 1, | 232 | CHANGE_ADDR_ADD_ADDR = 1, |
233 | CHANGE_ADDR_DEL_ADDR = 2, | 233 | CHANGE_ADDR_DEL_ADDR = 2, |
234 | CHANGE_ADDR_FLUSH_ADDR_TABLE = 4, | 234 | CHANGE_ADDR_FLUSH_ADDR_TABLE = 4, |
235 | |||
236 | |||
237 | }; | 235 | }; |
236 | enum qeth_ipa_promisc_modes { | ||
237 | SET_PROMISC_MODE_OFF = 0, | ||
238 | SET_PROMISC_MODE_ON = 1, | ||
239 | }; | ||
240 | |||
238 | /* (SET)DELIP(M) IPA stuff ***************************************************/ | 241 | /* (SET)DELIP(M) IPA stuff ***************************************************/ |
239 | struct qeth_ipacmd_setdelip4 { | 242 | struct qeth_ipacmd_setdelip4 { |
240 | __u8 ip_addr[4]; | 243 | __u8 ip_addr[4]; |
diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c index f91a02db5743..ddd6019ba092 100644 --- a/drivers/s390/net/qeth_sys.c +++ b/drivers/s390/net/qeth_sys.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.55 $) | 3 | * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.58 $) |
4 | * | 4 | * |
5 | * Linux on zSeries OSA Express and HiperSockets support | 5 | * Linux on zSeries OSA Express and HiperSockets support |
6 | * This file contains code related to sysfs. | 6 | * This file contains code related to sysfs. |
@@ -8,7 +8,7 @@ | |||
8 | * Copyright 2000,2003 IBM Corporation | 8 | * Copyright 2000,2003 IBM Corporation |
9 | * | 9 | * |
10 | * Author(s): Thomas Spatzier <tspat@de.ibm.com> | 10 | * Author(s): Thomas Spatzier <tspat@de.ibm.com> |
11 | * Frank Pavlic <pavlic@de.ibm.com> | 11 | * Frank Pavlic <fpavlic@de.ibm.com> |
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | #include <linux/list.h> | 14 | #include <linux/list.h> |
@@ -20,7 +20,7 @@ | |||
20 | #include "qeth_mpc.h" | 20 | #include "qeth_mpc.h" |
21 | #include "qeth_fs.h" | 21 | #include "qeth_fs.h" |
22 | 22 | ||
23 | const char *VERSION_QETH_SYS_C = "$Revision: 1.55 $"; | 23 | const char *VERSION_QETH_SYS_C = "$Revision: 1.58 $"; |
24 | 24 | ||
25 | /*****************************************************************************/ | 25 | /*****************************************************************************/ |
26 | /* */ | 26 | /* */ |
@@ -1117,7 +1117,7 @@ qeth_parse_ipatoe(const char* buf, enum qeth_prot_versions proto, | |||
1117 | start = buf; | 1117 | start = buf; |
1118 | /* get address string */ | 1118 | /* get address string */ |
1119 | end = strchr(start, '/'); | 1119 | end = strchr(start, '/'); |
1120 | if (!end){ | 1120 | if (!end || (end-start >= 49)){ |
1121 | PRINT_WARN("Invalid format for ipato_addx/delx. " | 1121 | PRINT_WARN("Invalid format for ipato_addx/delx. " |
1122 | "Use <ip addr>/<mask bits>\n"); | 1122 | "Use <ip addr>/<mask bits>\n"); |
1123 | return -EINVAL; | 1123 | return -EINVAL; |
diff --git a/drivers/s390/net/qeth_tso.h b/drivers/s390/net/qeth_tso.h index ad33e6f466f1..e245af3c4cbd 100644 --- a/drivers/s390/net/qeth_tso.h +++ b/drivers/s390/net/qeth_tso.h | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * Copyright 2004 IBM Corporation | 6 | * Copyright 2004 IBM Corporation |
7 | * | 7 | * |
8 | * Author(s): Frank Pavlic <pavlic@de.ibm.com> | 8 | * Author(s): Frank Pavlic <fpavlic@de.ibm.com> |
9 | * | 9 | * |
10 | * $Revision: 1.7 $ $Date: 2005/05/04 20:19:18 $ | 10 | * $Revision: 1.7 $ $Date: 2005/05/04 20:19:18 $ |
11 | * | 11 | * |