• Home
  • Raw
  • Download

Lines Matching refs:np

600 	struct netdev_private *np = netdev_priv(dev);  in netdev_vlan_rx_add_vid()  local
602 spin_lock(&np->lock); in netdev_vlan_rx_add_vid()
605 set_bit(vid, np->active_vlans); in netdev_vlan_rx_add_vid()
607 spin_unlock(&np->lock); in netdev_vlan_rx_add_vid()
615 struct netdev_private *np = netdev_priv(dev); in netdev_vlan_rx_kill_vid() local
617 spin_lock(&np->lock); in netdev_vlan_rx_kill_vid()
620 clear_bit(vid, np->active_vlans); in netdev_vlan_rx_kill_vid()
622 spin_unlock(&np->lock); in netdev_vlan_rx_kill_vid()
650 struct netdev_private *np; in starfire_init_one() local
675 dev = alloc_etherdev(sizeof(*np)); in starfire_init_one()
743 np = netdev_priv(dev); in starfire_init_one()
744 np->dev = dev; in starfire_init_one()
745 np->base = base; in starfire_init_one()
746 spin_lock_init(&np->lock); in starfire_init_one()
749 np->pci_dev = pdev; in starfire_init_one()
751 np->mii_if.dev = dev; in starfire_init_one()
752 np->mii_if.mdio_read = mdio_read; in starfire_init_one()
753 np->mii_if.mdio_write = mdio_write; in starfire_init_one()
754 np->mii_if.phy_id_mask = 0x1f; in starfire_init_one()
755 np->mii_if.reg_num_mask = 0x1f; in starfire_init_one()
759 np->speed100 = 1; in starfire_init_one()
762 np->intr_timer_ctrl = (((intr_latency * 10) / 1024) & IntrLatencyMask) | in starfire_init_one()
766 np->intr_timer_ctrl |= SmallFrameBypass; in starfire_init_one()
769 np->intr_timer_ctrl |= SmallFrame64; in starfire_init_one()
772 np->intr_timer_ctrl |= SmallFrame128; in starfire_init_one()
775 np->intr_timer_ctrl |= SmallFrame256; in starfire_init_one()
778 np->intr_timer_ctrl |= SmallFrame512; in starfire_init_one()
789 netif_napi_add(dev, &np->napi, netdev_poll, max_interrupt_work); in starfire_init_one()
817 np->phys[phy_idx++] = phy; in starfire_init_one()
818 np->mii_if.advertising = mdio_read(dev, phy, MII_ADVERTISE); in starfire_init_one()
821 dev->name, phy, mii_status, np->mii_if.advertising); in starfire_init_one()
826 np->phy_cnt = phy_idx; in starfire_init_one()
827 if (np->phy_cnt > 0) in starfire_init_one()
828 np->mii_if.phy_id = np->phys[0]; in starfire_init_one()
830 memset(&np->mii_if, 0, sizeof(np->mii_if)); in starfire_init_one()
850 struct netdev_private *np = netdev_priv(dev); in mdio_read() local
851 void __iomem *mdio_addr = np->base + MIICtrl + (phy_id<<7) + (location<<2); in mdio_read()
867 struct netdev_private *np = netdev_priv(dev); in mdio_write() local
868 void __iomem *mdio_addr = np->base + MIICtrl + (phy_id<<7) + (location<<2); in mdio_write()
878 struct netdev_private *np = netdev_priv(dev); in netdev_open() local
879 void __iomem *ioaddr = np->base; in netdev_open()
880 const int irq = np->pci_dev->irq; in netdev_open()
899 if (!np->queue_mem) { in netdev_open()
904 np->queue_mem_size = tx_done_q_size + rx_done_q_size + tx_ring_size + rx_ring_size; in netdev_open()
905 np->queue_mem = pci_alloc_consistent(np->pci_dev, np->queue_mem_size, &np->queue_mem_dma); in netdev_open()
906 if (np->queue_mem == NULL) { in netdev_open()
911 np->tx_done_q = np->queue_mem; in netdev_open()
912 np->tx_done_q_dma = np->queue_mem_dma; in netdev_open()
913 np->rx_done_q = (void *) np->tx_done_q + tx_done_q_size; in netdev_open()
914 np->rx_done_q_dma = np->tx_done_q_dma + tx_done_q_size; in netdev_open()
915 np->tx_ring = (void *) np->rx_done_q + rx_done_q_size; in netdev_open()
916 np->tx_ring_dma = np->rx_done_q_dma + rx_done_q_size; in netdev_open()
917 np->rx_ring = (void *) np->tx_ring + tx_ring_size; in netdev_open()
918 np->rx_ring_dma = np->tx_ring_dma + tx_ring_size; in netdev_open()
925 writel((np->rx_buf_sz << RxBufferLenShift) | in netdev_open()
948 writel( (np->queue_mem_dma >> 16) >> 16, ioaddr + RxDescQHiAddr); in netdev_open()
949 writel( (np->queue_mem_dma >> 16) >> 16, ioaddr + TxRingHiAddr); in netdev_open()
950 writel( (np->queue_mem_dma >> 16) >> 16, ioaddr + CompletionHiAddr); in netdev_open()
951 writel(np->rx_ring_dma, ioaddr + RxDescQAddr); in netdev_open()
952 writel(np->tx_ring_dma, ioaddr + TxRingPtr); in netdev_open()
954 writel(np->tx_done_q_dma, ioaddr + TxCompletionAddr); in netdev_open()
955 writel(np->rx_done_q_dma | in netdev_open()
981 np->tx_mode = TxFlowEnable|RxFlowEnable|PadEnable; /* modified when link is up. */ in netdev_open()
982 writel(MiiSoftReset | np->tx_mode, ioaddr + TxMode); in netdev_open()
984 writel(np->tx_mode, ioaddr + TxMode); in netdev_open()
985 np->tx_threshold = 4; in netdev_open()
986 writel(np->tx_threshold, ioaddr + TxThreshold); in netdev_open()
988 writel(np->intr_timer_ctrl, ioaddr + IntrTimerCtrl); in netdev_open()
990 napi_enable(&np->napi); in netdev_open()
998 np->mii_if.advertising = mdio_read(dev, np->phys[0], MII_ADVERTISE); in netdev_open()
1018 retval = request_firmware(&fw_rx, FIRMWARE_RX, &np->pci_dev->dev); in netdev_open()
1030 retval = request_firmware(&fw_tx, FIRMWARE_TX, &np->pci_dev->dev); in netdev_open()
1076 struct netdev_private *np = netdev_priv(dev); in check_duplex() local
1080 mdio_write(dev, np->phys[0], MII_ADVERTISE, np->mii_if.advertising); in check_duplex()
1081 mdio_write(dev, np->phys[0], MII_BMCR, BMCR_RESET); in check_duplex()
1083 while (--silly_count && mdio_read(dev, np->phys[0], MII_BMCR) & BMCR_RESET) in check_duplex()
1090 reg0 = mdio_read(dev, np->phys[0], MII_BMCR); in check_duplex()
1092 if (!np->mii_if.force_media) { in check_duplex()
1096 if (np->speed100) in check_duplex()
1098 if (np->mii_if.full_duplex) in check_duplex()
1102 np->speed100 ? "100" : "10", in check_duplex()
1103 np->mii_if.full_duplex ? "full" : "half"); in check_duplex()
1105 mdio_write(dev, np->phys[0], MII_BMCR, reg0); in check_duplex()
1111 struct netdev_private *np = netdev_priv(dev); in tx_timeout() local
1112 void __iomem *ioaddr = np->base; in tx_timeout()
1141 struct netdev_private *np = netdev_priv(dev); in init_ring() local
1144 np->cur_rx = np->cur_tx = np->reap_tx = 0; in init_ring()
1145 np->dirty_rx = np->dirty_tx = np->rx_done = np->tx_done = 0; in init_ring()
1147 np->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32); in init_ring()
1151 struct sk_buff *skb = netdev_alloc_skb(dev, np->rx_buf_sz); in init_ring()
1152 np->rx_info[i].skb = skb; in init_ring()
1155np->rx_info[i].mapping = pci_map_single(np->pci_dev, skb->data, np->rx_buf_sz, PCI_DMA_FROMDEVICE); in init_ring()
1156 if (pci_dma_mapping_error(np->pci_dev, in init_ring()
1157 np->rx_info[i].mapping)) { in init_ring()
1159 np->rx_info[i].skb = NULL; in init_ring()
1163 np->rx_ring[i].rxaddr = cpu_to_dma(np->rx_info[i].mapping | RxDescValid); in init_ring()
1165 writew(i - 1, np->base + RxDescQIdx); in init_ring()
1166 np->dirty_rx = (unsigned int)(i - RX_RING_SIZE); in init_ring()
1170 np->rx_ring[i].rxaddr = 0; in init_ring()
1171 np->rx_info[i].skb = NULL; in init_ring()
1172 np->rx_info[i].mapping = 0; in init_ring()
1175 np->rx_ring[RX_RING_SIZE - 1].rxaddr |= cpu_to_dma(RxDescEndRing); in init_ring()
1179 np->rx_done_q[i].status = 0; in init_ring()
1180 np->tx_done_q[i].status = 0; in init_ring()
1184 memset(&np->tx_info[i], 0, sizeof(np->tx_info[i])); in init_ring()
1190 struct netdev_private *np = netdev_priv(dev); in start_tx() local
1200 if ((np->cur_tx - np->dirty_tx) + skb_num_frags(skb) * 2 > TX_RING_SIZE) { in start_tx()
1212 prev_tx = np->cur_tx; in start_tx()
1213 entry = np->cur_tx % TX_RING_SIZE; in start_tx()
1219 np->tx_info[entry].skb = skb; in start_tx()
1225 if (np->reap_tx) { in start_tx()
1227 np->reap_tx = 0; in start_tx()
1235 np->tx_info[entry].mapping = in start_tx()
1236 pci_map_single(np->pci_dev, skb->data, skb_first_frag_len(skb), PCI_DMA_TODEVICE); in start_tx()
1240 np->tx_info[entry].mapping = in start_tx()
1241 pci_map_single(np->pci_dev, in start_tx()
1246 if (pci_dma_mapping_error(np->pci_dev, in start_tx()
1247 np->tx_info[entry].mapping)) { in start_tx()
1252 np->tx_ring[entry].addr = cpu_to_dma(np->tx_info[entry].mapping); in start_tx()
1253 np->tx_ring[entry].status = cpu_to_le32(status); in start_tx()
1256 dev->name, np->cur_tx, np->dirty_tx, in start_tx()
1259 np->tx_info[entry].used_slots = TX_RING_SIZE - entry; in start_tx()
1260 np->cur_tx += np->tx_info[entry].used_slots; in start_tx()
1263 np->tx_info[entry].used_slots = 1; in start_tx()
1264 np->cur_tx += np->tx_info[entry].used_slots; in start_tx()
1268 if (np->cur_tx % (TX_RING_SIZE / 2) == 0) in start_tx()
1269 np->reap_tx = 1; in start_tx()
1278 writel(entry * (sizeof(starfire_tx_desc) / 8), np->base + TxProducerIdx); in start_tx()
1281 if ((np->cur_tx - np->dirty_tx) + 4 > TX_RING_SIZE) in start_tx()
1288 np->tx_info[entry].skb = NULL; in start_tx()
1290 pci_unmap_single(np->pci_dev, in start_tx()
1291 np->tx_info[entry].mapping, in start_tx()
1294 np->tx_info[entry].mapping = 0; in start_tx()
1295 entry = (entry + np->tx_info[entry].used_slots) % TX_RING_SIZE; in start_tx()
1297 pci_unmap_single(np->pci_dev, in start_tx()
1298 np->tx_info[entry].mapping, in start_tx()
1306 np->cur_tx = prev_tx; in start_tx()
1315 struct netdev_private *np = netdev_priv(dev); in intr_handler() local
1316 void __iomem *ioaddr = np->base; in intr_handler()
1337 if (likely(napi_schedule_prep(&np->napi))) { in intr_handler()
1338 __napi_schedule(&np->napi); in intr_handler()
1365 while ((tx_status = le32_to_cpu(np->tx_done_q[np->tx_done].status)) != 0) { in intr_handler()
1368 dev->name, np->dirty_tx, np->tx_done, tx_status); in intr_handler()
1373 struct sk_buff *skb = np->tx_info[entry].skb; in intr_handler()
1374 np->tx_info[entry].skb = NULL; in intr_handler()
1375 pci_unmap_single(np->pci_dev, in intr_handler()
1376 np->tx_info[entry].mapping, in intr_handler()
1379 np->tx_info[entry].mapping = 0; in intr_handler()
1380 np->dirty_tx += np->tx_info[entry].used_slots; in intr_handler()
1381 entry = (entry + np->tx_info[entry].used_slots) % TX_RING_SIZE; in intr_handler()
1385 pci_unmap_single(np->pci_dev, in intr_handler()
1386 np->tx_info[entry].mapping, in intr_handler()
1389 np->dirty_tx++; in intr_handler()
1396 np->tx_done_q[np->tx_done].status = 0; in intr_handler()
1397 np->tx_done = (np->tx_done + 1) % DONE_Q_SIZE; in intr_handler()
1399 writew(np->tx_done, ioaddr + CompletionQConsumerIdx + 2); in intr_handler()
1402 (np->cur_tx - np->dirty_tx + 4 < TX_RING_SIZE)) { in intr_handler()
1441 struct netdev_private *np = netdev_priv(dev); in __netdev_rx() local
1446 while ((desc_status = le32_to_cpu(np->rx_done_q[np->rx_done].status)) != 0) { in __netdev_rx()
1450 rx_done_desc *desc = &np->rx_done_q[np->rx_done]; in __netdev_rx()
1453 printk(KERN_DEBUG " netdev_rx() status of %d was %#8.8x.\n", np->rx_done, desc_status); in __netdev_rx()
1480 pci_dma_sync_single_for_cpu(np->pci_dev, in __netdev_rx()
1481 np->rx_info[entry].mapping, in __netdev_rx()
1483 skb_copy_to_linear_data(skb, np->rx_info[entry].skb->data, pkt_len); in __netdev_rx()
1484 pci_dma_sync_single_for_device(np->pci_dev, in __netdev_rx()
1485 np->rx_info[entry].mapping, in __netdev_rx()
1489 pci_unmap_single(np->pci_dev, np->rx_info[entry].mapping, np->rx_buf_sz, PCI_DMA_FROMDEVICE); in __netdev_rx()
1490 skb = np->rx_info[entry].skb; in __netdev_rx()
1492 np->rx_info[entry].skb = NULL; in __netdev_rx()
1493 np->rx_info[entry].mapping = 0; in __netdev_rx()
1507 …printk(KERN_DEBUG " netdev_rx() status2 of %d was %#4.4x.\n", np->rx_done, le16_to_cpu(desc->stat… in __netdev_rx()
1542 np->cur_rx++; in __netdev_rx()
1544 np->rx_done = (np->rx_done + 1) % DONE_Q_SIZE; in __netdev_rx()
1551 writew(np->rx_done, np->base + CompletionQConsumerIdx); in __netdev_rx()
1557 retcode, np->rx_done, desc_status); in __netdev_rx()
1563 struct netdev_private *np = container_of(napi, struct netdev_private, napi); in netdev_poll() local
1564 struct net_device *dev = np->dev; in netdev_poll()
1566 void __iomem *ioaddr = np->base; in netdev_poll()
1594 struct netdev_private *np = netdev_priv(dev); in refill_rx_ring() local
1599 for (; np->cur_rx - np->dirty_rx > 0; np->dirty_rx++) { in refill_rx_ring()
1600 entry = np->dirty_rx % RX_RING_SIZE; in refill_rx_ring()
1601 if (np->rx_info[entry].skb == NULL) { in refill_rx_ring()
1602 skb = netdev_alloc_skb(dev, np->rx_buf_sz); in refill_rx_ring()
1603 np->rx_info[entry].skb = skb; in refill_rx_ring()
1606 np->rx_info[entry].mapping = in refill_rx_ring()
1607 pci_map_single(np->pci_dev, skb->data, np->rx_buf_sz, PCI_DMA_FROMDEVICE); in refill_rx_ring()
1608 if (pci_dma_mapping_error(np->pci_dev, in refill_rx_ring()
1609 np->rx_info[entry].mapping)) { in refill_rx_ring()
1611 np->rx_info[entry].skb = NULL; in refill_rx_ring()
1614 np->rx_ring[entry].rxaddr = in refill_rx_ring()
1615 cpu_to_dma(np->rx_info[entry].mapping | RxDescValid); in refill_rx_ring()
1618 np->rx_ring[entry].rxaddr |= cpu_to_dma(RxDescEndRing); in refill_rx_ring()
1621 writew(entry, np->base + RxDescQIdx); in refill_rx_ring()
1627 struct netdev_private *np = netdev_priv(dev); in netdev_media_change() local
1628 void __iomem *ioaddr = np->base; in netdev_media_change()
1634 mdio_read(dev, np->phys[0], MII_BMCR); in netdev_media_change()
1635 mdio_read(dev, np->phys[0], MII_BMSR); in netdev_media_change()
1637 reg0 = mdio_read(dev, np->phys[0], MII_BMCR); in netdev_media_change()
1638 reg1 = mdio_read(dev, np->phys[0], MII_BMSR); in netdev_media_change()
1644 reg4 = mdio_read(dev, np->phys[0], MII_ADVERTISE); in netdev_media_change()
1645 reg5 = mdio_read(dev, np->phys[0], MII_LPA); in netdev_media_change()
1647 np->speed100 = 1; in netdev_media_change()
1648 np->mii_if.full_duplex = 1; in netdev_media_change()
1650 np->speed100 = 1; in netdev_media_change()
1651 np->mii_if.full_duplex = 0; in netdev_media_change()
1653 np->speed100 = 0; in netdev_media_change()
1654 np->mii_if.full_duplex = 1; in netdev_media_change()
1656 np->speed100 = 0; in netdev_media_change()
1657 np->mii_if.full_duplex = 0; in netdev_media_change()
1662 np->speed100 = 1; in netdev_media_change()
1664 np->speed100 = 0; in netdev_media_change()
1666 np->mii_if.full_duplex = 1; in netdev_media_change()
1668 np->mii_if.full_duplex = 0; in netdev_media_change()
1673 np->speed100 ? "100" : "10", in netdev_media_change()
1674 np->mii_if.full_duplex ? "full" : "half"); in netdev_media_change()
1676 new_tx_mode = np->tx_mode & ~FullDuplex; /* duplex setting */ in netdev_media_change()
1677 if (np->mii_if.full_duplex) in netdev_media_change()
1679 if (np->tx_mode != new_tx_mode) { in netdev_media_change()
1680 np->tx_mode = new_tx_mode; in netdev_media_change()
1681 writel(np->tx_mode | MiiSoftReset, ioaddr + TxMode); in netdev_media_change()
1683 writel(np->tx_mode, ioaddr + TxMode); in netdev_media_change()
1686 new_intr_timer_ctrl = np->intr_timer_ctrl & ~Timer10X; in netdev_media_change()
1687 if (np->speed100) in netdev_media_change()
1689 if (np->intr_timer_ctrl != new_intr_timer_ctrl) { in netdev_media_change()
1690 np->intr_timer_ctrl = new_intr_timer_ctrl; in netdev_media_change()
1702 struct netdev_private *np = netdev_priv(dev); in netdev_error() local
1706 if (np->tx_threshold <= PKT_BUF_SZ / 16) { in netdev_error()
1707 writel(++np->tx_threshold, np->base + TxThreshold); in netdev_error()
1709 dev->name, np->tx_threshold * 16); in netdev_error()
1729 struct netdev_private *np = netdev_priv(dev); in get_stats() local
1730 void __iomem *ioaddr = np->base; in get_stats()
1754 static u32 set_vlan_mode(struct netdev_private *np) in set_vlan_mode() argument
1758 void __iomem *filter_addr = np->base + HashTable + 8; in set_vlan_mode()
1761 for_each_set_bit(vid, np->active_vlans, VLAN_N_VID) { in set_vlan_mode()
1782 struct netdev_private *np = netdev_priv(dev); in set_rx_mode() local
1783 void __iomem *ioaddr = np->base; in set_rx_mode()
1789 rx_mode |= set_vlan_mode(np); in set_rx_mode()
1855 struct netdev_private *np = netdev_priv(dev); in get_drvinfo() local
1858 strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); in get_drvinfo()
1863 struct netdev_private *np = netdev_priv(dev); in get_settings() local
1864 spin_lock_irq(&np->lock); in get_settings()
1865 mii_ethtool_gset(&np->mii_if, ecmd); in get_settings()
1866 spin_unlock_irq(&np->lock); in get_settings()
1872 struct netdev_private *np = netdev_priv(dev); in set_settings() local
1874 spin_lock_irq(&np->lock); in set_settings()
1875 res = mii_ethtool_sset(&np->mii_if, ecmd); in set_settings()
1876 spin_unlock_irq(&np->lock); in set_settings()
1883 struct netdev_private *np = netdev_priv(dev); in nway_reset() local
1884 return mii_nway_restart(&np->mii_if); in nway_reset()
1889 struct netdev_private *np = netdev_priv(dev); in get_link() local
1890 return mii_link_ok(&np->mii_if); in get_link()
1916 struct netdev_private *np = netdev_priv(dev); in netdev_ioctl() local
1923 spin_lock_irq(&np->lock); in netdev_ioctl()
1924 rc = generic_mii_ioctl(&np->mii_if, data, cmd, NULL); in netdev_ioctl()
1925 spin_unlock_irq(&np->lock); in netdev_ioctl()
1927 if ((cmd == SIOCSMIIREG) && (data->phy_id == np->phys[0])) in netdev_ioctl()
1935 struct netdev_private *np = netdev_priv(dev); in netdev_close() local
1936 void __iomem *ioaddr = np->base; in netdev_close()
1941 napi_disable(&np->napi); in netdev_close()
1947 dev->name, np->cur_tx, np->dirty_tx, in netdev_close()
1948 np->cur_rx, np->dirty_rx); in netdev_close()
1960 (long long) np->tx_ring_dma); in netdev_close()
1963 i, le32_to_cpu(np->tx_ring[i].status), in netdev_close()
1964 (long long) dma_to_cpu(np->tx_ring[i].addr), in netdev_close()
1965 le32_to_cpu(np->tx_done_q[i].status)); in netdev_close()
1967 (long long) np->rx_ring_dma, np->rx_done_q); in netdev_close()
1968 if (np->rx_done_q) in netdev_close()
1971 i, (long long) dma_to_cpu(np->rx_ring[i].rxaddr), le32_to_cpu(np->rx_done_q[i].status)); in netdev_close()
1975 free_irq(np->pci_dev->irq, dev); in netdev_close()
1979 np->rx_ring[i].rxaddr = cpu_to_dma(0xBADF00D0); /* An invalid address. */ in netdev_close()
1980 if (np->rx_info[i].skb != NULL) { in netdev_close()
1981 pci_unmap_single(np->pci_dev, np->rx_info[i].mapping, np->rx_buf_sz, PCI_DMA_FROMDEVICE); in netdev_close()
1982 dev_kfree_skb(np->rx_info[i].skb); in netdev_close()
1984 np->rx_info[i].skb = NULL; in netdev_close()
1985 np->rx_info[i].mapping = 0; in netdev_close()
1988 struct sk_buff *skb = np->tx_info[i].skb; in netdev_close()
1991 pci_unmap_single(np->pci_dev, in netdev_close()
1992 np->tx_info[i].mapping, in netdev_close()
1994 np->tx_info[i].mapping = 0; in netdev_close()
1996 np->tx_info[i].skb = NULL; in netdev_close()
2038 struct netdev_private *np = netdev_priv(dev); in starfire_remove_one() local
2044 if (np->queue_mem) in starfire_remove_one()
2045 pci_free_consistent(pdev, np->queue_mem_size, np->queue_mem, np->queue_mem_dma); in starfire_remove_one()
2052 iounmap(np->base); in starfire_remove_one()