aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-03 11:15:08 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-03 11:15:08 -0500
commite87cb5db0dc357473ac71801051954ddd6ff604f (patch)
treee901e2ed972dfe81af6a61cfb3424d94bad13b82 /drivers
parentd894f4510d2155f9136c8c1bb91912481329f6e0 (diff)
parent9ec46c6dae343688ff1136a0899b6a3c5e95e44b (diff)
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (48 commits) LIB82596: correct data types for hardware addresses via-velocity: don't oops on MTU change (resend) Stop phy code from returning success to unknown ioctls. SET_NETDEV_DEV() in fec_mpc52xx.c net: smc911x: only enable for mpr2 on sh. e1000: Fix NAPI state bug when Rx complete sky2: turn of dynamic Tx watermark workaround (FE+ only) sky2: don't use AER routines sky2: revert to access PCI config via device space cxgb - fix stats cxgb - fix NAPI cxgb - fix T2 GSO ucc_geth: handle passing of RX-only and TX-only internal delay PHY connection type parameters phylib: marvell: add support for TX-only and RX-only Internal Delay phylib: add PHY interface modes for internal delay for tx and rx only skge: MTU changing fix skge: serial mode register values skge version 1.13 skge: increase TX threshold for Jumbo skge: fiber link up/down fix ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/Kconfig4
-rw-r--r--drivers/net/amd8111e.c6
-rw-r--r--drivers/net/bfin_mac.c2
-rwxr-xr-x[-rw-r--r--]drivers/net/chelsio/cxgb2.c70
-rwxr-xr-x[-rw-r--r--]drivers/net/chelsio/pm3393.c112
-rwxr-xr-x[-rw-r--r--]drivers/net/chelsio/sge.c44
-rwxr-xr-x[-rw-r--r--]drivers/net/chelsio/sge.h3
-rw-r--r--drivers/net/e1000/e1000_main.c2
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_main.c20
-rw-r--r--drivers/net/ehea/ehea_qmr.h4
-rw-r--r--drivers/net/fec_mpc52xx.c2
-rw-r--r--drivers/net/forcedeth.c38
-rw-r--r--drivers/net/ibm_newemac/core.c31
-rw-r--r--drivers/net/ibm_newemac/core.h1
-rw-r--r--drivers/net/lib82596.c50
-rw-r--r--drivers/net/phy/marvell.c26
-rw-r--r--drivers/net/phy/phy.c3
-rw-r--r--drivers/net/s2io.c32
-rw-r--r--drivers/net/skge.c108
-rw-r--r--drivers/net/sky2.c121
-rw-r--r--drivers/net/sky2.h21
-rw-r--r--drivers/net/smc911x.c19
-rw-r--r--drivers/net/smc911x.h2
-rw-r--r--drivers/net/smc91x.h2
-rw-r--r--drivers/net/tulip/dmfe.c4
-rw-r--r--drivers/net/ucc_geth.c10
-rw-r--r--drivers/net/usb/dm9601.c2
-rw-r--r--drivers/net/via-velocity.c11
-rw-r--r--drivers/net/wireless/b43/main.c2
-rw-r--r--drivers/net/wireless/b43/phy.c2
-rw-r--r--drivers/net/wireless/b43legacy/dma.c2
-rw-r--r--drivers/net/wireless/b43legacy/main.c2
-rw-r--r--drivers/net/wireless/b43legacy/phy.c2
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_phy.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c13
-rw-r--r--drivers/net/wireless/libertas/if_cs.c3
-rw-r--r--drivers/net/wireless/libertas/main.c4
-rw-r--r--drivers/net/wireless/libertas/wext.c2
-rw-r--r--drivers/net/wireless/netwave_cs.c2
-rw-r--r--drivers/net/wireless/p54usb.c2
-rw-r--r--drivers/s390/net/ctcmain.c45
43 files changed, 437 insertions, 414 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index e8d69b0adf90..d9107e542dfa 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -888,7 +888,7 @@ config SMC91X
888 tristate "SMC 91C9x/91C1xxx support" 888 tristate "SMC 91C9x/91C1xxx support"
889 select CRC32 889 select CRC32
890 select MII 890 select MII
891 depends on ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH || SOC_AU1X00 || BFIN 891 depends on ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH || SOC_AU1X00 || BLACKFIN
892 help 892 help
893 This is a driver for SMC's 91x series of Ethernet chipsets, 893 This is a driver for SMC's 91x series of Ethernet chipsets,
894 including the SMC91C94 and the SMC91C111. Say Y if you want it 894 including the SMC91C94 and the SMC91C111. Say Y if you want it
@@ -926,7 +926,7 @@ config SMC911X
926 tristate "SMSC LAN911[5678] support" 926 tristate "SMSC LAN911[5678] support"
927 select CRC32 927 select CRC32
928 select MII 928 select MII
929 depends on ARCH_PXA || SUPERH 929 depends on ARCH_PXA || SH_MAGIC_PANEL_R2
930 help 930 help
931 This is a driver for SMSC's LAN911x series of Ethernet chipsets 931 This is a driver for SMSC's LAN911x series of Ethernet chipsets
932 including the new LAN9115, LAN9116, LAN9117, and LAN9118. 932 including the new LAN9115, LAN9116, LAN9117, and LAN9118.
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index eebf5bb2b03a..e7fdd81919bd 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1340,7 +1340,9 @@ static int amd8111e_close(struct net_device * dev)
1340 struct amd8111e_priv *lp = netdev_priv(dev); 1340 struct amd8111e_priv *lp = netdev_priv(dev);
1341 netif_stop_queue(dev); 1341 netif_stop_queue(dev);
1342 1342
1343#ifdef CONFIG_AMD8111E_NAPI
1343 napi_disable(&lp->napi); 1344 napi_disable(&lp->napi);
1345#endif
1344 1346
1345 spin_lock_irq(&lp->lock); 1347 spin_lock_irq(&lp->lock);
1346 1348
@@ -1372,7 +1374,9 @@ static int amd8111e_open(struct net_device * dev )
1372 dev->name, dev)) 1374 dev->name, dev))
1373 return -EAGAIN; 1375 return -EAGAIN;
1374 1376
1377#ifdef CONFIG_AMD8111E_NAPI
1375 napi_enable(&lp->napi); 1378 napi_enable(&lp->napi);
1379#endif
1376 1380
1377 spin_lock_irq(&lp->lock); 1381 spin_lock_irq(&lp->lock);
1378 1382
@@ -1380,7 +1384,9 @@ static int amd8111e_open(struct net_device * dev )
1380 1384
1381 if(amd8111e_restart(dev)){ 1385 if(amd8111e_restart(dev)){
1382 spin_unlock_irq(&lp->lock); 1386 spin_unlock_irq(&lp->lock);
1387#ifdef CONFIG_AMD8111E_NAPI
1383 napi_disable(&lp->napi); 1388 napi_disable(&lp->napi);
1389#endif
1384 if (dev->irq) 1390 if (dev->irq)
1385 free_irq(dev->irq, dev); 1391 free_irq(dev->irq, dev);
1386 return -ENOMEM; 1392 return -ENOMEM;
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 0b99b5549295..eb971755a3ff 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -676,7 +676,7 @@ static void bf537mac_rx(struct net_device *dev)
676 skb->protocol = eth_type_trans(skb, dev); 676 skb->protocol = eth_type_trans(skb, dev);
677#if defined(BFIN_MAC_CSUM_OFFLOAD) 677#if defined(BFIN_MAC_CSUM_OFFLOAD)
678 skb->csum = current_rx_ptr->status.ip_payload_csum; 678 skb->csum = current_rx_ptr->status.ip_payload_csum;
679 skb->ip_summed = CHECKSUM_PARTIAL; 679 skb->ip_summed = CHECKSUM_COMPLETE;
680#endif 680#endif
681 681
682 netif_rx(skb); 682 netif_rx(skb);
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
index 2dbf8dc116c6..c5975047c89b 100644..100755
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -374,7 +374,9 @@ static char stats_strings[][ETH_GSTRING_LEN] = {
374 "TxInternalMACXmitError", 374 "TxInternalMACXmitError",
375 "TxFramesWithExcessiveDeferral", 375 "TxFramesWithExcessiveDeferral",
376 "TxFCSErrors", 376 "TxFCSErrors",
377 377 "TxJumboFramesOk",
378 "TxJumboOctetsOk",
379
378 "RxOctetsOK", 380 "RxOctetsOK",
379 "RxOctetsBad", 381 "RxOctetsBad",
380 "RxUnicastFramesOK", 382 "RxUnicastFramesOK",
@@ -392,16 +394,17 @@ static char stats_strings[][ETH_GSTRING_LEN] = {
392 "RxInRangeLengthErrors", 394 "RxInRangeLengthErrors",
393 "RxOutOfRangeLengthField", 395 "RxOutOfRangeLengthField",
394 "RxFrameTooLongErrors", 396 "RxFrameTooLongErrors",
397 "RxJumboFramesOk",
398 "RxJumboOctetsOk",
395 399
396 /* Port stats */ 400 /* Port stats */
397 "RxPackets",
398 "RxCsumGood", 401 "RxCsumGood",
399 "TxPackets",
400 "TxCsumOffload", 402 "TxCsumOffload",
401 "TxTso", 403 "TxTso",
402 "RxVlan", 404 "RxVlan",
403 "TxVlan", 405 "TxVlan",
404 406 "TxNeedHeadroom",
407
405 /* Interrupt stats */ 408 /* Interrupt stats */
406 "rx drops", 409 "rx drops",
407 "pure_rsps", 410 "pure_rsps",
@@ -463,23 +466,56 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats,
463 const struct cmac_statistics *s; 466 const struct cmac_statistics *s;
464 const struct sge_intr_counts *t; 467 const struct sge_intr_counts *t;
465 struct sge_port_stats ss; 468 struct sge_port_stats ss;
466 unsigned int len;
467 469
468 s = mac->ops->statistics_update(mac, MAC_STATS_UPDATE_FULL); 470 s = mac->ops->statistics_update(mac, MAC_STATS_UPDATE_FULL);
469 471 t = t1_sge_get_intr_counts(adapter->sge);
470 len = sizeof(u64)*(&s->TxFCSErrors + 1 - &s->TxOctetsOK);
471 memcpy(data, &s->TxOctetsOK, len);
472 data += len;
473
474 len = sizeof(u64)*(&s->RxFrameTooLongErrors + 1 - &s->RxOctetsOK);
475 memcpy(data, &s->RxOctetsOK, len);
476 data += len;
477
478 t1_sge_get_port_stats(adapter->sge, dev->if_port, &ss); 472 t1_sge_get_port_stats(adapter->sge, dev->if_port, &ss);
479 memcpy(data, &ss, sizeof(ss));
480 data += sizeof(ss);
481 473
482 t = t1_sge_get_intr_counts(adapter->sge); 474 *data++ = s->TxOctetsOK;
475 *data++ = s->TxOctetsBad;
476 *data++ = s->TxUnicastFramesOK;
477 *data++ = s->TxMulticastFramesOK;
478 *data++ = s->TxBroadcastFramesOK;
479 *data++ = s->TxPauseFrames;
480 *data++ = s->TxFramesWithDeferredXmissions;
481 *data++ = s->TxLateCollisions;
482 *data++ = s->TxTotalCollisions;
483 *data++ = s->TxFramesAbortedDueToXSCollisions;
484 *data++ = s->TxUnderrun;
485 *data++ = s->TxLengthErrors;
486 *data++ = s->TxInternalMACXmitError;
487 *data++ = s->TxFramesWithExcessiveDeferral;
488 *data++ = s->TxFCSErrors;
489 *data++ = s->TxJumboFramesOK;
490 *data++ = s->TxJumboOctetsOK;
491
492 *data++ = s->RxOctetsOK;
493 *data++ = s->RxOctetsBad;
494 *data++ = s->RxUnicastFramesOK;
495 *data++ = s->RxMulticastFramesOK;
496 *data++ = s->RxBroadcastFramesOK;
497 *data++ = s->RxPauseFrames;
498 *data++ = s->RxFCSErrors;
499 *data++ = s->RxAlignErrors;
500 *data++ = s->RxSymbolErrors;
501 *data++ = s->RxDataErrors;
502 *data++ = s->RxSequenceErrors;
503 *data++ = s->RxRuntErrors;
504 *data++ = s->RxJabberErrors;
505 *data++ = s->RxInternalMACRcvError;
506 *data++ = s->RxInRangeLengthErrors;
507 *data++ = s->RxOutOfRangeLengthField;
508 *data++ = s->RxFrameTooLongErrors;
509 *data++ = s->RxJumboFramesOK;
510 *data++ = s->RxJumboOctetsOK;
511
512 *data++ = ss.rx_cso_good;
513 *data++ = ss.tx_cso;
514 *data++ = ss.tx_tso;
515 *data++ = ss.vlan_xtract;
516 *data++ = ss.vlan_insert;
517 *data++ = ss.tx_need_hdrroom;
518
483 *data++ = t->rx_drops; 519 *data++ = t->rx_drops;
484 *data++ = t->pure_rsps; 520 *data++ = t->pure_rsps;
485 *data++ = t->unhandled_irqs; 521 *data++ = t->unhandled_irqs;
diff --git a/drivers/net/chelsio/pm3393.c b/drivers/net/chelsio/pm3393.c
index 678778a8d133..2117c4fbb107 100644..100755
--- a/drivers/net/chelsio/pm3393.c
+++ b/drivers/net/chelsio/pm3393.c
@@ -45,7 +45,7 @@
45 45
46#include <linux/crc32.h> 46#include <linux/crc32.h>
47 47
48#define OFFSET(REG_ADDR) (REG_ADDR << 2) 48#define OFFSET(REG_ADDR) ((REG_ADDR) << 2)
49 49
50/* Max frame size PM3393 can handle. Includes Ethernet header and CRC. */ 50/* Max frame size PM3393 can handle. Includes Ethernet header and CRC. */
51#define MAX_FRAME_SIZE 9600 51#define MAX_FRAME_SIZE 9600
@@ -428,69 +428,26 @@ static int pm3393_set_speed_duplex_fc(struct cmac *cmac, int speed, int duplex,
428 return 0; 428 return 0;
429} 429}
430 430
431static void pm3393_rmon_update(struct adapter *adapter, u32 offs, u64 *val, 431#define RMON_UPDATE(mac, name, stat_name) \
432 int over) 432{ \
433{ 433 t1_tpi_read((mac)->adapter, OFFSET(name), &val0); \
434 u32 val0, val1, val2; 434 t1_tpi_read((mac)->adapter, OFFSET((name)+1), &val1); \
435 435 t1_tpi_read((mac)->adapter, OFFSET((name)+2), &val2); \
436 t1_tpi_read(adapter, offs, &val0); 436 (mac)->stats.stat_name = (u64)(val0 & 0xffff) | \
437 t1_tpi_read(adapter, offs + 4, &val1); 437 ((u64)(val1 & 0xffff) << 16) | \
438 t1_tpi_read(adapter, offs + 8, &val2); 438 ((u64)(val2 & 0xff) << 32) | \
439 439 ((mac)->stats.stat_name & \
440 *val &= ~0ull << 40; 440 0xffffff0000000000ULL); \
441 *val |= val0 & 0xffff; 441 if (ro & \
442 *val |= (val1 & 0xffff) << 16; 442 (1ULL << ((name - SUNI1x10GEXP_REG_MSTAT_COUNTER_0_LOW) >> 2))) \
443 *val |= (u64)(val2 & 0xff) << 32; 443 (mac)->stats.stat_name += 1ULL << 40; \
444
445 if (over)
446 *val += 1ull << 40;
447} 444}
448 445
449static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac, 446static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac,
450 int flag) 447 int flag)
451{ 448{
452 static struct { 449 u64 ro;
453 unsigned int reg; 450 u32 val0, val1, val2, val3;
454 unsigned int offset;
455 } hw_stats [] = {
456
457#define HW_STAT(name, stat_name) \
458 { name, (&((struct cmac_statistics *)NULL)->stat_name) - (u64 *)NULL }
459
460 /* Rx stats */
461 HW_STAT(RxOctetsReceivedOK, RxOctetsOK),
462 HW_STAT(RxUnicastFramesReceivedOK, RxUnicastFramesOK),
463 HW_STAT(RxMulticastFramesReceivedOK, RxMulticastFramesOK),
464 HW_STAT(RxBroadcastFramesReceivedOK, RxBroadcastFramesOK),
465 HW_STAT(RxPAUSEMACCtrlFramesReceived, RxPauseFrames),
466 HW_STAT(RxFrameCheckSequenceErrors, RxFCSErrors),
467 HW_STAT(RxFramesLostDueToInternalMACErrors,
468 RxInternalMACRcvError),
469 HW_STAT(RxSymbolErrors, RxSymbolErrors),
470 HW_STAT(RxInRangeLengthErrors, RxInRangeLengthErrors),
471 HW_STAT(RxFramesTooLongErrors , RxFrameTooLongErrors),
472 HW_STAT(RxJabbers, RxJabberErrors),
473 HW_STAT(RxFragments, RxRuntErrors),
474 HW_STAT(RxUndersizedFrames, RxRuntErrors),
475 HW_STAT(RxJumboFramesReceivedOK, RxJumboFramesOK),
476 HW_STAT(RxJumboOctetsReceivedOK, RxJumboOctetsOK),
477
478 /* Tx stats */
479 HW_STAT(TxOctetsTransmittedOK, TxOctetsOK),
480 HW_STAT(TxFramesLostDueToInternalMACTransmissionError,
481 TxInternalMACXmitError),
482 HW_STAT(TxTransmitSystemError, TxFCSErrors),
483 HW_STAT(TxUnicastFramesTransmittedOK, TxUnicastFramesOK),
484 HW_STAT(TxMulticastFramesTransmittedOK, TxMulticastFramesOK),
485 HW_STAT(TxBroadcastFramesTransmittedOK, TxBroadcastFramesOK),
486 HW_STAT(TxPAUSEMACCtrlFramesTransmitted, TxPauseFrames),
487 HW_STAT(TxJumboFramesReceivedOK, TxJumboFramesOK),
488 HW_STAT(TxJumboOctetsReceivedOK, TxJumboOctetsOK)
489 }, *p = hw_stats;
490 u64 ro;
491 u32 val0, val1, val2, val3;
492 u64 *stats = (u64 *) &mac->stats;
493 unsigned int i;
494 451
495 /* Snap the counters */ 452 /* Snap the counters */
496 pmwrite(mac, SUNI1x10GEXP_REG_MSTAT_CONTROL, 453 pmwrite(mac, SUNI1x10GEXP_REG_MSTAT_CONTROL,
@@ -504,14 +461,35 @@ static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac,
504 ro = ((u64)val0 & 0xffff) | (((u64)val1 & 0xffff) << 16) | 461 ro = ((u64)val0 & 0xffff) | (((u64)val1 & 0xffff) << 16) |
505 (((u64)val2 & 0xffff) << 32) | (((u64)val3 & 0xffff) << 48); 462 (((u64)val2 & 0xffff) << 32) | (((u64)val3 & 0xffff) << 48);
506 463
507 for (i = 0; i < ARRAY_SIZE(hw_stats); i++) { 464 /* Rx stats */
508 unsigned reg = p->reg - SUNI1x10GEXP_REG_MSTAT_COUNTER_0_LOW; 465 RMON_UPDATE(mac, RxOctetsReceivedOK, RxOctetsOK);
509 466 RMON_UPDATE(mac, RxUnicastFramesReceivedOK, RxUnicastFramesOK);
510 pm3393_rmon_update((mac)->adapter, OFFSET(p->reg), 467 RMON_UPDATE(mac, RxMulticastFramesReceivedOK, RxMulticastFramesOK);
511 stats + p->offset, ro & (reg >> 2)); 468 RMON_UPDATE(mac, RxBroadcastFramesReceivedOK, RxBroadcastFramesOK);
512 } 469 RMON_UPDATE(mac, RxPAUSEMACCtrlFramesReceived, RxPauseFrames);
513 470 RMON_UPDATE(mac, RxFrameCheckSequenceErrors, RxFCSErrors);
514 471 RMON_UPDATE(mac, RxFramesLostDueToInternalMACErrors,
472 RxInternalMACRcvError);
473 RMON_UPDATE(mac, RxSymbolErrors, RxSymbolErrors);
474 RMON_UPDATE(mac, RxInRangeLengthErrors, RxInRangeLengthErrors);
475 RMON_UPDATE(mac, RxFramesTooLongErrors , RxFrameTooLongErrors);
476 RMON_UPDATE(mac, RxJabbers, RxJabberErrors);
477 RMON_UPDATE(mac, RxFragments, RxRuntErrors);
478 RMON_UPDATE(mac, RxUndersizedFrames, RxRuntErrors);
479 RMON_UPDATE(mac, RxJumboFramesReceivedOK, RxJumboFramesOK);
480 RMON_UPDATE(mac, RxJumboOctetsReceivedOK, RxJumboOctetsOK);
481
482 /* Tx stats */
483 RMON_UPDATE(mac, TxOctetsTransmittedOK, TxOctetsOK);
484 RMON_UPDATE(mac, TxFramesLostDueToInternalMACTransmissionError,
485 TxInternalMACXmitError);
486 RMON_UPDATE(mac, TxTransmitSystemError, TxFCSErrors);
487 RMON_UPDATE(mac, TxUnicastFramesTransmittedOK, TxUnicastFramesOK);
488 RMON_UPDATE(mac, TxMulticastFramesTransmittedOK, TxMulticastFramesOK);
489 RMON_UPDATE(mac, TxBroadcastFramesTransmittedOK, TxBroadcastFramesOK);
490 RMON_UPDATE(mac, TxPAUSEMACCtrlFramesTransmitted, TxPauseFrames);
491 RMON_UPDATE(mac, TxJumboFramesReceivedOK, TxJumboFramesOK);
492 RMON_UPDATE(mac, TxJumboOctetsReceivedOK, TxJumboOctetsOK);
515 493
516 return &mac->stats; 494 return &mac->stats;
517} 495}
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index 443666292a5c..b301c0428ae0 100644..100755
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -986,11 +986,10 @@ void t1_sge_get_port_stats(const struct sge *sge, int port,
986 for_each_possible_cpu(cpu) { 986 for_each_possible_cpu(cpu) {
987 struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[port], cpu); 987 struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[port], cpu);
988 988
989 ss->rx_packets += st->rx_packets;
990 ss->rx_cso_good += st->rx_cso_good; 989 ss->rx_cso_good += st->rx_cso_good;
991 ss->tx_packets += st->tx_packets;
992 ss->tx_cso += st->tx_cso; 990 ss->tx_cso += st->tx_cso;
993 ss->tx_tso += st->tx_tso; 991 ss->tx_tso += st->tx_tso;
992 ss->tx_need_hdrroom += st->tx_need_hdrroom;
994 ss->vlan_xtract += st->vlan_xtract; 993 ss->vlan_xtract += st->vlan_xtract;
995 ss->vlan_insert += st->vlan_insert; 994 ss->vlan_insert += st->vlan_insert;
996 } 995 }
@@ -1380,7 +1379,6 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len)
1380 __skb_pull(skb, sizeof(*p)); 1379 __skb_pull(skb, sizeof(*p));
1381 1380
1382 st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id()); 1381 st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id());
1383 st->rx_packets++;
1384 1382
1385 skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev); 1383 skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev);
1386 skb->dev->last_rx = jiffies; 1384 skb->dev->last_rx = jiffies;
@@ -1624,11 +1622,9 @@ int t1_poll(struct napi_struct *napi, int budget)
1624{ 1622{
1625 struct adapter *adapter = container_of(napi, struct adapter, napi); 1623 struct adapter *adapter = container_of(napi, struct adapter, napi);
1626 struct net_device *dev = adapter->port[0].dev; 1624 struct net_device *dev = adapter->port[0].dev;
1627 int work_done; 1625 int work_done = process_responses(adapter, budget);
1628
1629 work_done = process_responses(adapter, budget);
1630 1626
1631 if (likely(!responses_pending(adapter))) { 1627 if (likely(work_done < budget)) {
1632 netif_rx_complete(dev, napi); 1628 netif_rx_complete(dev, napi);
1633 writel(adapter->sge->respQ.cidx, 1629 writel(adapter->sge->respQ.cidx,
1634 adapter->regs + A_SG_SLEEPING); 1630 adapter->regs + A_SG_SLEEPING);
@@ -1848,7 +1844,8 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
1848{ 1844{
1849 struct adapter *adapter = dev->priv; 1845 struct adapter *adapter = dev->priv;
1850 struct sge *sge = adapter->sge; 1846 struct sge *sge = adapter->sge;
1851 struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[dev->if_port], smp_processor_id()); 1847 struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[dev->if_port],
1848 smp_processor_id());
1852 struct cpl_tx_pkt *cpl; 1849 struct cpl_tx_pkt *cpl;
1853 struct sk_buff *orig_skb = skb; 1850 struct sk_buff *orig_skb = skb;
1854 int ret; 1851 int ret;
@@ -1856,6 +1853,18 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
1856 if (skb->protocol == htons(ETH_P_CPL5)) 1853 if (skb->protocol == htons(ETH_P_CPL5))
1857 goto send; 1854 goto send;
1858 1855
1856 /*
1857 * We are using a non-standard hard_header_len.
1858 * Allocate more header room in the rare cases it is not big enough.
1859 */
1860 if (unlikely(skb_headroom(skb) < dev->hard_header_len - ETH_HLEN)) {
1861 skb = skb_realloc_headroom(skb, sizeof(struct cpl_tx_pkt_lso));
1862 ++st->tx_need_hdrroom;
1863 dev_kfree_skb_any(orig_skb);
1864 if (!skb)
1865 return NETDEV_TX_OK;
1866 }
1867
1859 if (skb_shinfo(skb)->gso_size) { 1868 if (skb_shinfo(skb)->gso_size) {
1860 int eth_type; 1869 int eth_type;
1861 struct cpl_tx_pkt_lso *hdr; 1870 struct cpl_tx_pkt_lso *hdr;
@@ -1889,24 +1898,6 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
1889 return NETDEV_TX_OK; 1898 return NETDEV_TX_OK;
1890 } 1899 }
1891 1900
1892 /*
1893 * We are using a non-standard hard_header_len and some kernel
1894 * components, such as pktgen, do not handle it right.
1895 * Complain when this happens but try to fix things up.
1896 */
1897 if (unlikely(skb_headroom(skb) < dev->hard_header_len - ETH_HLEN)) {
1898 pr_debug("%s: headroom %d header_len %d\n", dev->name,
1899 skb_headroom(skb), dev->hard_header_len);
1900
1901 if (net_ratelimit())
1902 printk(KERN_ERR "%s: inadequate headroom in "
1903 "Tx packet\n", dev->name);
1904 skb = skb_realloc_headroom(skb, sizeof(*cpl));
1905 dev_kfree_skb_any(orig_skb);
1906 if (!skb)
1907 return NETDEV_TX_OK;
1908 }
1909
1910 if (!(adapter->flags & UDP_CSUM_CAPABLE) && 1901 if (!(adapter->flags & UDP_CSUM_CAPABLE) &&
1911 skb->ip_summed == CHECKSUM_PARTIAL && 1902 skb->ip_summed == CHECKSUM_PARTIAL &&
1912 ip_hdr(skb)->protocol == IPPROTO_UDP) { 1903 ip_hdr(skb)->protocol == IPPROTO_UDP) {
@@ -1952,7 +1943,6 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
1952 cpl->vlan_valid = 0; 1943 cpl->vlan_valid = 0;
1953 1944
1954send: 1945send:
1955 st->tx_packets++;
1956 dev->trans_start = jiffies; 1946 dev->trans_start = jiffies;
1957 ret = t1_sge_tx(skb, adapter, 0, dev); 1947 ret = t1_sge_tx(skb, adapter, 0, dev);
1958 1948
diff --git a/drivers/net/chelsio/sge.h b/drivers/net/chelsio/sge.h
index 713d9c55f24d..cced9dff91c5 100644..100755
--- a/drivers/net/chelsio/sge.h
+++ b/drivers/net/chelsio/sge.h
@@ -57,13 +57,12 @@ struct sge_intr_counts {
57}; 57};
58 58
59struct sge_port_stats { 59struct sge_port_stats {
60 u64 rx_packets; /* # of Ethernet packets received */
61 u64 rx_cso_good; /* # of successful RX csum offloads */ 60 u64 rx_cso_good; /* # of successful RX csum offloads */
62 u64 tx_packets; /* # of TX packets */
63 u64 tx_cso; /* # of TX checksum offloads */ 61 u64 tx_cso; /* # of TX checksum offloads */
64 u64 tx_tso; /* # of TSO requests */ 62 u64 tx_tso; /* # of TSO requests */
65 u64 vlan_xtract; /* # of VLAN tag extractions */ 63 u64 vlan_xtract; /* # of VLAN tag extractions */
66 u64 vlan_insert; /* # of VLAN tag insertions */ 64 u64 vlan_insert; /* # of VLAN tag insertions */
65 u64 tx_need_hdrroom; /* # of TX skbs in need of more header room */
67}; 66};
68 67
69struct sk_buff; 68struct sk_buff;
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index cf39473ef90a..4f37506ad374 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3942,7 +3942,7 @@ e1000_clean(struct napi_struct *napi, int budget)
3942 &work_done, budget); 3942 &work_done, budget);
3943 3943
3944 /* If no Tx and not enough Rx work done, exit the polling mode */ 3944 /* If no Tx and not enough Rx work done, exit the polling mode */
3945 if ((!tx_cleaned && (work_done < budget)) || 3945 if ((!tx_cleaned && (work_done == 0)) ||
3946 !netif_running(poll_dev)) { 3946 !netif_running(poll_dev)) {
3947quit_polling: 3947quit_polling:
3948 if (likely(adapter->itr_setting & 3)) 3948 if (likely(adapter->itr_setting & 3))
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index f78e5bf7cb33..5f82a4647eee 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -40,7 +40,7 @@
40#include <asm/io.h> 40#include <asm/io.h>
41 41
42#define DRV_NAME "ehea" 42#define DRV_NAME "ehea"
43#define DRV_VERSION "EHEA_0080" 43#define DRV_VERSION "EHEA_0083"
44 44
45/* eHEA capability flags */ 45/* eHEA capability flags */
46#define DLPAR_PORT_ADD_REM 1 46#define DLPAR_PORT_ADD_REM 1
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index f0319f1e8e05..869e1604b16e 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -136,7 +136,7 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev)
136 struct ehea_port *port = netdev_priv(dev); 136 struct ehea_port *port = netdev_priv(dev);
137 struct net_device_stats *stats = &port->stats; 137 struct net_device_stats *stats = &port->stats;
138 struct hcp_ehea_port_cb2 *cb2; 138 struct hcp_ehea_port_cb2 *cb2;
139 u64 hret, rx_packets; 139 u64 hret, rx_packets, tx_packets;
140 int i; 140 int i;
141 141
142 memset(stats, 0, sizeof(*stats)); 142 memset(stats, 0, sizeof(*stats));
@@ -162,7 +162,11 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev)
162 for (i = 0; i < port->num_def_qps; i++) 162 for (i = 0; i < port->num_def_qps; i++)
163 rx_packets += port->port_res[i].rx_packets; 163 rx_packets += port->port_res[i].rx_packets;
164 164
165 stats->tx_packets = cb2->txucp + cb2->txmcp + cb2->txbcp; 165 tx_packets = 0;
166 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++)
167 tx_packets += port->port_res[i].tx_packets;
168
169 stats->tx_packets = tx_packets;
166 stats->multicast = cb2->rxmcp; 170 stats->multicast = cb2->rxmcp;
167 stats->rx_errors = cb2->rxuerr; 171 stats->rx_errors = cb2->rxuerr;
168 stats->rx_bytes = cb2->rxo; 172 stats->rx_bytes = cb2->rxo;
@@ -406,11 +410,6 @@ static int ehea_treat_poll_error(struct ehea_port_res *pr, int rq,
406 if (cqe->status & EHEA_CQE_STAT_ERR_CRC) 410 if (cqe->status & EHEA_CQE_STAT_ERR_CRC)
407 pr->p_stats.err_frame_crc++; 411 pr->p_stats.err_frame_crc++;
408 412
409 if (netif_msg_rx_err(pr->port)) {
410 ehea_error("CQE Error for QP %d", pr->qp->init_attr.qp_nr);
411 ehea_dump(cqe, sizeof(*cqe), "CQE");
412 }
413
414 if (rq == 2) { 413 if (rq == 2) {
415 *processed_rq2 += 1; 414 *processed_rq2 += 1;
416 skb = get_skb_by_index(pr->rq2_skba.arr, pr->rq2_skba.len, cqe); 415 skb = get_skb_by_index(pr->rq2_skba.arr, pr->rq2_skba.len, cqe);
@@ -422,7 +421,11 @@ static int ehea_treat_poll_error(struct ehea_port_res *pr, int rq,
422 } 421 }
423 422
424 if (cqe->status & EHEA_CQE_STAT_FAT_ERR_MASK) { 423 if (cqe->status & EHEA_CQE_STAT_FAT_ERR_MASK) {
425 ehea_error("Critical receive error. Resetting port."); 424 if (netif_msg_rx_err(pr->port)) {
425 ehea_error("Critical receive error for QP %d. "
426 "Resetting port.", pr->qp->init_attr.qp_nr);
427 ehea_dump(cqe, sizeof(*cqe), "CQE");
428 }
426 schedule_work(&pr->port->reset_task); 429 schedule_work(&pr->port->reset_task);
427 return 1; 430 return 1;
428 } 431 }
@@ -2000,6 +2003,7 @@ static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev)
2000 } 2003 }
2001 2004
2002 ehea_post_swqe(pr->qp, swqe); 2005 ehea_post_swqe(pr->qp, swqe);
2006 pr->tx_packets++;
2003 2007
2004 if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) { 2008 if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) {
2005 spin_lock_irqsave(&pr->netif_queue, flags); 2009 spin_lock_irqsave(&pr->netif_queue, flags);
diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h
index 562de0ebdd85..bc62d389c166 100644
--- a/drivers/net/ehea/ehea_qmr.h
+++ b/drivers/net/ehea/ehea_qmr.h
@@ -145,8 +145,8 @@ struct ehea_rwqe {
145#define EHEA_CQE_VLAN_TAG_XTRACT 0x0400 145#define EHEA_CQE_VLAN_TAG_XTRACT 0x0400
146 146
147#define EHEA_CQE_TYPE_RQ 0x60 147#define EHEA_CQE_TYPE_RQ 0x60
148#define EHEA_CQE_STAT_ERR_MASK 0x720F 148#define EHEA_CQE_STAT_ERR_MASK 0x700F
149#define EHEA_CQE_STAT_FAT_ERR_MASK 0x1F 149#define EHEA_CQE_STAT_FAT_ERR_MASK 0xF
150#define EHEA_CQE_STAT_ERR_TCP 0x4000 150#define EHEA_CQE_STAT_ERR_TCP 0x4000
151#define EHEA_CQE_STAT_ERR_IP 0x2000 151#define EHEA_CQE_STAT_ERR_IP 0x2000
152#define EHEA_CQE_STAT_ERR_CRC 0x1000 152#define EHEA_CQE_STAT_ERR_CRC 0x1000
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index a8a0ee220da6..bf5a7caa5b52 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -971,6 +971,8 @@ mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match)
971 971
972 mpc52xx_fec_reset_stats(ndev); 972 mpc52xx_fec_reset_stats(ndev);
973 973
974 SET_NETDEV_DEV(ndev, &op->dev);
975
974 /* Register the new network device */ 976 /* Register the new network device */
975 rv = register_netdev(ndev); 977 rv = register_netdev(ndev);
976 if (rv < 0) 978 if (rv < 0)
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 92ce2e38f0d5..a96583cceb5e 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -5286,19 +5286,15 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
5286 if (readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_PHY_INIT) { 5286 if (readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_PHY_INIT) {
5287 np->mac_in_use = readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_MGMT_ST; 5287 np->mac_in_use = readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_MGMT_ST;
5288 dprintk(KERN_INFO "%s: mgmt unit is running. mac in use %x.\n", pci_name(pci_dev), np->mac_in_use); 5288 dprintk(KERN_INFO "%s: mgmt unit is running. mac in use %x.\n", pci_name(pci_dev), np->mac_in_use);
5289 for (i = 0; i < 5000; i++) { 5289 if (nv_mgmt_acquire_sema(dev)) {
5290 msleep(1); 5290 /* management unit setup the phy already? */
5291 if (nv_mgmt_acquire_sema(dev)) { 5291 if ((readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_MASK) ==
5292 /* management unit setup the phy already? */ 5292 NVREG_XMITCTL_SYNC_PHY_INIT) {
5293 if ((readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_MASK) == 5293 /* phy is inited by mgmt unit */
5294 NVREG_XMITCTL_SYNC_PHY_INIT) { 5294 phyinitialized = 1;
5295 /* phy is inited by mgmt unit */ 5295 dprintk(KERN_INFO "%s: Phy already initialized by mgmt unit.\n", pci_name(pci_dev));
5296 phyinitialized = 1; 5296 } else {
5297 dprintk(KERN_INFO "%s: Phy already initialized by mgmt unit.\n", pci_name(pci_dev)); 5297 /* we need to init the phy */
5298 } else {
5299 /* we need to init the phy */
5300 }
5301 break;
5302 } 5298 }
5303 } 5299 }
5304 } 5300 }
@@ -5613,6 +5609,22 @@ static struct pci_device_id pci_tbl[] = {
5613 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35), 5609 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35),
5614 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, 5610 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
5615 }, 5611 },
5612 { /* MCP79 Ethernet Controller */
5613 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36),
5614 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
5615 },
5616 { /* MCP79 Ethernet Controller */
5617 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37),
5618 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
5619 },
5620 { /* MCP79 Ethernet Controller */
5621 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38),
5622 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
5623 },
5624 { /* MCP79 Ethernet Controller */
5625 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39),
5626 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
5627 },
5616 {0,}, 5628 {0,},
5617}; 5629};
5618 5630
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 0de3aa2a2e44..eb0718b441bb 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -642,9 +642,11 @@ static void emac_reset_work(struct work_struct *work)
642 DBG(dev, "reset_work" NL); 642 DBG(dev, "reset_work" NL);
643 643
644 mutex_lock(&dev->link_lock); 644 mutex_lock(&dev->link_lock);
645 emac_netif_stop(dev); 645 if (dev->opened) {
646 emac_full_tx_reset(dev); 646 emac_netif_stop(dev);
647 emac_netif_start(dev); 647 emac_full_tx_reset(dev);
648 emac_netif_start(dev);
649 }
648 mutex_unlock(&dev->link_lock); 650 mutex_unlock(&dev->link_lock);
649} 651}
650 652
@@ -1063,10 +1065,9 @@ static int emac_open(struct net_device *ndev)
1063 dev->rx_sg_skb = NULL; 1065 dev->rx_sg_skb = NULL;
1064 1066
1065 mutex_lock(&dev->link_lock); 1067 mutex_lock(&dev->link_lock);
1068 dev->opened = 1;
1066 1069
1067 /* XXX Start PHY polling now. Shouldn't wr do like sungem instead and 1070 /* Start PHY polling now.
1068 * always poll the PHY even when the iface is down ? That would allow
1069 * things like laptop-net to work. --BenH
1070 */ 1071 */
1071 if (dev->phy.address >= 0) { 1072 if (dev->phy.address >= 0) {
1072 int link_poll_interval; 1073 int link_poll_interval;
@@ -1145,9 +1146,11 @@ static void emac_link_timer(struct work_struct *work)
1145 int link_poll_interval; 1146 int link_poll_interval;
1146 1147
1147 mutex_lock(&dev->link_lock); 1148 mutex_lock(&dev->link_lock);
1148
1149 DBG2(dev, "link timer" NL); 1149 DBG2(dev, "link timer" NL);
1150 1150
1151 if (!dev->opened)
1152 goto bail;
1153
1151 if (dev->phy.def->ops->poll_link(&dev->phy)) { 1154 if (dev->phy.def->ops->poll_link(&dev->phy)) {
1152 if (!netif_carrier_ok(dev->ndev)) { 1155 if (!netif_carrier_ok(dev->ndev)) {
1153 /* Get new link parameters */ 1156 /* Get new link parameters */
@@ -1170,13 +1173,14 @@ static void emac_link_timer(struct work_struct *work)
1170 link_poll_interval = PHY_POLL_LINK_OFF; 1173 link_poll_interval = PHY_POLL_LINK_OFF;
1171 } 1174 }
1172 schedule_delayed_work(&dev->link_work, link_poll_interval); 1175 schedule_delayed_work(&dev->link_work, link_poll_interval);
1173 1176 bail:
1174 mutex_unlock(&dev->link_lock); 1177 mutex_unlock(&dev->link_lock);
1175} 1178}
1176 1179
1177static void emac_force_link_update(struct emac_instance *dev) 1180static void emac_force_link_update(struct emac_instance *dev)
1178{ 1181{
1179 netif_carrier_off(dev->ndev); 1182 netif_carrier_off(dev->ndev);
1183 smp_rmb();
1180 if (dev->link_polling) { 1184 if (dev->link_polling) {
1181 cancel_rearming_delayed_work(&dev->link_work); 1185 cancel_rearming_delayed_work(&dev->link_work);
1182 if (dev->link_polling) 1186 if (dev->link_polling)
@@ -1191,11 +1195,14 @@ static int emac_close(struct net_device *ndev)
1191 1195
1192 DBG(dev, "close" NL); 1196 DBG(dev, "close" NL);
1193 1197
1194 if (dev->phy.address >= 0) 1198 if (dev->phy.address >= 0) {
1199 dev->link_polling = 0;
1195 cancel_rearming_delayed_work(&dev->link_work); 1200 cancel_rearming_delayed_work(&dev->link_work);
1196 1201 }
1202 mutex_lock(&dev->link_lock);
1197 emac_netif_stop(dev); 1203 emac_netif_stop(dev);
1198 flush_scheduled_work(); 1204 dev->opened = 0;
1205 mutex_unlock(&dev->link_lock);
1199 1206
1200 emac_rx_disable(dev); 1207 emac_rx_disable(dev);
1201 emac_tx_disable(dev); 1208 emac_tx_disable(dev);
@@ -2756,6 +2763,8 @@ static int __devexit emac_remove(struct of_device *ofdev)
2756 2763
2757 unregister_netdev(dev->ndev); 2764 unregister_netdev(dev->ndev);
2758 2765
2766 flush_scheduled_work();
2767
2759 if (emac_has_feature(dev, EMAC_FTR_HAS_TAH)) 2768 if (emac_has_feature(dev, EMAC_FTR_HAS_TAH))
2760 tah_detach(dev->tah_dev, dev->tah_port); 2769 tah_detach(dev->tah_dev, dev->tah_port);
2761 if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII)) 2770 if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII))
diff --git a/drivers/net/ibm_newemac/core.h b/drivers/net/ibm_newemac/core.h
index 4011803117ca..a010b2463fd9 100644
--- a/drivers/net/ibm_newemac/core.h
+++ b/drivers/net/ibm_newemac/core.h
@@ -258,6 +258,7 @@ struct emac_instance {
258 int stop_timeout; /* in us */ 258 int stop_timeout; /* in us */
259 int no_mcast; 259 int no_mcast;
260 int mcast_pending; 260 int mcast_pending;
261 int opened;
261 struct work_struct reset_work; 262 struct work_struct reset_work;
262 spinlock_t lock; 263 spinlock_t lock;
263}; 264};
diff --git a/drivers/net/lib82596.c b/drivers/net/lib82596.c
index 9a855e512147..b59f442bbf36 100644
--- a/drivers/net/lib82596.c
+++ b/drivers/net/lib82596.c
@@ -176,8 +176,8 @@ struct i596_reg {
176struct i596_tbd { 176struct i596_tbd {
177 unsigned short size; 177 unsigned short size;
178 unsigned short pad; 178 unsigned short pad;
179 dma_addr_t next; 179 u32 next;
180 dma_addr_t data; 180 u32 data;
181 u32 cache_pad[5]; /* Total 32 bytes... */ 181 u32 cache_pad[5]; /* Total 32 bytes... */
182}; 182};
183 183
@@ -195,12 +195,12 @@ struct i596_cmd {
195 struct i596_cmd *v_next; /* Address from CPUs viewpoint */ 195 struct i596_cmd *v_next; /* Address from CPUs viewpoint */
196 unsigned short status; 196 unsigned short status;
197 unsigned short command; 197 unsigned short command;
198 dma_addr_t b_next; /* Address from i596 viewpoint */ 198 u32 b_next; /* Address from i596 viewpoint */
199}; 199};
200 200
201struct tx_cmd { 201struct tx_cmd {
202 struct i596_cmd cmd; 202 struct i596_cmd cmd;
203 dma_addr_t tbd; 203 u32 tbd;
204 unsigned short size; 204 unsigned short size;
205 unsigned short pad; 205 unsigned short pad;
206 struct sk_buff *skb; /* So we can free it after tx */ 206 struct sk_buff *skb; /* So we can free it after tx */
@@ -237,8 +237,8 @@ struct cf_cmd {
237struct i596_rfd { 237struct i596_rfd {
238 unsigned short stat; 238 unsigned short stat;
239 unsigned short cmd; 239 unsigned short cmd;
240 dma_addr_t b_next; /* Address from i596 viewpoint */ 240 u32 b_next; /* Address from i596 viewpoint */
241 dma_addr_t rbd; 241 u32 rbd;
242 unsigned short count; 242 unsigned short count;
243 unsigned short size; 243 unsigned short size;
244 struct i596_rfd *v_next; /* Address from CPUs viewpoint */ 244 struct i596_rfd *v_next; /* Address from CPUs viewpoint */
@@ -249,18 +249,18 @@ struct i596_rfd {
249}; 249};
250 250
251struct i596_rbd { 251struct i596_rbd {
252 /* hardware data */ 252 /* hardware data */
253 unsigned short count; 253 unsigned short count;
254 unsigned short zero1; 254 unsigned short zero1;
255 dma_addr_t b_next; 255 u32 b_next;
256 dma_addr_t b_data; /* Address from i596 viewpoint */ 256 u32 b_data; /* Address from i596 viewpoint */
257 unsigned short size; 257 unsigned short size;
258 unsigned short zero2; 258 unsigned short zero2;
259 /* driver data */ 259 /* driver data */
260 struct sk_buff *skb; 260 struct sk_buff *skb;
261 struct i596_rbd *v_next; 261 struct i596_rbd *v_next;
262 dma_addr_t b_addr; /* This rbd addr from i596 view */ 262 u32 b_addr; /* This rbd addr from i596 view */
263 unsigned char *v_data; /* Address from CPUs viewpoint */ 263 unsigned char *v_data; /* Address from CPUs viewpoint */
264 /* Total 32 bytes... */ 264 /* Total 32 bytes... */
265#ifdef __LP64__ 265#ifdef __LP64__
266 u32 cache_pad[4]; 266 u32 cache_pad[4];
@@ -275,8 +275,8 @@ struct i596_rbd {
275struct i596_scb { 275struct i596_scb {
276 unsigned short status; 276 unsigned short status;
277 unsigned short command; 277 unsigned short command;
278 dma_addr_t cmd; 278 u32 cmd;
279 dma_addr_t rfd; 279 u32 rfd;
280 u32 crc_err; 280 u32 crc_err;
281 u32 align_err; 281 u32 align_err;
282 u32 resource_err; 282 u32 resource_err;
@@ -288,14 +288,14 @@ struct i596_scb {
288}; 288};
289 289
290struct i596_iscp { 290struct i596_iscp {
291 u32 stat; 291 u32 stat;
292 dma_addr_t scb; 292 u32 scb;
293}; 293};
294 294
295struct i596_scp { 295struct i596_scp {
296 u32 sysbus; 296 u32 sysbus;
297 u32 pad; 297 u32 pad;
298 dma_addr_t iscp; 298 u32 iscp;
299}; 299};
300 300
301struct i596_dma { 301struct i596_dma {
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 035fd41fb61f..f0574073a2a3 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -143,21 +143,29 @@ static int m88e1111_config_init(struct phy_device *phydev)
143 int err; 143 int err;
144 144
145 if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || 145 if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
146 (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)) { 146 (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) ||
147 (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
148 (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) {
147 int temp; 149 int temp;
148 150
149 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { 151 temp = phy_read(phydev, MII_M1111_PHY_EXT_CR);
150 temp = phy_read(phydev, MII_M1111_PHY_EXT_CR); 152 if (temp < 0)
151 if (temp < 0) 153 return temp;
152 return temp;
153 154
155 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
154 temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY); 156 temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY);
155 157 } else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) {
156 err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp); 158 temp &= ~MII_M1111_TX_DELAY;
157 if (err < 0) 159 temp |= MII_M1111_RX_DELAY;
158 return err; 160 } else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) {
161 temp &= ~MII_M1111_RX_DELAY;
162 temp |= MII_M1111_TX_DELAY;
159 } 163 }
160 164
165 err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp);
166 if (err < 0)
167 return err;
168
161 temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); 169 temp = phy_read(phydev, MII_M1111_PHY_EXT_SR);
162 if (temp < 0) 170 if (temp < 0)
163 return temp; 171 return temp;
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 9bc11773705b..7c9e6e349503 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -406,6 +406,9 @@ int phy_mii_ioctl(struct phy_device *phydev,
406 && phydev->drv->config_init) 406 && phydev->drv->config_init)
407 phydev->drv->config_init(phydev); 407 phydev->drv->config_init(phydev);
408 break; 408 break;
409
410 default:
411 return -ENOTTY;
409 } 412 }
410 413
411 return 0; 414 return 0;
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 632666706247..d5113dd712c2 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -1081,7 +1081,7 @@ static int init_nic(struct s2io_nic *nic)
1081 /* to set the swapper controle on the card */ 1081 /* to set the swapper controle on the card */
1082 if(s2io_set_swapper(nic)) { 1082 if(s2io_set_swapper(nic)) {
1083 DBG_PRINT(ERR_DBG,"ERROR: Setting Swapper failed\n"); 1083 DBG_PRINT(ERR_DBG,"ERROR: Setting Swapper failed\n");
1084 return -1; 1084 return -EIO;
1085 } 1085 }
1086 1086
1087 /* 1087 /*
@@ -1503,7 +1503,7 @@ static int init_nic(struct s2io_nic *nic)
1503 DBG_PRINT(ERR_DBG, "%s: failed rts ds steering", 1503 DBG_PRINT(ERR_DBG, "%s: failed rts ds steering",
1504 dev->name); 1504 dev->name);
1505 DBG_PRINT(ERR_DBG, "set on codepoint %d\n", i); 1505 DBG_PRINT(ERR_DBG, "set on codepoint %d\n", i);
1506 return FAILURE; 1506 return -ENODEV;
1507 } 1507 }
1508 } 1508 }
1509 1509
@@ -1570,7 +1570,7 @@ static int init_nic(struct s2io_nic *nic)
1570 if (time > 10) { 1570 if (time > 10) {
1571 DBG_PRINT(ERR_DBG, "%s: TTI init Failed\n", 1571 DBG_PRINT(ERR_DBG, "%s: TTI init Failed\n",
1572 dev->name); 1572 dev->name);
1573 return -1; 1573 return -ENODEV;
1574 } 1574 }
1575 msleep(50); 1575 msleep(50);
1576 time++; 1576 time++;
@@ -1623,7 +1623,7 @@ static int init_nic(struct s2io_nic *nic)
1623 if (time > 10) { 1623 if (time > 10) {
1624 DBG_PRINT(ERR_DBG, "%s: RTI init Failed\n", 1624 DBG_PRINT(ERR_DBG, "%s: RTI init Failed\n",
1625 dev->name); 1625 dev->name);
1626 return -1; 1626 return -ENODEV;
1627 } 1627 }
1628 time++; 1628 time++;
1629 msleep(50); 1629 msleep(50);
@@ -3914,6 +3914,12 @@ static int s2io_close(struct net_device *dev)
3914{ 3914{
3915 struct s2io_nic *sp = dev->priv; 3915 struct s2io_nic *sp = dev->priv;
3916 3916
3917 /* Return if the device is already closed *
3918 * Can happen when s2io_card_up failed in change_mtu *
3919 */
3920 if (!is_s2io_card_up(sp))
3921 return 0;
3922
3917 netif_stop_queue(dev); 3923 netif_stop_queue(dev);
3918 napi_disable(&sp->napi); 3924 napi_disable(&sp->napi);
3919 /* Reset card, kill tasklet and free Tx and Rx buffers. */ 3925 /* Reset card, kill tasklet and free Tx and Rx buffers. */
@@ -6355,6 +6361,7 @@ static int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
6355static int s2io_change_mtu(struct net_device *dev, int new_mtu) 6361static int s2io_change_mtu(struct net_device *dev, int new_mtu)
6356{ 6362{
6357 struct s2io_nic *sp = dev->priv; 6363 struct s2io_nic *sp = dev->priv;
6364 int ret = 0;
6358 6365
6359 if ((new_mtu < MIN_MTU) || (new_mtu > S2IO_JUMBO_SIZE)) { 6366 if ((new_mtu < MIN_MTU) || (new_mtu > S2IO_JUMBO_SIZE)) {
6360 DBG_PRINT(ERR_DBG, "%s: MTU size is invalid.\n", 6367 DBG_PRINT(ERR_DBG, "%s: MTU size is invalid.\n",
@@ -6366,9 +6373,11 @@ static int s2io_change_mtu(struct net_device *dev, int new_mtu)
6366 if (netif_running(dev)) { 6373 if (netif_running(dev)) {
6367 s2io_card_down(sp); 6374 s2io_card_down(sp);
6368 netif_stop_queue(dev); 6375 netif_stop_queue(dev);
6369 if (s2io_card_up(sp)) { 6376 ret = s2io_card_up(sp);
6377 if (ret) {
6370 DBG_PRINT(ERR_DBG, "%s: Device bring up failed\n", 6378 DBG_PRINT(ERR_DBG, "%s: Device bring up failed\n",
6371 __FUNCTION__); 6379 __FUNCTION__);
6380 return ret;
6372 } 6381 }
6373 if (netif_queue_stopped(dev)) 6382 if (netif_queue_stopped(dev))
6374 netif_wake_queue(dev); 6383 netif_wake_queue(dev);
@@ -6379,7 +6388,7 @@ static int s2io_change_mtu(struct net_device *dev, int new_mtu)
6379 writeq(vBIT(val64, 2, 14), &bar0->rmac_max_pyld_len); 6388 writeq(vBIT(val64, 2, 14), &bar0->rmac_max_pyld_len);
6380 } 6389 }
6381 6390
6382 return 0; 6391 return ret;
6383} 6392}
6384 6393
6385/** 6394/**
@@ -6777,6 +6786,9 @@ static void do_s2io_card_down(struct s2io_nic * sp, int do_io)
6777 unsigned long flags; 6786 unsigned long flags;
6778 register u64 val64 = 0; 6787 register u64 val64 = 0;
6779 6788
6789 if (!is_s2io_card_up(sp))
6790 return;
6791
6780 del_timer_sync(&sp->alarm_timer); 6792 del_timer_sync(&sp->alarm_timer);
6781 /* If s2io_set_link task is executing, wait till it completes. */ 6793 /* If s2io_set_link task is executing, wait till it completes. */
6782 while (test_and_set_bit(__S2IO_STATE_LINK_TASK, &(sp->state))) { 6794 while (test_and_set_bit(__S2IO_STATE_LINK_TASK, &(sp->state))) {
@@ -6850,11 +6862,13 @@ static int s2io_card_up(struct s2io_nic * sp)
6850 u16 interruptible; 6862 u16 interruptible;
6851 6863
6852 /* Initialize the H/W I/O registers */ 6864 /* Initialize the H/W I/O registers */
6853 if (init_nic(sp) != 0) { 6865 ret = init_nic(sp);
6866 if (ret != 0) {
6854 DBG_PRINT(ERR_DBG, "%s: H/W initialization failed\n", 6867 DBG_PRINT(ERR_DBG, "%s: H/W initialization failed\n",
6855 dev->name); 6868 dev->name);
6856 s2io_reset(sp); 6869 if (ret != -EIO)
6857 return -ENODEV; 6870 s2io_reset(sp);
6871 return ret;
6858 } 6872 }
6859 6873
6860 /* 6874 /*
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 6d62250fba07..186eb8ebfda6 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -44,7 +44,7 @@
44#include "skge.h" 44#include "skge.h"
45 45
46#define DRV_NAME "skge" 46#define DRV_NAME "skge"
47#define DRV_VERSION "1.12" 47#define DRV_VERSION "1.13"
48#define PFX DRV_NAME " " 48#define PFX DRV_NAME " "
49 49
50#define DEFAULT_TX_RING_SIZE 128 50#define DEFAULT_TX_RING_SIZE 128
@@ -1095,16 +1095,9 @@ static void xm_link_down(struct skge_hw *hw, int port)
1095{ 1095{
1096 struct net_device *dev = hw->dev[port]; 1096 struct net_device *dev = hw->dev[port];
1097 struct skge_port *skge = netdev_priv(dev); 1097 struct skge_port *skge = netdev_priv(dev);
1098 u16 cmd = xm_read16(hw, port, XM_MMU_CMD);
1099 1098
1100 xm_write16(hw, port, XM_IMSK, XM_IMSK_DISABLE); 1099 xm_write16(hw, port, XM_IMSK, XM_IMSK_DISABLE);
1101 1100
1102 cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX);
1103 xm_write16(hw, port, XM_MMU_CMD, cmd);
1104
1105 /* dummy read to ensure writing */
1106 xm_read16(hw, port, XM_MMU_CMD);
1107
1108 if (netif_carrier_ok(dev)) 1101 if (netif_carrier_ok(dev))
1109 skge_link_down(skge); 1102 skge_link_down(skge);
1110} 1103}
@@ -1194,6 +1187,7 @@ static void genesis_init(struct skge_hw *hw)
1194static void genesis_reset(struct skge_hw *hw, int port) 1187static void genesis_reset(struct skge_hw *hw, int port)
1195{ 1188{
1196 const u8 zero[8] = { 0 }; 1189 const u8 zero[8] = { 0 };
1190 u32 reg;
1197 1191
1198 skge_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0); 1192 skge_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0);
1199 1193
@@ -1209,6 +1203,11 @@ static void genesis_reset(struct skge_hw *hw, int port)
1209 xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff); 1203 xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff);
1210 1204
1211 xm_outhash(hw, port, XM_HSM, zero); 1205 xm_outhash(hw, port, XM_HSM, zero);
1206
1207 /* Flush TX and RX fifo */
1208 reg = xm_read32(hw, port, XM_MODE);
1209 xm_write32(hw, port, XM_MODE, reg | XM_MD_FTF);
1210 xm_write32(hw, port, XM_MODE, reg | XM_MD_FRF);
1212} 1211}
1213 1212
1214 1213
@@ -1634,15 +1633,14 @@ static void genesis_mac_init(struct skge_hw *hw, int port)
1634 } 1633 }
1635 xm_write16(hw, port, XM_RX_CMD, r); 1634 xm_write16(hw, port, XM_RX_CMD, r);
1636 1635
1637
1638 /* We want short frames padded to 60 bytes. */ 1636 /* We want short frames padded to 60 bytes. */
1639 xm_write16(hw, port, XM_TX_CMD, XM_TX_AUTO_PAD); 1637 xm_write16(hw, port, XM_TX_CMD, XM_TX_AUTO_PAD);
1640 1638
1641 /* 1639 /* Increase threshold for jumbo frames on dual port */
1642 * Bump up the transmit threshold. This helps hold off transmit 1640 if (hw->ports > 1 && jumbo)
1643 * underruns when we're blasting traffic from both ports at once. 1641 xm_write16(hw, port, XM_TX_THR, 1020);
1644 */ 1642 else
1645 xm_write16(hw, port, XM_TX_THR, 512); 1643 xm_write16(hw, port, XM_TX_THR, 512);
1646 1644
1647 /* 1645 /*
1648 * Enable the reception of all error frames. This is is 1646 * Enable the reception of all error frames. This is is
@@ -1713,7 +1711,13 @@ static void genesis_stop(struct skge_port *skge)
1713{ 1711{
1714 struct skge_hw *hw = skge->hw; 1712 struct skge_hw *hw = skge->hw;
1715 int port = skge->port; 1713 int port = skge->port;
1716 u32 reg; 1714 unsigned retries = 1000;
1715 u16 cmd;
1716
1717 /* Disable Tx and Rx */
1718 cmd = xm_read16(hw, port, XM_MMU_CMD);
1719 cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX);
1720 xm_write16(hw, port, XM_MMU_CMD, cmd);
1717 1721
1718 genesis_reset(hw, port); 1722 genesis_reset(hw, port);
1719 1723
@@ -1721,20 +1725,17 @@ static void genesis_stop(struct skge_port *skge)
1721 skge_write16(hw, B3_PA_CTRL, 1725 skge_write16(hw, B3_PA_CTRL,
1722 port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2); 1726 port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2);
1723 1727
1724 /*
1725 * If the transfer sticks at the MAC the STOP command will not
1726 * terminate if we don't flush the XMAC's transmit FIFO !
1727 */
1728 xm_write32(hw, port, XM_MODE,
1729 xm_read32(hw, port, XM_MODE)|XM_MD_FTF);
1730
1731
1732 /* Reset the MAC */ 1728 /* Reset the MAC */
1733 skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST); 1729 skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_CLR_MAC_RST);
1730 do {
1731 skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST);
1732 if (!(skge_read16(hw, SK_REG(port, TX_MFF_CTRL1)) & MFF_SET_MAC_RST))
1733 break;
1734 } while (--retries > 0);
1734 1735
1735 /* For external PHYs there must be special handling */ 1736 /* For external PHYs there must be special handling */
1736 if (hw->phy_type != SK_PHY_XMAC) { 1737 if (hw->phy_type != SK_PHY_XMAC) {
1737 reg = skge_read32(hw, B2_GP_IO); 1738 u32 reg = skge_read32(hw, B2_GP_IO);
1738 if (port == 0) { 1739 if (port == 0) {
1739 reg |= GP_DIR_0; 1740 reg |= GP_DIR_0;
1740 reg &= ~GP_IO_0; 1741 reg &= ~GP_IO_0;
@@ -1801,11 +1802,6 @@ static void genesis_mac_intr(struct skge_hw *hw, int port)
1801 xm_write32(hw, port, XM_MODE, XM_MD_FTF); 1802 xm_write32(hw, port, XM_MODE, XM_MD_FTF);
1802 ++dev->stats.tx_fifo_errors; 1803 ++dev->stats.tx_fifo_errors;
1803 } 1804 }
1804
1805 if (status & XM_IS_RXF_OV) {
1806 xm_write32(hw, port, XM_MODE, XM_MD_FRF);
1807 ++dev->stats.rx_fifo_errors;
1808 }
1809} 1805}
1810 1806
1811static void genesis_link_up(struct skge_port *skge) 1807static void genesis_link_up(struct skge_port *skge)
@@ -1862,9 +1858,9 @@ static void genesis_link_up(struct skge_port *skge)
1862 1858
1863 xm_write32(hw, port, XM_MODE, mode); 1859 xm_write32(hw, port, XM_MODE, mode);
1864 1860
1865 /* Turn on detection of Tx underrun, Rx overrun */ 1861 /* Turn on detection of Tx underrun */
1866 msk = xm_read16(hw, port, XM_IMSK); 1862 msk = xm_read16(hw, port, XM_IMSK);
1867 msk &= ~(XM_IS_RXF_OV | XM_IS_TXF_UR); 1863 msk &= ~XM_IS_TXF_UR;
1868 xm_write16(hw, port, XM_IMSK, msk); 1864 xm_write16(hw, port, XM_IMSK, msk);
1869 1865
1870 xm_read16(hw, port, XM_ISRC); 1866 xm_read16(hw, port, XM_ISRC);
@@ -2194,9 +2190,12 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
2194 TX_JAM_IPG_VAL(TX_JAM_IPG_DEF) | 2190 TX_JAM_IPG_VAL(TX_JAM_IPG_DEF) |
2195 TX_IPG_JAM_DATA(TX_IPG_JAM_DEF)); 2191 TX_IPG_JAM_DATA(TX_IPG_JAM_DEF));
2196 2192
2197 /* serial mode register */ 2193 /* configure the Serial Mode Register */
2198 reg = GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF); 2194 reg = DATA_BLIND_VAL(DATA_BLIND_DEF)
2199 if (hw->dev[port]->mtu > 1500) 2195 | GM_SMOD_VLAN_ENA
2196 | IPG_DATA_VAL(IPG_DATA_DEF);
2197
2198 if (hw->dev[port]->mtu > ETH_DATA_LEN)
2200 reg |= GM_SMOD_JUMBO_ENA; 2199 reg |= GM_SMOD_JUMBO_ENA;
2201 2200
2202 gma_write16(hw, port, GM_SERIAL_MODE, reg); 2201 gma_write16(hw, port, GM_SERIAL_MODE, reg);
@@ -2619,8 +2618,8 @@ static int skge_up(struct net_device *dev)
2619 yukon_mac_init(hw, port); 2618 yukon_mac_init(hw, port);
2620 spin_unlock_bh(&hw->phy_lock); 2619 spin_unlock_bh(&hw->phy_lock);
2621 2620
2622 /* Configure RAMbuffers */ 2621 /* Configure RAMbuffers - equally between ports and tx/rx */
2623 chunk = hw->ram_size / ((hw->ports + 1)*2); 2622 chunk = (hw->ram_size - hw->ram_offset) / (hw->ports * 2);
2624 ram_addr = hw->ram_offset + 2 * chunk * port; 2623 ram_addr = hw->ram_offset + 2 * chunk * port;
2625 2624
2626 skge_ramset(hw, rxqaddr[port], ram_addr, chunk); 2625 skge_ramset(hw, rxqaddr[port], ram_addr, chunk);
@@ -2897,11 +2896,7 @@ static void skge_tx_timeout(struct net_device *dev)
2897 2896
2898static int skge_change_mtu(struct net_device *dev, int new_mtu) 2897static int skge_change_mtu(struct net_device *dev, int new_mtu)
2899{ 2898{
2900 struct skge_port *skge = netdev_priv(dev);
2901 struct skge_hw *hw = skge->hw;
2902 int port = skge->port;
2903 int err; 2899 int err;
2904 u16 ctl, reg;
2905 2900
2906 if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU) 2901 if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU)
2907 return -EINVAL; 2902 return -EINVAL;
@@ -2911,40 +2906,13 @@ static int skge_change_mtu(struct net_device *dev, int new_mtu)
2911 return 0; 2906 return 0;
2912 } 2907 }
2913 2908
2914 skge_write32(hw, B0_IMSK, 0); 2909 skge_down(dev);
2915 dev->trans_start = jiffies; /* prevent tx timeout */
2916 netif_stop_queue(dev);
2917 napi_disable(&skge->napi);
2918
2919 ctl = gma_read16(hw, port, GM_GP_CTRL);
2920 gma_write16(hw, port, GM_GP_CTRL, ctl & ~GM_GPCR_RX_ENA);
2921
2922 skge_rx_clean(skge);
2923 skge_rx_stop(hw, port);
2924 2910
2925 dev->mtu = new_mtu; 2911 dev->mtu = new_mtu;
2926 2912
2927 reg = GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF); 2913 err = skge_up(dev);
2928 if (new_mtu > 1500)
2929 reg |= GM_SMOD_JUMBO_ENA;
2930 gma_write16(hw, port, GM_SERIAL_MODE, reg);
2931
2932 skge_write8(hw, RB_ADDR(rxqaddr[port], RB_CTRL), RB_ENA_OP_MD);
2933
2934 err = skge_rx_fill(dev);
2935 wmb();
2936 if (!err)
2937 skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F);
2938 skge_write32(hw, B0_IMSK, hw->intr_mask);
2939
2940 if (err) 2914 if (err)
2941 dev_close(dev); 2915 dev_close(dev);
2942 else {
2943 gma_write16(hw, port, GM_GP_CTRL, ctl);
2944
2945 napi_enable(&skge->napi);
2946 netif_wake_queue(dev);
2947 }
2948 2916
2949 return err; 2917 return err;
2950} 2918}
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index a2070db725c9..3d1dfc948405 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -31,7 +31,6 @@
31#include <linux/etherdevice.h> 31#include <linux/etherdevice.h>
32#include <linux/ethtool.h> 32#include <linux/ethtool.h>
33#include <linux/pci.h> 33#include <linux/pci.h>
34#include <linux/aer.h>
35#include <linux/ip.h> 34#include <linux/ip.h>
36#include <net/ip.h> 35#include <net/ip.h>
37#include <linux/tcp.h> 36#include <linux/tcp.h>
@@ -240,22 +239,21 @@ static void sky2_power_on(struct sky2_hw *hw)
240 sky2_write8(hw, B2_Y2_CLK_GATE, 0); 239 sky2_write8(hw, B2_Y2_CLK_GATE, 0);
241 240
242 if (hw->flags & SKY2_HW_ADV_POWER_CTL) { 241 if (hw->flags & SKY2_HW_ADV_POWER_CTL) {
243 struct pci_dev *pdev = hw->pdev;
244 u32 reg; 242 u32 reg;
245 243
246 pci_write_config_dword(pdev, PCI_DEV_REG3, 0); 244 sky2_pci_write32(hw, PCI_DEV_REG3, 0);
247 245
248 pci_read_config_dword(pdev, PCI_DEV_REG4, &reg); 246 reg = sky2_pci_read32(hw, PCI_DEV_REG4);
249 /* set all bits to 0 except bits 15..12 and 8 */ 247 /* set all bits to 0 except bits 15..12 and 8 */
250 reg &= P_ASPM_CONTROL_MSK; 248 reg &= P_ASPM_CONTROL_MSK;
251 pci_write_config_dword(pdev, PCI_DEV_REG4, reg); 249 sky2_pci_write32(hw, PCI_DEV_REG4, reg);
252 250
253 pci_read_config_dword(pdev, PCI_DEV_REG5, &reg); 251 reg = sky2_pci_read32(hw, PCI_DEV_REG5);
254 /* set all bits to 0 except bits 28 & 27 */ 252 /* set all bits to 0 except bits 28 & 27 */
255 reg &= P_CTL_TIM_VMAIN_AV_MSK; 253 reg &= P_CTL_TIM_VMAIN_AV_MSK;
256 pci_write_config_dword(pdev, PCI_DEV_REG5, reg); 254 sky2_pci_write32(hw, PCI_DEV_REG5, reg);
257 255
258 pci_write_config_dword(pdev, PCI_CFG_REG_1, 0); 256 sky2_pci_write32(hw, PCI_CFG_REG_1, 0);
259 257
260 /* Enable workaround for dev 4.107 on Yukon-Ultra & Extreme */ 258 /* Enable workaround for dev 4.107 on Yukon-Ultra & Extreme */
261 reg = sky2_read32(hw, B2_GP_IO); 259 reg = sky2_read32(hw, B2_GP_IO);
@@ -619,12 +617,11 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
619 617
620static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff) 618static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff)
621{ 619{
622 struct pci_dev *pdev = hw->pdev;
623 u32 reg1; 620 u32 reg1;
624 static const u32 phy_power[] = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD }; 621 static const u32 phy_power[] = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD };
625 static const u32 coma_mode[] = { PCI_Y2_PHY1_COMA, PCI_Y2_PHY2_COMA }; 622 static const u32 coma_mode[] = { PCI_Y2_PHY1_COMA, PCI_Y2_PHY2_COMA };
626 623
627 pci_read_config_dword(pdev, PCI_DEV_REG1, &reg1); 624 reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
628 /* Turn on/off phy power saving */ 625 /* Turn on/off phy power saving */
629 if (onoff) 626 if (onoff)
630 reg1 &= ~phy_power[port]; 627 reg1 &= ~phy_power[port];
@@ -634,8 +631,8 @@ static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff)
634 if (onoff && hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) 631 if (onoff && hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1)
635 reg1 |= coma_mode[port]; 632 reg1 |= coma_mode[port];
636 633
637 pci_write_config_dword(pdev, PCI_DEV_REG1, reg1); 634 sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
638 pci_read_config_dword(pdev, PCI_DEV_REG1, &reg1); 635 reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
639 636
640 udelay(100); 637 udelay(100);
641} 638}
@@ -704,9 +701,9 @@ static void sky2_wol_init(struct sky2_port *sky2)
704 sky2_write16(hw, WOL_REGS(port, WOL_CTRL_STAT), ctrl); 701 sky2_write16(hw, WOL_REGS(port, WOL_CTRL_STAT), ctrl);
705 702
706 /* Turn on legacy PCI-Express PME mode */ 703 /* Turn on legacy PCI-Express PME mode */
707 pci_read_config_dword(hw->pdev, PCI_DEV_REG1, &reg1); 704 reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
708 reg1 |= PCI_Y2_PME_LEGACY; 705 reg1 |= PCI_Y2_PME_LEGACY;
709 pci_write_config_dword(hw->pdev, PCI_DEV_REG1, reg1); 706 sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
710 707
711 /* block receiver */ 708 /* block receiver */
712 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); 709 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET);
@@ -848,6 +845,13 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
848 sky2_set_tx_stfwd(hw, port); 845 sky2_set_tx_stfwd(hw, port);
849 } 846 }
850 847
848 if (hw->chip_id == CHIP_ID_YUKON_FE_P &&
849 hw->chip_rev == CHIP_REV_YU_FE2_A0) {
850 /* disable dynamic watermark */
851 reg = sky2_read16(hw, SK_REG(port, TX_GMF_EA));
852 reg &= ~TX_DYN_WM_ENA;
853 sky2_write16(hw, SK_REG(port, TX_GMF_EA), reg);
854 }
851} 855}
852 856
853/* Assign Ram Buffer allocation to queue */ 857/* Assign Ram Buffer allocation to queue */
@@ -1320,15 +1324,12 @@ static int sky2_up(struct net_device *dev)
1320 */ 1324 */
1321 if (otherdev && netif_running(otherdev) && 1325 if (otherdev && netif_running(otherdev) &&
1322 (cap = pci_find_capability(hw->pdev, PCI_CAP_ID_PCIX))) { 1326 (cap = pci_find_capability(hw->pdev, PCI_CAP_ID_PCIX))) {
1323 struct sky2_port *osky2 = netdev_priv(otherdev);
1324 u16 cmd; 1327 u16 cmd;
1325 1328
1326 pci_read_config_word(hw->pdev, cap + PCI_X_CMD, &cmd); 1329 cmd = sky2_pci_read16(hw, cap + PCI_X_CMD);
1327 cmd &= ~PCI_X_CMD_MAX_SPLIT; 1330 cmd &= ~PCI_X_CMD_MAX_SPLIT;
1328 pci_write_config_word(hw->pdev, cap + PCI_X_CMD, cmd); 1331 sky2_pci_write16(hw, cap + PCI_X_CMD, cmd);
1329 1332
1330 sky2->rx_csum = 0;
1331 osky2->rx_csum = 0;
1332 } 1333 }
1333 1334
1334 if (netif_msg_ifup(sky2)) 1335 if (netif_msg_ifup(sky2))
@@ -2426,37 +2427,26 @@ static void sky2_hw_intr(struct sky2_hw *hw)
2426 if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) { 2427 if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) {
2427 u16 pci_err; 2428 u16 pci_err;
2428 2429
2429 pci_read_config_word(pdev, PCI_STATUS, &pci_err); 2430 pci_err = sky2_pci_read16(hw, PCI_STATUS);
2430 if (net_ratelimit()) 2431 if (net_ratelimit())
2431 dev_err(&pdev->dev, "PCI hardware error (0x%x)\n", 2432 dev_err(&pdev->dev, "PCI hardware error (0x%x)\n",
2432 pci_err); 2433 pci_err);
2433 2434
2434 pci_write_config_word(pdev, PCI_STATUS, 2435 sky2_pci_write16(hw, PCI_STATUS,
2435 pci_err | PCI_STATUS_ERROR_BITS); 2436 pci_err | PCI_STATUS_ERROR_BITS);
2436 } 2437 }
2437 2438
2438 if (status & Y2_IS_PCI_EXP) { 2439 if (status & Y2_IS_PCI_EXP) {
2439 /* PCI-Express uncorrectable Error occurred */ 2440 /* PCI-Express uncorrectable Error occurred */
2440 int aer = pci_find_aer_capability(hw->pdev);
2441 u32 err; 2441 u32 err;
2442 2442
2443 if (aer) { 2443 err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS);
2444 pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_STATUS, 2444 sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS,
2445 &err); 2445 0xfffffffful);
2446 pci_cleanup_aer_uncorrect_error_status(pdev);
2447 } else {
2448 /* Either AER not configured, or not working
2449 * because of bad MMCONFIG, so just do recover
2450 * manually.
2451 */
2452 err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS);
2453 sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS,
2454 0xfffffffful);
2455 }
2456
2457 if (net_ratelimit()) 2446 if (net_ratelimit())
2458 dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err); 2447 dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err);
2459 2448
2449 sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS);
2460 } 2450 }
2461 2451
2462 if (status & Y2_HWE_L1_MASK) 2452 if (status & Y2_HWE_L1_MASK)
@@ -2703,13 +2693,10 @@ static inline u32 sky2_clk2us(const struct sky2_hw *hw, u32 clk)
2703 2693
2704static int __devinit sky2_init(struct sky2_hw *hw) 2694static int __devinit sky2_init(struct sky2_hw *hw)
2705{ 2695{
2706 int rc;
2707 u8 t8; 2696 u8 t8;
2708 2697
2709 /* Enable all clocks and check for bad PCI access */ 2698 /* Enable all clocks and check for bad PCI access */
2710 rc = pci_write_config_dword(hw->pdev, PCI_DEV_REG3, 0); 2699 sky2_pci_write32(hw, PCI_DEV_REG3, 0);
2711 if (rc)
2712 return rc;
2713 2700
2714 sky2_write8(hw, B0_CTST, CS_RST_CLR); 2701 sky2_write8(hw, B0_CTST, CS_RST_CLR);
2715 2702
@@ -2806,32 +2793,21 @@ static void sky2_reset(struct sky2_hw *hw)
2806 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); 2793 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
2807 2794
2808 /* clear PCI errors, if any */ 2795 /* clear PCI errors, if any */
2809 pci_read_config_word(pdev, PCI_STATUS, &status); 2796 status = sky2_pci_read16(hw, PCI_STATUS);
2810 status |= PCI_STATUS_ERROR_BITS; 2797 status |= PCI_STATUS_ERROR_BITS;
2811 pci_write_config_word(pdev, PCI_STATUS, status); 2798 sky2_pci_write16(hw, PCI_STATUS, status);
2812 2799
2813 sky2_write8(hw, B0_CTST, CS_MRST_CLR); 2800 sky2_write8(hw, B0_CTST, CS_MRST_CLR);
2814 2801
2815 cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); 2802 cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
2816 if (cap) { 2803 if (cap) {
2817 if (pci_find_aer_capability(pdev)) { 2804 sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS,
2818 /* Check for advanced error reporting */ 2805 0xfffffffful);
2819 pci_cleanup_aer_uncorrect_error_status(pdev);
2820 pci_cleanup_aer_correct_error_status(pdev);
2821 } else {
2822 dev_warn(&pdev->dev,
2823 "PCI Express Advanced Error Reporting"
2824 " not configured or MMCONFIG problem?\n");
2825
2826 sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS,
2827 0xfffffffful);
2828 }
2829 2806
2830 /* If error bit is stuck on ignore it */ 2807 /* If error bit is stuck on ignore it */
2831 if (sky2_read32(hw, B0_HWE_ISRC) & Y2_IS_PCI_EXP) 2808 if (sky2_read32(hw, B0_HWE_ISRC) & Y2_IS_PCI_EXP)
2832 dev_info(&pdev->dev, "ignoring stuck error report bit\n"); 2809 dev_info(&pdev->dev, "ignoring stuck error report bit\n");
2833 2810 else
2834 else if (pci_enable_pcie_error_reporting(pdev))
2835 hwe_mask |= Y2_IS_PCI_EXP; 2811 hwe_mask |= Y2_IS_PCI_EXP;
2836 } 2812 }
2837 2813
@@ -3672,32 +3648,33 @@ static int sky2_set_tso(struct net_device *dev, u32 data)
3672static int sky2_get_eeprom_len(struct net_device *dev) 3648static int sky2_get_eeprom_len(struct net_device *dev)
3673{ 3649{
3674 struct sky2_port *sky2 = netdev_priv(dev); 3650 struct sky2_port *sky2 = netdev_priv(dev);
3651 struct sky2_hw *hw = sky2->hw;
3675 u16 reg2; 3652 u16 reg2;
3676 3653
3677 pci_read_config_word(sky2->hw->pdev, PCI_DEV_REG2, &reg2); 3654 reg2 = sky2_pci_read16(hw, PCI_DEV_REG2);
3678 return 1 << ( ((reg2 & PCI_VPD_ROM_SZ) >> 14) + 8); 3655 return 1 << ( ((reg2 & PCI_VPD_ROM_SZ) >> 14) + 8);
3679} 3656}
3680 3657
3681static u32 sky2_vpd_read(struct pci_dev *pdev, int cap, u16 offset) 3658static u32 sky2_vpd_read(struct sky2_hw *hw, int cap, u16 offset)
3682{ 3659{
3683 u32 val; 3660 u32 val;
3684 3661
3685 pci_write_config_word(pdev, cap + PCI_VPD_ADDR, offset); 3662 sky2_pci_write16(hw, cap + PCI_VPD_ADDR, offset);
3686 3663
3687 do { 3664 do {
3688 pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &offset); 3665 offset = sky2_pci_read16(hw, cap + PCI_VPD_ADDR);
3689 } while (!(offset & PCI_VPD_ADDR_F)); 3666 } while (!(offset & PCI_VPD_ADDR_F));
3690 3667
3691 pci_read_config_dword(pdev, cap + PCI_VPD_DATA, &val); 3668 val = sky2_pci_read32(hw, cap + PCI_VPD_DATA);
3692 return val; 3669 return val;
3693} 3670}
3694 3671
3695static void sky2_vpd_write(struct pci_dev *pdev, int cap, u16 offset, u32 val) 3672static void sky2_vpd_write(struct sky2_hw *hw, int cap, u16 offset, u32 val)
3696{ 3673{
3697 pci_write_config_word(pdev, cap + PCI_VPD_DATA, val); 3674 sky2_pci_write16(hw, cap + PCI_VPD_DATA, val);
3698 pci_write_config_dword(pdev, cap + PCI_VPD_ADDR, offset | PCI_VPD_ADDR_F); 3675 sky2_pci_write32(hw, cap + PCI_VPD_ADDR, offset | PCI_VPD_ADDR_F);
3699 do { 3676 do {
3700 pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &offset); 3677 offset = sky2_pci_read16(hw, cap + PCI_VPD_ADDR);
3701 } while (offset & PCI_VPD_ADDR_F); 3678 } while (offset & PCI_VPD_ADDR_F);
3702} 3679}
3703 3680
@@ -3715,7 +3692,7 @@ static int sky2_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom
3715 eeprom->magic = SKY2_EEPROM_MAGIC; 3692 eeprom->magic = SKY2_EEPROM_MAGIC;
3716 3693
3717 while (length > 0) { 3694 while (length > 0) {
3718 u32 val = sky2_vpd_read(sky2->hw->pdev, cap, offset); 3695 u32 val = sky2_vpd_read(sky2->hw, cap, offset);
3719 int n = min_t(int, length, sizeof(val)); 3696 int n = min_t(int, length, sizeof(val));
3720 3697
3721 memcpy(data, &val, n); 3698 memcpy(data, &val, n);
@@ -3745,10 +3722,10 @@ static int sky2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom
3745 int n = min_t(int, length, sizeof(val)); 3722 int n = min_t(int, length, sizeof(val));
3746 3723
3747 if (n < sizeof(val)) 3724 if (n < sizeof(val))
3748 val = sky2_vpd_read(sky2->hw->pdev, cap, offset); 3725 val = sky2_vpd_read(sky2->hw, cap, offset);
3749 memcpy(&val, data, n); 3726 memcpy(&val, data, n);
3750 3727
3751 sky2_vpd_write(sky2->hw->pdev, cap, offset, val); 3728 sky2_vpd_write(sky2->hw, cap, offset, val);
3752 3729
3753 length -= n; 3730 length -= n;
3754 data += n; 3731 data += n;
@@ -4013,7 +3990,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
4013 sky2->duplex = -1; 3990 sky2->duplex = -1;
4014 sky2->speed = -1; 3991 sky2->speed = -1;
4015 sky2->advertising = sky2_supported_modes(hw); 3992 sky2->advertising = sky2_supported_modes(hw);
4016 sky2->rx_csum = 1; 3993 sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL);
4017 sky2->wol = wol; 3994 sky2->wol = wol;
4018 3995
4019 spin_lock_init(&sky2->phy_lock); 3996 spin_lock_init(&sky2->phy_lock);
@@ -4184,9 +4161,9 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4184 */ 4161 */
4185 { 4162 {
4186 u32 reg; 4163 u32 reg;
4187 pci_read_config_dword(pdev,PCI_DEV_REG2, &reg); 4164 reg = sky2_pci_read32(hw, PCI_DEV_REG2);
4188 reg &= ~PCI_REV_DESC; 4165 reg &= ~PCI_REV_DESC;
4189 pci_write_config_dword(pdev, PCI_DEV_REG2, reg); 4166 sky2_pci_write32(hw, PCI_DEV_REG2, reg);
4190 } 4167 }
4191#endif 4168#endif
4192 4169
@@ -4377,7 +4354,7 @@ static int sky2_resume(struct pci_dev *pdev)
4377 if (hw->chip_id == CHIP_ID_YUKON_EX || 4354 if (hw->chip_id == CHIP_ID_YUKON_EX ||
4378 hw->chip_id == CHIP_ID_YUKON_EC_U || 4355 hw->chip_id == CHIP_ID_YUKON_EC_U ||
4379 hw->chip_id == CHIP_ID_YUKON_FE_P) 4356 hw->chip_id == CHIP_ID_YUKON_FE_P)
4380 pci_write_config_dword(pdev, PCI_DEV_REG3, 0); 4357 sky2_pci_write32(hw, PCI_DEV_REG3, 0);
4381 4358
4382 sky2_reset(hw); 4359 sky2_reset(hw);
4383 sky2_write32(hw, B0_IMSK, Y2_IS_BASE); 4360 sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index 69525fd7908d..bc646a47edd2 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -2128,4 +2128,25 @@ static inline void gma_set_addr(struct sky2_hw *hw, unsigned port, unsigned reg,
2128 gma_write16(hw, port, reg+4,(u16) addr[2] | ((u16) addr[3] << 8)); 2128 gma_write16(hw, port, reg+4,(u16) addr[2] | ((u16) addr[3] << 8));
2129 gma_write16(hw, port, reg+8,(u16) addr[4] | ((u16) addr[5] << 8)); 2129 gma_write16(hw, port, reg+8,(u16) addr[4] | ((u16) addr[5] << 8));
2130} 2130}
2131
2132/* PCI config space access */
2133static inline u32 sky2_pci_read32(const struct sky2_hw *hw, unsigned reg)
2134{
2135 return sky2_read32(hw, Y2_CFG_SPC + reg);
2136}
2137
2138static inline u16 sky2_pci_read16(const struct sky2_hw *hw, unsigned reg)
2139{
2140 return sky2_read16(hw, Y2_CFG_SPC + reg);
2141}
2142
2143static inline void sky2_pci_write32(struct sky2_hw *hw, unsigned reg, u32 val)
2144{
2145 sky2_write32(hw, Y2_CFG_SPC + reg, val);
2146}
2147
2148static inline void sky2_pci_write16(struct sky2_hw *hw, unsigned reg, u16 val)
2149{
2150 sky2_write16(hw, Y2_CFG_SPC + reg, val);
2151}
2131#endif 2152#endif
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index dd18af0ce676..1a3d80bfe9ea 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -428,7 +428,6 @@ static inline void smc911x_drop_pkt(struct net_device *dev)
428 */ 428 */
429static inline void smc911x_rcv(struct net_device *dev) 429static inline void smc911x_rcv(struct net_device *dev)
430{ 430{
431 struct smc911x_local *lp = netdev_priv(dev);
432 unsigned long ioaddr = dev->base_addr; 431 unsigned long ioaddr = dev->base_addr;
433 unsigned int pkt_len, status; 432 unsigned int pkt_len, status;
434 struct sk_buff *skb; 433 struct sk_buff *skb;
@@ -473,6 +472,7 @@ static inline void smc911x_rcv(struct net_device *dev)
473 skb_put(skb,pkt_len-4); 472 skb_put(skb,pkt_len-4);
474#ifdef SMC_USE_DMA 473#ifdef SMC_USE_DMA
475 { 474 {
475 struct smc911x_local *lp = netdev_priv(dev);
476 unsigned int fifo; 476 unsigned int fifo;
477 /* Lower the FIFO threshold if possible */ 477 /* Lower the FIFO threshold if possible */
478 fifo = SMC_GET_FIFO_INT(); 478 fifo = SMC_GET_FIFO_INT();
@@ -1379,13 +1379,6 @@ static void smc911x_set_multicast_list(struct net_device *dev)
1379 unsigned int multicast_table[2]; 1379 unsigned int multicast_table[2];
1380 unsigned int mcr, update_multicast = 0; 1380 unsigned int mcr, update_multicast = 0;
1381 unsigned long flags; 1381 unsigned long flags;
1382 /* table for flipping the order of 5 bits */
1383 static const unsigned char invert5[] =
1384 {0x00, 0x10, 0x08, 0x18, 0x04, 0x14, 0x0C, 0x1C,
1385 0x02, 0x12, 0x0A, 0x1A, 0x06, 0x16, 0x0E, 0x1E,
1386 0x01, 0x11, 0x09, 0x19, 0x05, 0x15, 0x0D, 0x1D,
1387 0x03, 0x13, 0x0B, 0x1B, 0x07, 0x17, 0x0F, 0x1F};
1388
1389 1382
1390 DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __FUNCTION__); 1383 DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __FUNCTION__);
1391 1384
@@ -1432,7 +1425,7 @@ static void smc911x_set_multicast_list(struct net_device *dev)
1432 1425
1433 cur_addr = dev->mc_list; 1426 cur_addr = dev->mc_list;
1434 for (i = 0; i < dev->mc_count; i++, cur_addr = cur_addr->next) { 1427 for (i = 0; i < dev->mc_count; i++, cur_addr = cur_addr->next) {
1435 int position; 1428 u32 position;
1436 1429
1437 /* do we have a pointer here? */ 1430 /* do we have a pointer here? */
1438 if (!cur_addr) 1431 if (!cur_addr)
@@ -1442,12 +1435,10 @@ static void smc911x_set_multicast_list(struct net_device *dev)
1442 if (!(*cur_addr->dmi_addr & 1)) 1435 if (!(*cur_addr->dmi_addr & 1))
1443 continue; 1436 continue;
1444 1437
1445 /* only use the low order bits */ 1438 /* upper 6 bits are used as hash index */
1446 position = crc32_le(~0, cur_addr->dmi_addr, 6) & 0x3f; 1439 position = ether_crc(ETH_ALEN, cur_addr->dmi_addr)>>26;
1447 1440
1448 /* do some messy swapping to put the bit in the right spot */ 1441 multicast_table[position>>5] |= 1 << (position&0x1f);
1449 multicast_table[invert5[position&0x1F]&0x1] |=
1450 (1<<invert5[(position>>1)&0x1F]);
1451 } 1442 }
1452 1443
1453 /* be sure I get rid of flags I might have set */ 1444 /* be sure I get rid of flags I might have set */
diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h
index 16a0edc078fd..d04e4fa35206 100644
--- a/drivers/net/smc911x.h
+++ b/drivers/net/smc911x.h
@@ -37,7 +37,7 @@
37 #define SMC_USE_16BIT 0 37 #define SMC_USE_16BIT 0
38 #define SMC_USE_32BIT 1 38 #define SMC_USE_32BIT 1
39 #define SMC_IRQ_SENSE IRQF_TRIGGER_FALLING 39 #define SMC_IRQ_SENSE IRQF_TRIGGER_FALLING
40#elif CONFIG_SH_MAGIC_PANEL_R2 40#elif defined(CONFIG_SH_MAGIC_PANEL_R2)
41 #define SMC_USE_SH_DMA 0 41 #define SMC_USE_SH_DMA 0
42 #define SMC_USE_16BIT 0 42 #define SMC_USE_16BIT 0
43 #define SMC_USE_32BIT 1 43 #define SMC_USE_32BIT 1
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index db34e1eb67e9..07b7f7120e37 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -55,7 +55,7 @@
55#define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) 55#define SMC_insw(a, r, p, l) readsw((a) + (r), p, l)
56#define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) 56#define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l)
57 57
58#elif defined(CONFIG_BFIN) 58#elif defined(CONFIG_BLACKFIN)
59 59
60#define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH 60#define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH
61#define RPC_LSA_DEFAULT RPC_LED_100_10 61#define RPC_LSA_DEFAULT RPC_LED_100_10
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index ca90566d5bcd..b4891caeae5a 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -2118,8 +2118,8 @@ static int dmfe_suspend(struct pci_dev *pci_dev, pm_message_t state)
2118 pci_enable_wake(pci_dev, PCI_D3cold, 1); 2118 pci_enable_wake(pci_dev, PCI_D3cold, 1);
2119 2119
2120 /* Power down device*/ 2120 /* Power down device*/
2121 pci_set_power_state(pci_dev, pci_choose_state (pci_dev,state));
2122 pci_save_state(pci_dev); 2121 pci_save_state(pci_dev);
2122 pci_set_power_state(pci_dev, pci_choose_state (pci_dev, state));
2123 2123
2124 return 0; 2124 return 0;
2125} 2125}
@@ -2129,8 +2129,8 @@ static int dmfe_resume(struct pci_dev *pci_dev)
2129 struct net_device *dev = pci_get_drvdata(pci_dev); 2129 struct net_device *dev = pci_get_drvdata(pci_dev);
2130 u32 tmp; 2130 u32 tmp;
2131 2131
2132 pci_restore_state(pci_dev);
2133 pci_set_power_state(pci_dev, PCI_D0); 2132 pci_set_power_state(pci_dev, PCI_D0);
2133 pci_restore_state(pci_dev);
2134 2134
2135 /* Re-initilize DM910X board */ 2135 /* Re-initilize DM910X board */
2136 dmfe_init_dm910x(dev); 2136 dmfe_init_dm910x(dev);
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index a3ff270593f1..7f689907ac28 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1460,6 +1460,8 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
1460 if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) || 1460 if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) ||
1461 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) || 1461 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) ||
1462 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) || 1462 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) ||
1463 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
1464 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) ||
1463 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { 1465 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
1464 upsmr |= UPSMR_RPM; 1466 upsmr |= UPSMR_RPM;
1465 switch (ugeth->max_speed) { 1467 switch (ugeth->max_speed) {
@@ -1557,6 +1559,8 @@ static void adjust_link(struct net_device *dev)
1557 if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) || 1559 if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) ||
1558 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) || 1560 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) ||
1559 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) || 1561 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) ||
1562 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
1563 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) ||
1560 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { 1564 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
1561 if (phydev->speed == SPEED_10) 1565 if (phydev->speed == SPEED_10)
1562 upsmr |= UPSMR_R10M; 1566 upsmr |= UPSMR_R10M;
@@ -3795,6 +3799,10 @@ static phy_interface_t to_phy_interface(const char *phy_connection_type)
3795 return PHY_INTERFACE_MODE_RGMII; 3799 return PHY_INTERFACE_MODE_RGMII;
3796 if (strcasecmp(phy_connection_type, "rgmii-id") == 0) 3800 if (strcasecmp(phy_connection_type, "rgmii-id") == 0)
3797 return PHY_INTERFACE_MODE_RGMII_ID; 3801 return PHY_INTERFACE_MODE_RGMII_ID;
3802 if (strcasecmp(phy_connection_type, "rgmii-txid") == 0)
3803 return PHY_INTERFACE_MODE_RGMII_TXID;
3804 if (strcasecmp(phy_connection_type, "rgmii-rxid") == 0)
3805 return PHY_INTERFACE_MODE_RGMII_RXID;
3798 if (strcasecmp(phy_connection_type, "rtbi") == 0) 3806 if (strcasecmp(phy_connection_type, "rtbi") == 0)
3799 return PHY_INTERFACE_MODE_RTBI; 3807 return PHY_INTERFACE_MODE_RTBI;
3800 3808
@@ -3889,6 +3897,8 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3889 case PHY_INTERFACE_MODE_GMII: 3897 case PHY_INTERFACE_MODE_GMII:
3890 case PHY_INTERFACE_MODE_RGMII: 3898 case PHY_INTERFACE_MODE_RGMII:
3891 case PHY_INTERFACE_MODE_RGMII_ID: 3899 case PHY_INTERFACE_MODE_RGMII_ID:
3900 case PHY_INTERFACE_MODE_RGMII_RXID:
3901 case PHY_INTERFACE_MODE_RGMII_TXID:
3892 case PHY_INTERFACE_MODE_TBI: 3902 case PHY_INTERFACE_MODE_TBI:
3893 case PHY_INTERFACE_MODE_RTBI: 3903 case PHY_INTERFACE_MODE_RTBI:
3894 max_speed = SPEED_1000; 3904 max_speed = SPEED_1000;
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 2c685734b7a4..1ffdd106f4c4 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -94,7 +94,7 @@ static void dm_write_async_callback(struct urb *urb)
94 struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context; 94 struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context;
95 95
96 if (urb->status < 0) 96 if (urb->status < 0)
97 printk(KERN_DEBUG "dm_write_async_callback() failed with %d", 97 printk(KERN_DEBUG "dm_write_async_callback() failed with %d\n",
98 urb->status); 98 urb->status);
99 99
100 kfree(req); 100 kfree(req);
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 450e29d7a9f3..35cd65d6b9ed 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -1242,6 +1242,9 @@ static int velocity_rx_refill(struct velocity_info *vptr)
1242static int velocity_init_rd_ring(struct velocity_info *vptr) 1242static int velocity_init_rd_ring(struct velocity_info *vptr)
1243{ 1243{
1244 int ret; 1244 int ret;
1245 int mtu = vptr->dev->mtu;
1246
1247 vptr->rx_buf_sz = (mtu <= ETH_DATA_LEN) ? PKT_BUF_SZ : mtu + 32;
1245 1248
1246 vptr->rd_info = kcalloc(vptr->options.numrx, 1249 vptr->rd_info = kcalloc(vptr->options.numrx,
1247 sizeof(struct velocity_rd_info), GFP_KERNEL); 1250 sizeof(struct velocity_rd_info), GFP_KERNEL);
@@ -1898,8 +1901,6 @@ static int velocity_open(struct net_device *dev)
1898 struct velocity_info *vptr = netdev_priv(dev); 1901 struct velocity_info *vptr = netdev_priv(dev);
1899 int ret; 1902 int ret;
1900 1903
1901 vptr->rx_buf_sz = (dev->mtu <= 1504 ? PKT_BUF_SZ : dev->mtu + 32);
1902
1903 ret = velocity_init_rings(vptr); 1904 ret = velocity_init_rings(vptr);
1904 if (ret < 0) 1905 if (ret < 0)
1905 goto out; 1906 goto out;
@@ -1978,12 +1979,6 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu)
1978 velocity_free_rd_ring(vptr); 1979 velocity_free_rd_ring(vptr);
1979 1980
1980 dev->mtu = new_mtu; 1981 dev->mtu = new_mtu;
1981 if (new_mtu > 8192)
1982 vptr->rx_buf_sz = 9 * 1024;
1983 else if (new_mtu > 4096)
1984 vptr->rx_buf_sz = 8192;
1985 else
1986 vptr->rx_buf_sz = 4 * 1024;
1987 1982
1988 ret = velocity_init_rd_ring(vptr); 1983 ret = velocity_init_rd_ring(vptr);
1989 if (ret < 0) 1984 if (ret < 0)
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 2b17c1dc46f1..b45eecc53c4a 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1566,7 +1566,7 @@ static void b43_release_firmware(struct b43_wldev *dev)
1566static void b43_print_fw_helptext(struct b43_wl *wl) 1566static void b43_print_fw_helptext(struct b43_wl *wl)
1567{ 1567{
1568 b43err(wl, "You must go to " 1568 b43err(wl, "You must go to "
1569 "http://linuxwireless.org/en/users/Drivers/bcm43xx#devicefirmware " 1569 "http://linuxwireless.org/en/users/Drivers/b43#devicefirmware "
1570 "and download the correct firmware (version 4).\n"); 1570 "and download the correct firmware (version 4).\n");
1571} 1571}
1572 1572
diff --git a/drivers/net/wireless/b43/phy.c b/drivers/net/wireless/b43/phy.c
index 3d4ed647c311..7ff091e69f05 100644
--- a/drivers/net/wireless/b43/phy.c
+++ b/drivers/net/wireless/b43/phy.c
@@ -2214,7 +2214,7 @@ int b43_phy_init_tssi2dbm_table(struct b43_wldev *dev)
2214 } 2214 }
2215 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); 2215 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL);
2216 if (dyn_tssi2dbm == NULL) { 2216 if (dyn_tssi2dbm == NULL) {
2217 b43err(dev->wl, "Could not allocate memory" 2217 b43err(dev->wl, "Could not allocate memory "
2218 "for tssi2dbm table\n"); 2218 "for tssi2dbm table\n");
2219 return -ENOMEM; 2219 return -ENOMEM;
2220 } 2220 }
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
index 8cb3dc4c4745..83161d9af813 100644
--- a/drivers/net/wireless/b43legacy/dma.c
+++ b/drivers/net/wireless/b43legacy/dma.c
@@ -996,7 +996,7 @@ int b43legacy_dma_init(struct b43legacy_wldev *dev)
996 996
997 err = ssb_dma_set_mask(dev->dev, dmamask); 997 err = ssb_dma_set_mask(dev->dev, dmamask);
998 if (err) { 998 if (err) {
999#ifdef BCM43XX_PIO 999#ifdef CONFIG_B43LEGACY_PIO
1000 b43legacywarn(dev->wl, "DMA for this device not supported. " 1000 b43legacywarn(dev->wl, "DMA for this device not supported. "
1001 "Falling back to PIO\n"); 1001 "Falling back to PIO\n");
1002 dev->__using_pio = 1; 1002 dev->__using_pio = 1;
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 3bde1e9ab428..32d5e1785bda 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -1419,7 +1419,7 @@ static void b43legacy_release_firmware(struct b43legacy_wldev *dev)
1419static void b43legacy_print_fw_helptext(struct b43legacy_wl *wl) 1419static void b43legacy_print_fw_helptext(struct b43legacy_wl *wl)
1420{ 1420{
1421 b43legacyerr(wl, "You must go to http://linuxwireless.org/en/users/" 1421 b43legacyerr(wl, "You must go to http://linuxwireless.org/en/users/"
1422 "Drivers/bcm43xx#devicefirmware " 1422 "Drivers/b43#devicefirmware "
1423 "and download the correct firmware (version 3).\n"); 1423 "and download the correct firmware (version 3).\n");
1424} 1424}
1425 1425
diff --git a/drivers/net/wireless/b43legacy/phy.c b/drivers/net/wireless/b43legacy/phy.c
index 22a4b3d0186d..491e518e4aeb 100644
--- a/drivers/net/wireless/b43legacy/phy.c
+++ b/drivers/net/wireless/b43legacy/phy.c
@@ -2020,7 +2020,7 @@ int b43legacy_phy_init_tssi2dbm_table(struct b43legacy_wldev *dev)
2020 phy->idle_tssi = 62; 2020 phy->idle_tssi = 62;
2021 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); 2021 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL);
2022 if (dyn_tssi2dbm == NULL) { 2022 if (dyn_tssi2dbm == NULL) {
2023 b43legacyerr(dev->wl, "Could not allocate memory" 2023 b43legacyerr(dev->wl, "Could not allocate memory "
2024 "for tssi2dbm table\n"); 2024 "for tssi2dbm table\n");
2025 return -ENOMEM; 2025 return -ENOMEM;
2026 } 2026 }
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
index b37f1e348700..af3de3343650 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
@@ -2149,7 +2149,7 @@ int bcm43xx_phy_init_tssi2dbm_table(struct bcm43xx_private *bcm)
2149 } 2149 }
2150 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); 2150 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL);
2151 if (dyn_tssi2dbm == NULL) { 2151 if (dyn_tssi2dbm == NULL) {
2152 printk(KERN_ERR PFX "Could not allocate memory" 2152 printk(KERN_ERR PFX "Could not allocate memory "
2153 "for tssi2dbm table\n"); 2153 "for tssi2dbm table\n");
2154 return -ENOMEM; 2154 return -ENOMEM;
2155 } 2155 }
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 465da4f67ce7..4bdf237f6adc 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2915,6 +2915,10 @@ static void iwl_set_rate(struct iwl_priv *priv)
2915 int i; 2915 int i;
2916 2916
2917 hw = iwl_get_hw_mode(priv, priv->phymode); 2917 hw = iwl_get_hw_mode(priv, priv->phymode);
2918 if (!hw) {
2919 IWL_ERROR("Failed to set rate: unable to get hw mode\n");
2920 return;
2921 }
2918 2922
2919 priv->active_rate = 0; 2923 priv->active_rate = 0;
2920 priv->active_rate_basic = 0; 2924 priv->active_rate_basic = 0;
@@ -6936,13 +6940,10 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
6936 DECLARE_MAC_BUF(mac); 6940 DECLARE_MAC_BUF(mac);
6937 6941
6938 IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); 6942 IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type);
6939 if (conf->mac_addr)
6940 IWL_DEBUG_MAC80211("enter: MAC %s\n",
6941 print_mac(mac, conf->mac_addr));
6942 6943
6943 if (priv->interface_id) { 6944 if (priv->interface_id) {
6944 IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); 6945 IWL_DEBUG_MAC80211("leave - interface_id != 0\n");
6945 return 0; 6946 return -EOPNOTSUPP;
6946 } 6947 }
6947 6948
6948 spin_lock_irqsave(&priv->lock, flags); 6949 spin_lock_irqsave(&priv->lock, flags);
@@ -6951,6 +6952,12 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
6951 spin_unlock_irqrestore(&priv->lock, flags); 6952 spin_unlock_irqrestore(&priv->lock, flags);
6952 6953
6953 mutex_lock(&priv->mutex); 6954 mutex_lock(&priv->mutex);
6955
6956 if (conf->mac_addr) {
6957 IWL_DEBUG_MAC80211("Set: %s\n", print_mac(mac, conf->mac_addr));
6958 memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
6959 }
6960
6954 iwl_set_mode(priv, conf->type); 6961 iwl_set_mode(priv, conf->type);
6955 6962
6956 IWL_DEBUG_MAC80211("leave\n"); 6963 IWL_DEBUG_MAC80211("leave\n");
@@ -8270,6 +8277,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
8270{ 8277{
8271 iwl_hw_cancel_deferred_work(priv); 8278 iwl_hw_cancel_deferred_work(priv);
8272 8279
8280 cancel_delayed_work_sync(&priv->init_alive_start);
8273 cancel_delayed_work(&priv->scan_check); 8281 cancel_delayed_work(&priv->scan_check);
8274 cancel_delayed_work(&priv->alive_start); 8282 cancel_delayed_work(&priv->alive_start);
8275 cancel_delayed_work(&priv->post_associate); 8283 cancel_delayed_work(&priv->post_associate);
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 9918780f5e86..8f85564ec6fa 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -3003,6 +3003,10 @@ static void iwl_set_rate(struct iwl_priv *priv)
3003 int i; 3003 int i;
3004 3004
3005 hw = iwl_get_hw_mode(priv, priv->phymode); 3005 hw = iwl_get_hw_mode(priv, priv->phymode);
3006 if (!hw) {
3007 IWL_ERROR("Failed to set rate: unable to get hw mode\n");
3008 return;
3009 }
3006 3010
3007 priv->active_rate = 0; 3011 priv->active_rate = 0;
3008 priv->active_rate_basic = 0; 3012 priv->active_rate_basic = 0;
@@ -7326,9 +7330,6 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
7326 DECLARE_MAC_BUF(mac); 7330 DECLARE_MAC_BUF(mac);
7327 7331
7328 IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); 7332 IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type);
7329 if (conf->mac_addr)
7330 IWL_DEBUG_MAC80211("enter: MAC %s\n",
7331 print_mac(mac, conf->mac_addr));
7332 7333
7333 if (priv->interface_id) { 7334 if (priv->interface_id) {
7334 IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); 7335 IWL_DEBUG_MAC80211("leave - interface_id != 0\n");
@@ -7341,6 +7342,11 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
7341 spin_unlock_irqrestore(&priv->lock, flags); 7342 spin_unlock_irqrestore(&priv->lock, flags);
7342 7343
7343 mutex_lock(&priv->mutex); 7344 mutex_lock(&priv->mutex);
7345
7346 if (conf->mac_addr) {
7347 IWL_DEBUG_MAC80211("Set %s\n", print_mac(mac, conf->mac_addr));
7348 memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
7349 }
7344 iwl_set_mode(priv, conf->type); 7350 iwl_set_mode(priv, conf->type);
7345 7351
7346 IWL_DEBUG_MAC80211("leave\n"); 7352 IWL_DEBUG_MAC80211("leave\n");
@@ -8864,6 +8870,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
8864{ 8870{
8865 iwl_hw_cancel_deferred_work(priv); 8871 iwl_hw_cancel_deferred_work(priv);
8866 8872
8873 cancel_delayed_work_sync(&priv->init_alive_start);
8867 cancel_delayed_work(&priv->scan_check); 8874 cancel_delayed_work(&priv->scan_check);
8868 cancel_delayed_work(&priv->alive_start); 8875 cancel_delayed_work(&priv->alive_start);
8869 cancel_delayed_work(&priv->post_associate); 8876 cancel_delayed_work(&priv->post_associate);
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index ec89dabc412c..ba4fc2b3bf0a 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -170,7 +170,8 @@ static int if_cs_poll_while_fw_download(struct if_cs_card *card, uint addr, u8 r
170#define IF_CS_H_IC_TX_OVER 0x0001 170#define IF_CS_H_IC_TX_OVER 0x0001
171#define IF_CS_H_IC_RX_OVER 0x0002 171#define IF_CS_H_IC_RX_OVER 0x0002
172#define IF_CS_H_IC_DNLD_OVER 0x0004 172#define IF_CS_H_IC_DNLD_OVER 0x0004
173#define IF_CS_H_IC_HOST_EVENT 0x0008 173#define IF_CS_H_IC_POWER_DOWN 0x0008
174#define IF_CS_H_IC_HOST_EVENT 0x0010
174#define IF_CS_H_IC_MASK 0x001f 175#define IF_CS_H_IC_MASK 0x001f
175 176
176#define IF_CS_H_INT_MASK 0x00000004 177#define IF_CS_H_INT_MASK 0x00000004
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 5ead08312e1e..1823b48a8ba7 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -1165,8 +1165,6 @@ wlan_private *libertas_add_card(void *card, struct device *dmdev)
1165#ifdef WIRELESS_EXT 1165#ifdef WIRELESS_EXT
1166 dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def; 1166 dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def;
1167#endif 1167#endif
1168#define NETIF_F_DYNALLOC 16
1169 dev->features |= NETIF_F_DYNALLOC;
1170 dev->flags |= IFF_BROADCAST | IFF_MULTICAST; 1168 dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
1171 dev->set_multicast_list = libertas_set_multicast_list; 1169 dev->set_multicast_list = libertas_set_multicast_list;
1172 1170
@@ -1348,8 +1346,6 @@ int libertas_add_mesh(wlan_private *priv, struct device *dev)
1348#ifdef WIRELESS_EXT 1346#ifdef WIRELESS_EXT
1349 mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def; 1347 mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def;
1350#endif 1348#endif
1351#define NETIF_F_DYNALLOC 16
1352
1353 /* Register virtual mesh interface */ 1349 /* Register virtual mesh interface */
1354 ret = register_netdev(mesh_dev); 1350 ret = register_netdev(mesh_dev);
1355 if (ret) { 1351 if (ret) {
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index c6f5aa3cb465..395b7882d4d6 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -1528,7 +1528,7 @@ static int wlan_set_encodeext(struct net_device *dev,
1528 && (ext->key_len != KEY_LEN_WPA_TKIP)) 1528 && (ext->key_len != KEY_LEN_WPA_TKIP))
1529 || ((alg == IW_ENCODE_ALG_CCMP) 1529 || ((alg == IW_ENCODE_ALG_CCMP)
1530 && (ext->key_len != KEY_LEN_WPA_AES))) { 1530 && (ext->key_len != KEY_LEN_WPA_AES))) {
1531 lbs_deb_wext("invalid size %d for key of alg" 1531 lbs_deb_wext("invalid size %d for key of alg "
1532 "type %d\n", 1532 "type %d\n",
1533 ext->key_len, 1533 ext->key_len,
1534 alg); 1534 alg);
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index 2402cb8dd328..d2fa079fbc4c 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -806,7 +806,7 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) {
806 for (i = 0; i < 6; i++) 806 for (i = 0; i < 6; i++)
807 dev->dev_addr[i] = readb(ramBase + NETWAVE_EREG_PA + i); 807 dev->dev_addr[i] = readb(ramBase + NETWAVE_EREG_PA + i);
808 808
809 printk(KERN_INFO "%s: Netwave: port %#3lx, irq %d, mem %lx" 809 printk(KERN_INFO "%s: Netwave: port %#3lx, irq %d, mem %lx, "
810 "id %c%c, hw_addr %s\n", 810 "id %c%c, hw_addr %s\n",
811 dev->name, dev->base_addr, dev->irq, 811 dev->name, dev->base_addr, dev->irq,
812 (u_long) ramBase, 812 (u_long) ramBase,
diff --git a/drivers/net/wireless/p54usb.c b/drivers/net/wireless/p54usb.c
index 755482a5a938..60d286eb0b8b 100644
--- a/drivers/net/wireless/p54usb.c
+++ b/drivers/net/wireless/p54usb.c
@@ -308,7 +308,7 @@ static int p54u_read_eeprom(struct ieee80211_hw *dev)
308 308
309 buf = kmalloc(0x2020, GFP_KERNEL); 309 buf = kmalloc(0x2020, GFP_KERNEL);
310 if (!buf) { 310 if (!buf) {
311 printk(KERN_ERR "prism54usb: cannot allocate memory for" 311 printk(KERN_ERR "prism54usb: cannot allocate memory for "
312 "eeprom readback!\n"); 312 "eeprom readback!\n");
313 return -ENOMEM; 313 return -ENOMEM;
314 } 314 }
diff --git a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c
index 6bf3ebbe985a..b3b6f654365c 100644
--- a/drivers/s390/net/ctcmain.c
+++ b/drivers/s390/net/ctcmain.c
@@ -2782,35 +2782,14 @@ ctc_probe_device(struct ccwgroup_device *cgdev)
2782} 2782}
2783 2783
2784/** 2784/**
2785 * Initialize everything of the net device except the name and the 2785 * Device setup function called by alloc_netdev().
2786 * channel structs. 2786 *
2787 * @param dev Device to be setup.
2787 */ 2788 */
2788static struct net_device * 2789void ctc_init_netdevice(struct net_device * dev)
2789ctc_init_netdevice(struct net_device * dev, int alloc_device,
2790 struct ctc_priv *privptr)
2791{ 2790{
2792 if (!privptr)
2793 return NULL;
2794
2795 DBF_TEXT(setup, 3, __FUNCTION__); 2791 DBF_TEXT(setup, 3, __FUNCTION__);
2796 2792
2797 if (alloc_device) {
2798 dev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
2799 if (!dev)
2800 return NULL;
2801 }
2802
2803 dev->priv = privptr;
2804 privptr->fsm = init_fsm("ctcdev", dev_state_names,
2805 dev_event_names, CTC_NR_DEV_STATES, CTC_NR_DEV_EVENTS,
2806 dev_fsm, DEV_FSM_LEN, GFP_KERNEL);
2807 if (privptr->fsm == NULL) {
2808 if (alloc_device)
2809 kfree(dev);
2810 return NULL;
2811 }
2812 fsm_newstate(privptr->fsm, DEV_STATE_STOPPED);
2813 fsm_settimer(privptr->fsm, &privptr->restart_timer);
2814 if (dev->mtu == 0) 2793 if (dev->mtu == 0)
2815 dev->mtu = CTC_BUFSIZE_DEFAULT - LL_HEADER_LENGTH - 2; 2794 dev->mtu = CTC_BUFSIZE_DEFAULT - LL_HEADER_LENGTH - 2;
2816 dev->hard_start_xmit = ctc_tx; 2795 dev->hard_start_xmit = ctc_tx;
@@ -2823,7 +2802,7 @@ ctc_init_netdevice(struct net_device * dev, int alloc_device,
2823 dev->type = ARPHRD_SLIP; 2802 dev->type = ARPHRD_SLIP;
2824 dev->tx_queue_len = 100; 2803 dev->tx_queue_len = 100;
2825 dev->flags = IFF_POINTOPOINT | IFF_NOARP; 2804 dev->flags = IFF_POINTOPOINT | IFF_NOARP;
2826 return dev; 2805 SET_MODULE_OWNER(dev);
2827} 2806}
2828 2807
2829 2808
@@ -2879,14 +2858,22 @@ ctc_new_device(struct ccwgroup_device *cgdev)
2879 "ccw_device_set_online (cdev[1]) failed with ret = %d\n", ret); 2858 "ccw_device_set_online (cdev[1]) failed with ret = %d\n", ret);
2880 } 2859 }
2881 2860
2882 dev = ctc_init_netdevice(NULL, 1, privptr); 2861 dev = alloc_netdev(0, "ctc%d", ctc_init_netdevice);
2883
2884 if (!dev) { 2862 if (!dev) {
2885 ctc_pr_warn("ctc_init_netdevice failed\n"); 2863 ctc_pr_warn("ctc_init_netdevice failed\n");
2886 goto out; 2864 goto out;
2887 } 2865 }
2866 dev->priv = privptr;
2888 2867
2889 strlcpy(dev->name, "ctc%d", IFNAMSIZ); 2868 privptr->fsm = init_fsm("ctcdev", dev_state_names,
2869 dev_event_names, CTC_NR_DEV_STATES, CTC_NR_DEV_EVENTS,
2870 dev_fsm, DEV_FSM_LEN, GFP_KERNEL);
2871 if (privptr->fsm == NULL) {
2872 free_netdev(dev);
2873 goto out;
2874 }
2875 fsm_newstate(privptr->fsm, DEV_STATE_STOPPED);
2876 fsm_settimer(privptr->fsm, &privptr->restart_timer);
2890 2877
2891 for (direction = READ; direction <= WRITE; direction++) { 2878 for (direction = READ; direction <= WRITE; direction++) {
2892 privptr->channel[direction] = 2879 privptr->channel[direction] =