Lines Matching refs:tp

358                                  struct rtl8169_private *tp, void *ioaddr);
408 struct rtl8169_private *tp = dev->priv; in rtl8169_get_drvinfo() local
412 strcpy(info->bus_info, pci_name(tp->pci_dev)); in rtl8169_get_drvinfo()
430 static void rtl8169_get_mac_version(struct rtl8169_private *tp, void *ioaddr) in rtl8169_get_mac_version() argument
445 tp->mac_version = p->mac_version; in rtl8169_get_mac_version()
448 static void rtl8169_print_mac_version(struct rtl8169_private *tp) in rtl8169_print_mac_version() argument
461 if (tp->mac_version == p->version) { in rtl8169_print_mac_version()
470 static void rtl8169_get_phy_version(struct rtl8169_private *tp, void *ioaddr) in rtl8169_get_phy_version() argument
487 tp->phy_version = p->phy_version; in rtl8169_get_phy_version()
490 static void rtl8169_print_phy_version(struct rtl8169_private *tp) in rtl8169_print_phy_version() argument
505 if (tp->phy_version == p->version) { in rtl8169_print_phy_version()
515 struct rtl8169_private *tp = dev->priv; in rtl8169_hw_phy_config() local
516 void *ioaddr = tp->mmio_addr; in rtl8169_hw_phy_config()
549 rtl8169_print_mac_version(tp); in rtl8169_hw_phy_config()
550 rtl8169_print_phy_version(tp); in rtl8169_hw_phy_config()
552 if (tp->mac_version <= RTL_GIGA_MAC_VER_B) in rtl8169_hw_phy_config()
554 if (tp->phy_version >= RTL_GIGA_PHY_VER_F) in rtl8169_hw_phy_config()
583 struct rtl8169_private *tp = dev->priv; in rtl8169_hw_phy_reset() local
584 void *ioaddr = tp->mmio_addr; in rtl8169_hw_phy_reset()
607 struct rtl8169_private *tp = dev->priv; in rtl8169_phy_timer() local
608 struct timer_list *timer = &tp->timer; in rtl8169_phy_timer()
609 void *ioaddr = tp->mmio_addr; in rtl8169_phy_timer()
611 assert(tp->mac_version > RTL_GIGA_MAC_VER_B); in rtl8169_phy_timer()
612 assert(tp->phy_version < RTL_GIGA_PHY_VER_G); in rtl8169_phy_timer()
615 tp->phy_link_down_cnt = 0; in rtl8169_phy_timer()
617 tp->phy_link_down_cnt++; in rtl8169_phy_timer()
618 if (tp->phy_link_down_cnt >= 12) { in rtl8169_phy_timer()
626 tp->phy_link_down_cnt = 0; in rtl8169_phy_timer()
635 struct rtl8169_private *tp = dev->priv; in rtl8169_delete_timer() local
636 struct timer_list *timer = &tp->timer; in rtl8169_delete_timer()
638 if ((tp->mac_version <= RTL_GIGA_MAC_VER_B) || in rtl8169_delete_timer()
639 (tp->phy_version >= RTL_GIGA_PHY_VER_G)) in rtl8169_delete_timer()
644 tp->phy_link_down_cnt = 0; in rtl8169_delete_timer()
649 struct rtl8169_private *tp = dev->priv; in rtl8169_request_timer() local
650 struct timer_list *timer = &tp->timer; in rtl8169_request_timer()
652 if ((tp->mac_version <= RTL_GIGA_MAC_VER_B) || in rtl8169_request_timer()
653 (tp->phy_version >= RTL_GIGA_PHY_VER_G)) in rtl8169_request_timer()
656 tp->phy_link_down_cnt = 0; in rtl8169_request_timer()
671 struct rtl8169_private *tp; in rtl8169_init_board() local
683 dev = alloc_etherdev(sizeof (*tp)); in rtl8169_init_board()
691 tp = dev->priv; in rtl8169_init_board()
737 tp->cp_cmd = PCIMulRW | RxChkSum; in rtl8169_init_board()
741 tp->cp_cmd |= PCIDAC; in rtl8169_init_board()
773 rtl8169_get_mac_version(tp, ioaddr); in rtl8169_init_board()
774 rtl8169_get_phy_version(tp, ioaddr); in rtl8169_init_board()
776 rtl8169_print_mac_version(tp); in rtl8169_init_board()
777 rtl8169_print_phy_version(tp); in rtl8169_init_board()
780 if (tp->mac_version == rtl_chip_info[i].mac_version) in rtl8169_init_board()
790 tp->chipset = i; in rtl8169_init_board()
811 struct rtl8169_private *tp = NULL; in rtl8169_init_one() local
832 tp = dev->priv; in rtl8169_init_one()
835 assert(tp != NULL); in rtl8169_init_one()
853 tp = dev->priv; // private data // in rtl8169_init_one()
854 tp->pci_dev = pdev; in rtl8169_init_one()
855 tp->mmio_addr = ioaddr; in rtl8169_init_one()
857 spin_lock_init(&tp->lock); in rtl8169_init_one()
869 rtl_chip_info[tp->chipset].name); in rtl8169_init_one()
888 if (tp->mac_version < RTL_GIGA_MAC_VER_E) { in rtl8169_init_one()
893 if (tp->mac_version == RTL_GIGA_MAC_VER_D) { in rtl8169_init_one()
990 INIT_TQUEUE(&tp->reset_task, (void (*)(void *))rtl8169_reset_task, dev); in rtl8169_init_one()
999 struct rtl8169_private *tp = dev->priv; in rtl8169_remove_one() local
1002 assert(tp != NULL); in rtl8169_remove_one()
1006 iounmap(tp->mmio_addr); in rtl8169_remove_one()
1019 struct rtl8169_private *tp = dev->priv; in rtl8169_suspend() local
1020 void *ioaddr = tp->mmio_addr; in rtl8169_suspend()
1028 spin_lock_irqsave(&tp->lock, flags); in rtl8169_suspend()
1035 tp->stats.rx_missed_errors += RTL_R32(RxMissed); in rtl8169_suspend()
1037 spin_unlock_irqrestore(&tp->lock, flags); in rtl8169_suspend()
1060 struct rtl8169_private *tp = dev->priv; in rtl8169_open() local
1061 struct pci_dev *pdev = tp->pci_dev; in rtl8169_open()
1075 tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES, in rtl8169_open()
1076 &tp->TxPhyAddr); in rtl8169_open()
1077 if (!tp->TxDescArray) in rtl8169_open()
1080 tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES, in rtl8169_open()
1081 &tp->RxPhyAddr); in rtl8169_open()
1082 if (!tp->RxDescArray) in rtl8169_open()
1096 pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, in rtl8169_open()
1097 tp->RxPhyAddr); in rtl8169_open()
1099 pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, in rtl8169_open()
1100 tp->TxPhyAddr); in rtl8169_open()
1109 struct rtl8169_private *tp = dev->priv; in rtl8169_hw_start() local
1110 void *ioaddr = tp->mmio_addr; in rtl8169_hw_start()
1132 i = rtl8169_rx_config | (RTL_R32(RxConfig) & rtl_chip_info[tp->chipset]. in rtl8169_hw_start()
1140 tp->cp_cmd |= RTL_R16(CPlusCmd); in rtl8169_hw_start()
1141 RTL_W16(CPlusCmd, tp->cp_cmd); in rtl8169_hw_start()
1143 if (tp->mac_version == RTL_GIGA_MAC_VER_D) { in rtl8169_hw_start()
1145 tp->cp_cmd |= (1 << 14) | PCIMulRW; in rtl8169_hw_start()
1146 RTL_W16(CPlusCmd, tp->cp_cmd); in rtl8169_hw_start()
1149 tp->cur_rx = 0; in rtl8169_hw_start()
1151 RTL_W32(TxDescStartAddrLow, ((u64) tp->TxPhyAddr & DMA_32BIT_MASK)); in rtl8169_hw_start()
1152 RTL_W32(TxDescStartAddrHigh, ((u64) tp->TxPhyAddr >> 32)); in rtl8169_hw_start()
1153 RTL_W32(RxDescAddrLow, ((u64) tp->RxPhyAddr & DMA_32BIT_MASK)); in rtl8169_hw_start()
1154 RTL_W32(RxDescAddrHigh, ((u64) tp->RxPhyAddr >> 32)); in rtl8169_hw_start()
1228 static void rtl8169_rx_clear(struct rtl8169_private *tp) in rtl8169_rx_clear() argument
1233 if (tp->Rx_skbuff[i]) { in rtl8169_rx_clear()
1234 rtl8169_free_rx_skb(tp->pci_dev, tp->Rx_skbuff + i, in rtl8169_rx_clear()
1235 tp->RxDescArray + i); in rtl8169_rx_clear()
1240 static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, in rtl8169_rx_fill() argument
1248 if (tp->Rx_skbuff[i]) in rtl8169_rx_fill()
1251 ret = rtl8169_alloc_rx_skb(tp->pci_dev, dev, tp->Rx_skbuff + i, in rtl8169_rx_fill()
1252 tp->RxDescArray + i); in rtl8169_rx_fill()
1266 struct rtl8169_private *tp = dev->priv; in rtl8169_init_ring() local
1268 tp->cur_rx = tp->dirty_rx = 0; in rtl8169_init_ring()
1269 tp->cur_tx = tp->dirty_tx = 0; in rtl8169_init_ring()
1270 memset(tp->TxDescArray, 0x0, NUM_TX_DESC * sizeof (struct TxDesc)); in rtl8169_init_ring()
1271 memset(tp->RxDescArray, 0x0, NUM_RX_DESC * sizeof (struct RxDesc)); in rtl8169_init_ring()
1273 memset(tp->Tx_skbuff, 0x0, NUM_TX_DESC * sizeof(struct sk_buff *)); in rtl8169_init_ring()
1274 memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *)); in rtl8169_init_ring()
1276 if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC) != NUM_RX_DESC) in rtl8169_init_ring()
1279 rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1); in rtl8169_init_ring()
1284 rtl8169_rx_clear(tp); in rtl8169_init_ring()
1300 rtl8169_tx_clear(struct rtl8169_private *tp) in rtl8169_tx_clear() argument
1304 tp->cur_tx = 0; in rtl8169_tx_clear()
1306 struct sk_buff *skb = tp->Tx_skbuff[i]; in rtl8169_tx_clear()
1309 rtl8169_unmap_tx_skb(tp->pci_dev, tp->Tx_skbuff + i, in rtl8169_tx_clear()
1310 tp->TxDescArray + i); in rtl8169_tx_clear()
1312 tp->stats.tx_dropped++; in rtl8169_tx_clear()
1320 struct rtl8169_private *tp = dev->priv; in rtl8169_reset_task() local
1321 void *ioaddr = tp->mmio_addr; in rtl8169_reset_task()
1329 rtl8169_rx_interrupt(dev, tp, ioaddr); in rtl8169_reset_task()
1331 spin_lock_irq(&tp->lock); in rtl8169_reset_task()
1332 rtl8169_tx_clear(tp); in rtl8169_reset_task()
1333 spin_unlock_irq(&tp->lock); in rtl8169_reset_task()
1335 if (tp->dirty_rx == tp->cur_rx) { in rtl8169_reset_task()
1336 tp->dirty_tx = tp->dirty_rx = tp->cur_tx = tp->cur_rx = 0; in rtl8169_reset_task()
1344 schedule_task(&tp->reset_task); in rtl8169_reset_task()
1354 struct rtl8169_private *tp = dev->priv; in rtl8169_tx_timeout() local
1355 void *ioaddr = tp->mmio_addr; in rtl8169_tx_timeout()
1367 spin_lock_irq(&tp->lock); in rtl8169_tx_timeout()
1368 rtl8169_tx_clear(tp); in rtl8169_tx_timeout()
1369 spin_unlock_irq(&tp->lock); in rtl8169_tx_timeout()
1380 struct rtl8169_private *tp = dev->priv; in rtl8169_start_xmit() local
1381 void *ioaddr = tp->mmio_addr; in rtl8169_start_xmit()
1382 int entry = tp->cur_tx % NUM_TX_DESC; in rtl8169_start_xmit()
1392 spin_lock_irq(&tp->lock); in rtl8169_start_xmit()
1394 if (!(le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit)) { in rtl8169_start_xmit()
1397 mapping = pci_map_single(tp->pci_dev, skb->data, len, in rtl8169_start_xmit()
1400 tp->Tx_skbuff[entry] = skb; in rtl8169_start_xmit()
1401 tp->TxDescArray[entry].addr = cpu_to_le64(mapping); in rtl8169_start_xmit()
1403 tp->TxDescArray[entry].status = cpu_to_le32(OWNbit | FSbit | in rtl8169_start_xmit()
1410 tp->cur_tx++; in rtl8169_start_xmit()
1415 if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx) { in rtl8169_start_xmit()
1419 spin_unlock_irq(&tp->lock); in rtl8169_start_xmit()
1426 tp->stats.tx_dropped++; in rtl8169_start_xmit()
1431 rtl8169_tx_interrupt(struct net_device *dev, struct rtl8169_private *tp, in rtl8169_tx_interrupt() argument
1437 assert(tp != NULL); in rtl8169_tx_interrupt()
1440 dirty_tx = tp->dirty_tx; in rtl8169_tx_interrupt()
1441 tx_left = tp->cur_tx - dirty_tx; in rtl8169_tx_interrupt()
1445 struct sk_buff *skb = tp->Tx_skbuff[entry]; in rtl8169_tx_interrupt()
1449 status = le32_to_cpu(tp->TxDescArray[entry].status); in rtl8169_tx_interrupt()
1454 tp->stats.tx_bytes += skb->len >= ETH_ZLEN ? in rtl8169_tx_interrupt()
1456 tp->stats.tx_packets++; in rtl8169_tx_interrupt()
1457 rtl8169_unmap_tx_skb(tp->pci_dev, tp->Tx_skbuff + entry, in rtl8169_tx_interrupt()
1458 tp->TxDescArray + entry); in rtl8169_tx_interrupt()
1464 if (tp->dirty_tx != dirty_tx) { in rtl8169_tx_interrupt()
1465 tp->dirty_tx = dirty_tx; in rtl8169_tx_interrupt()
1499 rtl8169_rx_interrupt(struct net_device *dev, struct rtl8169_private *tp, in rtl8169_rx_interrupt() argument
1506 assert(tp != NULL); in rtl8169_rx_interrupt()
1509 cur_rx = tp->cur_rx; in rtl8169_rx_interrupt()
1510 rx_left = NUM_RX_DESC + tp->dirty_rx - cur_rx; in rtl8169_rx_interrupt()
1517 status = le32_to_cpu(tp->RxDescArray[entry].status); in rtl8169_rx_interrupt()
1526 tp->stats.rx_errors++; in rtl8169_rx_interrupt()
1528 tp->stats.rx_length_errors++; in rtl8169_rx_interrupt()
1530 tp->stats.rx_crc_errors++; in rtl8169_rx_interrupt()
1532 tp->stats.rx_fifo_errors++; in rtl8169_rx_interrupt()
1533 schedule_task(&tp->reset_task); in rtl8169_rx_interrupt()
1536 rtl8169_return_to_asic(tp->RxDescArray + entry); in rtl8169_rx_interrupt()
1539 struct RxDesc *desc = tp->RxDescArray + entry; in rtl8169_rx_interrupt()
1540 struct sk_buff *skb = tp->Rx_skbuff[entry]; in rtl8169_rx_interrupt()
1549 tp->stats.rx_dropped++; in rtl8169_rx_interrupt()
1550 tp->stats.rx_length_errors++; in rtl8169_rx_interrupt()
1555 pci_dma_sync_single(tp->pci_dev, le64_to_cpu(desc->addr), in rtl8169_rx_interrupt()
1559 pci_unmap_single(tp->pci_dev, le64_to_cpu(desc->addr), in rtl8169_rx_interrupt()
1561 tp->Rx_skbuff[entry] = NULL; in rtl8169_rx_interrupt()
1570 tp->stats.rx_bytes += pkt_size; in rtl8169_rx_interrupt()
1571 tp->stats.rx_packets++; in rtl8169_rx_interrupt()
1575 tp->cur_rx = cur_rx; in rtl8169_rx_interrupt()
1577 delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx); in rtl8169_rx_interrupt()
1579 tp->dirty_rx += delta; in rtl8169_rx_interrupt()
1590 if (tp->dirty_rx + NUM_RX_DESC == tp->cur_rx && net_ratelimit()) in rtl8169_rx_interrupt()
1599 struct rtl8169_private *tp = dev->priv; in rtl8169_interrupt() local
1601 void *ioaddr = tp->mmio_addr; in rtl8169_interrupt()
1625 rtl8169_rx_interrupt(dev, tp, ioaddr); in rtl8169_interrupt()
1629 spin_lock(&tp->lock); in rtl8169_interrupt()
1630 rtl8169_tx_interrupt(dev, tp, ioaddr); in rtl8169_interrupt()
1631 spin_unlock(&tp->lock); in rtl8169_interrupt()
1650 struct rtl8169_private *tp = dev->priv; in rtl8169_close() local
1651 struct pci_dev *pdev = tp->pci_dev; in rtl8169_close()
1652 void *ioaddr = tp->mmio_addr; in rtl8169_close()
1658 spin_lock_irq(&tp->lock); in rtl8169_close()
1667 tp->stats.rx_missed_errors += RTL_R32(RxMissed); in rtl8169_close()
1670 spin_unlock_irq(&tp->lock); in rtl8169_close()
1675 rtl8169_tx_clear(tp); in rtl8169_close()
1677 rtl8169_rx_clear(tp); in rtl8169_close()
1679 pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, in rtl8169_close()
1680 tp->RxPhyAddr); in rtl8169_close()
1681 pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, in rtl8169_close()
1682 tp->TxPhyAddr); in rtl8169_close()
1683 tp->TxDescArray = NULL; in rtl8169_close()
1684 tp->RxDescArray = NULL; in rtl8169_close()
1692 struct rtl8169_private *tp = dev->priv; in rtl8169_set_rx_mode() local
1693 void *ioaddr = tp->mmio_addr; in rtl8169_set_rx_mode()
1724 spin_lock_irqsave(&tp->lock, flags); in rtl8169_set_rx_mode()
1728 rtl_chip_info[tp->chipset]. in rtl8169_set_rx_mode()
1735 spin_unlock_irqrestore(&tp->lock, flags); in rtl8169_set_rx_mode()
1746 struct rtl8169_private *tp = dev->priv; in rtl8169_get_stats() local
1747 void *ioaddr = tp->mmio_addr; in rtl8169_get_stats()
1751 spin_lock_irqsave(&tp->lock, flags); in rtl8169_get_stats()
1752 tp->stats.rx_missed_errors += RTL_R32(RxMissed); in rtl8169_get_stats()
1754 spin_unlock_irqrestore(&tp->lock, flags); in rtl8169_get_stats()
1757 return &tp->stats; in rtl8169_get_stats()