diff options
Diffstat (limited to 'drivers/net/via-rhine.c')
| -rw-r--r-- | drivers/net/via-rhine.c | 570 |
1 files changed, 428 insertions, 142 deletions
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index 4930f9dbc493..7f23ab913fd9 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
| @@ -29,14 +29,17 @@ | |||
| 29 | 29 | ||
| 30 | */ | 30 | */ |
| 31 | 31 | ||
| 32 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
| 33 | |||
| 32 | #define DRV_NAME "via-rhine" | 34 | #define DRV_NAME "via-rhine" |
| 33 | #define DRV_VERSION "1.4.3" | 35 | #define DRV_VERSION "1.5.0" |
| 34 | #define DRV_RELDATE "2007-03-06" | 36 | #define DRV_RELDATE "2010-10-09" |
| 35 | 37 | ||
| 36 | 38 | ||
| 37 | /* A few user-configurable values. | 39 | /* A few user-configurable values. |
| 38 | These may be modified when a driver module is loaded. */ | 40 | These may be modified when a driver module is loaded. */ |
| 39 | 41 | ||
| 42 | #define DEBUG | ||
| 40 | static int debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */ | 43 | static int debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */ |
| 41 | static int max_interrupt_work = 20; | 44 | static int max_interrupt_work = 20; |
| 42 | 45 | ||
| @@ -100,6 +103,7 @@ static const int multicast_filter_limit = 32; | |||
| 100 | #include <linux/mii.h> | 103 | #include <linux/mii.h> |
| 101 | #include <linux/ethtool.h> | 104 | #include <linux/ethtool.h> |
| 102 | #include <linux/crc32.h> | 105 | #include <linux/crc32.h> |
| 106 | #include <linux/if_vlan.h> | ||
| 103 | #include <linux/bitops.h> | 107 | #include <linux/bitops.h> |
| 104 | #include <linux/workqueue.h> | 108 | #include <linux/workqueue.h> |
| 105 | #include <asm/processor.h> /* Processor type for cache alignment. */ | 109 | #include <asm/processor.h> /* Processor type for cache alignment. */ |
| @@ -110,8 +114,7 @@ static const int multicast_filter_limit = 32; | |||
| 110 | 114 | ||
| 111 | /* These identify the driver base version and may not be removed. */ | 115 | /* These identify the driver base version and may not be removed. */ |
| 112 | static const char version[] __devinitconst = | 116 | static const char version[] __devinitconst = |
| 113 | KERN_INFO DRV_NAME ".c:v1.10-LK" DRV_VERSION " " DRV_RELDATE | 117 | "v1.10-LK" DRV_VERSION " " DRV_RELDATE " Written by Donald Becker"; |
| 114 | " Written by Donald Becker\n"; | ||
| 115 | 118 | ||
| 116 | /* This driver was written to use PCI memory space. Some early versions | 119 | /* This driver was written to use PCI memory space. Some early versions |
| 117 | of the Rhine may only work correctly with I/O space accesses. */ | 120 | of the Rhine may only work correctly with I/O space accesses. */ |
| @@ -133,6 +136,9 @@ MODULE_PARM_DESC(debug, "VIA Rhine debug level (0-7)"); | |||
| 133 | MODULE_PARM_DESC(rx_copybreak, "VIA Rhine copy breakpoint for copy-only-tiny-frames"); | 136 | MODULE_PARM_DESC(rx_copybreak, "VIA Rhine copy breakpoint for copy-only-tiny-frames"); |
| 134 | MODULE_PARM_DESC(avoid_D3, "Avoid power state D3 (work-around for broken BIOSes)"); | 137 | MODULE_PARM_DESC(avoid_D3, "Avoid power state D3 (work-around for broken BIOSes)"); |
| 135 | 138 | ||
| 139 | #define MCAM_SIZE 32 | ||
| 140 | #define VCAM_SIZE 32 | ||
| 141 | |||
| 136 | /* | 142 | /* |
| 137 | Theory of Operation | 143 | Theory of Operation |
| 138 | 144 | ||
| @@ -279,15 +285,16 @@ MODULE_DEVICE_TABLE(pci, rhine_pci_tbl); | |||
| 279 | /* Offsets to the device registers. */ | 285 | /* Offsets to the device registers. */ |
| 280 | enum register_offsets { | 286 | enum register_offsets { |
| 281 | StationAddr=0x00, RxConfig=0x06, TxConfig=0x07, ChipCmd=0x08, | 287 | StationAddr=0x00, RxConfig=0x06, TxConfig=0x07, ChipCmd=0x08, |
| 282 | ChipCmd1=0x09, | 288 | ChipCmd1=0x09, TQWake=0x0A, |
| 283 | IntrStatus=0x0C, IntrEnable=0x0E, | 289 | IntrStatus=0x0C, IntrEnable=0x0E, |
| 284 | MulticastFilter0=0x10, MulticastFilter1=0x14, | 290 | MulticastFilter0=0x10, MulticastFilter1=0x14, |
| 285 | RxRingPtr=0x18, TxRingPtr=0x1C, GFIFOTest=0x54, | 291 | RxRingPtr=0x18, TxRingPtr=0x1C, GFIFOTest=0x54, |
| 286 | MIIPhyAddr=0x6C, MIIStatus=0x6D, PCIBusConfig=0x6E, | 292 | MIIPhyAddr=0x6C, MIIStatus=0x6D, PCIBusConfig=0x6E, PCIBusConfig1=0x6F, |
| 287 | MIICmd=0x70, MIIRegAddr=0x71, MIIData=0x72, MACRegEEcsr=0x74, | 293 | MIICmd=0x70, MIIRegAddr=0x71, MIIData=0x72, MACRegEEcsr=0x74, |
| 288 | ConfigA=0x78, ConfigB=0x79, ConfigC=0x7A, ConfigD=0x7B, | 294 | ConfigA=0x78, ConfigB=0x79, ConfigC=0x7A, ConfigD=0x7B, |
| 289 | RxMissed=0x7C, RxCRCErrs=0x7E, MiscCmd=0x81, | 295 | RxMissed=0x7C, RxCRCErrs=0x7E, MiscCmd=0x81, |
| 290 | StickyHW=0x83, IntrStatus2=0x84, | 296 | StickyHW=0x83, IntrStatus2=0x84, |
| 297 | CamMask=0x88, CamCon=0x92, CamAddr=0x93, | ||
| 291 | WOLcrSet=0xA0, PwcfgSet=0xA1, WOLcgSet=0xA3, WOLcrClr=0xA4, | 298 | WOLcrSet=0xA0, PwcfgSet=0xA1, WOLcgSet=0xA3, WOLcrClr=0xA4, |
| 292 | WOLcrClr1=0xA6, WOLcgClr=0xA7, | 299 | WOLcrClr1=0xA6, WOLcgClr=0xA7, |
| 293 | PwrcsrSet=0xA8, PwrcsrSet1=0xA9, PwrcsrClr=0xAC, PwrcsrClr1=0xAD, | 300 | PwrcsrSet=0xA8, PwrcsrSet1=0xA9, PwrcsrClr=0xAC, PwrcsrClr1=0xAD, |
| @@ -299,6 +306,40 @@ enum backoff_bits { | |||
| 299 | BackCaptureEffect=0x04, BackRandom=0x08 | 306 | BackCaptureEffect=0x04, BackRandom=0x08 |
| 300 | }; | 307 | }; |
| 301 | 308 | ||
| 309 | /* Bits in the TxConfig (TCR) register */ | ||
| 310 | enum tcr_bits { | ||
| 311 | TCR_PQEN=0x01, | ||
| 312 | TCR_LB0=0x02, /* loopback[0] */ | ||
| 313 | TCR_LB1=0x04, /* loopback[1] */ | ||
| 314 | TCR_OFSET=0x08, | ||
| 315 | TCR_RTGOPT=0x10, | ||
| 316 | TCR_RTFT0=0x20, | ||
| 317 | TCR_RTFT1=0x40, | ||
| 318 | TCR_RTSF=0x80, | ||
| 319 | }; | ||
| 320 | |||
| 321 | /* Bits in the CamCon (CAMC) register */ | ||
| 322 | enum camcon_bits { | ||
| 323 | CAMC_CAMEN=0x01, | ||
| 324 | CAMC_VCAMSL=0x02, | ||
| 325 | CAMC_CAMWR=0x04, | ||
| 326 | CAMC_CAMRD=0x08, | ||
| 327 | }; | ||
| 328 | |||
| 329 | /* Bits in the PCIBusConfig1 (BCR1) register */ | ||
| 330 | enum bcr1_bits { | ||
| 331 | BCR1_POT0=0x01, | ||
| 332 | BCR1_POT1=0x02, | ||
| 333 | BCR1_POT2=0x04, | ||
| 334 | BCR1_CTFT0=0x08, | ||
| 335 | BCR1_CTFT1=0x10, | ||
| 336 | BCR1_CTSF=0x20, | ||
| 337 | BCR1_TXQNOBK=0x40, /* for VT6105 */ | ||
| 338 | BCR1_VIDFR=0x80, /* for VT6105 */ | ||
| 339 | BCR1_MED0=0x40, /* for VT6102 */ | ||
| 340 | BCR1_MED1=0x80, /* for VT6102 */ | ||
| 341 | }; | ||
| 342 | |||
| 302 | #ifdef USE_MMIO | 343 | #ifdef USE_MMIO |
| 303 | /* Registers we check that mmio and reg are the same. */ | 344 | /* Registers we check that mmio and reg are the same. */ |
| 304 | static const int mmio_verify_registers[] = { | 345 | static const int mmio_verify_registers[] = { |
| @@ -356,6 +397,11 @@ enum desc_status_bits { | |||
| 356 | DescOwn=0x80000000 | 397 | DescOwn=0x80000000 |
| 357 | }; | 398 | }; |
| 358 | 399 | ||
| 400 | /* Bits in *_desc.*_length */ | ||
| 401 | enum desc_length_bits { | ||
| 402 | DescTag=0x00010000 | ||
| 403 | }; | ||
| 404 | |||
| 359 | /* Bits in ChipCmd. */ | 405 | /* Bits in ChipCmd. */ |
| 360 | enum chip_cmd_bits { | 406 | enum chip_cmd_bits { |
| 361 | CmdInit=0x01, CmdStart=0x02, CmdStop=0x04, CmdRxOn=0x08, | 407 | CmdInit=0x01, CmdStart=0x02, CmdStop=0x04, CmdRxOn=0x08, |
| @@ -365,6 +411,9 @@ enum chip_cmd_bits { | |||
| 365 | }; | 411 | }; |
| 366 | 412 | ||
| 367 | struct rhine_private { | 413 | struct rhine_private { |
| 414 | /* Bit mask for configured VLAN ids */ | ||
| 415 | unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; | ||
| 416 | |||
| 368 | /* Descriptor rings */ | 417 | /* Descriptor rings */ |
| 369 | struct rx_desc *rx_ring; | 418 | struct rx_desc *rx_ring; |
| 370 | struct tx_desc *tx_ring; | 419 | struct tx_desc *tx_ring; |
| @@ -405,6 +454,23 @@ struct rhine_private { | |||
| 405 | void __iomem *base; | 454 | void __iomem *base; |
| 406 | }; | 455 | }; |
| 407 | 456 | ||
| 457 | #define BYTE_REG_BITS_ON(x, p) do { iowrite8((ioread8((p))|(x)), (p)); } while (0) | ||
| 458 | #define WORD_REG_BITS_ON(x, p) do { iowrite16((ioread16((p))|(x)), (p)); } while (0) | ||
| 459 | #define DWORD_REG_BITS_ON(x, p) do { iowrite32((ioread32((p))|(x)), (p)); } while (0) | ||
| 460 | |||
| 461 | #define BYTE_REG_BITS_IS_ON(x, p) (ioread8((p)) & (x)) | ||
| 462 | #define WORD_REG_BITS_IS_ON(x, p) (ioread16((p)) & (x)) | ||
| 463 | #define DWORD_REG_BITS_IS_ON(x, p) (ioread32((p)) & (x)) | ||
| 464 | |||
| 465 | #define BYTE_REG_BITS_OFF(x, p) do { iowrite8(ioread8((p)) & (~(x)), (p)); } while (0) | ||
| 466 | #define WORD_REG_BITS_OFF(x, p) do { iowrite16(ioread16((p)) & (~(x)), (p)); } while (0) | ||
| 467 | #define DWORD_REG_BITS_OFF(x, p) do { iowrite32(ioread32((p)) & (~(x)), (p)); } while (0) | ||
| 468 | |||
| 469 | #define BYTE_REG_BITS_SET(x, m, p) do { iowrite8((ioread8((p)) & (~(m)))|(x), (p)); } while (0) | ||
| 470 | #define WORD_REG_BITS_SET(x, m, p) do { iowrite16((ioread16((p)) & (~(m)))|(x), (p)); } while (0) | ||
| 471 | #define DWORD_REG_BITS_SET(x, m, p) do { iowrite32((ioread32((p)) & (~(m)))|(x), (p)); } while (0) | ||
| 472 | |||
| 473 | |||
| 408 | static int mdio_read(struct net_device *dev, int phy_id, int location); | 474 | static int mdio_read(struct net_device *dev, int phy_id, int location); |
| 409 | static void mdio_write(struct net_device *dev, int phy_id, int location, int value); | 475 | static void mdio_write(struct net_device *dev, int phy_id, int location, int value); |
| 410 | static int rhine_open(struct net_device *dev); | 476 | static int rhine_open(struct net_device *dev); |
| @@ -422,15 +488,24 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | |||
| 422 | static const struct ethtool_ops netdev_ethtool_ops; | 488 | static const struct ethtool_ops netdev_ethtool_ops; |
| 423 | static int rhine_close(struct net_device *dev); | 489 | static int rhine_close(struct net_device *dev); |
| 424 | static void rhine_shutdown (struct pci_dev *pdev); | 490 | static void rhine_shutdown (struct pci_dev *pdev); |
| 425 | 491 | static void rhine_vlan_rx_add_vid(struct net_device *dev, unsigned short vid); | |
| 426 | #define RHINE_WAIT_FOR(condition) do { \ | 492 | static void rhine_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid); |
| 427 | int i=1024; \ | 493 | static void rhine_set_cam(void __iomem *ioaddr, int idx, u8 *addr); |
| 428 | while (!(condition) && --i) \ | 494 | static void rhine_set_vlan_cam(void __iomem *ioaddr, int idx, u8 *addr); |
| 429 | ; \ | 495 | static void rhine_set_cam_mask(void __iomem *ioaddr, u32 mask); |
| 430 | if (debug > 1 && i < 512) \ | 496 | static void rhine_set_vlan_cam_mask(void __iomem *ioaddr, u32 mask); |
| 431 | printk(KERN_INFO "%s: %4d cycles used @ %s:%d\n", \ | 497 | static void rhine_init_cam_filter(struct net_device *dev); |
| 432 | DRV_NAME, 1024-i, __func__, __LINE__); \ | 498 | static void rhine_update_vcam(struct net_device *dev); |
| 433 | } while(0) | 499 | |
| 500 | #define RHINE_WAIT_FOR(condition) \ | ||
| 501 | do { \ | ||
| 502 | int i = 1024; \ | ||
| 503 | while (!(condition) && --i) \ | ||
| 504 | ; \ | ||
| 505 | if (debug > 1 && i < 512) \ | ||
| 506 | pr_info("%4d cycles used @ %s:%d\n", \ | ||
| 507 | 1024 - i, __func__, __LINE__); \ | ||
| 508 | } while (0) | ||
| 434 | 509 | ||
| 435 | static inline u32 get_intr_status(struct net_device *dev) | 510 | static inline u32 get_intr_status(struct net_device *dev) |
| 436 | { | 511 | { |
| @@ -499,8 +574,8 @@ static void rhine_power_init(struct net_device *dev) | |||
| 499 | default: | 574 | default: |
| 500 | reason = "Unknown"; | 575 | reason = "Unknown"; |
| 501 | } | 576 | } |
| 502 | printk(KERN_INFO "%s: Woke system up. Reason: %s.\n", | 577 | netdev_info(dev, "Woke system up. Reason: %s\n", |
| 503 | DRV_NAME, reason); | 578 | reason); |
| 504 | } | 579 | } |
| 505 | } | 580 | } |
| 506 | } | 581 | } |
| @@ -514,8 +589,7 @@ static void rhine_chip_reset(struct net_device *dev) | |||
| 514 | IOSYNC; | 589 | IOSYNC; |
| 515 | 590 | ||
| 516 | if (ioread8(ioaddr + ChipCmd1) & Cmd1Reset) { | 591 | if (ioread8(ioaddr + ChipCmd1) & Cmd1Reset) { |
| 517 | printk(KERN_INFO "%s: Reset not complete yet. " | 592 | netdev_info(dev, "Reset not complete yet. Trying harder.\n"); |
| 518 | "Trying harder.\n", DRV_NAME); | ||
| 519 | 593 | ||
| 520 | /* Force reset */ | 594 | /* Force reset */ |
| 521 | if (rp->quirks & rqForceReset) | 595 | if (rp->quirks & rqForceReset) |
| @@ -526,9 +600,9 @@ static void rhine_chip_reset(struct net_device *dev) | |||
| 526 | } | 600 | } |
| 527 | 601 | ||
| 528 | if (debug > 1) | 602 | if (debug > 1) |
| 529 | printk(KERN_INFO "%s: Reset %s.\n", dev->name, | 603 | netdev_info(dev, "Reset %s\n", |
| 530 | (ioread8(ioaddr + ChipCmd1) & Cmd1Reset) ? | 604 | (ioread8(ioaddr + ChipCmd1) & Cmd1Reset) ? |
| 531 | "failed" : "succeeded"); | 605 | "failed" : "succeeded"); |
| 532 | } | 606 | } |
| 533 | 607 | ||
| 534 | #ifdef USE_MMIO | 608 | #ifdef USE_MMIO |
| @@ -629,6 +703,8 @@ static const struct net_device_ops rhine_netdev_ops = { | |||
| 629 | .ndo_set_mac_address = eth_mac_addr, | 703 | .ndo_set_mac_address = eth_mac_addr, |
| 630 | .ndo_do_ioctl = netdev_ioctl, | 704 | .ndo_do_ioctl = netdev_ioctl, |
| 631 | .ndo_tx_timeout = rhine_tx_timeout, | 705 | .ndo_tx_timeout = rhine_tx_timeout, |
| 706 | .ndo_vlan_rx_add_vid = rhine_vlan_rx_add_vid, | ||
| 707 | .ndo_vlan_rx_kill_vid = rhine_vlan_rx_kill_vid, | ||
| 632 | #ifdef CONFIG_NET_POLL_CONTROLLER | 708 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 633 | .ndo_poll_controller = rhine_poll, | 709 | .ndo_poll_controller = rhine_poll, |
| 634 | #endif | 710 | #endif |
| @@ -654,9 +730,7 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
| 654 | 730 | ||
| 655 | /* when built into the kernel, we only print version if device is found */ | 731 | /* when built into the kernel, we only print version if device is found */ |
| 656 | #ifndef MODULE | 732 | #ifndef MODULE |
| 657 | static int printed_version; | 733 | pr_info_once("%s\n", version); |
| 658 | if (!printed_version++) | ||
| 659 | printk(version); | ||
| 660 | #endif | 734 | #endif |
| 661 | 735 | ||
| 662 | io_size = 256; | 736 | io_size = 256; |
| @@ -691,8 +765,8 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
| 691 | /* this should always be supported */ | 765 | /* this should always be supported */ |
| 692 | rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | 766 | rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); |
| 693 | if (rc) { | 767 | if (rc) { |
| 694 | printk(KERN_ERR "32-bit PCI DMA addresses not supported by " | 768 | dev_err(&pdev->dev, |
| 695 | "the card!?\n"); | 769 | "32-bit PCI DMA addresses not supported by the card!?\n"); |
| 696 | goto err_out; | 770 | goto err_out; |
| 697 | } | 771 | } |
| 698 | 772 | ||
| @@ -700,7 +774,7 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
| 700 | if ((pci_resource_len(pdev, 0) < io_size) || | 774 | if ((pci_resource_len(pdev, 0) < io_size) || |
| 701 | (pci_resource_len(pdev, 1) < io_size)) { | 775 | (pci_resource_len(pdev, 1) < io_size)) { |
| 702 | rc = -EIO; | 776 | rc = -EIO; |
| 703 | printk(KERN_ERR "Insufficient PCI resources, aborting\n"); | 777 | dev_err(&pdev->dev, "Insufficient PCI resources, aborting\n"); |
| 704 | goto err_out; | 778 | goto err_out; |
| 705 | } | 779 | } |
| 706 | 780 | ||
| @@ -712,7 +786,7 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
| 712 | dev = alloc_etherdev(sizeof(struct rhine_private)); | 786 | dev = alloc_etherdev(sizeof(struct rhine_private)); |
| 713 | if (!dev) { | 787 | if (!dev) { |
| 714 | rc = -ENOMEM; | 788 | rc = -ENOMEM; |
| 715 | printk(KERN_ERR "alloc_etherdev failed\n"); | 789 | dev_err(&pdev->dev, "alloc_etherdev failed\n"); |
| 716 | goto err_out; | 790 | goto err_out; |
| 717 | } | 791 | } |
| 718 | SET_NETDEV_DEV(dev, &pdev->dev); | 792 | SET_NETDEV_DEV(dev, &pdev->dev); |
| @@ -730,8 +804,9 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
| 730 | ioaddr = pci_iomap(pdev, bar, io_size); | 804 | ioaddr = pci_iomap(pdev, bar, io_size); |
| 731 | if (!ioaddr) { | 805 | if (!ioaddr) { |
| 732 | rc = -EIO; | 806 | rc = -EIO; |
| 733 | printk(KERN_ERR "ioremap failed for device %s, region 0x%X " | 807 | dev_err(&pdev->dev, |
| 734 | "@ 0x%lX\n", pci_name(pdev), io_size, memaddr); | 808 | "ioremap failed for device %s, region 0x%X @ 0x%lX\n", |
| 809 | pci_name(pdev), io_size, memaddr); | ||
| 735 | goto err_out_free_res; | 810 | goto err_out_free_res; |
| 736 | } | 811 | } |
| 737 | 812 | ||
| @@ -746,8 +821,9 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
| 746 | unsigned char b = readb(ioaddr+reg); | 821 | unsigned char b = readb(ioaddr+reg); |
| 747 | if (a != b) { | 822 | if (a != b) { |
| 748 | rc = -EIO; | 823 | rc = -EIO; |
| 749 | printk(KERN_ERR "MMIO do not match PIO [%02x] " | 824 | dev_err(&pdev->dev, |
| 750 | "(%02x != %02x)\n", reg, a, b); | 825 | "MMIO do not match PIO [%02x] (%02x != %02x)\n", |
| 826 | reg, a, b); | ||
| 751 | goto err_out_unmap; | 827 | goto err_out_unmap; |
| 752 | } | 828 | } |
| 753 | } | 829 | } |
| @@ -762,13 +838,15 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
| 762 | 838 | ||
| 763 | for (i = 0; i < 6; i++) | 839 | for (i = 0; i < 6; i++) |
| 764 | dev->dev_addr[i] = ioread8(ioaddr + StationAddr + i); | 840 | dev->dev_addr[i] = ioread8(ioaddr + StationAddr + i); |
| 765 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
| 766 | 841 | ||
| 767 | if (!is_valid_ether_addr(dev->perm_addr)) { | 842 | if (!is_valid_ether_addr(dev->dev_addr)) { |
| 768 | rc = -EIO; | 843 | /* Report it and use a random ethernet address instead */ |
| 769 | printk(KERN_ERR "Invalid MAC address\n"); | 844 | netdev_err(dev, "Invalid MAC address: %pM\n", dev->dev_addr); |
| 770 | goto err_out_unmap; | 845 | random_ether_addr(dev->dev_addr); |
| 846 | netdev_info(dev, "Using random MAC address: %pM\n", | ||
| 847 | dev->dev_addr); | ||
| 771 | } | 848 | } |
| 849 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
| 772 | 850 | ||
| 773 | /* For Rhine-I/II, phy_id is loaded from EEPROM */ | 851 | /* For Rhine-I/II, phy_id is loaded from EEPROM */ |
| 774 | if (!phy_id) | 852 | if (!phy_id) |
| @@ -795,19 +873,23 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
| 795 | if (rp->quirks & rqRhineI) | 873 | if (rp->quirks & rqRhineI) |
| 796 | dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM; | 874 | dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM; |
| 797 | 875 | ||
| 876 | if (pdev->revision >= VT6105M) | ||
| 877 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX | | ||
| 878 | NETIF_F_HW_VLAN_FILTER; | ||
| 879 | |||
| 798 | /* dev->name not defined before register_netdev()! */ | 880 | /* dev->name not defined before register_netdev()! */ |
| 799 | rc = register_netdev(dev); | 881 | rc = register_netdev(dev); |
| 800 | if (rc) | 882 | if (rc) |
| 801 | goto err_out_unmap; | 883 | goto err_out_unmap; |
| 802 | 884 | ||
| 803 | printk(KERN_INFO "%s: VIA %s at 0x%lx, %pM, IRQ %d.\n", | 885 | netdev_info(dev, "VIA %s at 0x%lx, %pM, IRQ %d\n", |
| 804 | dev->name, name, | 886 | name, |
| 805 | #ifdef USE_MMIO | 887 | #ifdef USE_MMIO |
| 806 | memaddr, | 888 | memaddr, |
| 807 | #else | 889 | #else |
| 808 | (long)ioaddr, | 890 | (long)ioaddr, |
| 809 | #endif | 891 | #endif |
| 810 | dev->dev_addr, pdev->irq); | 892 | dev->dev_addr, pdev->irq); |
| 811 | 893 | ||
| 812 | pci_set_drvdata(pdev, dev); | 894 | pci_set_drvdata(pdev, dev); |
| 813 | 895 | ||
| @@ -818,11 +900,11 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
| 818 | mdio_write(dev, phy_id, MII_BMCR, mii_cmd); | 900 | mdio_write(dev, phy_id, MII_BMCR, mii_cmd); |
| 819 | if (mii_status != 0xffff && mii_status != 0x0000) { | 901 | if (mii_status != 0xffff && mii_status != 0x0000) { |
| 820 | rp->mii_if.advertising = mdio_read(dev, phy_id, 4); | 902 | rp->mii_if.advertising = mdio_read(dev, phy_id, 4); |
| 821 | printk(KERN_INFO "%s: MII PHY found at address " | 903 | netdev_info(dev, |
| 822 | "%d, status 0x%4.4x advertising %4.4x " | 904 | "MII PHY found at address %d, status 0x%04x advertising %04x Link %04x\n", |
| 823 | "Link %4.4x.\n", dev->name, phy_id, | 905 | phy_id, |
| 824 | mii_status, rp->mii_if.advertising, | 906 | mii_status, rp->mii_if.advertising, |
| 825 | mdio_read(dev, phy_id, 5)); | 907 | mdio_read(dev, phy_id, 5)); |
| 826 | 908 | ||
| 827 | /* set IFF_RUNNING */ | 909 | /* set IFF_RUNNING */ |
| 828 | if (mii_status & BMSR_LSTATUS) | 910 | if (mii_status & BMSR_LSTATUS) |
| @@ -834,8 +916,7 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
| 834 | } | 916 | } |
| 835 | rp->mii_if.phy_id = phy_id; | 917 | rp->mii_if.phy_id = phy_id; |
| 836 | if (debug > 1 && avoid_D3) | 918 | if (debug > 1 && avoid_D3) |
| 837 | printk(KERN_INFO "%s: No D3 power state at shutdown.\n", | 919 | netdev_info(dev, "No D3 power state at shutdown\n"); |
| 838 | dev->name); | ||
| 839 | 920 | ||
| 840 | return 0; | 921 | return 0; |
| 841 | 922 | ||
| @@ -860,7 +941,7 @@ static int alloc_ring(struct net_device* dev) | |||
| 860 | TX_RING_SIZE * sizeof(struct tx_desc), | 941 | TX_RING_SIZE * sizeof(struct tx_desc), |
| 861 | &ring_dma); | 942 | &ring_dma); |
| 862 | if (!ring) { | 943 | if (!ring) { |
| 863 | printk(KERN_ERR "Could not allocate DMA memory.\n"); | 944 | netdev_err(dev, "Could not allocate DMA memory\n"); |
| 864 | return -ENOMEM; | 945 | return -ENOMEM; |
| 865 | } | 946 | } |
| 866 | if (rp->quirks & rqRhineI) { | 947 | if (rp->quirks & rqRhineI) { |
| @@ -1020,8 +1101,8 @@ static void rhine_check_media(struct net_device *dev, unsigned int init_media) | |||
| 1020 | iowrite8(ioread8(ioaddr + ChipCmd1) & ~Cmd1FDuplex, | 1101 | iowrite8(ioread8(ioaddr + ChipCmd1) & ~Cmd1FDuplex, |
| 1021 | ioaddr + ChipCmd1); | 1102 | ioaddr + ChipCmd1); |
| 1022 | if (debug > 1) | 1103 | if (debug > 1) |
| 1023 | printk(KERN_INFO "%s: force_media %d, carrier %d\n", dev->name, | 1104 | netdev_info(dev, "force_media %d, carrier %d\n", |
| 1024 | rp->mii_if.force_media, netif_carrier_ok(dev)); | 1105 | rp->mii_if.force_media, netif_carrier_ok(dev)); |
| 1025 | } | 1106 | } |
| 1026 | 1107 | ||
| 1027 | /* Called after status of force_media possibly changed */ | 1108 | /* Called after status of force_media possibly changed */ |
| @@ -1035,9 +1116,169 @@ static void rhine_set_carrier(struct mii_if_info *mii) | |||
| 1035 | else /* Let MMI library update carrier status */ | 1116 | else /* Let MMI library update carrier status */ |
| 1036 | rhine_check_media(mii->dev, 0); | 1117 | rhine_check_media(mii->dev, 0); |
| 1037 | if (debug > 1) | 1118 | if (debug > 1) |
| 1038 | printk(KERN_INFO "%s: force_media %d, carrier %d\n", | 1119 | netdev_info(mii->dev, "force_media %d, carrier %d\n", |
| 1039 | mii->dev->name, mii->force_media, | 1120 | mii->force_media, netif_carrier_ok(mii->dev)); |
| 1040 | netif_carrier_ok(mii->dev)); | 1121 | } |
| 1122 | |||
| 1123 | /** | ||
| 1124 | * rhine_set_cam - set CAM multicast filters | ||
| 1125 | * @ioaddr: register block of this Rhine | ||
| 1126 | * @idx: multicast CAM index [0..MCAM_SIZE-1] | ||
| 1127 | * @addr: multicast address (6 bytes) | ||
| 1128 | * | ||
| 1129 | * Load addresses into multicast filters. | ||
| 1130 | */ | ||
| 1131 | static void rhine_set_cam(void __iomem *ioaddr, int idx, u8 *addr) | ||
| 1132 | { | ||
| 1133 | int i; | ||
| 1134 | |||
| 1135 | iowrite8(CAMC_CAMEN, ioaddr + CamCon); | ||
| 1136 | wmb(); | ||
| 1137 | |||
| 1138 | /* Paranoid -- idx out of range should never happen */ | ||
| 1139 | idx &= (MCAM_SIZE - 1); | ||
| 1140 | |||
| 1141 | iowrite8((u8) idx, ioaddr + CamAddr); | ||
| 1142 | |||
| 1143 | for (i = 0; i < 6; i++, addr++) | ||
| 1144 | iowrite8(*addr, ioaddr + MulticastFilter0 + i); | ||
| 1145 | udelay(10); | ||
| 1146 | wmb(); | ||
| 1147 | |||
| 1148 | iowrite8(CAMC_CAMWR | CAMC_CAMEN, ioaddr + CamCon); | ||
| 1149 | udelay(10); | ||
| 1150 | |||
| 1151 | iowrite8(0, ioaddr + CamCon); | ||
| 1152 | } | ||
| 1153 | |||
| 1154 | /** | ||
| 1155 | * rhine_set_vlan_cam - set CAM VLAN filters | ||
| 1156 | * @ioaddr: register block of this Rhine | ||
| 1157 | * @idx: VLAN CAM index [0..VCAM_SIZE-1] | ||
| 1158 | * @addr: VLAN ID (2 bytes) | ||
| 1159 | * | ||
| 1160 | * Load addresses into VLAN filters. | ||
| 1161 | */ | ||
| 1162 | static void rhine_set_vlan_cam(void __iomem *ioaddr, int idx, u8 *addr) | ||
| 1163 | { | ||
| 1164 | iowrite8(CAMC_CAMEN | CAMC_VCAMSL, ioaddr + CamCon); | ||
| 1165 | wmb(); | ||
| 1166 | |||
| 1167 | /* Paranoid -- idx out of range should never happen */ | ||
| 1168 | idx &= (VCAM_SIZE - 1); | ||
| 1169 | |||
| 1170 | iowrite8((u8) idx, ioaddr + CamAddr); | ||
| 1171 | |||
| 1172 | iowrite16(*((u16 *) addr), ioaddr + MulticastFilter0 + 6); | ||
| 1173 | udelay(10); | ||
| 1174 | wmb(); | ||
| 1175 | |||
| 1176 | iowrite8(CAMC_CAMWR | CAMC_CAMEN, ioaddr + CamCon); | ||
| 1177 | udelay(10); | ||
| 1178 | |||
| 1179 | iowrite8(0, ioaddr + CamCon); | ||
| 1180 | } | ||
| 1181 | |||
| 1182 | /** | ||
| 1183 | * rhine_set_cam_mask - set multicast CAM mask | ||
| 1184 | * @ioaddr: register block of this Rhine | ||
| 1185 | * @mask: multicast CAM mask | ||
| 1186 | * | ||
| 1187 | * Mask sets multicast filters active/inactive. | ||
| 1188 | */ | ||
| 1189 | static void rhine_set_cam_mask(void __iomem *ioaddr, u32 mask) | ||
| 1190 | { | ||
| 1191 | iowrite8(CAMC_CAMEN, ioaddr + CamCon); | ||
| 1192 | wmb(); | ||
| 1193 | |||
| 1194 | /* write mask */ | ||
| 1195 | iowrite32(mask, ioaddr + CamMask); | ||
| 1196 | |||
| 1197 | /* disable CAMEN */ | ||
| 1198 | iowrite8(0, ioaddr + CamCon); | ||
| 1199 | } | ||
| 1200 | |||
| 1201 | /** | ||
| 1202 | * rhine_set_vlan_cam_mask - set VLAN CAM mask | ||
| 1203 | * @ioaddr: register block of this Rhine | ||
| 1204 | * @mask: VLAN CAM mask | ||
| 1205 | * | ||
| 1206 | * Mask sets VLAN filters active/inactive. | ||
| 1207 | */ | ||
| 1208 | static void rhine_set_vlan_cam_mask(void __iomem *ioaddr, u32 mask) | ||
| 1209 | { | ||
| 1210 | iowrite8(CAMC_CAMEN | CAMC_VCAMSL, ioaddr + CamCon); | ||
| 1211 | wmb(); | ||
| 1212 | |||
| 1213 | /* write mask */ | ||
| 1214 | iowrite32(mask, ioaddr + CamMask); | ||
| 1215 | |||
| 1216 | /* disable CAMEN */ | ||
| 1217 | iowrite8(0, ioaddr + CamCon); | ||
| 1218 | } | ||
| 1219 | |||
| 1220 | /** | ||
| 1221 | * rhine_init_cam_filter - initialize CAM filters | ||
| 1222 | * @dev: network device | ||
| 1223 | * | ||
| 1224 | * Initialize (disable) hardware VLAN and multicast support on this | ||
| 1225 | * Rhine. | ||
| 1226 | */ | ||
| 1227 | static void rhine_init_cam_filter(struct net_device *dev) | ||
| 1228 | { | ||
| 1229 | struct rhine_private *rp = netdev_priv(dev); | ||
| 1230 | void __iomem *ioaddr = rp->base; | ||
| 1231 | |||
| 1232 | /* Disable all CAMs */ | ||
| 1233 | rhine_set_vlan_cam_mask(ioaddr, 0); | ||
| 1234 | rhine_set_cam_mask(ioaddr, 0); | ||
| 1235 | |||
| 1236 | /* disable hardware VLAN support */ | ||
| 1237 | BYTE_REG_BITS_ON(TCR_PQEN, ioaddr + TxConfig); | ||
| 1238 | BYTE_REG_BITS_OFF(BCR1_VIDFR, ioaddr + PCIBusConfig1); | ||
| 1239 | } | ||
| 1240 | |||
| 1241 | /** | ||
| 1242 | * rhine_update_vcam - update VLAN CAM filters | ||
| 1243 | * @rp: rhine_private data of this Rhine | ||
| 1244 | * | ||
| 1245 | * Update VLAN CAM filters to match configuration change. | ||
| 1246 | */ | ||
| 1247 | static void rhine_update_vcam(struct net_device *dev) | ||
| 1248 | { | ||
| 1249 | struct rhine_private *rp = netdev_priv(dev); | ||
| 1250 | void __iomem *ioaddr = rp->base; | ||
| 1251 | u16 vid; | ||
| 1252 | u32 vCAMmask = 0; /* 32 vCAMs (6105M and better) */ | ||
| 1253 | unsigned int i = 0; | ||
| 1254 | |||
| 1255 | for_each_set_bit(vid, rp->active_vlans, VLAN_N_VID) { | ||
| 1256 | rhine_set_vlan_cam(ioaddr, i, (u8 *)&vid); | ||
| 1257 | vCAMmask |= 1 << i; | ||
| 1258 | if (++i >= VCAM_SIZE) | ||
| 1259 | break; | ||
| 1260 | } | ||
| 1261 | rhine_set_vlan_cam_mask(ioaddr, vCAMmask); | ||
| 1262 | } | ||
| 1263 | |||
| 1264 | static void rhine_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) | ||
| 1265 | { | ||
| 1266 | struct rhine_private *rp = netdev_priv(dev); | ||
| 1267 | |||
| 1268 | spin_lock_irq(&rp->lock); | ||
| 1269 | set_bit(vid, rp->active_vlans); | ||
| 1270 | rhine_update_vcam(dev); | ||
| 1271 | spin_unlock_irq(&rp->lock); | ||
| 1272 | } | ||
| 1273 | |||
| 1274 | static void rhine_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | ||
| 1275 | { | ||
| 1276 | struct rhine_private *rp = netdev_priv(dev); | ||
| 1277 | |||
| 1278 | spin_lock_irq(&rp->lock); | ||
| 1279 | clear_bit(vid, rp->active_vlans); | ||
| 1280 | rhine_update_vcam(dev); | ||
| 1281 | spin_unlock_irq(&rp->lock); | ||
| 1041 | } | 1282 | } |
| 1042 | 1283 | ||
| 1043 | static void init_registers(struct net_device *dev) | 1284 | static void init_registers(struct net_device *dev) |
| @@ -1061,6 +1302,9 @@ static void init_registers(struct net_device *dev) | |||
| 1061 | 1302 | ||
| 1062 | rhine_set_rx_mode(dev); | 1303 | rhine_set_rx_mode(dev); |
| 1063 | 1304 | ||
| 1305 | if (rp->pdev->revision >= VT6105M) | ||
| 1306 | rhine_init_cam_filter(dev); | ||
| 1307 | |||
| 1064 | napi_enable(&rp->napi); | 1308 | napi_enable(&rp->napi); |
| 1065 | 1309 | ||
| 1066 | /* Enable interrupts by setting the interrupt mask. */ | 1310 | /* Enable interrupts by setting the interrupt mask. */ |
| @@ -1160,8 +1404,7 @@ static int rhine_open(struct net_device *dev) | |||
| 1160 | return rc; | 1404 | return rc; |
| 1161 | 1405 | ||
| 1162 | if (debug > 1) | 1406 | if (debug > 1) |
| 1163 | printk(KERN_DEBUG "%s: rhine_open() irq %d.\n", | 1407 | netdev_dbg(dev, "%s() irq %d\n", __func__, rp->pdev->irq); |
| 1164 | dev->name, rp->pdev->irq); | ||
| 1165 | 1408 | ||
| 1166 | rc = alloc_ring(dev); | 1409 | rc = alloc_ring(dev); |
| 1167 | if (rc) { | 1410 | if (rc) { |
| @@ -1173,10 +1416,9 @@ static int rhine_open(struct net_device *dev) | |||
| 1173 | rhine_chip_reset(dev); | 1416 | rhine_chip_reset(dev); |
| 1174 | init_registers(dev); | 1417 | init_registers(dev); |
| 1175 | if (debug > 2) | 1418 | if (debug > 2) |
| 1176 | printk(KERN_DEBUG "%s: Done rhine_open(), status %4.4x " | 1419 | netdev_dbg(dev, "%s() Done - status %04x MII status: %04x\n", |
| 1177 | "MII status: %4.4x.\n", | 1420 | __func__, ioread16(ioaddr + ChipCmd), |
| 1178 | dev->name, ioread16(ioaddr + ChipCmd), | 1421 | mdio_read(dev, rp->mii_if.phy_id, MII_BMSR)); |
| 1179 | mdio_read(dev, rp->mii_if.phy_id, MII_BMSR)); | ||
| 1180 | 1422 | ||
| 1181 | netif_start_queue(dev); | 1423 | netif_start_queue(dev); |
| 1182 | 1424 | ||
| @@ -1219,10 +1461,9 @@ static void rhine_tx_timeout(struct net_device *dev) | |||
| 1219 | struct rhine_private *rp = netdev_priv(dev); | 1461 | struct rhine_private *rp = netdev_priv(dev); |
| 1220 | void __iomem *ioaddr = rp->base; | 1462 | void __iomem *ioaddr = rp->base; |
| 1221 | 1463 | ||
| 1222 | printk(KERN_WARNING "%s: Transmit timed out, status %4.4x, PHY status " | 1464 | netdev_warn(dev, "Transmit timed out, status %04x, PHY status %04x, resetting...\n", |
| 1223 | "%4.4x, resetting...\n", | 1465 | ioread16(ioaddr + IntrStatus), |
| 1224 | dev->name, ioread16(ioaddr + IntrStatus), | 1466 | mdio_read(dev, rp->mii_if.phy_id, MII_BMSR)); |
| 1225 | mdio_read(dev, rp->mii_if.phy_id, MII_BMSR)); | ||
| 1226 | 1467 | ||
| 1227 | schedule_work(&rp->reset_task); | 1468 | schedule_work(&rp->reset_task); |
| 1228 | } | 1469 | } |
| @@ -1276,16 +1517,28 @@ static netdev_tx_t rhine_start_tx(struct sk_buff *skb, | |||
| 1276 | rp->tx_ring[entry].desc_length = | 1517 | rp->tx_ring[entry].desc_length = |
| 1277 | cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN)); | 1518 | cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN)); |
| 1278 | 1519 | ||
| 1520 | if (unlikely(vlan_tx_tag_present(skb))) { | ||
| 1521 | rp->tx_ring[entry].tx_status = cpu_to_le32((vlan_tx_tag_get(skb)) << 16); | ||
| 1522 | /* request tagging */ | ||
| 1523 | rp->tx_ring[entry].desc_length |= cpu_to_le32(0x020000); | ||
| 1524 | } | ||
| 1525 | else | ||
| 1526 | rp->tx_ring[entry].tx_status = 0; | ||
| 1527 | |||
| 1279 | /* lock eth irq */ | 1528 | /* lock eth irq */ |
| 1280 | spin_lock_irqsave(&rp->lock, flags); | 1529 | spin_lock_irqsave(&rp->lock, flags); |
| 1281 | wmb(); | 1530 | wmb(); |
| 1282 | rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn); | 1531 | rp->tx_ring[entry].tx_status |= cpu_to_le32(DescOwn); |
| 1283 | wmb(); | 1532 | wmb(); |
| 1284 | 1533 | ||
| 1285 | rp->cur_tx++; | 1534 | rp->cur_tx++; |
| 1286 | 1535 | ||
| 1287 | /* Non-x86 Todo: explicitly flush cache lines here. */ | 1536 | /* Non-x86 Todo: explicitly flush cache lines here. */ |
| 1288 | 1537 | ||
| 1538 | if (vlan_tx_tag_present(skb)) | ||
| 1539 | /* Tx queues are bits 7-0 (first Tx queue: bit 7) */ | ||
| 1540 | BYTE_REG_BITS_ON(1 << 7, ioaddr + TQWake); | ||
| 1541 | |||
| 1289 | /* Wake the potentially-idle transmit channel */ | 1542 | /* Wake the potentially-idle transmit channel */ |
| 1290 | iowrite8(ioread8(ioaddr + ChipCmd1) | Cmd1TxDemand, | 1543 | iowrite8(ioread8(ioaddr + ChipCmd1) | Cmd1TxDemand, |
| 1291 | ioaddr + ChipCmd1); | 1544 | ioaddr + ChipCmd1); |
| @@ -1297,8 +1550,8 @@ static netdev_tx_t rhine_start_tx(struct sk_buff *skb, | |||
| 1297 | spin_unlock_irqrestore(&rp->lock, flags); | 1550 | spin_unlock_irqrestore(&rp->lock, flags); |
| 1298 | 1551 | ||
| 1299 | if (debug > 4) { | 1552 | if (debug > 4) { |
| 1300 | printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n", | 1553 | netdev_dbg(dev, "Transmit frame #%d queued in slot %d\n", |
| 1301 | dev->name, rp->cur_tx-1, entry); | 1554 | rp->cur_tx-1, entry); |
| 1302 | } | 1555 | } |
| 1303 | return NETDEV_TX_OK; | 1556 | return NETDEV_TX_OK; |
| 1304 | } | 1557 | } |
| @@ -1324,8 +1577,8 @@ static irqreturn_t rhine_interrupt(int irq, void *dev_instance) | |||
| 1324 | IOSYNC; | 1577 | IOSYNC; |
| 1325 | 1578 | ||
| 1326 | if (debug > 4) | 1579 | if (debug > 4) |
| 1327 | printk(KERN_DEBUG "%s: Interrupt, status %8.8x.\n", | 1580 | netdev_dbg(dev, "Interrupt, status %08x\n", |
| 1328 | dev->name, intr_status); | 1581 | intr_status); |
| 1329 | 1582 | ||
| 1330 | if (intr_status & (IntrRxDone | IntrRxErr | IntrRxDropped | | 1583 | if (intr_status & (IntrRxDone | IntrRxErr | IntrRxDropped | |
| 1331 | IntrRxWakeUp | IntrRxEmpty | IntrRxNoBuf)) { | 1584 | IntrRxWakeUp | IntrRxEmpty | IntrRxNoBuf)) { |
| @@ -1343,9 +1596,9 @@ static irqreturn_t rhine_interrupt(int irq, void *dev_instance) | |||
| 1343 | RHINE_WAIT_FOR(!(ioread8(ioaddr+ChipCmd) & CmdTxOn)); | 1596 | RHINE_WAIT_FOR(!(ioread8(ioaddr+ChipCmd) & CmdTxOn)); |
| 1344 | if (debug > 2 && | 1597 | if (debug > 2 && |
| 1345 | ioread8(ioaddr+ChipCmd) & CmdTxOn) | 1598 | ioread8(ioaddr+ChipCmd) & CmdTxOn) |
| 1346 | printk(KERN_WARNING "%s: " | 1599 | netdev_warn(dev, |
| 1347 | "rhine_interrupt() Tx engine " | 1600 | "%s: Tx engine still on\n", |
| 1348 | "still on.\n", dev->name); | 1601 | __func__); |
| 1349 | } | 1602 | } |
| 1350 | rhine_tx(dev); | 1603 | rhine_tx(dev); |
| 1351 | } | 1604 | } |
| @@ -1357,16 +1610,15 @@ static irqreturn_t rhine_interrupt(int irq, void *dev_instance) | |||
| 1357 | rhine_error(dev, intr_status); | 1610 | rhine_error(dev, intr_status); |
| 1358 | 1611 | ||
| 1359 | if (--boguscnt < 0) { | 1612 | if (--boguscnt < 0) { |
| 1360 | printk(KERN_WARNING "%s: Too much work at interrupt, " | 1613 | netdev_warn(dev, "Too much work at interrupt, status=%#08x\n", |
| 1361 | "status=%#8.8x.\n", | 1614 | intr_status); |
| 1362 | dev->name, intr_status); | ||
| 1363 | break; | 1615 | break; |
| 1364 | } | 1616 | } |
| 1365 | } | 1617 | } |
| 1366 | 1618 | ||
| 1367 | if (debug > 3) | 1619 | if (debug > 3) |
| 1368 | printk(KERN_DEBUG "%s: exiting interrupt, status=%8.8x.\n", | 1620 | netdev_dbg(dev, "exiting interrupt, status=%08x\n", |
| 1369 | dev->name, ioread16(ioaddr + IntrStatus)); | 1621 | ioread16(ioaddr + IntrStatus)); |
| 1370 | return IRQ_RETVAL(handled); | 1622 | return IRQ_RETVAL(handled); |
| 1371 | } | 1623 | } |
| 1372 | 1624 | ||
| @@ -1383,15 +1635,14 @@ static void rhine_tx(struct net_device *dev) | |||
| 1383 | while (rp->dirty_tx != rp->cur_tx) { | 1635 | while (rp->dirty_tx != rp->cur_tx) { |
| 1384 | txstatus = le32_to_cpu(rp->tx_ring[entry].tx_status); | 1636 | txstatus = le32_to_cpu(rp->tx_ring[entry].tx_status); |
| 1385 | if (debug > 6) | 1637 | if (debug > 6) |
| 1386 | printk(KERN_DEBUG "Tx scavenge %d status %8.8x.\n", | 1638 | netdev_dbg(dev, "Tx scavenge %d status %08x\n", |
| 1387 | entry, txstatus); | 1639 | entry, txstatus); |
| 1388 | if (txstatus & DescOwn) | 1640 | if (txstatus & DescOwn) |
| 1389 | break; | 1641 | break; |
| 1390 | if (txstatus & 0x8000) { | 1642 | if (txstatus & 0x8000) { |
| 1391 | if (debug > 1) | 1643 | if (debug > 1) |
| 1392 | printk(KERN_DEBUG "%s: Transmit error, " | 1644 | netdev_dbg(dev, "Transmit error, Tx status %08x\n", |
| 1393 | "Tx status %8.8x.\n", | 1645 | txstatus); |
| 1394 | dev->name, txstatus); | ||
| 1395 | dev->stats.tx_errors++; | 1646 | dev->stats.tx_errors++; |
| 1396 | if (txstatus & 0x0400) | 1647 | if (txstatus & 0x0400) |
| 1397 | dev->stats.tx_carrier_errors++; | 1648 | dev->stats.tx_carrier_errors++; |
| @@ -1414,9 +1665,9 @@ static void rhine_tx(struct net_device *dev) | |||
| 1414 | else | 1665 | else |
| 1415 | dev->stats.collisions += txstatus & 0x0F; | 1666 | dev->stats.collisions += txstatus & 0x0F; |
| 1416 | if (debug > 6) | 1667 | if (debug > 6) |
| 1417 | printk(KERN_DEBUG "collisions: %1.1x:%1.1x\n", | 1668 | netdev_dbg(dev, "collisions: %1.1x:%1.1x\n", |
| 1418 | (txstatus >> 3) & 0xF, | 1669 | (txstatus >> 3) & 0xF, |
| 1419 | txstatus & 0xF); | 1670 | txstatus & 0xF); |
| 1420 | dev->stats.tx_bytes += rp->tx_skbuff[entry]->len; | 1671 | dev->stats.tx_bytes += rp->tx_skbuff[entry]->len; |
| 1421 | dev->stats.tx_packets++; | 1672 | dev->stats.tx_packets++; |
| 1422 | } | 1673 | } |
| @@ -1437,6 +1688,21 @@ static void rhine_tx(struct net_device *dev) | |||
| 1437 | spin_unlock(&rp->lock); | 1688 | spin_unlock(&rp->lock); |
| 1438 | } | 1689 | } |
| 1439 | 1690 | ||
| 1691 | /** | ||
| 1692 | * rhine_get_vlan_tci - extract TCI from Rx data buffer | ||
| 1693 | * @skb: pointer to sk_buff | ||
| 1694 | * @data_size: used data area of the buffer including CRC | ||
| 1695 | * | ||
| 1696 | * If hardware VLAN tag extraction is enabled and the chip indicates a 802.1Q | ||
| 1697 | * packet, the extracted 802.1Q header (2 bytes TPID + 2 bytes TCI) is 4-byte | ||
| 1698 | * aligned following the CRC. | ||
| 1699 | */ | ||
| 1700 | static inline u16 rhine_get_vlan_tci(struct sk_buff *skb, int data_size) | ||
| 1701 | { | ||
| 1702 | u8 *trailer = (u8 *)skb->data + ((data_size + 3) & ~3) + 2; | ||
| 1703 | return be16_to_cpup((__be16 *)trailer); | ||
| 1704 | } | ||
| 1705 | |||
| 1440 | /* Process up to limit frames from receive ring */ | 1706 | /* Process up to limit frames from receive ring */ |
| 1441 | static int rhine_rx(struct net_device *dev, int limit) | 1707 | static int rhine_rx(struct net_device *dev, int limit) |
| 1442 | { | 1708 | { |
| @@ -1445,41 +1711,42 @@ static int rhine_rx(struct net_device *dev, int limit) | |||
| 1445 | int entry = rp->cur_rx % RX_RING_SIZE; | 1711 | int entry = rp->cur_rx % RX_RING_SIZE; |
| 1446 | 1712 | ||
| 1447 | if (debug > 4) { | 1713 | if (debug > 4) { |
| 1448 | printk(KERN_DEBUG "%s: rhine_rx(), entry %d status %8.8x.\n", | 1714 | netdev_dbg(dev, "%s(), entry %d status %08x\n", |
| 1449 | dev->name, entry, | 1715 | __func__, entry, |
| 1450 | le32_to_cpu(rp->rx_head_desc->rx_status)); | 1716 | le32_to_cpu(rp->rx_head_desc->rx_status)); |
| 1451 | } | 1717 | } |
| 1452 | 1718 | ||
| 1453 | /* If EOP is set on the next entry, it's a new packet. Send it up. */ | 1719 | /* If EOP is set on the next entry, it's a new packet. Send it up. */ |
| 1454 | for (count = 0; count < limit; ++count) { | 1720 | for (count = 0; count < limit; ++count) { |
| 1455 | struct rx_desc *desc = rp->rx_head_desc; | 1721 | struct rx_desc *desc = rp->rx_head_desc; |
| 1456 | u32 desc_status = le32_to_cpu(desc->rx_status); | 1722 | u32 desc_status = le32_to_cpu(desc->rx_status); |
| 1723 | u32 desc_length = le32_to_cpu(desc->desc_length); | ||
| 1457 | int data_size = desc_status >> 16; | 1724 | int data_size = desc_status >> 16; |
| 1458 | 1725 | ||
| 1459 | if (desc_status & DescOwn) | 1726 | if (desc_status & DescOwn) |
| 1460 | break; | 1727 | break; |
| 1461 | 1728 | ||
| 1462 | if (debug > 4) | 1729 | if (debug > 4) |
| 1463 | printk(KERN_DEBUG "rhine_rx() status is %8.8x.\n", | 1730 | netdev_dbg(dev, "%s() status is %08x\n", |
| 1464 | desc_status); | 1731 | __func__, desc_status); |
| 1465 | 1732 | ||
| 1466 | if ((desc_status & (RxWholePkt | RxErr)) != RxWholePkt) { | 1733 | if ((desc_status & (RxWholePkt | RxErr)) != RxWholePkt) { |
| 1467 | if ((desc_status & RxWholePkt) != RxWholePkt) { | 1734 | if ((desc_status & RxWholePkt) != RxWholePkt) { |
| 1468 | printk(KERN_WARNING "%s: Oversized Ethernet " | 1735 | netdev_warn(dev, |
| 1469 | "frame spanned multiple buffers, entry " | 1736 | "Oversized Ethernet frame spanned multiple buffers, " |
| 1470 | "%#x length %d status %8.8x!\n", | 1737 | "entry %#x length %d status %08x!\n", |
| 1471 | dev->name, entry, data_size, | 1738 | entry, data_size, |
| 1472 | desc_status); | 1739 | desc_status); |
| 1473 | printk(KERN_WARNING "%s: Oversized Ethernet " | 1740 | netdev_warn(dev, |
| 1474 | "frame %p vs %p.\n", dev->name, | 1741 | "Oversized Ethernet frame %p vs %p\n", |
| 1475 | rp->rx_head_desc, &rp->rx_ring[entry]); | 1742 | rp->rx_head_desc, |
| 1743 | &rp->rx_ring[entry]); | ||
| 1476 | dev->stats.rx_length_errors++; | 1744 | dev->stats.rx_length_errors++; |
| 1477 | } else if (desc_status & RxErr) { | 1745 | } else if (desc_status & RxErr) { |
| 1478 | /* There was a error. */ | 1746 | /* There was a error. */ |
| 1479 | if (debug > 2) | 1747 | if (debug > 2) |
| 1480 | printk(KERN_DEBUG "rhine_rx() Rx " | 1748 | netdev_dbg(dev, "%s() Rx error was %08x\n", |
| 1481 | "error was %8.8x.\n", | 1749 | __func__, desc_status); |
| 1482 | desc_status); | ||
| 1483 | dev->stats.rx_errors++; | 1750 | dev->stats.rx_errors++; |
| 1484 | if (desc_status & 0x0030) | 1751 | if (desc_status & 0x0030) |
| 1485 | dev->stats.rx_length_errors++; | 1752 | dev->stats.rx_length_errors++; |
| @@ -1498,6 +1765,7 @@ static int rhine_rx(struct net_device *dev, int limit) | |||
| 1498 | struct sk_buff *skb = NULL; | 1765 | struct sk_buff *skb = NULL; |
| 1499 | /* Length should omit the CRC */ | 1766 | /* Length should omit the CRC */ |
| 1500 | int pkt_len = data_size - 4; | 1767 | int pkt_len = data_size - 4; |
| 1768 | u16 vlan_tci = 0; | ||
| 1501 | 1769 | ||
| 1502 | /* Check if the packet is long enough to accept without | 1770 | /* Check if the packet is long enough to accept without |
| 1503 | copying to a minimally-sized skbuff. */ | 1771 | copying to a minimally-sized skbuff. */ |
| @@ -1520,9 +1788,7 @@ static int rhine_rx(struct net_device *dev, int limit) | |||
| 1520 | } else { | 1788 | } else { |
| 1521 | skb = rp->rx_skbuff[entry]; | 1789 | skb = rp->rx_skbuff[entry]; |
| 1522 | if (skb == NULL) { | 1790 | if (skb == NULL) { |
| 1523 | printk(KERN_ERR "%s: Inconsistent Rx " | 1791 | netdev_err(dev, "Inconsistent Rx descriptor chain\n"); |
| 1524 | "descriptor chain.\n", | ||
| 1525 | dev->name); | ||
| 1526 | break; | 1792 | break; |
| 1527 | } | 1793 | } |
| 1528 | rp->rx_skbuff[entry] = NULL; | 1794 | rp->rx_skbuff[entry] = NULL; |
| @@ -1532,7 +1798,14 @@ static int rhine_rx(struct net_device *dev, int limit) | |||
| 1532 | rp->rx_buf_sz, | 1798 | rp->rx_buf_sz, |
| 1533 | PCI_DMA_FROMDEVICE); | 1799 | PCI_DMA_FROMDEVICE); |
| 1534 | } | 1800 | } |
| 1801 | |||
| 1802 | if (unlikely(desc_length & DescTag)) | ||
| 1803 | vlan_tci = rhine_get_vlan_tci(skb, data_size); | ||
| 1804 | |||
| 1535 | skb->protocol = eth_type_trans(skb, dev); | 1805 | skb->protocol = eth_type_trans(skb, dev); |
| 1806 | |||
| 1807 | if (unlikely(desc_length & DescTag)) | ||
| 1808 | __vlan_hwaccel_put_tag(skb, vlan_tci); | ||
| 1536 | netif_receive_skb(skb); | 1809 | netif_receive_skb(skb); |
| 1537 | dev->stats.rx_bytes += pkt_len; | 1810 | dev->stats.rx_bytes += pkt_len; |
| 1538 | dev->stats.rx_packets++; | 1811 | dev->stats.rx_packets++; |
| @@ -1583,7 +1856,7 @@ static void rhine_restart_tx(struct net_device *dev) { | |||
| 1583 | u32 intr_status; | 1856 | u32 intr_status; |
| 1584 | 1857 | ||
| 1585 | /* | 1858 | /* |
| 1586 | * If new errors occured, we need to sort them out before doing Tx. | 1859 | * If new errors occurred, we need to sort them out before doing Tx. |
| 1587 | * In that case the ISR will be back here RSN anyway. | 1860 | * In that case the ISR will be back here RSN anyway. |
| 1588 | */ | 1861 | */ |
| 1589 | intr_status = get_intr_status(dev); | 1862 | intr_status = get_intr_status(dev); |
| @@ -1596,6 +1869,11 @@ static void rhine_restart_tx(struct net_device *dev) { | |||
| 1596 | 1869 | ||
| 1597 | iowrite8(ioread8(ioaddr + ChipCmd) | CmdTxOn, | 1870 | iowrite8(ioread8(ioaddr + ChipCmd) | CmdTxOn, |
| 1598 | ioaddr + ChipCmd); | 1871 | ioaddr + ChipCmd); |
| 1872 | |||
| 1873 | if (rp->tx_ring[entry].desc_length & cpu_to_le32(0x020000)) | ||
| 1874 | /* Tx queues are bits 7-0 (first Tx queue: bit 7) */ | ||
| 1875 | BYTE_REG_BITS_ON(1 << 7, ioaddr + TQWake); | ||
| 1876 | |||
| 1599 | iowrite8(ioread8(ioaddr + ChipCmd1) | Cmd1TxDemand, | 1877 | iowrite8(ioread8(ioaddr + ChipCmd1) | Cmd1TxDemand, |
| 1600 | ioaddr + ChipCmd1); | 1878 | ioaddr + ChipCmd1); |
| 1601 | IOSYNC; | 1879 | IOSYNC; |
| @@ -1603,9 +1881,8 @@ static void rhine_restart_tx(struct net_device *dev) { | |||
| 1603 | else { | 1881 | else { |
| 1604 | /* This should never happen */ | 1882 | /* This should never happen */ |
| 1605 | if (debug > 1) | 1883 | if (debug > 1) |
| 1606 | printk(KERN_WARNING "%s: rhine_restart_tx() " | 1884 | netdev_warn(dev, "%s() Another error occurred %08x\n", |
| 1607 | "Another error occured %8.8x.\n", | 1885 | __func__, intr_status); |
| 1608 | dev->name, intr_status); | ||
| 1609 | } | 1886 | } |
| 1610 | 1887 | ||
| 1611 | } | 1888 | } |
| @@ -1626,32 +1903,29 @@ static void rhine_error(struct net_device *dev, int intr_status) | |||
| 1626 | } | 1903 | } |
| 1627 | if (intr_status & IntrTxAborted) { | 1904 | if (intr_status & IntrTxAborted) { |
| 1628 | if (debug > 1) | 1905 | if (debug > 1) |
| 1629 | printk(KERN_INFO "%s: Abort %8.8x, frame dropped.\n", | 1906 | netdev_info(dev, "Abort %08x, frame dropped\n", |
| 1630 | dev->name, intr_status); | 1907 | intr_status); |
| 1631 | } | 1908 | } |
| 1632 | if (intr_status & IntrTxUnderrun) { | 1909 | if (intr_status & IntrTxUnderrun) { |
| 1633 | if (rp->tx_thresh < 0xE0) | 1910 | if (rp->tx_thresh < 0xE0) |
| 1634 | iowrite8(rp->tx_thresh += 0x20, ioaddr + TxConfig); | 1911 | BYTE_REG_BITS_SET((rp->tx_thresh += 0x20), 0x80, ioaddr + TxConfig); |
| 1635 | if (debug > 1) | 1912 | if (debug > 1) |
| 1636 | printk(KERN_INFO "%s: Transmitter underrun, Tx " | 1913 | netdev_info(dev, "Transmitter underrun, Tx threshold now %02x\n", |
| 1637 | "threshold now %2.2x.\n", | 1914 | rp->tx_thresh); |
| 1638 | dev->name, rp->tx_thresh); | ||
| 1639 | } | 1915 | } |
| 1640 | if (intr_status & IntrTxDescRace) { | 1916 | if (intr_status & IntrTxDescRace) { |
| 1641 | if (debug > 2) | 1917 | if (debug > 2) |
| 1642 | printk(KERN_INFO "%s: Tx descriptor write-back race.\n", | 1918 | netdev_info(dev, "Tx descriptor write-back race\n"); |
| 1643 | dev->name); | ||
| 1644 | } | 1919 | } |
| 1645 | if ((intr_status & IntrTxError) && | 1920 | if ((intr_status & IntrTxError) && |
| 1646 | (intr_status & (IntrTxAborted | | 1921 | (intr_status & (IntrTxAborted | |
| 1647 | IntrTxUnderrun | IntrTxDescRace)) == 0) { | 1922 | IntrTxUnderrun | IntrTxDescRace)) == 0) { |
| 1648 | if (rp->tx_thresh < 0xE0) { | 1923 | if (rp->tx_thresh < 0xE0) { |
| 1649 | iowrite8(rp->tx_thresh += 0x20, ioaddr + TxConfig); | 1924 | BYTE_REG_BITS_SET((rp->tx_thresh += 0x20), 0x80, ioaddr + TxConfig); |
| 1650 | } | 1925 | } |
| 1651 | if (debug > 1) | 1926 | if (debug > 1) |
| 1652 | printk(KERN_INFO "%s: Unspecified error. Tx " | 1927 | netdev_info(dev, "Unspecified error. Tx threshold now %02x\n", |
| 1653 | "threshold now %2.2x.\n", | 1928 | rp->tx_thresh); |
| 1654 | dev->name, rp->tx_thresh); | ||
| 1655 | } | 1929 | } |
| 1656 | if (intr_status & (IntrTxAborted | IntrTxUnderrun | IntrTxDescRace | | 1930 | if (intr_status & (IntrTxAborted | IntrTxUnderrun | IntrTxDescRace | |
| 1657 | IntrTxError)) | 1931 | IntrTxError)) |
| @@ -1661,8 +1935,8 @@ static void rhine_error(struct net_device *dev, int intr_status) | |||
| 1661 | IntrTxError | IntrTxAborted | IntrNormalSummary | | 1935 | IntrTxError | IntrTxAborted | IntrNormalSummary | |
| 1662 | IntrTxDescRace)) { | 1936 | IntrTxDescRace)) { |
| 1663 | if (debug > 1) | 1937 | if (debug > 1) |
| 1664 | printk(KERN_ERR "%s: Something Wicked happened! " | 1938 | netdev_err(dev, "Something Wicked happened! %08x\n", |
| 1665 | "%8.8x.\n", dev->name, intr_status); | 1939 | intr_status); |
| 1666 | } | 1940 | } |
| 1667 | 1941 | ||
| 1668 | spin_unlock(&rp->lock); | 1942 | spin_unlock(&rp->lock); |
| @@ -1688,7 +1962,8 @@ static void rhine_set_rx_mode(struct net_device *dev) | |||
| 1688 | struct rhine_private *rp = netdev_priv(dev); | 1962 | struct rhine_private *rp = netdev_priv(dev); |
| 1689 | void __iomem *ioaddr = rp->base; | 1963 | void __iomem *ioaddr = rp->base; |
| 1690 | u32 mc_filter[2]; /* Multicast hash filter */ | 1964 | u32 mc_filter[2]; /* Multicast hash filter */ |
| 1691 | u8 rx_mode; /* Note: 0x02=accept runt, 0x01=accept errs */ | 1965 | u8 rx_mode = 0x0C; /* Note: 0x02=accept runt, 0x01=accept errs */ |
| 1966 | struct netdev_hw_addr *ha; | ||
| 1692 | 1967 | ||
| 1693 | if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ | 1968 | if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ |
| 1694 | rx_mode = 0x1C; | 1969 | rx_mode = 0x1C; |
| @@ -1699,10 +1974,18 @@ static void rhine_set_rx_mode(struct net_device *dev) | |||
| 1699 | /* Too many to match, or accept all multicasts. */ | 1974 | /* Too many to match, or accept all multicasts. */ |
| 1700 | iowrite32(0xffffffff, ioaddr + MulticastFilter0); | 1975 | iowrite32(0xffffffff, ioaddr + MulticastFilter0); |
| 1701 | iowrite32(0xffffffff, ioaddr + MulticastFilter1); | 1976 | iowrite32(0xffffffff, ioaddr + MulticastFilter1); |
| 1702 | rx_mode = 0x0C; | 1977 | } else if (rp->pdev->revision >= VT6105M) { |
| 1978 | int i = 0; | ||
| 1979 | u32 mCAMmask = 0; /* 32 mCAMs (6105M and better) */ | ||
| 1980 | netdev_for_each_mc_addr(ha, dev) { | ||
| 1981 | if (i == MCAM_SIZE) | ||
| 1982 | break; | ||
| 1983 | rhine_set_cam(ioaddr, i, ha->addr); | ||
| 1984 | mCAMmask |= 1 << i; | ||
| 1985 | i++; | ||
| 1986 | } | ||
| 1987 | rhine_set_cam_mask(ioaddr, mCAMmask); | ||
| 1703 | } else { | 1988 | } else { |
| 1704 | struct netdev_hw_addr *ha; | ||
| 1705 | |||
| 1706 | memset(mc_filter, 0, sizeof(mc_filter)); | 1989 | memset(mc_filter, 0, sizeof(mc_filter)); |
| 1707 | netdev_for_each_mc_addr(ha, dev) { | 1990 | netdev_for_each_mc_addr(ha, dev) { |
| 1708 | int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26; | 1991 | int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26; |
| @@ -1711,9 +1994,15 @@ static void rhine_set_rx_mode(struct net_device *dev) | |||
| 1711 | } | 1994 | } |
| 1712 | iowrite32(mc_filter[0], ioaddr + MulticastFilter0); | 1995 | iowrite32(mc_filter[0], ioaddr + MulticastFilter0); |
| 1713 | iowrite32(mc_filter[1], ioaddr + MulticastFilter1); | 1996 | iowrite32(mc_filter[1], ioaddr + MulticastFilter1); |
| 1714 | rx_mode = 0x0C; | ||
| 1715 | } | 1997 | } |
| 1716 | iowrite8(rp->rx_thresh | rx_mode, ioaddr + RxConfig); | 1998 | /* enable/disable VLAN receive filtering */ |
| 1999 | if (rp->pdev->revision >= VT6105M) { | ||
| 2000 | if (dev->flags & IFF_PROMISC) | ||
| 2001 | BYTE_REG_BITS_OFF(BCR1_VIDFR, ioaddr + PCIBusConfig1); | ||
| 2002 | else | ||
| 2003 | BYTE_REG_BITS_ON(BCR1_VIDFR, ioaddr + PCIBusConfig1); | ||
| 2004 | } | ||
| 2005 | BYTE_REG_BITS_ON(rx_mode, ioaddr + RxConfig); | ||
| 1717 | } | 2006 | } |
| 1718 | 2007 | ||
| 1719 | static void netdev_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 2008 | static void netdev_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
| @@ -1847,9 +2136,8 @@ static int rhine_close(struct net_device *dev) | |||
| 1847 | spin_lock_irq(&rp->lock); | 2136 | spin_lock_irq(&rp->lock); |
| 1848 | 2137 | ||
| 1849 | if (debug > 1) | 2138 | if (debug > 1) |
| 1850 | printk(KERN_DEBUG "%s: Shutting down ethercard, " | 2139 | netdev_dbg(dev, "Shutting down ethercard, status was %04x\n", |
| 1851 | "status was %4.4x.\n", | 2140 | ioread16(ioaddr + ChipCmd)); |
| 1852 | dev->name, ioread16(ioaddr + ChipCmd)); | ||
| 1853 | 2141 | ||
| 1854 | /* Switch to loopback mode to avoid hardware races. */ | 2142 | /* Switch to loopback mode to avoid hardware races. */ |
| 1855 | iowrite8(rp->tx_thresh | 0x02, ioaddr + TxConfig); | 2143 | iowrite8(rp->tx_thresh | 0x02, ioaddr + TxConfig); |
| @@ -1966,13 +2254,13 @@ static int rhine_resume(struct pci_dev *pdev) | |||
| 1966 | if (!netif_running(dev)) | 2254 | if (!netif_running(dev)) |
| 1967 | return 0; | 2255 | return 0; |
| 1968 | 2256 | ||
| 1969 | if (request_irq(dev->irq, rhine_interrupt, IRQF_SHARED, dev->name, dev)) | 2257 | if (request_irq(dev->irq, rhine_interrupt, IRQF_SHARED, dev->name, dev)) |
| 1970 | printk(KERN_ERR "via-rhine %s: request_irq failed\n", dev->name); | 2258 | netdev_err(dev, "request_irq failed\n"); |
| 1971 | 2259 | ||
| 1972 | ret = pci_set_power_state(pdev, PCI_D0); | 2260 | ret = pci_set_power_state(pdev, PCI_D0); |
| 1973 | if (debug > 1) | 2261 | if (debug > 1) |
| 1974 | printk(KERN_INFO "%s: Entering power state D0 %s (%d).\n", | 2262 | netdev_info(dev, "Entering power state D0 %s (%d)\n", |
| 1975 | dev->name, ret ? "failed" : "succeeded", ret); | 2263 | ret ? "failed" : "succeeded", ret); |
| 1976 | 2264 | ||
| 1977 | pci_restore_state(pdev); | 2265 | pci_restore_state(pdev); |
| 1978 | 2266 | ||
| @@ -2028,17 +2316,15 @@ static int __init rhine_init(void) | |||
| 2028 | { | 2316 | { |
| 2029 | /* when a module, this is printed whether or not devices are found in probe */ | 2317 | /* when a module, this is printed whether or not devices are found in probe */ |
| 2030 | #ifdef MODULE | 2318 | #ifdef MODULE |
| 2031 | printk(version); | 2319 | pr_info("%s\n", version); |
| 2032 | #endif | 2320 | #endif |
| 2033 | if (dmi_check_system(rhine_dmi_table)) { | 2321 | if (dmi_check_system(rhine_dmi_table)) { |
| 2034 | /* these BIOSes fail at PXE boot if chip is in D3 */ | 2322 | /* these BIOSes fail at PXE boot if chip is in D3 */ |
| 2035 | avoid_D3 = 1; | 2323 | avoid_D3 = 1; |
| 2036 | printk(KERN_WARNING "%s: Broken BIOS detected, avoid_D3 " | 2324 | pr_warn("Broken BIOS detected, avoid_D3 enabled\n"); |
| 2037 | "enabled.\n", | ||
| 2038 | DRV_NAME); | ||
| 2039 | } | 2325 | } |
| 2040 | else if (avoid_D3) | 2326 | else if (avoid_D3) |
| 2041 | printk(KERN_INFO "%s: avoid_D3 set.\n", DRV_NAME); | 2327 | pr_info("avoid_D3 set\n"); |
| 2042 | 2328 | ||
| 2043 | return pci_register_driver(&rhine_driver); | 2329 | return pci_register_driver(&rhine_driver); |
| 2044 | } | 2330 | } |
