Lines Matching +full:x +full:- +full:rp

1 /* via-rhine.c: A Linux Ethernet device driver for VIA Rhine family chips. */
3 Written 1998-2001 by Donald Becker.
14 This driver is designed for the VIA VT86C100A Rhine-I.
15 It also works with the Rhine-II (6102) and Rhine-III (6105/6105L/6105LOM
27 http://www.scyld.com/network/via-rhine.html
28 [link no longer provides useful info -jgarzik]
34 #define DRV_NAME "via-rhine"
38 /* A few user-configurable values.
44 /* Set the copy breakpoint for the copy-only-tiny-frames scheme.
54 /* Work-around for broken BIOSes: they are unable to get the chip back out of
55 power state D3 so PXE booting fails. bootparam(7): via-rhine.avoid_D3=1 */
63 /* Maximum number of multicast addresses to filter (vs. rx-all-multicast).
64 The Rhine has a 64 element 8390-like hash table. */
75 * There are no ill effects from too-large receive rings.
78 #define TX_QUEUE_LEN (TX_RING_SIZE - 6) /* Limit ring entries actually used. */
100 #include <linux/dma-mapping.h>
126 MODULE_PARM_DESC(rx_copybreak, "VIA Rhine copy breakpoint for copy-only-tiny-frames");
127 MODULE_PARM_DESC(avoid_D3, "Avoid power state D3 (work-around for broken BIOSes)");
137 This driver is designed for the VIA 86c100A Rhine-II PCI Fast Ethernet
140 II. Board-specific settings
142 Boards with this chip are functional only in a bus-master PCI slot.
154 This driver uses two statically allocated fixed-size descriptor lists
160 This driver attempts to use a zero-copy receive and transmit scheme.
166 open() time and passes the skb->data field to the chip as receive data
173 The RX_COPYBREAK value is chosen to trade-off the memory wasted by
174 using a full-sized skbuff for small frames vs. the copying costs of larger
185 has the beneficial effect of 16-byte aligning the IP header.
189 The driver runs as two independent, single-threaded flows of control. One
190 is the send-packet routine, which enforces single-threaded use by the
191 netdev_priv(dev)->lock spinlock. The other thread is the interrupt handler,
195 netdev_priv(dev)->lock whenever it's queuing a Tx packet. If the next slot in
228 Note the matching code -- the first table entry matchs all 56** cards but
250 rqWOL = 0x0001, /* Wake-On-LAN support */
263 * rqRhineI: VT86C100A (aka Rhine-I) uses different bits to enable
280 /* OpenFirmware identifiers for platform-bus devices
285 { .compatible = "via,vt8500-rhine", .data = &vt8500_quirks },
400 /* Initial value for tx_desc.desc_length, Buffer size goes to bits 0-10 */
441 /* The addresses of receive-in-place skbuffs. */
445 /* The saved address of a sent-in-place packet/buffer, for later free(). */
449 /* Tx bounce buffers (Rhine-I only) */
481 #define BYTE_REG_BITS_ON(x, p) do { iowrite8((ioread8((p))|(x)), (p)); } while (0) argument
482 #define WORD_REG_BITS_ON(x, p) do { iowrite16((ioread16((p))|(x)), (p)); } while (0) argument
483 #define DWORD_REG_BITS_ON(x, p) do { iowrite32((ioread32((p))|(x)), (p)); } while (0) argument
485 #define BYTE_REG_BITS_IS_ON(x, p) (ioread8((p)) & (x)) argument
486 #define WORD_REG_BITS_IS_ON(x, p) (ioread16((p)) & (x)) argument
487 #define DWORD_REG_BITS_IS_ON(x, p) (ioread32((p)) & (x)) argument
489 #define BYTE_REG_BITS_OFF(x, p) do { iowrite8(ioread8((p)) & (~(x)), (p)); } while (0) argument
490 #define WORD_REG_BITS_OFF(x, p) do { iowrite16(ioread16((p)) & (~(x)), (p)); } while (0) argument
491 #define DWORD_REG_BITS_OFF(x, p) do { iowrite32(ioread32((p)) & (~(x)), (p)); } while (0) argument
493 #define BYTE_REG_BITS_SET(x, m, p) do { iowrite8((ioread8((p)) & (~(m)))|(x), (p)); } while (0) argument
494 #define WORD_REG_BITS_SET(x, m, p) do { iowrite16((ioread16((p)) & (~(m)))|(x), (p)); } while (0) argument
495 #define DWORD_REG_BITS_SET(x, m, p) do { iowrite32((ioread32((p)) & (~(m)))|(x), (p)); } while (0) argument
521 static void rhine_wait_bit(struct rhine_private *rp, u8 reg, u8 mask, bool low) in rhine_wait_bit() argument
523 void __iomem *ioaddr = rp->base; in rhine_wait_bit()
534 netif_dbg(rp, hw, rp->dev, "%s bit wait (%02x/%02x) cycle " in rhine_wait_bit()
539 static void rhine_wait_bit_high(struct rhine_private *rp, u8 reg, u8 mask) in rhine_wait_bit_high() argument
541 rhine_wait_bit(rp, reg, mask, false); in rhine_wait_bit_high()
544 static void rhine_wait_bit_low(struct rhine_private *rp, u8 reg, u8 mask) in rhine_wait_bit_low() argument
546 rhine_wait_bit(rp, reg, mask, true); in rhine_wait_bit_low()
549 static u32 rhine_get_events(struct rhine_private *rp) in rhine_get_events() argument
551 void __iomem *ioaddr = rp->base; in rhine_get_events()
555 /* On Rhine-II, Bit 3 indicates Tx descriptor write-back race. */ in rhine_get_events()
556 if (rp->quirks & rqStatusWBRace) in rhine_get_events()
561 static void rhine_ack_events(struct rhine_private *rp, u32 mask) in rhine_ack_events() argument
563 void __iomem *ioaddr = rp->base; in rhine_ack_events()
565 if (rp->quirks & rqStatusWBRace) in rhine_ack_events()
576 struct rhine_private *rp = netdev_priv(dev); in rhine_power_init() local
577 void __iomem *ioaddr = rp->base; in rhine_power_init()
580 if (rp->quirks & rqWOL) { in rhine_power_init()
584 /* Disable "force PME-enable" */ in rhine_power_init()
587 /* Clear power-event config bits (WOL) */ in rhine_power_init()
590 if (rp->quirks & rq6patterns) in rhine_power_init()
593 /* Save power-event status bits */ in rhine_power_init()
595 if (rp->quirks & rq6patterns) in rhine_power_init()
598 /* Clear power-event status bits */ in rhine_power_init()
600 if (rp->quirks & rq6patterns) in rhine_power_init()
632 struct rhine_private *rp = netdev_priv(dev); in rhine_chip_reset() local
633 void __iomem *ioaddr = rp->base; in rhine_chip_reset()
643 if (rp->quirks & rqForceReset) in rhine_chip_reset()
647 rhine_wait_bit_low(rp, ChipCmd1, Cmd1Reset); in rhine_chip_reset()
651 netif_info(rp, hw, dev, "Reset %s\n", (cmd1 & Cmd1Reset) ? in rhine_chip_reset()
687 "MMIO do not match PIO [%02x] (%02x != %02x)\n", in verify_mmio()
689 return -EIO; in verify_mmio()
697 * Loads bytes 0x00-0x05, 0x6E-0x6F, 0x78-0x7B from EEPROM
698 * (plus 0x6C for Rhine-I/II)
702 struct rhine_private *rp = netdev_priv(dev); in rhine_reload_eeprom() local
703 void __iomem *ioaddr = rp->base; in rhine_reload_eeprom()
715 * Reloading from EEPROM overwrites ConfigA-D, so we must re-enable in rhine_reload_eeprom()
717 * it is not known if that still works with the "win98-reboot" problem. in rhine_reload_eeprom()
719 enable_mmio(pioaddr, rp->quirks); in rhine_reload_eeprom()
721 /* Turn off EEPROM-controlled wake-up (magic packet) */ in rhine_reload_eeprom()
722 if (rp->quirks & rqWOL) in rhine_reload_eeprom()
730 struct rhine_private *rp = netdev_priv(dev); in rhine_poll() local
731 const int irq = rp->irq; in rhine_poll()
739 static void rhine_kick_tx_threshold(struct rhine_private *rp) in rhine_kick_tx_threshold() argument
741 if (rp->tx_thresh < 0xe0) { in rhine_kick_tx_threshold()
742 void __iomem *ioaddr = rp->base; in rhine_kick_tx_threshold()
744 rp->tx_thresh += 0x20; in rhine_kick_tx_threshold()
745 BYTE_REG_BITS_SET(rp->tx_thresh, 0x80, ioaddr + TxConfig); in rhine_kick_tx_threshold()
749 static void rhine_tx_err(struct rhine_private *rp, u32 status) in rhine_tx_err() argument
751 struct net_device *dev = rp->dev; in rhine_tx_err()
754 netif_info(rp, tx_err, dev, in rhine_tx_err()
755 "Abort %08x, frame dropped\n", status); in rhine_tx_err()
759 rhine_kick_tx_threshold(rp); in rhine_tx_err()
760 netif_info(rp, tx_err ,dev, "Transmitter underrun, " in rhine_tx_err()
761 "Tx threshold now %02x\n", rp->tx_thresh); in rhine_tx_err()
765 netif_info(rp, tx_err, dev, "Tx descriptor write-back race\n"); in rhine_tx_err()
769 rhine_kick_tx_threshold(rp); in rhine_tx_err()
770 netif_info(rp, tx_err, dev, "Unspecified error. " in rhine_tx_err()
771 "Tx threshold now %02x\n", rp->tx_thresh); in rhine_tx_err()
777 static void rhine_update_rx_crc_and_missed_errord(struct rhine_private *rp) in rhine_update_rx_crc_and_missed_errord() argument
779 void __iomem *ioaddr = rp->base; in rhine_update_rx_crc_and_missed_errord()
780 struct net_device_stats *stats = &rp->dev->stats; in rhine_update_rx_crc_and_missed_errord()
782 stats->rx_crc_errors += ioread16(ioaddr + RxCRCErrs); in rhine_update_rx_crc_and_missed_errord()
783 stats->rx_missed_errors += ioread16(ioaddr + RxMissed); in rhine_update_rx_crc_and_missed_errord()
818 struct rhine_private *rp = container_of(napi, struct rhine_private, napi); in rhine_napipoll() local
819 struct net_device *dev = rp->dev; in rhine_napipoll()
820 void __iomem *ioaddr = rp->base; in rhine_napipoll()
825 status = rhine_get_events(rp); in rhine_napipoll()
826 rhine_ack_events(rp, status & ~RHINE_EVENT_SLOW); in rhine_napipoll()
834 rhine_wait_bit_low(rp, ChipCmd, CmdTxOn); in rhine_napipoll()
836 netif_warn(rp, tx_err, dev, "Tx still on\n"); in rhine_napipoll()
842 rhine_tx_err(rp, status); in rhine_napipoll()
846 spin_lock(&rp->lock); in rhine_napipoll()
847 rhine_update_rx_crc_and_missed_errord(rp); in rhine_napipoll()
848 spin_unlock(&rp->lock); in rhine_napipoll()
853 schedule_work(&rp->slow_event_task); in rhine_napipoll()
865 struct rhine_private *rp = netdev_priv(dev); in rhine_hw_init() local
870 /* Rhine-I needs extra time to recuperate before EEPROM reload */ in rhine_hw_init()
871 if (rp->quirks & rqRhineI) in rhine_hw_init()
875 if (dev_is_pci(dev->dev.parent)) in rhine_hw_init()
900 struct rhine_private *rp; in rhine_init_one_common() local
908 dev_err(hwdev, "32-bit DMA addresses not supported by the card!?\n"); in rhine_init_one_common()
914 rc = -ENOMEM; in rhine_init_one_common()
919 rp = netdev_priv(dev); in rhine_init_one_common()
920 rp->dev = dev; in rhine_init_one_common()
921 rp->quirks = quirks; in rhine_init_one_common()
922 rp->pioaddr = pioaddr; in rhine_init_one_common()
923 rp->base = ioaddr; in rhine_init_one_common()
924 rp->irq = irq; in rhine_init_one_common()
925 rp->msg_enable = netif_msg_init(debug, RHINE_MSG_DEFAULT); in rhine_init_one_common()
927 phy_id = rp->quirks & rqIntPHY ? 1 : 0; in rhine_init_one_common()
929 u64_stats_init(&rp->tx_stats.syncp); in rhine_init_one_common()
930 u64_stats_init(&rp->rx_stats.syncp); in rhine_init_one_common()
940 if (!is_valid_ether_addr(dev->dev_addr)) { in rhine_init_one_common()
942 netdev_err(dev, "Invalid MAC address: %pM\n", dev->dev_addr); in rhine_init_one_common()
945 dev->dev_addr); in rhine_init_one_common()
948 /* For Rhine-I/II, phy_id is loaded from EEPROM */ in rhine_init_one_common()
952 spin_lock_init(&rp->lock); in rhine_init_one_common()
953 mutex_init(&rp->task_lock); in rhine_init_one_common()
954 INIT_WORK(&rp->reset_task, rhine_reset_task); in rhine_init_one_common()
955 INIT_WORK(&rp->slow_event_task, rhine_slow_event_task); in rhine_init_one_common()
957 rp->mii_if.dev = dev; in rhine_init_one_common()
958 rp->mii_if.mdio_read = mdio_read; in rhine_init_one_common()
959 rp->mii_if.mdio_write = mdio_write; in rhine_init_one_common()
960 rp->mii_if.phy_id_mask = 0x1f; in rhine_init_one_common()
961 rp->mii_if.reg_num_mask = 0x1f; in rhine_init_one_common()
963 /* The chip-specific entries in the device structure. */ in rhine_init_one_common()
964 dev->netdev_ops = &rhine_netdev_ops; in rhine_init_one_common()
965 dev->ethtool_ops = &netdev_ethtool_ops; in rhine_init_one_common()
966 dev->watchdog_timeo = TX_TIMEOUT; in rhine_init_one_common()
968 netif_napi_add(dev, &rp->napi, rhine_napipoll); in rhine_init_one_common()
970 if (rp->quirks & rqRhineI) in rhine_init_one_common()
971 dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM; in rhine_init_one_common()
973 if (rp->quirks & rqMgmt) in rhine_init_one_common()
974 dev->features |= NETIF_F_HW_VLAN_CTAG_TX | in rhine_init_one_common()
978 /* dev->name not defined before register_netdev()! */ in rhine_init_one_common()
983 if (rp->quirks & rqRhineI) in rhine_init_one_common()
985 else if (rp->quirks & rqStatusWBRace) in rhine_init_one_common()
987 else if (rp->quirks & rqMgmt) in rhine_init_one_common()
993 name, ioaddr, dev->dev_addr, rp->irq); in rhine_init_one_common()
1003 rp->mii_if.advertising = mdio_read(dev, phy_id, 4); in rhine_init_one_common()
1005 "MII PHY found at address %d, status 0x%04x advertising %04x Link %04x\n", in rhine_init_one_common()
1007 mii_status, rp->mii_if.advertising, in rhine_init_one_common()
1018 rp->mii_if.phy_id = phy_id; in rhine_init_one_common()
1020 netif_info(rp, probe, dev, "No D3 power state at shutdown\n"); in rhine_init_one_common()
1033 struct device *hwdev = &pdev->dev; in rhine_init_one_pci()
1037 int io_size = pdev->revision < VTunknown0 ? 128 : 256; in rhine_init_one_pci()
1054 if (pdev->revision < VTunknown0) { in rhine_init_one_pci()
1056 } else if (pdev->revision >= VT6102) { in rhine_init_one_pci()
1058 if (pdev->revision < VT6105) { in rhine_init_one_pci()
1062 if (pdev->revision >= VT6105_B0) in rhine_init_one_pci()
1064 if (pdev->revision >= VT6105M) in rhine_init_one_pci()
1072 rc = -EIO; in rhine_init_one_pci()
1088 rc = -EIO; in rhine_init_one_pci()
1090 "ioremap failed for device %s, region 0x%X @ 0x%lX\n", in rhine_init_one_pci()
1101 rc = rhine_init_one_common(&pdev->dev, quirks, in rhine_init_one_pci()
1102 pioaddr, ioaddr, pdev->irq); in rhine_init_one_pci()
1122 quirks = of_device_get_match_data(&pdev->dev); in rhine_init_one_platform()
1124 return -EINVAL; in rhine_init_one_platform()
1130 irq = irq_of_parse_and_map(pdev->dev.of_node, 0); in rhine_init_one_platform()
1132 return -EINVAL; in rhine_init_one_platform()
1134 return rhine_init_one_common(&pdev->dev, *quirks, in rhine_init_one_platform()
1140 struct rhine_private *rp = netdev_priv(dev); in alloc_ring() local
1141 struct device *hwdev = dev->dev.parent; in alloc_ring()
1152 return -ENOMEM; in alloc_ring()
1154 if (rp->quirks & rqRhineI) { in alloc_ring()
1155 rp->tx_bufs = dma_alloc_coherent(hwdev, in alloc_ring()
1157 &rp->tx_bufs_dma, in alloc_ring()
1159 if (rp->tx_bufs == NULL) { in alloc_ring()
1164 return -ENOMEM; in alloc_ring()
1168 rp->rx_ring = ring; in alloc_ring()
1169 rp->tx_ring = ring + RX_RING_SIZE * sizeof(struct rx_desc); in alloc_ring()
1170 rp->rx_ring_dma = ring_dma; in alloc_ring()
1171 rp->tx_ring_dma = ring_dma + RX_RING_SIZE * sizeof(struct rx_desc); in alloc_ring()
1178 struct rhine_private *rp = netdev_priv(dev); in free_ring() local
1179 struct device *hwdev = dev->dev.parent; in free_ring()
1184 rp->rx_ring, rp->rx_ring_dma); in free_ring()
1185 rp->tx_ring = NULL; in free_ring()
1187 if (rp->tx_bufs) in free_ring()
1189 rp->tx_bufs, rp->tx_bufs_dma); in free_ring()
1191 rp->tx_bufs = NULL; in free_ring()
1203 struct rhine_private *rp = netdev_priv(dev); in rhine_skb_dma_init() local
1204 struct device *hwdev = dev->dev.parent; in rhine_skb_dma_init()
1205 const int size = rp->rx_buf_sz; in rhine_skb_dma_init()
1207 sd->skb = netdev_alloc_skb(dev, size); in rhine_skb_dma_init()
1208 if (!sd->skb) in rhine_skb_dma_init()
1209 return -ENOMEM; in rhine_skb_dma_init()
1211 sd->dma = dma_map_single(hwdev, sd->skb->data, size, DMA_FROM_DEVICE); in rhine_skb_dma_init()
1212 if (unlikely(dma_mapping_error(hwdev, sd->dma))) { in rhine_skb_dma_init()
1213 netif_err(rp, drv, dev, "Rx DMA mapping failure\n"); in rhine_skb_dma_init()
1214 dev_kfree_skb_any(sd->skb); in rhine_skb_dma_init()
1215 return -EIO; in rhine_skb_dma_init()
1221 static void rhine_reset_rbufs(struct rhine_private *rp) in rhine_reset_rbufs() argument
1225 rp->cur_rx = 0; in rhine_reset_rbufs()
1228 rp->rx_ring[i].rx_status = cpu_to_le32(DescOwn); in rhine_reset_rbufs()
1231 static inline void rhine_skb_dma_nic_store(struct rhine_private *rp, in rhine_skb_dma_nic_store() argument
1234 rp->rx_skbuff_dma[entry] = sd->dma; in rhine_skb_dma_nic_store()
1235 rp->rx_skbuff[entry] = sd->skb; in rhine_skb_dma_nic_store()
1237 rp->rx_ring[entry].addr = cpu_to_le32(sd->dma); in rhine_skb_dma_nic_store()
1245 struct rhine_private *rp = netdev_priv(dev); in alloc_rbufs() local
1249 rp->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32); in alloc_rbufs()
1250 next = rp->rx_ring_dma; in alloc_rbufs()
1254 rp->rx_ring[i].rx_status = 0; in alloc_rbufs()
1255 rp->rx_ring[i].desc_length = cpu_to_le32(rp->rx_buf_sz); in alloc_rbufs()
1257 rp->rx_ring[i].next_desc = cpu_to_le32(next); in alloc_rbufs()
1258 rp->rx_skbuff[i] = NULL; in alloc_rbufs()
1261 rp->rx_ring[i-1].next_desc = cpu_to_le32(rp->rx_ring_dma); in alloc_rbufs()
1273 rhine_skb_dma_nic_store(rp, &sd, i); in alloc_rbufs()
1276 rhine_reset_rbufs(rp); in alloc_rbufs()
1283 struct rhine_private *rp = netdev_priv(dev); in free_rbufs() local
1284 struct device *hwdev = dev->dev.parent; in free_rbufs()
1289 rp->rx_ring[i].rx_status = 0; in free_rbufs()
1290 rp->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */ in free_rbufs()
1291 if (rp->rx_skbuff[i]) { in free_rbufs()
1293 rp->rx_skbuff_dma[i], in free_rbufs()
1294 rp->rx_buf_sz, DMA_FROM_DEVICE); in free_rbufs()
1295 dev_kfree_skb(rp->rx_skbuff[i]); in free_rbufs()
1297 rp->rx_skbuff[i] = NULL; in free_rbufs()
1303 struct rhine_private *rp = netdev_priv(dev); in alloc_tbufs() local
1307 rp->dirty_tx = rp->cur_tx = 0; in alloc_tbufs()
1308 next = rp->tx_ring_dma; in alloc_tbufs()
1310 rp->tx_skbuff[i] = NULL; in alloc_tbufs()
1311 rp->tx_ring[i].tx_status = 0; in alloc_tbufs()
1312 rp->tx_ring[i].desc_length = cpu_to_le32(TXDESC); in alloc_tbufs()
1314 rp->tx_ring[i].next_desc = cpu_to_le32(next); in alloc_tbufs()
1315 if (rp->quirks & rqRhineI) in alloc_tbufs()
1316 rp->tx_buf[i] = &rp->tx_bufs[i * PKT_BUF_SZ]; in alloc_tbufs()
1318 rp->tx_ring[i-1].next_desc = cpu_to_le32(rp->tx_ring_dma); in alloc_tbufs()
1325 struct rhine_private *rp = netdev_priv(dev); in free_tbufs() local
1326 struct device *hwdev = dev->dev.parent; in free_tbufs()
1330 rp->tx_ring[i].tx_status = 0; in free_tbufs()
1331 rp->tx_ring[i].desc_length = cpu_to_le32(TXDESC); in free_tbufs()
1332 rp->tx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */ in free_tbufs()
1333 if (rp->tx_skbuff[i]) { in free_tbufs()
1334 if (rp->tx_skbuff_dma[i]) { in free_tbufs()
1336 rp->tx_skbuff_dma[i], in free_tbufs()
1337 rp->tx_skbuff[i]->len, in free_tbufs()
1340 dev_kfree_skb(rp->tx_skbuff[i]); in free_tbufs()
1342 rp->tx_skbuff[i] = NULL; in free_tbufs()
1343 rp->tx_buf[i] = NULL; in free_tbufs()
1349 struct rhine_private *rp = netdev_priv(dev); in rhine_check_media() local
1350 void __iomem *ioaddr = rp->base; in rhine_check_media()
1352 if (!rp->mii_if.force_media) in rhine_check_media()
1353 mii_check_media(&rp->mii_if, netif_msg_link(rp), init_media); in rhine_check_media()
1355 if (rp->mii_if.full_duplex) in rhine_check_media()
1362 netif_info(rp, link, dev, "force_media %d, carrier %d\n", in rhine_check_media()
1363 rp->mii_if.force_media, netif_carrier_ok(dev)); in rhine_check_media()
1369 struct net_device *dev = mii->dev; in rhine_set_carrier()
1370 struct rhine_private *rp = netdev_priv(dev); in rhine_set_carrier() local
1372 if (mii->force_media) { in rhine_set_carrier()
1380 netif_info(rp, link, dev, "force_media %d, carrier %d\n", in rhine_set_carrier()
1381 mii->force_media, netif_carrier_ok(dev)); in rhine_set_carrier()
1385 * rhine_set_cam - set CAM multicast filters
1387 * @idx: multicast CAM index [0..MCAM_SIZE-1]
1399 /* Paranoid -- idx out of range should never happen */ in rhine_set_cam()
1400 idx &= (MCAM_SIZE - 1); in rhine_set_cam()
1416 * rhine_set_vlan_cam - set CAM VLAN filters
1418 * @idx: VLAN CAM index [0..VCAM_SIZE-1]
1428 /* Paranoid -- idx out of range should never happen */ in rhine_set_vlan_cam()
1429 idx &= (VCAM_SIZE - 1); in rhine_set_vlan_cam()
1444 * rhine_set_cam_mask - set multicast CAM mask
1463 * rhine_set_vlan_cam_mask - set VLAN CAM mask
1482 * rhine_init_cam_filter - initialize CAM filters
1490 struct rhine_private *rp = netdev_priv(dev); in rhine_init_cam_filter() local
1491 void __iomem *ioaddr = rp->base; in rhine_init_cam_filter()
1503 * rhine_update_vcam - update VLAN CAM filters
1510 struct rhine_private *rp = netdev_priv(dev); in rhine_update_vcam() local
1511 void __iomem *ioaddr = rp->base; in rhine_update_vcam()
1516 for_each_set_bit(vid, rp->active_vlans, VLAN_N_VID) { in rhine_update_vcam()
1527 struct rhine_private *rp = netdev_priv(dev); in rhine_vlan_rx_add_vid() local
1529 spin_lock_bh(&rp->lock); in rhine_vlan_rx_add_vid()
1530 set_bit(vid, rp->active_vlans); in rhine_vlan_rx_add_vid()
1532 spin_unlock_bh(&rp->lock); in rhine_vlan_rx_add_vid()
1538 struct rhine_private *rp = netdev_priv(dev); in rhine_vlan_rx_kill_vid() local
1540 spin_lock_bh(&rp->lock); in rhine_vlan_rx_kill_vid()
1541 clear_bit(vid, rp->active_vlans); in rhine_vlan_rx_kill_vid()
1543 spin_unlock_bh(&rp->lock); in rhine_vlan_rx_kill_vid()
1549 struct rhine_private *rp = netdev_priv(dev); in init_registers() local
1550 void __iomem *ioaddr = rp->base; in init_registers()
1554 iowrite8(dev->dev_addr[i], ioaddr + StationAddr + i); in init_registers()
1560 rp->tx_thresh = 0x20; in init_registers()
1561 rp->rx_thresh = 0x60; /* Written in rhine_set_rx_mode(). */ in init_registers()
1563 iowrite32(rp->rx_ring_dma, ioaddr + RxRingPtr); in init_registers()
1564 iowrite32(rp->tx_ring_dma, ioaddr + TxRingPtr); in init_registers()
1568 if (rp->quirks & rqMgmt) in init_registers()
1571 napi_enable(&rp->napi); in init_registers()
1580 /* Enable MII link status auto-polling (required for IntrLinkChange) */
1581 static void rhine_enable_linkmon(struct rhine_private *rp) in rhine_enable_linkmon() argument
1583 void __iomem *ioaddr = rp->base; in rhine_enable_linkmon()
1589 rhine_wait_bit_high(rp, MIIRegAddr, 0x20); in rhine_enable_linkmon()
1594 /* Disable MII link status auto-polling (required for MDIO access) */
1595 static void rhine_disable_linkmon(struct rhine_private *rp) in rhine_disable_linkmon() argument
1597 void __iomem *ioaddr = rp->base; in rhine_disable_linkmon()
1601 if (rp->quirks & rqRhineI) { in rhine_disable_linkmon()
1610 rhine_wait_bit_high(rp, MIIRegAddr, 0x20); in rhine_disable_linkmon()
1616 rhine_wait_bit_high(rp, MIIRegAddr, 0x80); in rhine_disable_linkmon()
1623 struct rhine_private *rp = netdev_priv(dev); in mdio_read() local
1624 void __iomem *ioaddr = rp->base; in mdio_read()
1627 rhine_disable_linkmon(rp); in mdio_read()
1633 rhine_wait_bit_low(rp, MIICmd, 0x40); in mdio_read()
1636 rhine_enable_linkmon(rp); in mdio_read()
1642 struct rhine_private *rp = netdev_priv(dev); in mdio_write() local
1643 void __iomem *ioaddr = rp->base; in mdio_write()
1645 rhine_disable_linkmon(rp); in mdio_write()
1652 rhine_wait_bit_low(rp, MIICmd, 0x20); in mdio_write()
1654 rhine_enable_linkmon(rp); in mdio_write()
1657 static void rhine_task_disable(struct rhine_private *rp) in rhine_task_disable() argument
1659 mutex_lock(&rp->task_lock); in rhine_task_disable()
1660 rp->task_enable = false; in rhine_task_disable()
1661 mutex_unlock(&rp->task_lock); in rhine_task_disable()
1663 cancel_work_sync(&rp->slow_event_task); in rhine_task_disable()
1664 cancel_work_sync(&rp->reset_task); in rhine_task_disable()
1667 static void rhine_task_enable(struct rhine_private *rp) in rhine_task_enable() argument
1669 mutex_lock(&rp->task_lock); in rhine_task_enable()
1670 rp->task_enable = true; in rhine_task_enable()
1671 mutex_unlock(&rp->task_lock); in rhine_task_enable()
1676 struct rhine_private *rp = netdev_priv(dev); in rhine_open() local
1677 void __iomem *ioaddr = rp->base; in rhine_open()
1680 rc = request_irq(rp->irq, rhine_interrupt, IRQF_SHARED, dev->name, dev); in rhine_open()
1684 netif_dbg(rp, ifup, dev, "%s() irq %d\n", __func__, rp->irq); in rhine_open()
1695 enable_mmio(rp->pioaddr, rp->quirks); in rhine_open()
1698 rhine_task_enable(rp); in rhine_open()
1701 netif_dbg(rp, ifup, dev, "%s() Done - status %04x MII status: %04x\n", in rhine_open()
1703 mdio_read(dev, rp->mii_if.phy_id, MII_BMSR)); in rhine_open()
1713 free_irq(rp->irq, dev); in rhine_open()
1719 struct rhine_private *rp = container_of(work, struct rhine_private, in rhine_reset_task() local
1721 struct net_device *dev = rp->dev; in rhine_reset_task()
1723 mutex_lock(&rp->task_lock); in rhine_reset_task()
1725 if (!rp->task_enable) in rhine_reset_task()
1728 napi_disable(&rp->napi); in rhine_reset_task()
1730 spin_lock_bh(&rp->lock); in rhine_reset_task()
1736 rhine_reset_rbufs(rp); in rhine_reset_task()
1742 spin_unlock_bh(&rp->lock); in rhine_reset_task()
1745 dev->stats.tx_errors++; in rhine_reset_task()
1749 mutex_unlock(&rp->task_lock); in rhine_reset_task()
1754 struct rhine_private *rp = netdev_priv(dev); in rhine_tx_timeout() local
1755 void __iomem *ioaddr = rp->base; in rhine_tx_timeout()
1757 netdev_warn(dev, "Transmit timed out, status %04x, PHY status %04x, resetting...\n", in rhine_tx_timeout()
1759 mdio_read(dev, rp->mii_if.phy_id, MII_BMSR)); in rhine_tx_timeout()
1761 schedule_work(&rp->reset_task); in rhine_tx_timeout()
1764 static inline bool rhine_tx_queue_full(struct rhine_private *rp) in rhine_tx_queue_full() argument
1766 return (rp->cur_tx - rp->dirty_tx) >= TX_QUEUE_LEN; in rhine_tx_queue_full()
1772 struct rhine_private *rp = netdev_priv(dev); in rhine_start_tx() local
1773 struct device *hwdev = dev->dev.parent; in rhine_start_tx()
1774 void __iomem *ioaddr = rp->base; in rhine_start_tx()
1781 entry = rp->cur_tx % TX_RING_SIZE; in rhine_start_tx()
1786 rp->tx_skbuff[entry] = skb; in rhine_start_tx()
1788 if ((rp->quirks & rqRhineI) && in rhine_start_tx()
1789 …(((unsigned long)skb->data & 3) || skb_shinfo(skb)->nr_frags != 0 || skb->ip_summed == CHECKSUM_PA… in rhine_start_tx()
1791 if (skb->len > PKT_BUF_SZ) { in rhine_start_tx()
1794 rp->tx_skbuff[entry] = NULL; in rhine_start_tx()
1795 dev->stats.tx_dropped++; in rhine_start_tx()
1800 skb_copy_and_csum_dev(skb, rp->tx_buf[entry]); in rhine_start_tx()
1801 if (skb->len < ETH_ZLEN) in rhine_start_tx()
1802 memset(rp->tx_buf[entry] + skb->len, 0, in rhine_start_tx()
1803 ETH_ZLEN - skb->len); in rhine_start_tx()
1804 rp->tx_skbuff_dma[entry] = 0; in rhine_start_tx()
1805 rp->tx_ring[entry].addr = cpu_to_le32(rp->tx_bufs_dma + in rhine_start_tx()
1806 (rp->tx_buf[entry] - in rhine_start_tx()
1807 rp->tx_bufs)); in rhine_start_tx()
1809 rp->tx_skbuff_dma[entry] = in rhine_start_tx()
1810 dma_map_single(hwdev, skb->data, skb->len, in rhine_start_tx()
1812 if (dma_mapping_error(hwdev, rp->tx_skbuff_dma[entry])) { in rhine_start_tx()
1814 rp->tx_skbuff_dma[entry] = 0; in rhine_start_tx()
1815 dev->stats.tx_dropped++; in rhine_start_tx()
1818 rp->tx_ring[entry].addr = cpu_to_le32(rp->tx_skbuff_dma[entry]); in rhine_start_tx()
1821 rp->tx_ring[entry].desc_length = in rhine_start_tx()
1822 cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN)); in rhine_start_tx()
1830 rp->tx_ring[entry].tx_status = cpu_to_le32((vid_pcp) << 16); in rhine_start_tx()
1832 rp->tx_ring[entry].desc_length |= cpu_to_le32(0x020000); in rhine_start_tx()
1835 rp->tx_ring[entry].tx_status = 0; in rhine_start_tx()
1837 netdev_sent_queue(dev, skb->len); in rhine_start_tx()
1840 rp->tx_ring[entry].tx_status |= cpu_to_le32(DescOwn); in rhine_start_tx()
1843 rp->cur_tx++; in rhine_start_tx()
1851 /* Non-x86 Todo: explicitly flush cache lines here. */ in rhine_start_tx()
1854 /* Tx queues are bits 7-0 (first Tx queue: bit 7) */ in rhine_start_tx()
1857 /* Wake the potentially-idle transmit channel */ in rhine_start_tx()
1862 /* dirty_tx may be pessimistically out-of-sync. See rhine_tx. */ in rhine_start_tx()
1863 if (rhine_tx_queue_full(rp)) { in rhine_start_tx()
1867 if (!rhine_tx_queue_full(rp)) in rhine_start_tx()
1871 netif_dbg(rp, tx_queued, dev, "Transmit frame #%d queued in slot %d\n", in rhine_start_tx()
1872 rp->cur_tx - 1, entry); in rhine_start_tx()
1877 static void rhine_irq_disable(struct rhine_private *rp) in rhine_irq_disable() argument
1879 iowrite16(0x0000, rp->base + IntrEnable); in rhine_irq_disable()
1887 struct rhine_private *rp = netdev_priv(dev); in rhine_interrupt() local
1891 status = rhine_get_events(rp); in rhine_interrupt()
1893 netif_dbg(rp, intr, dev, "Interrupt, status %08x\n", status); in rhine_interrupt()
1898 rhine_irq_disable(rp); in rhine_interrupt()
1899 napi_schedule(&rp->napi); in rhine_interrupt()
1903 netif_err(rp, intr, dev, "Something Wicked happened! %08x\n", in rhine_interrupt()
1914 struct rhine_private *rp = netdev_priv(dev); in rhine_tx() local
1915 struct device *hwdev = dev->dev.parent; in rhine_tx()
1917 unsigned int dirty_tx = rp->dirty_tx; in rhine_tx()
1928 cur_tx = rp->cur_tx; in rhine_tx()
1932 u32 txstatus = le32_to_cpu(rp->tx_ring[entry].tx_status); in rhine_tx()
1934 netif_dbg(rp, tx_done, dev, "Tx scavenge %d status %08x\n", in rhine_tx()
1938 skb = rp->tx_skbuff[entry]; in rhine_tx()
1940 netif_dbg(rp, tx_done, dev, in rhine_tx()
1941 "Transmit error, Tx status %08x\n", txstatus); in rhine_tx()
1942 dev->stats.tx_errors++; in rhine_tx()
1944 dev->stats.tx_carrier_errors++; in rhine_tx()
1946 dev->stats.tx_window_errors++; in rhine_tx()
1948 dev->stats.tx_aborted_errors++; in rhine_tx()
1950 dev->stats.tx_heartbeat_errors++; in rhine_tx()
1951 if (((rp->quirks & rqRhineI) && txstatus & 0x0002) || in rhine_tx()
1953 dev->stats.tx_fifo_errors++; in rhine_tx()
1954 rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn); in rhine_tx()
1955 break; /* Keep the skb - we try again */ in rhine_tx()
1959 if (rp->quirks & rqRhineI) in rhine_tx()
1960 dev->stats.collisions += (txstatus >> 3) & 0x0F; in rhine_tx()
1962 dev->stats.collisions += txstatus & 0x0F; in rhine_tx()
1963 netif_dbg(rp, tx_done, dev, "collisions: %1.1x:%1.1x\n", in rhine_tx()
1966 u64_stats_update_begin(&rp->tx_stats.syncp); in rhine_tx()
1967 rp->tx_stats.bytes += skb->len; in rhine_tx()
1968 rp->tx_stats.packets++; in rhine_tx()
1969 u64_stats_update_end(&rp->tx_stats.syncp); in rhine_tx()
1972 if (rp->tx_skbuff_dma[entry]) { in rhine_tx()
1974 rp->tx_skbuff_dma[entry], in rhine_tx()
1975 skb->len, in rhine_tx()
1978 bytes_compl += skb->len; in rhine_tx()
1981 rp->tx_skbuff[entry] = NULL; in rhine_tx()
1985 rp->dirty_tx = dirty_tx; in rhine_tx()
1991 /* cur_tx may be optimistically out-of-sync. See rhine_start_tx. */ in rhine_tx()
1992 if (!rhine_tx_queue_full(rp) && netif_queue_stopped(dev)) { in rhine_tx()
1996 if (rhine_tx_queue_full(rp)) in rhine_tx()
2002 * rhine_get_vlan_tci - extract TCI from Rx data buffer
2007 * packet, the extracted 802.1Q header (2 bytes TPID + 2 bytes TCI) is 4-byte
2012 u8 *trailer = (u8 *)skb->data + ((data_size + 3) & ~3) + 2; in rhine_get_vlan_tci()
2020 if (unlikely(desc->desc_length & cpu_to_le32(DescTag))) { in rhine_rx_vlan_tag()
2031 struct rhine_private *rp = netdev_priv(dev); in rhine_rx() local
2032 struct device *hwdev = dev->dev.parent; in rhine_rx()
2033 int entry = rp->cur_rx % RX_RING_SIZE; in rhine_rx()
2036 netif_dbg(rp, rx_status, dev, "%s(), entry %d status %08x\n", __func__, in rhine_rx()
2037 entry, le32_to_cpu(rp->rx_ring[entry].rx_status)); in rhine_rx()
2041 struct rx_desc *desc = rp->rx_ring + entry; in rhine_rx()
2042 u32 desc_status = le32_to_cpu(desc->rx_status); in rhine_rx()
2048 netif_dbg(rp, rx_status, dev, "%s() status %08x\n", __func__, in rhine_rx()
2055 "entry %#x length %d status %08x!\n", in rhine_rx()
2058 dev->stats.rx_length_errors++; in rhine_rx()
2061 netif_dbg(rp, rx_err, dev, in rhine_rx()
2062 "%s() Rx error %08x\n", __func__, in rhine_rx()
2064 dev->stats.rx_errors++; in rhine_rx()
2066 dev->stats.rx_length_errors++; in rhine_rx()
2068 dev->stats.rx_fifo_errors++; in rhine_rx()
2070 dev->stats.rx_frame_errors++; in rhine_rx()
2073 spin_lock(&rp->lock); in rhine_rx()
2074 dev->stats.rx_crc_errors++; in rhine_rx()
2075 spin_unlock(&rp->lock); in rhine_rx()
2080 int pkt_len = data_size - 4; in rhine_rx()
2084 copying to a minimally-sized skbuff. */ in rhine_rx()
2091 rp->rx_skbuff_dma[entry], in rhine_rx()
2092 rp->rx_buf_sz, in rhine_rx()
2096 rp->rx_skbuff[entry]->data, in rhine_rx()
2100 rp->rx_skbuff_dma[entry], in rhine_rx()
2101 rp->rx_buf_sz, in rhine_rx()
2109 skb = rp->rx_skbuff[entry]; in rhine_rx()
2112 rp->rx_skbuff_dma[entry], in rhine_rx()
2113 rp->rx_buf_sz, in rhine_rx()
2115 rhine_skb_dma_nic_store(rp, &sd, entry); in rhine_rx()
2122 skb->protocol = eth_type_trans(skb, dev); in rhine_rx()
2126 u64_stats_update_begin(&rp->rx_stats.syncp); in rhine_rx()
2127 rp->rx_stats.bytes += pkt_len; in rhine_rx()
2128 rp->rx_stats.packets++; in rhine_rx()
2129 u64_stats_update_end(&rp->rx_stats.syncp); in rhine_rx()
2132 desc->rx_status = cpu_to_le32(DescOwn); in rhine_rx()
2133 entry = (++rp->cur_rx) % RX_RING_SIZE; in rhine_rx()
2139 dev->stats.rx_dropped++; in rhine_rx()
2144 struct rhine_private *rp = netdev_priv(dev); in rhine_restart_tx() local
2145 void __iomem *ioaddr = rp->base; in rhine_restart_tx()
2146 int entry = rp->dirty_tx % TX_RING_SIZE; in rhine_restart_tx()
2153 intr_status = rhine_get_events(rp); in rhine_restart_tx()
2158 iowrite32(rp->tx_ring_dma + entry * sizeof(struct tx_desc), in rhine_restart_tx()
2164 if (rp->tx_ring[entry].desc_length & cpu_to_le32(0x020000)) in rhine_restart_tx()
2165 /* Tx queues are bits 7-0 (first Tx queue: bit 7) */ in rhine_restart_tx()
2174 netif_warn(rp, tx_err, dev, "another error occurred %08x\n", in rhine_restart_tx()
2182 struct rhine_private *rp = in rhine_slow_event_task() local
2184 struct net_device *dev = rp->dev; in rhine_slow_event_task()
2187 mutex_lock(&rp->task_lock); in rhine_slow_event_task()
2189 if (!rp->task_enable) in rhine_slow_event_task()
2192 intr_status = rhine_get_events(rp); in rhine_slow_event_task()
2193 rhine_ack_events(rp, intr_status & RHINE_EVENT_SLOW); in rhine_slow_event_task()
2199 netif_warn(rp, hw, dev, "PCI error\n"); in rhine_slow_event_task()
2201 iowrite16(RHINE_EVENT & 0xffff, rp->base + IntrEnable); in rhine_slow_event_task()
2204 mutex_unlock(&rp->task_lock); in rhine_slow_event_task()
2210 struct rhine_private *rp = netdev_priv(dev); in rhine_get_stats64() local
2213 spin_lock_bh(&rp->lock); in rhine_get_stats64()
2214 rhine_update_rx_crc_and_missed_errord(rp); in rhine_get_stats64()
2215 spin_unlock_bh(&rp->lock); in rhine_get_stats64()
2217 netdev_stats_to_stats64(stats, &dev->stats); in rhine_get_stats64()
2220 start = u64_stats_fetch_begin(&rp->rx_stats.syncp); in rhine_get_stats64()
2221 stats->rx_packets = rp->rx_stats.packets; in rhine_get_stats64()
2222 stats->rx_bytes = rp->rx_stats.bytes; in rhine_get_stats64()
2223 } while (u64_stats_fetch_retry(&rp->rx_stats.syncp, start)); in rhine_get_stats64()
2226 start = u64_stats_fetch_begin(&rp->tx_stats.syncp); in rhine_get_stats64()
2227 stats->tx_packets = rp->tx_stats.packets; in rhine_get_stats64()
2228 stats->tx_bytes = rp->tx_stats.bytes; in rhine_get_stats64()
2229 } while (u64_stats_fetch_retry(&rp->tx_stats.syncp, start)); in rhine_get_stats64()
2234 struct rhine_private *rp = netdev_priv(dev); in rhine_set_rx_mode() local
2235 void __iomem *ioaddr = rp->base; in rhine_set_rx_mode()
2240 if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ in rhine_set_rx_mode()
2245 (dev->flags & IFF_ALLMULTI)) { in rhine_set_rx_mode()
2249 } else if (rp->quirks & rqMgmt) { in rhine_set_rx_mode()
2255 rhine_set_cam(ioaddr, i, ha->addr); in rhine_set_rx_mode()
2263 int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26; in rhine_set_rx_mode()
2271 if (rp->quirks & rqMgmt) { in rhine_set_rx_mode()
2272 if (dev->flags & IFF_PROMISC) in rhine_set_rx_mode()
2282 struct device *hwdev = dev->dev.parent; in netdev_get_drvinfo()
2284 strscpy(info->driver, DRV_NAME, sizeof(info->driver)); in netdev_get_drvinfo()
2285 strscpy(info->bus_info, dev_name(hwdev), sizeof(info->bus_info)); in netdev_get_drvinfo()
2291 struct rhine_private *rp = netdev_priv(dev); in netdev_get_link_ksettings() local
2293 mutex_lock(&rp->task_lock); in netdev_get_link_ksettings()
2294 mii_ethtool_get_link_ksettings(&rp->mii_if, cmd); in netdev_get_link_ksettings()
2295 mutex_unlock(&rp->task_lock); in netdev_get_link_ksettings()
2303 struct rhine_private *rp = netdev_priv(dev); in netdev_set_link_ksettings() local
2306 mutex_lock(&rp->task_lock); in netdev_set_link_ksettings()
2307 rc = mii_ethtool_set_link_ksettings(&rp->mii_if, cmd); in netdev_set_link_ksettings()
2308 rhine_set_carrier(&rp->mii_if); in netdev_set_link_ksettings()
2309 mutex_unlock(&rp->task_lock); in netdev_set_link_ksettings()
2316 struct rhine_private *rp = netdev_priv(dev); in netdev_nway_reset() local
2318 return mii_nway_restart(&rp->mii_if); in netdev_nway_reset()
2323 struct rhine_private *rp = netdev_priv(dev); in netdev_get_link() local
2325 return mii_link_ok(&rp->mii_if); in netdev_get_link()
2330 struct rhine_private *rp = netdev_priv(dev); in netdev_get_msglevel() local
2332 return rp->msg_enable; in netdev_get_msglevel()
2337 struct rhine_private *rp = netdev_priv(dev); in netdev_set_msglevel() local
2339 rp->msg_enable = value; in netdev_set_msglevel()
2344 struct rhine_private *rp = netdev_priv(dev); in rhine_get_wol() local
2346 if (!(rp->quirks & rqWOL)) in rhine_get_wol()
2349 spin_lock_irq(&rp->lock); in rhine_get_wol()
2350 wol->supported = WAKE_PHY | WAKE_MAGIC | in rhine_get_wol()
2352 wol->wolopts = rp->wolopts; in rhine_get_wol()
2353 spin_unlock_irq(&rp->lock); in rhine_get_wol()
2358 struct rhine_private *rp = netdev_priv(dev); in rhine_set_wol() local
2362 if (!(rp->quirks & rqWOL)) in rhine_set_wol()
2363 return -EINVAL; in rhine_set_wol()
2365 if (wol->wolopts & ~support) in rhine_set_wol()
2366 return -EINVAL; in rhine_set_wol()
2368 spin_lock_irq(&rp->lock); in rhine_set_wol()
2369 rp->wolopts = wol->wolopts; in rhine_set_wol()
2370 spin_unlock_irq(&rp->lock); in rhine_set_wol()
2389 struct rhine_private *rp = netdev_priv(dev); in netdev_ioctl() local
2393 return -EINVAL; in netdev_ioctl()
2395 mutex_lock(&rp->task_lock); in netdev_ioctl()
2396 rc = generic_mii_ioctl(&rp->mii_if, if_mii(rq), cmd, NULL); in netdev_ioctl()
2397 rhine_set_carrier(&rp->mii_if); in netdev_ioctl()
2398 mutex_unlock(&rp->task_lock); in netdev_ioctl()
2405 struct rhine_private *rp = netdev_priv(dev); in rhine_close() local
2406 void __iomem *ioaddr = rp->base; in rhine_close()
2408 rhine_task_disable(rp); in rhine_close()
2409 napi_disable(&rp->napi); in rhine_close()
2412 netif_dbg(rp, ifdown, dev, "Shutting down ethercard, status was %04x\n", in rhine_close()
2416 iowrite8(rp->tx_thresh | 0x02, ioaddr + TxConfig); in rhine_close()
2418 rhine_irq_disable(rp); in rhine_close()
2423 free_irq(rp->irq, dev); in rhine_close()
2435 struct rhine_private *rp = netdev_priv(dev); in rhine_remove_one_pci() local
2439 pci_iounmap(pdev, rp->base); in rhine_remove_one_pci()
2449 struct rhine_private *rp = netdev_priv(dev); in rhine_remove_one_platform() local
2453 iounmap(rp->base); in rhine_remove_one_platform()
2463 struct rhine_private *rp = netdev_priv(dev); in rhine_shutdown_pci() local
2464 void __iomem *ioaddr = rp->base; in rhine_shutdown_pci()
2466 if (!(rp->quirks & rqWOL)) in rhine_shutdown_pci()
2467 return; /* Nothing to do for non-WOL adapters */ in rhine_shutdown_pci()
2472 if (rp->quirks & rq6patterns) in rhine_shutdown_pci()
2475 spin_lock(&rp->lock); in rhine_shutdown_pci()
2477 if (rp->wolopts & WAKE_MAGIC) { in rhine_shutdown_pci()
2480 * Turn EEPROM-controlled wake-up back on -- some hardware may in rhine_shutdown_pci()
2486 if (rp->wolopts & (WAKE_BCAST|WAKE_MCAST)) in rhine_shutdown_pci()
2489 if (rp->wolopts & WAKE_PHY) in rhine_shutdown_pci()
2492 if (rp->wolopts & WAKE_UCAST) in rhine_shutdown_pci()
2495 if (rp->wolopts) { in rhine_shutdown_pci()
2501 spin_unlock(&rp->lock); in rhine_shutdown_pci()
2515 struct rhine_private *rp = netdev_priv(dev); in rhine_suspend() local
2520 rhine_task_disable(rp); in rhine_suspend()
2521 rhine_irq_disable(rp); in rhine_suspend()
2522 napi_disable(&rp->napi); in rhine_suspend()
2535 struct rhine_private *rp = netdev_priv(dev); in rhine_resume() local
2540 enable_mmio(rp->pioaddr, rp->quirks); in rhine_resume()
2544 rhine_reset_rbufs(rp); in rhine_resume()
2545 rhine_task_enable(rp); in rhine_resume()
2546 spin_lock_bh(&rp->lock); in rhine_resume()
2548 spin_unlock_bh(&rp->lock); in rhine_resume()
2585 .ident = "EPIA-M",