Lines Matching refs:tp

590 	struct netdrv_private *tp;  in netdrv_init_board()  local
606 dev = alloc_etherdev (sizeof (*tp)); in netdrv_init_board()
613 tp = dev->priv; in netdrv_init_board()
700 tp->chipset = i; in netdrv_init_board()
708 tp->chipset = 0; in netdrv_init_board()
713 tp->chipset, in netdrv_init_board()
714 rtl_chip_info[tp->chipset].name); in netdrv_init_board()
742 struct netdrv_private *tp; in netdrv_init_one() local
768 tp = dev->priv; in netdrv_init_one()
772 assert (tp != NULL); in netdrv_init_one()
793 tp = dev->priv; in netdrv_init_one()
796 tp->drv_flags = PCI_COMMAND_IO | PCI_COMMAND_MEMORY | in netdrv_init_one()
798 tp->pci_dev = pdev; in netdrv_init_one()
799 tp->board = ent->driver_data; in netdrv_init_one()
800 tp->mmio_addr = ioaddr; in netdrv_init_one()
801 tp->lock = SPIN_LOCK_UNLOCKED; in netdrv_init_one()
805 tp->phys[0] = 32; in netdrv_init_one()
819 dev->name, rtl_chip_info[tp->chipset].name); in netdrv_init_one()
827 tp->full_duplex = (option & 0x200) ? 1 : 0; in netdrv_init_one()
828 tp->default_port = option & 15; in netdrv_init_one()
829 if (tp->default_port) in netdrv_init_one()
830 tp->medialock = 1; in netdrv_init_one()
833 if (tp->full_duplex) { in netdrv_init_one()
837 mdio_write (dev, tp->phys[0], MII_ADVERTISE, ADVERTISE_FULL); in netdrv_init_one()
838 tp->duplex_lock = 1; in netdrv_init_one()
995 struct netdrv_private *tp = dev->priv; in mdio_read() local
996 void *mdio_addr = tp->mmio_addr + Config4; in mdio_read()
1006 readw (tp->mmio_addr + mii_2_8139_map[location]) : 0; in mdio_read()
1038 struct netdrv_private *tp = dev->priv; in mdio_write() local
1039 void *mdio_addr = tp->mmio_addr + Config4; in mdio_write()
1049 tp->mmio_addr + mii_2_8139_map[location]); in mdio_write()
1050 readw (tp->mmio_addr + mii_2_8139_map[location]); in mdio_write()
1081 struct netdrv_private *tp = dev->priv; in netdrv_open() local
1084 void *ioaddr = tp->mmio_addr; in netdrv_open()
1095 tp->tx_bufs = pci_alloc_consistent(tp->pci_dev, TX_BUF_TOT_LEN, in netdrv_open()
1096 &tp->tx_bufs_dma); in netdrv_open()
1097 tp->rx_ring = pci_alloc_consistent(tp->pci_dev, RX_BUF_TOT_LEN, in netdrv_open()
1098 &tp->rx_ring_dma); in netdrv_open()
1099 if (tp->tx_bufs == NULL || tp->rx_ring == NULL) { in netdrv_open()
1102 if (tp->tx_bufs) in netdrv_open()
1103 pci_free_consistent(tp->pci_dev, TX_BUF_TOT_LEN, in netdrv_open()
1104 tp->tx_bufs, tp->tx_bufs_dma); in netdrv_open()
1105 if (tp->rx_ring) in netdrv_open()
1106 pci_free_consistent(tp->pci_dev, RX_BUF_TOT_LEN, in netdrv_open()
1107 tp->rx_ring, tp->rx_ring_dma); in netdrv_open()
1114 tp->full_duplex = tp->duplex_lock; in netdrv_open()
1115 tp->tx_flag = (TX_FIFO_THRESH << 11) & 0x003f0000; in netdrv_open()
1122 dev->name, pci_resource_start (tp->pci_dev, 1), in netdrv_open()
1124 tp->full_duplex ? "full" : "half"); in netdrv_open()
1128 init_timer (&tp->timer); in netdrv_open()
1129 tp->timer.expires = jiffies + 3 * HZ; in netdrv_open()
1130 tp->timer.data = (unsigned long) dev; in netdrv_open()
1131 tp->timer.function = &netdrv_timer; in netdrv_open()
1132 add_timer (&tp->timer); in netdrv_open()
1142 struct netdrv_private *tp = dev->priv; in netdrv_hw_start() local
1143 void *ioaddr = tp->mmio_addr; in netdrv_hw_start()
1167 (NETDRV_R32 (RxConfig) & rtl_chip_info[tp->chipset].RxConfigMask); in netdrv_hw_start()
1177 tp->cur_rx = 0; in netdrv_hw_start()
1184 NETDRV_W32_F (RxBuf, tp->rx_ring_dma); in netdrv_hw_start()
1188 NETDRV_W32_F (TxAddr0 + (i * 4), tp->tx_bufs_dma + (tp->tx_buf[i] - tp->tx_bufs)); in netdrv_hw_start()
1213 struct netdrv_private *tp = dev->priv; in netdrv_init_ring() local
1218 tp->cur_rx = 0; in netdrv_init_ring()
1219 atomic_set (&tp->cur_tx, 0); in netdrv_init_ring()
1220 atomic_set (&tp->dirty_tx, 0); in netdrv_init_ring()
1223 tp->tx_info[i].skb = NULL; in netdrv_init_ring()
1224 tp->tx_info[i].mapping = 0; in netdrv_init_ring()
1225 tp->tx_buf[i] = &tp->tx_bufs[i * TX_BUF_SIZE]; in netdrv_init_ring()
1235 struct netdrv_private *tp = dev->priv; in netdrv_timer() local
1236 void *ioaddr = tp->mmio_addr; in netdrv_timer()
1240 mii_lpa = mdio_read (dev, tp->phys[0], MII_LPA); in netdrv_timer()
1242 if (!tp->duplex_lock && mii_lpa != 0xffff) { in netdrv_timer()
1245 if (tp->full_duplex != duplex) { in netdrv_timer()
1246 tp->full_duplex = duplex; in netdrv_timer()
1250 tp->full_duplex ? "full" : "half", in netdrv_timer()
1251 tp->phys[0], mii_lpa); in netdrv_timer()
1253 NETDRV_W8 (Config1, tp->full_duplex ? 0x60 : 0x20); in netdrv_timer()
1269 tp->timer.expires = jiffies + next_tick; in netdrv_timer()
1270 add_timer (&tp->timer); in netdrv_timer()
1274 static void netdrv_tx_clear (struct netdrv_private *tp) in netdrv_tx_clear() argument
1278 atomic_set (&tp->cur_tx, 0); in netdrv_tx_clear()
1279 atomic_set (&tp->dirty_tx, 0); in netdrv_tx_clear()
1283 struct ring_info *rp = &tp->tx_info[i]; in netdrv_tx_clear()
1285 pci_unmap_single (tp->pci_dev, rp->mapping, in netdrv_tx_clear()
1292 tp->stats.tx_dropped++; in netdrv_tx_clear()
1300 struct netdrv_private *tp = dev->priv; in netdrv_tx_timeout() local
1301 void *ioaddr = tp->mmio_addr; in netdrv_tx_timeout()
1322 dev->name, atomic_read (&tp->cur_tx), in netdrv_tx_timeout()
1323 atomic_read (&tp->dirty_tx)); in netdrv_tx_timeout()
1327 i == atomic_read (&tp->dirty_tx) % NUM_TX_DESC ? in netdrv_tx_timeout()
1331 spin_lock_irqsave (&tp->lock, flags); in netdrv_tx_timeout()
1333 netdrv_tx_clear (tp); in netdrv_tx_timeout()
1335 spin_unlock_irqrestore (&tp->lock, flags); in netdrv_tx_timeout()
1347 struct netdrv_private *tp = dev->priv; in netdrv_start_xmit() local
1348 void *ioaddr = tp->mmio_addr; in netdrv_start_xmit()
1362 entry = atomic_read (&tp->cur_tx) % NUM_TX_DESC; in netdrv_start_xmit()
1364 assert (tp->tx_info[entry].skb == NULL); in netdrv_start_xmit()
1365 assert (tp->tx_info[entry].mapping == 0); in netdrv_start_xmit()
1367 tp->tx_info[entry].skb = skb; in netdrv_start_xmit()
1369 memcpy (tp->tx_buf[entry], skb->data, skb->len); in netdrv_start_xmit()
1372 tp->tx_flag | skb->len); in netdrv_start_xmit()
1375 atomic_inc (&tp->cur_tx); in netdrv_start_xmit()
1376 if ((atomic_read (&tp->cur_tx) - atomic_read (&tp->dirty_tx)) >= NUM_TX_DESC) in netdrv_start_xmit()
1387 struct netdrv_private *tp, in netdrv_tx_interrupt() argument
1393 assert (tp != NULL); in netdrv_tx_interrupt()
1396 dirty_tx = atomic_read (&tp->dirty_tx); in netdrv_tx_interrupt()
1398 cur_tx = atomic_read (&tp->cur_tx); in netdrv_tx_interrupt()
1414 tp->stats.tx_errors++; in netdrv_tx_interrupt()
1416 tp->stats.tx_aborted_errors++; in netdrv_tx_interrupt()
1420 tp->stats.tx_carrier_errors++; in netdrv_tx_interrupt()
1422 tp->stats.tx_window_errors++; in netdrv_tx_interrupt()
1426 if (tp->tx_flag < 0x00300000) in netdrv_tx_interrupt()
1427 tp->tx_flag += 0x00020000; in netdrv_tx_interrupt()
1428 tp->stats.tx_fifo_errors++; in netdrv_tx_interrupt()
1430 tp->stats.collisions += (txstatus >> 24) & 15; in netdrv_tx_interrupt()
1431 tp->stats.tx_bytes += txstatus & 0x7ff; in netdrv_tx_interrupt()
1432 tp->stats.tx_packets++; in netdrv_tx_interrupt()
1436 if (tp->tx_info[entry].mapping != 0) { in netdrv_tx_interrupt()
1437 pci_unmap_single(tp->pci_dev, in netdrv_tx_interrupt()
1438 tp->tx_info[entry].mapping, in netdrv_tx_interrupt()
1439 tp->tx_info[entry].skb->len, in netdrv_tx_interrupt()
1441 tp->tx_info[entry].mapping = 0; in netdrv_tx_interrupt()
1443 dev_kfree_skb_irq (tp->tx_info[entry].skb); in netdrv_tx_interrupt()
1444 tp->tx_info[entry].skb = NULL; in netdrv_tx_interrupt()
1447 atomic_sub (cur_tx, &tp->cur_tx); /* XXX racy? */ in netdrv_tx_interrupt()
1453 cur_tx = atomic_read (&tp->cur_tx); in netdrv_tx_interrupt()
1459 if (atomic_read (&tp->cur_tx) - dirty_tx > NUM_TX_DESC) { in netdrv_tx_interrupt()
1462 dev->name, dirty_tx, atomic_read (&tp->cur_tx)); in netdrv_tx_interrupt()
1467 atomic_set (&tp->dirty_tx, dirty_tx); in netdrv_tx_interrupt()
1473 struct netdrv_private *tp, void *ioaddr) in netdrv_rx_err() argument
1485 tp->stats.rx_errors++; in netdrv_rx_err()
1487 tp->stats.rx_frame_errors++; in netdrv_rx_err()
1489 tp->stats.rx_length_errors++; in netdrv_rx_err()
1491 tp->stats.rx_crc_errors++; in netdrv_rx_err()
1493 tp->cur_rx = 0; in netdrv_rx_err()
1524 struct netdrv_private *tp, void *ioaddr) in netdrv_rx_interrupt() argument
1530 assert (tp != NULL); in netdrv_rx_interrupt()
1533 rx_ring = tp->rx_ring; in netdrv_rx_interrupt()
1534 cur_rx = tp->cur_rx; in netdrv_rx_interrupt()
1574 netdrv_rx_err (rx_status, dev, tp, ioaddr); in netdrv_rx_interrupt()
1598 tp->stats.rx_bytes += pkt_size; in netdrv_rx_interrupt()
1599 tp->stats.rx_packets++; in netdrv_rx_interrupt()
1604 tp->stats.rx_dropped++; in netdrv_rx_interrupt()
1616 tp->cur_rx = cur_rx; in netdrv_rx_interrupt()
1621 struct netdrv_private *tp, in netdrv_weird_interrupt() argument
1629 assert (tp != NULL); in netdrv_weird_interrupt()
1633 tp->stats.rx_missed_errors += NETDRV_R32 (RxMissed); in netdrv_weird_interrupt()
1637 (tp->drv_flags & HAS_LNK_CHNG)) { in netdrv_weird_interrupt()
1641 || tp->duplex_lock; in netdrv_weird_interrupt()
1642 if (tp->full_duplex != duplex) { in netdrv_weird_interrupt()
1643 tp->full_duplex = duplex; in netdrv_weird_interrupt()
1645 NETDRV_W8 (Config1, tp->full_duplex ? 0x60 : 0x20); in netdrv_weird_interrupt()
1654 tp->stats.rx_errors++; in netdrv_weird_interrupt()
1657 tp->stats.rx_length_errors++; in netdrv_weird_interrupt()
1659 tp->stats.rx_fifo_errors++; in netdrv_weird_interrupt()
1661 tp->stats.rx_over_errors++; in netdrv_weird_interrupt()
1662 tp->cur_rx = NETDRV_R16 (RxBufAddr) % RX_BUF_LEN; in netdrv_weird_interrupt()
1663 NETDRV_W16_F (RxBufPtr, tp->cur_rx - 16); in netdrv_weird_interrupt()
1667 pci_read_config_word (tp->pci_dev, PCI_STATUS, &pci_cmd_status); in netdrv_weird_interrupt()
1681 struct netdrv_private *tp = dev->priv; in netdrv_interrupt() local
1683 void *ioaddr = tp->mmio_addr; in netdrv_interrupt()
1686 spin_lock (&tp->lock); in netdrv_interrupt()
1710 netdrv_weird_interrupt (dev, tp, ioaddr, in netdrv_interrupt()
1714 netdrv_rx_interrupt (dev, tp, ioaddr); in netdrv_interrupt()
1717 netdrv_tx_interrupt (dev, tp, ioaddr); in netdrv_interrupt()
1732 spin_unlock (&tp->lock); in netdrv_interrupt()
1741 struct netdrv_private *tp = dev->priv; in netdrv_close() local
1742 void *ioaddr = tp->mmio_addr; in netdrv_close()
1752 del_timer_sync (&tp->timer); in netdrv_close()
1754 spin_lock_irqsave (&tp->lock, flags); in netdrv_close()
1763 tp->stats.rx_missed_errors += NETDRV_R32 (RxMissed); in netdrv_close()
1766 spin_unlock_irqrestore (&tp->lock, flags); in netdrv_close()
1771 netdrv_tx_clear (tp); in netdrv_close()
1773 pci_free_consistent(tp->pci_dev, RX_BUF_TOT_LEN, in netdrv_close()
1774 tp->rx_ring, tp->rx_ring_dma); in netdrv_close()
1775 pci_free_consistent(tp->pci_dev, TX_BUF_TOT_LEN, in netdrv_close()
1776 tp->tx_bufs, tp->tx_bufs_dma); in netdrv_close()
1777 tp->rx_ring = NULL; in netdrv_close()
1778 tp->tx_bufs = NULL; in netdrv_close()
1792 struct netdrv_private *tp = dev->priv; in netdrv_ioctl() local
1802 data->phy_id = tp->phys[0] & 0x3f; in netdrv_ioctl()
1807 spin_lock_irqsave (&tp->lock, flags); in netdrv_ioctl()
1809 spin_unlock_irqrestore (&tp->lock, flags); in netdrv_ioctl()
1819 spin_lock_irqsave (&tp->lock, flags); in netdrv_ioctl()
1821 spin_unlock_irqrestore (&tp->lock, flags); in netdrv_ioctl()
1836 struct netdrv_private *tp = dev->priv; in netdrv_get_stats() local
1837 void *ioaddr = tp->mmio_addr; in netdrv_get_stats()
1841 assert (tp != NULL); in netdrv_get_stats()
1846 spin_lock_irqsave (&tp->lock, flags); in netdrv_get_stats()
1848 tp->stats.rx_missed_errors += NETDRV_R32 (RxMissed); in netdrv_get_stats()
1851 spin_unlock_irqrestore (&tp->lock, flags); in netdrv_get_stats()
1855 return &tp->stats; in netdrv_get_stats()
1863 struct netdrv_private *tp = dev->priv; in netdrv_set_rx_mode() local
1864 void *ioaddr = tp->mmio_addr; in netdrv_set_rx_mode()
1900 spin_lock_irq (&tp->lock); in netdrv_set_rx_mode()
1904 (NETDRV_R32 (RxConfig) & rtl_chip_info[tp->chipset].RxConfigMask); in netdrv_set_rx_mode()
1910 spin_unlock_irq (&tp->lock); in netdrv_set_rx_mode()
1921 struct netdrv_private *tp = dev->priv; in netdrv_suspend() local
1922 void *ioaddr = tp->mmio_addr; in netdrv_suspend()
1929 spin_lock_irqsave (&tp->lock, flags); in netdrv_suspend()
1936 tp->stats.rx_missed_errors += NETDRV_R32 (RxMissed); in netdrv_suspend()
1939 spin_unlock_irqrestore (&tp->lock, flags); in netdrv_suspend()