Lines Matching refs:tp

711 	struct rtl8139_private *tp;  in __rtl8139_cleanup_dev()  local
717 tp = dev->priv; in __rtl8139_cleanup_dev()
718 assert (tp->pci_dev != NULL); in __rtl8139_cleanup_dev()
719 pdev = tp->pci_dev; in __rtl8139_cleanup_dev()
722 if (tp->mmio_addr) in __rtl8139_cleanup_dev()
723 iounmap (tp->mmio_addr); in __rtl8139_cleanup_dev()
757 struct rtl8139_private *tp; in rtl8139_init_board() local
770 dev = alloc_etherdev (sizeof (*tp)); in rtl8139_init_board()
777 tp = dev->priv; in rtl8139_init_board()
778 tp->pci_dev = pdev; in rtl8139_init_board()
837 tp->mmio_addr = ioaddr; in rtl8139_init_board()
838 tp->regs_len = pio_len; in rtl8139_init_board()
848 tp->mmio_addr = ioaddr; in rtl8139_init_board()
849 tp->regs_len = mmio_len; in rtl8139_init_board()
867 tp->chipset = i; in rtl8139_init_board()
875 tp->chipset = 0; in rtl8139_init_board()
880 tp->chipset, in rtl8139_init_board()
881 rtl_chip_info[tp->chipset].name); in rtl8139_init_board()
883 if (tp->chipset >= CH_8139B) { in rtl8139_init_board()
886 if ((rtl_chip_info[tp->chipset].flags & HasLWake) && in rtl8139_init_board()
895 if (rtl_chip_info[tp->chipset].flags & HasLWake) { in rtl8139_init_board()
925 struct rtl8139_private *tp; in rtl8139_init_one() local
961 tp = dev->priv; in rtl8139_init_one()
962 assert (tp != NULL); in rtl8139_init_one()
963 ioaddr = tp->mmio_addr; in rtl8139_init_one()
991 tp = dev->priv; in rtl8139_init_one()
994 tp->drv_flags = board_info[ent->driver_data].hw_flags; in rtl8139_init_one()
995 tp->mmio_addr = ioaddr; in rtl8139_init_one()
996 tp->msg_enable = in rtl8139_init_one()
998 spin_lock_init (&tp->lock); in rtl8139_init_one()
999 init_waitqueue_head (&tp->thr_wait); in rtl8139_init_one()
1000 init_completion (&tp->thr_exited); in rtl8139_init_one()
1001 tp->mii.dev = dev; in rtl8139_init_one()
1002 tp->mii.mdio_read = mdio_read; in rtl8139_init_one()
1003 tp->mii.mdio_write = mdio_write; in rtl8139_init_one()
1004 tp->mii.phy_id_mask = 0x3f; in rtl8139_init_one()
1005 tp->mii.reg_num_mask = 0x1f; in rtl8139_init_one()
1026 dev->name, rtl_chip_info[tp->chipset].name); in rtl8139_init_one()
1032 if (tp->drv_flags & HAS_MII_XCVR) { in rtl8139_init_one()
1034 for (phy = 0; phy < 32 && phy_idx < sizeof(tp->phys); phy++) { in rtl8139_init_one()
1038 tp->phys[phy_idx++] = phy; in rtl8139_init_one()
1048 tp->phys[0] = 32; in rtl8139_init_one()
1052 tp->phys[0] = 32; in rtl8139_init_one()
1053 tp->mii.phy_id = tp->phys[0]; in rtl8139_init_one()
1058 tp->mii.full_duplex = (option & 0x210) ? 1 : 0; in rtl8139_init_one()
1059 tp->default_port = option & 0xFF; in rtl8139_init_one()
1060 if (tp->default_port) in rtl8139_init_one()
1061 tp->mii.force_media = 1; in rtl8139_init_one()
1064 tp->mii.full_duplex = full_duplex[board_idx]; in rtl8139_init_one()
1065 if (tp->mii.full_duplex) { in rtl8139_init_one()
1069 tp->mii.force_media = 1; in rtl8139_init_one()
1071 if (tp->default_port) { in rtl8139_init_one()
1075 mdio_write(dev, tp->phys[0], 0, in rtl8139_init_one()
1081 if (rtl_chip_info[tp->chipset].flags & HasHltClk) in rtl8139_init_one()
1213 struct rtl8139_private *tp = dev->priv; in mdio_read() local
1216 void *mdio_addr = tp->mmio_addr + Config4; in mdio_read()
1223 readw (tp->mmio_addr + mii_2_8139_map[location]) : 0; in mdio_read()
1255 struct rtl8139_private *tp = dev->priv; in mdio_write() local
1257 void *mdio_addr = tp->mmio_addr + Config4; in mdio_write()
1263 void *ioaddr = tp->mmio_addr; in mdio_write()
1298 struct rtl8139_private *tp = dev->priv; in rtl8139_open() local
1300 void *ioaddr = tp->mmio_addr; in rtl8139_open()
1306 tp->tx_bufs = pci_alloc_consistent(tp->pci_dev, TX_BUF_TOT_LEN, in rtl8139_open()
1307 &tp->tx_bufs_dma); in rtl8139_open()
1308 tp->rx_ring = pci_alloc_consistent(tp->pci_dev, RX_BUF_TOT_LEN, in rtl8139_open()
1309 &tp->rx_ring_dma); in rtl8139_open()
1310 if (tp->tx_bufs == NULL || tp->rx_ring == NULL) { in rtl8139_open()
1313 if (tp->tx_bufs) in rtl8139_open()
1314 pci_free_consistent(tp->pci_dev, TX_BUF_TOT_LEN, in rtl8139_open()
1315 tp->tx_bufs, tp->tx_bufs_dma); in rtl8139_open()
1316 if (tp->rx_ring) in rtl8139_open()
1317 pci_free_consistent(tp->pci_dev, RX_BUF_TOT_LEN, in rtl8139_open()
1318 tp->rx_ring, tp->rx_ring_dma); in rtl8139_open()
1324 tp->mii.full_duplex = tp->mii.force_media; in rtl8139_open()
1325 tp->tx_flag = (TX_FIFO_THRESH << 11) & 0x003f0000; in rtl8139_open()
1330 if (netif_msg_ifup(tp)) in rtl8139_open()
1333 dev->name, pci_resource_start (tp->pci_dev, 1), in rtl8139_open()
1335 tp->mii.full_duplex ? "full" : "half"); in rtl8139_open()
1345 struct rtl8139_private *tp = dev->priv; in rtl_check_media() local
1347 if (tp->phys[0] >= 0) { in rtl_check_media()
1348 mii_check_media(&tp->mii, netif_msg_link(tp), init_media); in rtl_check_media()
1355 struct rtl8139_private *tp = dev->priv; in rtl8139_hw_start() local
1356 void *ioaddr = tp->mmio_addr; in rtl8139_hw_start()
1361 if (rtl_chip_info[tp->chipset].flags & HasHltClk) in rtl8139_hw_start()
1375 tp->rx_config = rtl8139_rx_config | AcceptBroadcast | AcceptMyPhys; in rtl8139_hw_start()
1376 RTL_W32 (RxConfig, tp->rx_config); in rtl8139_hw_start()
1381 tp->cur_rx = 0; in rtl8139_hw_start()
1385 if (tp->chipset >= CH_8139B) { in rtl8139_hw_start()
1398 RTL_W32_F (RxBuf, tp->rx_ring_dma); in rtl8139_hw_start()
1402 RTL_W32_F (TxAddr0 + (i * 4), tp->tx_bufs_dma + (tp->tx_buf[i] - tp->tx_bufs)); in rtl8139_hw_start()
1426 struct rtl8139_private *tp = dev->priv; in rtl8139_init_ring() local
1429 tp->cur_rx = 0; in rtl8139_init_ring()
1430 tp->cur_tx = 0; in rtl8139_init_ring()
1431 tp->dirty_tx = 0; in rtl8139_init_ring()
1434 tp->tx_buf[i] = &tp->tx_bufs[i * TX_BUF_SIZE]; in rtl8139_init_ring()
1443 struct rtl8139_private *tp) {} in rtl8139_tune_twister() argument
1459 struct rtl8139_private *tp) in rtl8139_tune_twister() argument
1462 void *ioaddr = tp->mmio_addr; in rtl8139_tune_twister()
1468 switch (tp->twistie) { in rtl8139_tune_twister()
1473 tp->twistie = 2; /* Change to state 2. */ in rtl8139_tune_twister()
1481 tp->twistie = 0; /* Bail from future actions. */ in rtl8139_tune_twister()
1488 tp->twist_row = 3; in rtl8139_tune_twister()
1490 tp->twist_row = 2; in rtl8139_tune_twister()
1492 tp->twist_row = 1; in rtl8139_tune_twister()
1494 tp->twist_row = 0; in rtl8139_tune_twister()
1495 tp->twist_col = 0; in rtl8139_tune_twister()
1496 tp->twistie = 3; /* Change to state 2. */ in rtl8139_tune_twister()
1501 if (tp->twist_col == 0) in rtl8139_tune_twister()
1503 RTL_W32 (PARA7c, param[(int) tp->twist_row] in rtl8139_tune_twister()
1504 [(int) tp->twist_col]); in rtl8139_tune_twister()
1506 if (++tp->twist_col >= 4) { in rtl8139_tune_twister()
1509 tp->twistie = in rtl8139_tune_twister()
1510 (tp->twist_row == 3) ? 4 : 0; in rtl8139_tune_twister()
1517 tp->twistie = 0; in rtl8139_tune_twister()
1521 tp->twistie = 5; in rtl8139_tune_twister()
1531 tp->twist_row = 2; in rtl8139_tune_twister()
1532 tp->twist_col = 0; in rtl8139_tune_twister()
1533 tp->twistie = 3; in rtl8139_tune_twister()
1545 struct rtl8139_private *tp, in rtl8139_thread_iter() argument
1550 mii_lpa = mdio_read (dev, tp->phys[0], MII_LPA); in rtl8139_thread_iter()
1552 if (!tp->mii.force_media && mii_lpa != 0xffff) { in rtl8139_thread_iter()
1555 if (tp->mii.full_duplex != duplex) { in rtl8139_thread_iter()
1556 tp->mii.full_duplex = duplex; in rtl8139_thread_iter()
1563 tp->mii.full_duplex ? "full" : "half", in rtl8139_thread_iter()
1564 tp->phys[0], mii_lpa); in rtl8139_thread_iter()
1571 RTL_W8 (Config1, tp->mii.full_duplex ? 0x60 : 0x20); in rtl8139_thread_iter()
1579 rtl8139_tune_twister (dev, tp); in rtl8139_thread_iter()
1593 struct rtl8139_private *tp = dev->priv; in rtl8139_thread() local
1609 timeout = interruptible_sleep_on_timeout (&tp->thr_wait, timeout); in rtl8139_thread()
1618 if (tp->time_to_die) in rtl8139_thread()
1622 rtl8139_thread_iter (dev, tp, tp->mmio_addr); in rtl8139_thread()
1626 complete_and_exit (&tp->thr_exited, 0); in rtl8139_thread()
1631 struct rtl8139_private *tp = dev->priv; in rtl8139_start_thread() local
1633 tp->thr_pid = -1; in rtl8139_start_thread()
1634 tp->twistie = 0; in rtl8139_start_thread()
1635 tp->time_to_die = 0; in rtl8139_start_thread()
1636 if (tp->chipset == CH_8139_K) in rtl8139_start_thread()
1637 tp->twistie = 1; in rtl8139_start_thread()
1638 else if (tp->drv_flags & HAS_LNK_CHNG) in rtl8139_start_thread()
1641 tp->thr_pid = kernel_thread(rtl8139_thread, dev, CLONE_FS|CLONE_FILES); in rtl8139_start_thread()
1642 if (tp->thr_pid < 0) { in rtl8139_start_thread()
1648 static void rtl8139_tx_clear (struct rtl8139_private *tp) in rtl8139_tx_clear() argument
1650 tp->cur_tx = 0; in rtl8139_tx_clear()
1651 tp->dirty_tx = 0; in rtl8139_tx_clear()
1659 struct rtl8139_private *tp = dev->priv; in rtl8139_tx_timeout() local
1660 void *ioaddr = tp->mmio_addr; in rtl8139_tx_timeout()
1671 tp->xstats.tx_timeouts++; in rtl8139_tx_timeout()
1683 dev->name, tp->cur_tx, tp->dirty_tx); in rtl8139_tx_timeout()
1687 i == tp->dirty_tx % NUM_TX_DESC ? in rtl8139_tx_timeout()
1691 spin_lock_irqsave (&tp->lock, flags); in rtl8139_tx_timeout()
1692 rtl8139_tx_clear (tp); in rtl8139_tx_timeout()
1693 spin_unlock_irqrestore (&tp->lock, flags); in rtl8139_tx_timeout()
1704 struct rtl8139_private *tp = dev->priv; in rtl8139_start_xmit() local
1705 void *ioaddr = tp->mmio_addr; in rtl8139_start_xmit()
1710 entry = tp->cur_tx % NUM_TX_DESC; in rtl8139_start_xmit()
1714 memset(tp->tx_buf[entry], 0, ETH_ZLEN); in rtl8139_start_xmit()
1715 skb_copy_and_csum_dev(skb, tp->tx_buf[entry]); in rtl8139_start_xmit()
1719 tp->stats.tx_dropped++; in rtl8139_start_xmit()
1724 spin_lock_irq(&tp->lock); in rtl8139_start_xmit()
1726 tp->tx_flag | max(len, (unsigned int)ETH_ZLEN)); in rtl8139_start_xmit()
1730 tp->cur_tx++; in rtl8139_start_xmit()
1733 if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx) in rtl8139_start_xmit()
1735 spin_unlock_irq(&tp->lock); in rtl8139_start_xmit()
1737 if (netif_msg_tx_queued(tp)) in rtl8139_start_xmit()
1746 struct rtl8139_private *tp, in rtl8139_tx_interrupt() argument
1752 assert (tp != NULL); in rtl8139_tx_interrupt()
1755 dirty_tx = tp->dirty_tx; in rtl8139_tx_interrupt()
1756 tx_left = tp->cur_tx - dirty_tx; in rtl8139_tx_interrupt()
1769 if (netif_msg_tx_err(tp)) in rtl8139_tx_interrupt()
1772 tp->stats.tx_errors++; in rtl8139_tx_interrupt()
1774 tp->stats.tx_aborted_errors++; in rtl8139_tx_interrupt()
1780 tp->stats.tx_carrier_errors++; in rtl8139_tx_interrupt()
1782 tp->stats.tx_window_errors++; in rtl8139_tx_interrupt()
1786 if (tp->tx_flag < 0x00300000) in rtl8139_tx_interrupt()
1787 tp->tx_flag += 0x00020000; in rtl8139_tx_interrupt()
1788 tp->stats.tx_fifo_errors++; in rtl8139_tx_interrupt()
1790 tp->stats.collisions += (txstatus >> 24) & 15; in rtl8139_tx_interrupt()
1791 tp->stats.tx_bytes += txstatus & 0x7ff; in rtl8139_tx_interrupt()
1792 tp->stats.tx_packets++; in rtl8139_tx_interrupt()
1800 if (tp->cur_tx - dirty_tx > NUM_TX_DESC) { in rtl8139_tx_interrupt()
1802 dev->name, dirty_tx, tp->cur_tx); in rtl8139_tx_interrupt()
1808 if (tp->dirty_tx != dirty_tx) { in rtl8139_tx_interrupt()
1809 tp->dirty_tx = dirty_tx; in rtl8139_tx_interrupt()
1819 struct rtl8139_private *tp, void *ioaddr) in rtl8139_rx_err() argument
1826 if (netif_msg_rx_err (tp)) in rtl8139_rx_err()
1829 tp->stats.rx_errors++; in rtl8139_rx_err()
1837 tp->stats.rx_frame_errors++; in rtl8139_rx_err()
1839 tp->stats.rx_length_errors++; in rtl8139_rx_err()
1841 tp->stats.rx_crc_errors++; in rtl8139_rx_err()
1843 tp->xstats.rx_lost_in_ring++; in rtl8139_rx_err()
1850 RTL_W32 (RxConfig, tp->rx_config); in rtl8139_rx_err()
1851 tp->cur_rx = 0; in rtl8139_rx_err()
1883 tp->rx_config = rtl8139_rx_config | AcceptBroadcast | AcceptMyPhys; in rtl8139_rx_err()
1884 RTL_W32 (RxConfig, tp->rx_config); in rtl8139_rx_err()
1885 tp->cur_rx = 0; in rtl8139_rx_err()
1893 RTL_W32_F (RxBuf, tp->rx_ring_dma); in rtl8139_rx_err()
1901 struct rtl8139_private *tp, void *ioaddr) in rtl8139_rx_interrupt() argument
1907 assert (tp != NULL); in rtl8139_rx_interrupt()
1910 rx_ring = tp->rx_ring; in rtl8139_rx_interrupt()
1911 cur_rx = tp->cur_rx; in rtl8139_rx_interrupt()
1932 if (netif_msg_rx_status(tp)) in rtl8139_rx_interrupt()
1952 tp->xstats.early_rx++; in rtl8139_rx_interrupt()
1964 rtl8139_rx_err (rx_status, dev, tp, ioaddr); in rtl8139_rx_interrupt()
1988 tp->stats.rx_bytes += pkt_size; in rtl8139_rx_interrupt()
1989 tp->stats.rx_packets++; in rtl8139_rx_interrupt()
1994 tp->stats.rx_dropped++; in rtl8139_rx_interrupt()
2009 tp->cur_rx = cur_rx; in rtl8139_rx_interrupt()
2014 struct rtl8139_private *tp, in rtl8139_weird_interrupt() argument
2022 assert (tp != NULL); in rtl8139_weird_interrupt()
2026 tp->stats.rx_missed_errors += RTL_R32 (RxMissed); in rtl8139_weird_interrupt()
2030 (tp->drv_flags & HAS_LNK_CHNG)) { in rtl8139_weird_interrupt()
2038 tp->stats.rx_errors++; in rtl8139_weird_interrupt()
2041 tp->stats.rx_length_errors++; in rtl8139_weird_interrupt()
2043 tp->stats.rx_fifo_errors++; in rtl8139_weird_interrupt()
2046 pci_read_config_word (tp->pci_dev, PCI_STATUS, &pci_cmd_status); in rtl8139_weird_interrupt()
2047 pci_write_config_word (tp->pci_dev, PCI_STATUS, pci_cmd_status); in rtl8139_weird_interrupt()
2061 struct rtl8139_private *tp = dev->priv; in rtl8139_interrupt() local
2063 void *ioaddr = tp->mmio_addr; in rtl8139_interrupt()
2068 spin_lock (&tp->lock); in rtl8139_interrupt()
2095 if (netif_msg_intr(tp)) in rtl8139_interrupt()
2100 rtl8139_rx_interrupt (dev, tp, ioaddr); in rtl8139_interrupt()
2105 rtl8139_weird_interrupt (dev, tp, ioaddr, in rtl8139_interrupt()
2109 rtl8139_tx_interrupt (dev, tp, ioaddr); in rtl8139_interrupt()
2125 spin_unlock (&tp->lock); in rtl8139_interrupt()
2135 struct rtl8139_private *tp = dev->priv; in rtl8139_close() local
2136 void *ioaddr = tp->mmio_addr; in rtl8139_close()
2142 if (tp->thr_pid >= 0) { in rtl8139_close()
2143 tp->time_to_die = 1; in rtl8139_close()
2145 ret = kill_proc (tp->thr_pid, SIGTERM, 1); in rtl8139_close()
2150 wait_for_completion (&tp->thr_exited); in rtl8139_close()
2153 if (netif_msg_ifdown(tp)) in rtl8139_close()
2157 spin_lock_irqsave (&tp->lock, flags); in rtl8139_close()
2166 tp->stats.rx_missed_errors += RTL_R32 (RxMissed); in rtl8139_close()
2169 spin_unlock_irqrestore (&tp->lock, flags); in rtl8139_close()
2174 rtl8139_tx_clear (tp); in rtl8139_close()
2176 pci_free_consistent(tp->pci_dev, RX_BUF_TOT_LEN, in rtl8139_close()
2177 tp->rx_ring, tp->rx_ring_dma); in rtl8139_close()
2178 pci_free_consistent(tp->pci_dev, TX_BUF_TOT_LEN, in rtl8139_close()
2179 tp->tx_bufs, tp->tx_bufs_dma); in rtl8139_close()
2180 tp->rx_ring = NULL; in rtl8139_close()
2181 tp->tx_bufs = NULL; in rtl8139_close()
2186 if (rtl_chip_info[tp->chipset].flags & HasHltClk) in rtl8139_close()
2401 struct rtl8139_private *tp = dev->priv; in rtl8139_get_stats() local
2402 void *ioaddr = tp->mmio_addr; in rtl8139_get_stats()
2406 spin_lock_irqsave (&tp->lock, flags); in rtl8139_get_stats()
2407 tp->stats.rx_missed_errors += RTL_R32 (RxMissed); in rtl8139_get_stats()
2409 spin_unlock_irqrestore (&tp->lock, flags); in rtl8139_get_stats()
2412 return &tp->stats; in rtl8139_get_stats()
2420 struct rtl8139_private *tp = dev->priv; in __set_rx_mode() local
2421 void *ioaddr = tp->mmio_addr; in __set_rx_mode()
2458 if (tp->rx_config != tmp) { in __set_rx_mode()
2460 tp->rx_config = tmp; in __set_rx_mode()
2469 struct rtl8139_private *tp = dev->priv; in rtl8139_set_rx_mode() local
2471 spin_lock_irqsave (&tp->lock, flags); in rtl8139_set_rx_mode()
2473 spin_unlock_irqrestore (&tp->lock, flags); in rtl8139_set_rx_mode()
2481 struct rtl8139_private *tp = dev->priv; in rtl8139_suspend() local
2482 void *ioaddr = tp->mmio_addr; in rtl8139_suspend()
2485 pci_save_state (pdev, tp->pci_state); in rtl8139_suspend()
2492 spin_lock_irqsave (&tp->lock, flags); in rtl8139_suspend()
2499 tp->stats.rx_missed_errors += RTL_R32 (RxMissed); in rtl8139_suspend()
2504 spin_unlock_irqrestore (&tp->lock, flags); in rtl8139_suspend()
2512 struct rtl8139_private *tp = dev->priv; in rtl8139_resume() local
2514 pci_restore_state (pdev, tp->pci_state); in rtl8139_resume()