• Home
  • Raw
  • Download

Lines Matching refs:np

52 static void dl2k_enable_int(struct netdev_private *np)  in dl2k_enable_int()  argument
54 void __iomem *ioaddr = np->ioaddr; in dl2k_enable_int()
106 struct netdev_private *np; in rio_probe1() local
127 dev = alloc_etherdev (sizeof (*np)); in rio_probe1()
132 np = netdev_priv(dev); in rio_probe1()
138 np->eeprom_addr = ioaddr; in rio_probe1()
146 np->ioaddr = ioaddr; in rio_probe1()
147 np->chip_id = chip_idx; in rio_probe1()
148 np->pdev = pdev; in rio_probe1()
149 spin_lock_init (&np->tx_lock); in rio_probe1()
150 spin_lock_init (&np->rx_lock); in rio_probe1()
153 np->an_enable = 1; in rio_probe1()
154 np->tx_coalesce = 1; in rio_probe1()
157 np->an_enable = 0; in rio_probe1()
161 np->an_enable = 2; in rio_probe1()
164 np->speed = 100; in rio_probe1()
165 np->full_duplex = 1; in rio_probe1()
168 np->speed = 100; in rio_probe1()
169 np->full_duplex = 0; in rio_probe1()
172 np->speed = 10; in rio_probe1()
173 np->full_duplex = 1; in rio_probe1()
176 np->speed = 10; in rio_probe1()
177 np->full_duplex = 0; in rio_probe1()
180 np->speed=1000; in rio_probe1()
181 np->full_duplex=1; in rio_probe1()
184 np->speed = 1000; in rio_probe1()
185 np->full_duplex = 0; in rio_probe1()
187 np->an_enable = 1; in rio_probe1()
191 np->jumbo = 1; in rio_probe1()
194 np->jumbo = 0; in rio_probe1()
198 np->vlan = (vlan[card_idx] > 0 && vlan[card_idx] < 4096) ? in rio_probe1()
201 np->rx_coalesce = rx_coalesce; in rio_probe1()
202 np->rx_timeout = rx_timeout; in rio_probe1()
203 np->coalesce = 1; in rio_probe1()
205 np->tx_flow = (tx_flow == 0) ? 0 : 1; in rio_probe1()
206 np->rx_flow = (rx_flow == 0) ? 0 : 1; in rio_probe1()
221 dev->max_mtu = np->jumbo ? MAX_JUMBO : PACKET_SIZE; in rio_probe1()
229 np->tx_ring = ring_space; in rio_probe1()
230 np->tx_ring_dma = ring_dma; in rio_probe1()
236 np->rx_ring = ring_space; in rio_probe1()
237 np->rx_ring_dma = ring_dma; in rio_probe1()
248 np->phy_media = (dr16(ASICCtrl) & PhyMedia) ? 1 : 0; in rio_probe1()
249 np->link_status = 0; in rio_probe1()
251 if (np->phy_media) { in rio_probe1()
253 if (np->an_enable == 2) { in rio_probe1()
254 np->an_enable = 1; in rio_probe1()
259 if (np->speed == 1000) in rio_probe1()
260 np->an_enable = 1; in rio_probe1()
270 dev->name, np->name, dev->dev_addr, irq); in rio_probe1()
274 if (np->coalesce) in rio_probe1()
278 np->rx_coalesce, np->rx_timeout*640); in rio_probe1()
279 if (np->vlan) in rio_probe1()
280 printk(KERN_INFO "vlan(id):\t%d\n", np->vlan); in rio_probe1()
284 dma_free_coherent(&pdev->dev, RX_TOTAL_SIZE, np->rx_ring, in rio_probe1()
285 np->rx_ring_dma); in rio_probe1()
287 dma_free_coherent(&pdev->dev, TX_TOTAL_SIZE, np->tx_ring, in rio_probe1()
288 np->tx_ring_dma); in rio_probe1()
291 pci_iounmap(pdev, np->ioaddr); in rio_probe1()
293 pci_iounmap(pdev, np->eeprom_addr); in rio_probe1()
306 struct netdev_private *np = netdev_priv(dev); in find_miiphy() local
309 np->phy_addr = 1; in find_miiphy()
314 np->phy_addr = i; in find_miiphy()
328 struct netdev_private *np = netdev_priv(dev); in parse_eeprom() local
329 void __iomem *ioaddr = np->ioaddr; in parse_eeprom()
339 ((__le16 *) sromdata)[i] = cpu_to_le16(read_eeprom(np, i)); in parse_eeprom()
341 if (np->pdev->vendor == PCI_VENDOR_ID_DLINK) { /* D-Link Only */ in parse_eeprom()
355 if (np->chip_id == CHIP_IP1000A) { in parse_eeprom()
356 np->led_mode = psrom->led_mode; in parse_eeprom()
360 if (np->pdev->vendor != PCI_VENDOR_ID_DLINK) { in parse_eeprom()
380 np->duplex_polarity = psib[i]; in parse_eeprom()
384 np->wake_polarity = psib[i]; in parse_eeprom()
388 memcpy (np->name, &(psib[i]), j); in parse_eeprom()
407 struct netdev_private *np = netdev_priv(dev); in rio_set_led_mode() local
408 void __iomem *ioaddr = np->ioaddr; in rio_set_led_mode()
411 if (np->chip_id != CHIP_IP1000A) in rio_set_led_mode()
417 if (np->led_mode & 0x01) in rio_set_led_mode()
419 if (np->led_mode & 0x02) in rio_set_led_mode()
421 if (np->led_mode & 0x08) in rio_set_led_mode()
434 struct netdev_private *np = netdev_priv(dev); in free_list() local
440 skb = np->rx_skbuff[i]; in free_list()
442 dma_unmap_single(&np->pdev->dev, in free_list()
443 desc_to_dma(&np->rx_ring[i]), in free_list()
446 np->rx_skbuff[i] = NULL; in free_list()
448 np->rx_ring[i].status = 0; in free_list()
449 np->rx_ring[i].fraginfo = 0; in free_list()
452 skb = np->tx_skbuff[i]; in free_list()
454 dma_unmap_single(&np->pdev->dev, in free_list()
455 desc_to_dma(&np->tx_ring[i]), in free_list()
458 np->tx_skbuff[i] = NULL; in free_list()
463 static void rio_reset_ring(struct netdev_private *np) in rio_reset_ring() argument
467 np->cur_rx = 0; in rio_reset_ring()
468 np->cur_tx = 0; in rio_reset_ring()
469 np->old_rx = 0; in rio_reset_ring()
470 np->old_tx = 0; in rio_reset_ring()
473 np->tx_ring[i].status = cpu_to_le64(TFDDone); in rio_reset_ring()
476 np->rx_ring[i].status = 0; in rio_reset_ring()
482 struct netdev_private *np = netdev_priv(dev); in alloc_list() local
485 rio_reset_ring(np); in alloc_list()
486 np->rx_buf_sz = (dev->mtu <= 1500 ? PACKET_SIZE : dev->mtu + 32); in alloc_list()
490 np->tx_skbuff[i] = NULL; in alloc_list()
491 np->tx_ring[i].next_desc = cpu_to_le64(np->tx_ring_dma + in alloc_list()
501 skb = netdev_alloc_skb_ip_align(dev, np->rx_buf_sz); in alloc_list()
502 np->rx_skbuff[i] = skb; in alloc_list()
508 np->rx_ring[i].next_desc = cpu_to_le64(np->rx_ring_dma + in alloc_list()
512 np->rx_ring[i].fraginfo = in alloc_list()
513 cpu_to_le64(dma_map_single(&np->pdev->dev, skb->data, in alloc_list()
514 np->rx_buf_sz, DMA_FROM_DEVICE)); in alloc_list()
515 np->rx_ring[i].fraginfo |= cpu_to_le64((u64)np->rx_buf_sz << 48); in alloc_list()
523 struct netdev_private *np = netdev_priv(dev); in rio_hw_init() local
524 void __iomem *ioaddr = np->ioaddr; in rio_hw_init()
538 if (np->chip_id == CHIP_IP1000A && in rio_hw_init()
539 (np->pdev->revision == 0x40 || np->pdev->revision == 0x41)) { in rio_hw_init()
541 mii_write(dev, np->phy_addr, 31, 0x0001); in rio_hw_init()
542 mii_write(dev, np->phy_addr, 27, 0x01e0); in rio_hw_init()
543 mii_write(dev, np->phy_addr, 31, 0x0002); in rio_hw_init()
544 mii_write(dev, np->phy_addr, 27, 0xeb8e); in rio_hw_init()
545 mii_write(dev, np->phy_addr, 31, 0x0000); in rio_hw_init()
546 mii_write(dev, np->phy_addr, 30, 0x005e); in rio_hw_init()
548 mii_write(dev, np->phy_addr, MII_CTRL1000, 0x0700); in rio_hw_init()
551 if (np->phy_media) in rio_hw_init()
557 if (np->jumbo != 0) in rio_hw_init()
561 dw32(RFDListPtr0, np->rx_ring_dma); in rio_hw_init()
573 if (np->coalesce) { in rio_hw_init()
574 dw32(RxDMAIntCtrl, np->rx_coalesce | np->rx_timeout << 16); in rio_hw_init()
586 if (np->vlan) { in rio_hw_init()
590 dw16(VLANId, np->vlan); in rio_hw_init()
592 dw32(VLANTag, 0x8100 << 16 | np->vlan); in rio_hw_init()
602 macctrl |= (np->vlan) ? AutoVLANuntagging : 0; in rio_hw_init()
603 macctrl |= (np->full_duplex) ? DuplexSelect : 0; in rio_hw_init()
604 macctrl |= (np->tx_flow) ? TxFlowControlEnable : 0; in rio_hw_init()
605 macctrl |= (np->rx_flow) ? RxFlowControlEnable : 0; in rio_hw_init()
611 struct netdev_private *np = netdev_priv(dev); in rio_hw_stop() local
612 void __iomem *ioaddr = np->ioaddr; in rio_hw_stop()
623 struct netdev_private *np = netdev_priv(dev); in rio_open() local
624 const int irq = np->pdev->irq; in rio_open()
640 timer_setup(&np->timer, rio_timer, 0); in rio_open()
641 np->timer.expires = jiffies + 1 * HZ; in rio_open()
642 add_timer(&np->timer); in rio_open()
646 dl2k_enable_int(np); in rio_open()
653 struct netdev_private *np = from_timer(np, t, timer); in rio_timer() local
654 struct net_device *dev = pci_get_drvdata(np->pdev); in rio_timer()
659 spin_lock_irqsave(&np->rx_lock, flags); in rio_timer()
661 if (np->cur_rx - np->old_rx >= RX_RING_SIZE) { in rio_timer()
664 for (; np->cur_rx - np->old_rx > 0; np->old_rx++) { in rio_timer()
666 entry = np->old_rx % RX_RING_SIZE; in rio_timer()
668 if (np->rx_skbuff[entry] == NULL) { in rio_timer()
670 np->rx_buf_sz); in rio_timer()
672 np->rx_ring[entry].fraginfo = 0; in rio_timer()
678 np->rx_skbuff[entry] = skb; in rio_timer()
679 np->rx_ring[entry].fraginfo = in rio_timer()
680 cpu_to_le64 (dma_map_single(&np->pdev->dev, skb->data, in rio_timer()
681 np->rx_buf_sz, DMA_FROM_DEVICE)); in rio_timer()
683 np->rx_ring[entry].fraginfo |= in rio_timer()
684 cpu_to_le64((u64)np->rx_buf_sz << 48); in rio_timer()
685 np->rx_ring[entry].status = 0; in rio_timer()
688 spin_unlock_irqrestore (&np->rx_lock, flags); in rio_timer()
689 np->timer.expires = jiffies + next_tick; in rio_timer()
690 add_timer(&np->timer); in rio_timer()
696 struct netdev_private *np = netdev_priv(dev); in rio_tx_timeout() local
697 void __iomem *ioaddr = np->ioaddr; in rio_tx_timeout()
709 struct netdev_private *np = netdev_priv(dev); in start_xmit() local
710 void __iomem *ioaddr = np->ioaddr; in start_xmit()
715 if (np->link_status == 0) { /* Link Down */ in start_xmit()
719 entry = np->cur_tx % TX_RING_SIZE; in start_xmit()
720 np->tx_skbuff[entry] = skb; in start_xmit()
721 txdesc = &np->tx_ring[entry]; in start_xmit()
730 if (np->vlan) { in start_xmit()
732 ((u64)np->vlan << 32) | in start_xmit()
735 txdesc->fraginfo = cpu_to_le64 (dma_map_single(&np->pdev->dev, skb->data, in start_xmit()
741 if (entry % np->tx_coalesce == 0 || np->speed == 10) in start_xmit()
755 np->cur_tx = (np->cur_tx + 1) % TX_RING_SIZE; in start_xmit()
756 if ((np->cur_tx - np->old_tx + TX_RING_SIZE) % TX_RING_SIZE in start_xmit()
757 < TX_QUEUE_LEN - 1 && np->speed != 10) { in start_xmit()
765 dw32(TFDListPtr0, np->tx_ring_dma + in start_xmit()
777 struct netdev_private *np = netdev_priv(dev); in rio_interrupt() local
778 void __iomem *ioaddr = np->ioaddr; in rio_interrupt()
808 if (np->cur_tx != np->old_tx) in rio_interrupt()
816 struct netdev_private *np = netdev_priv(dev); in rio_free_tx() local
817 int entry = np->old_tx % TX_RING_SIZE; in rio_free_tx()
822 spin_lock(&np->tx_lock); in rio_free_tx()
824 spin_lock_irqsave(&np->tx_lock, flag); in rio_free_tx()
827 while (entry != np->cur_tx) { in rio_free_tx()
830 if (!(np->tx_ring[entry].status & cpu_to_le64(TFDDone))) in rio_free_tx()
832 skb = np->tx_skbuff[entry]; in rio_free_tx()
833 dma_unmap_single(&np->pdev->dev, in rio_free_tx()
834 desc_to_dma(&np->tx_ring[entry]), skb->len, in rio_free_tx()
841 np->tx_skbuff[entry] = NULL; in rio_free_tx()
846 spin_unlock(&np->tx_lock); in rio_free_tx()
848 spin_unlock_irqrestore(&np->tx_lock, flag); in rio_free_tx()
849 np->old_tx = entry; in rio_free_tx()
855 ((np->cur_tx - np->old_tx + TX_RING_SIZE) % TX_RING_SIZE in rio_free_tx()
856 < TX_QUEUE_LEN - 1 || np->speed == 10)) { in rio_free_tx()
864 struct netdev_private *np = netdev_priv(dev); in tx_error() local
865 void __iomem *ioaddr = np->ioaddr; in tx_error()
889 dw32(TFDListPtr0, np->tx_ring_dma + in tx_error()
890 np->old_tx * sizeof (struct netdev_desc)); in tx_error()
919 struct netdev_private *np = netdev_priv(dev); in receive_packet() local
920 int entry = np->cur_rx % RX_RING_SIZE; in receive_packet()
925 struct netdev_desc *desc = &np->rx_ring[entry]; in receive_packet()
946 if (frame_status & RxAlignmentError && np->speed != 1000) in receive_packet()
955 dma_unmap_single(&np->pdev->dev, in receive_packet()
957 np->rx_buf_sz, in receive_packet()
959 skb_put (skb = np->rx_skbuff[entry], pkt_len); in receive_packet()
960 np->rx_skbuff[entry] = NULL; in receive_packet()
962 dma_sync_single_for_cpu(&np->pdev->dev, in receive_packet()
964 np->rx_buf_sz, in receive_packet()
967 np->rx_skbuff[entry]->data, in receive_packet()
970 dma_sync_single_for_device(&np->pdev->dev, in receive_packet()
972 np->rx_buf_sz, in receive_packet()
978 if (np->pdev->pci_rev_id >= 0x0c && in receive_packet()
987 spin_lock(&np->rx_lock); in receive_packet()
988 np->cur_rx = entry; in receive_packet()
990 entry = np->old_rx; in receive_packet()
991 while (entry != np->cur_rx) { in receive_packet()
994 if (np->rx_skbuff[entry] == NULL) { in receive_packet()
995 skb = netdev_alloc_skb_ip_align(dev, np->rx_buf_sz); in receive_packet()
997 np->rx_ring[entry].fraginfo = 0; in receive_packet()
1004 np->rx_skbuff[entry] = skb; in receive_packet()
1005 np->rx_ring[entry].fraginfo = in receive_packet()
1006 cpu_to_le64(dma_map_single(&np->pdev->dev, skb->data, in receive_packet()
1007 np->rx_buf_sz, DMA_FROM_DEVICE)); in receive_packet()
1009 np->rx_ring[entry].fraginfo |= in receive_packet()
1010 cpu_to_le64((u64)np->rx_buf_sz << 48); in receive_packet()
1011 np->rx_ring[entry].status = 0; in receive_packet()
1014 np->old_rx = entry; in receive_packet()
1015 spin_unlock(&np->rx_lock); in receive_packet()
1022 struct netdev_private *np = netdev_priv(dev); in rio_error() local
1023 void __iomem *ioaddr = np->ioaddr; in rio_error()
1030 if (np->phy_media) in rio_error()
1034 if (np->speed == 1000) in rio_error()
1035 np->tx_coalesce = tx_coalesce; in rio_error()
1037 np->tx_coalesce = 1; in rio_error()
1039 macctrl |= (np->vlan) ? AutoVLANuntagging : 0; in rio_error()
1040 macctrl |= (np->full_duplex) ? DuplexSelect : 0; in rio_error()
1041 macctrl |= (np->tx_flow) ? in rio_error()
1043 macctrl |= (np->rx_flow) ? in rio_error()
1046 np->link_status = 1; in rio_error()
1050 np->link_status = 0; in rio_error()
1074 struct netdev_private *np = netdev_priv(dev); in get_stats() local
1075 void __iomem *ioaddr = np->ioaddr; in get_stats()
1136 struct netdev_private *np = netdev_priv(dev); in clear_stats() local
1137 void __iomem *ioaddr = np->ioaddr; in clear_stats()
1191 struct netdev_private *np = netdev_priv(dev); in set_multicast() local
1192 void __iomem *ioaddr = np->ioaddr; in set_multicast()
1225 if (np->vlan) { in set_multicast()
1237 struct netdev_private *np = netdev_priv(dev); in rio_get_drvinfo() local
1240 strlcpy(info->bus_info, pci_name(np->pdev), sizeof(info->bus_info)); in rio_get_drvinfo()
1246 struct netdev_private *np = netdev_priv(dev); in rio_get_link_ksettings() local
1249 if (np->phy_media) { in rio_get_link_ksettings()
1266 if (np->link_status) { in rio_get_link_ksettings()
1267 cmd->base.speed = np->speed; in rio_get_link_ksettings()
1268 cmd->base.duplex = np->full_duplex ? DUPLEX_FULL : DUPLEX_HALF; in rio_get_link_ksettings()
1273 if (np->an_enable) in rio_get_link_ksettings()
1278 cmd->base.phy_address = np->phy_addr; in rio_get_link_ksettings()
1291 struct netdev_private *np = netdev_priv(dev); in rio_set_link_ksettings() local
1297 if (np->an_enable) { in rio_set_link_ksettings()
1300 np->an_enable = 1; in rio_set_link_ksettings()
1305 np->an_enable = 0; in rio_set_link_ksettings()
1306 if (np->speed == 1000) { in rio_set_link_ksettings()
1313 np->speed = 10; in rio_set_link_ksettings()
1314 np->full_duplex = (duplex == DUPLEX_FULL); in rio_set_link_ksettings()
1317 np->speed = 100; in rio_set_link_ksettings()
1318 np->full_duplex = (duplex == DUPLEX_FULL); in rio_set_link_ksettings()
1331 struct netdev_private *np = netdev_priv(dev); in rio_get_link() local
1332 return np->link_status; in rio_get_link()
1346 struct netdev_private *np = netdev_priv(dev); in rio_ioctl() local
1349 phy_addr = np->phy_addr; in rio_ioctl()
1372 static int read_eeprom(struct netdev_private *np, int eep_addr) in read_eeprom() argument
1374 void __iomem *ioaddr = np->eeprom_addr; in read_eeprom()
1394 struct netdev_private *np = netdev_priv(dev); in mii_sendbit() local
1395 void __iomem *ioaddr = np->ioaddr; in mii_sendbit()
1407 struct netdev_private *np = netdev_priv(dev); in mii_getbit() local
1408 void __iomem *ioaddr = np->ioaddr; in mii_getbit()
1477 struct netdev_private *np; in mii_wait_link() local
1479 np = netdev_priv(dev); in mii_wait_link()
1480 phy_addr = np->phy_addr; in mii_wait_link()
1498 struct netdev_private *np; in mii_get_media() local
1500 np = netdev_priv(dev); in mii_get_media()
1501 phy_addr = np->phy_addr; in mii_get_media()
1504 if (np->an_enable) { in mii_get_media()
1514 np->speed = 1000; in mii_get_media()
1515 np->full_duplex = 1; in mii_get_media()
1518 np->speed = 1000; in mii_get_media()
1519 np->full_duplex = 0; in mii_get_media()
1522 np->speed = 100; in mii_get_media()
1523 np->full_duplex = 1; in mii_get_media()
1526 np->speed = 100; in mii_get_media()
1527 np->full_duplex = 0; in mii_get_media()
1530 np->speed = 10; in mii_get_media()
1531 np->full_duplex = 1; in mii_get_media()
1534 np->speed = 10; in mii_get_media()
1535 np->full_duplex = 0; in mii_get_media()
1539 np->tx_flow &= 1; in mii_get_media()
1540 np->rx_flow &= 1; in mii_get_media()
1542 np->tx_flow = 0; in mii_get_media()
1543 np->rx_flow &= 1; in mii_get_media()
1564 if (np->tx_flow) in mii_get_media()
1568 if (np->rx_flow) in mii_get_media()
1584 struct netdev_private *np; in mii_set_media() local
1585 np = netdev_priv(dev); in mii_set_media()
1586 phy_addr = np->phy_addr; in mii_set_media()
1589 if (np->an_enable) { in mii_set_media()
1641 if (np->speed == 100) { in mii_set_media()
1644 } else if (np->speed == 10) { in mii_set_media()
1647 if (np->full_duplex) { in mii_set_media()
1671 struct netdev_private *np; in mii_get_media_pcs() local
1673 np = netdev_priv(dev); in mii_get_media_pcs()
1674 phy_addr = np->phy_addr; in mii_get_media_pcs()
1677 if (np->an_enable) { in mii_get_media_pcs()
1684 np->speed = 1000; in mii_get_media_pcs()
1687 np->full_duplex = 1; in mii_get_media_pcs()
1690 np->full_duplex = 0; in mii_get_media_pcs()
1693 np->tx_flow &= 1; in mii_get_media_pcs()
1694 np->rx_flow &= 1; in mii_get_media_pcs()
1696 np->tx_flow = 0; in mii_get_media_pcs()
1697 np->rx_flow &= 1; in mii_get_media_pcs()
1709 if (np->tx_flow) in mii_get_media_pcs()
1713 if (np->rx_flow) in mii_get_media_pcs()
1728 struct netdev_private *np; in mii_set_media_pcs() local
1729 np = netdev_priv(dev); in mii_set_media_pcs()
1730 phy_addr = np->phy_addr; in mii_set_media_pcs()
1733 if (np->an_enable) { in mii_set_media_pcs()
1757 if (np->full_duplex) { in mii_set_media_pcs()
1777 struct netdev_private *np = netdev_priv(dev); in rio_close() local
1778 struct pci_dev *pdev = np->pdev; in rio_close()
1785 del_timer_sync (&np->timer); in rio_close()
1798 struct netdev_private *np = netdev_priv(dev); in rio_remove1() local
1801 dma_free_coherent(&pdev->dev, RX_TOTAL_SIZE, np->rx_ring, in rio_remove1()
1802 np->rx_ring_dma); in rio_remove1()
1803 dma_free_coherent(&pdev->dev, TX_TOTAL_SIZE, np->tx_ring, in rio_remove1()
1804 np->tx_ring_dma); in rio_remove1()
1806 pci_iounmap(pdev, np->ioaddr); in rio_remove1()
1808 pci_iounmap(pdev, np->eeprom_addr); in rio_remove1()
1819 struct netdev_private *np = netdev_priv(dev); in rio_suspend() local
1825 del_timer_sync(&np->timer); in rio_suspend()
1834 struct netdev_private *np = netdev_priv(dev); in rio_resume() local
1839 rio_reset_ring(np); in rio_resume()
1841 np->timer.expires = jiffies + 1 * HZ; in rio_resume()
1842 add_timer(&np->timer); in rio_resume()
1844 dl2k_enable_int(np); in rio_resume()