Lines Matching refs:c2dev
211 struct c2_dev *c2dev = c2_port->c2dev; in c2_rx_alloc() local
232 pci_map_single(c2dev->pcidev, skb->data, maplen, in c2_rx_alloc()
279 struct c2_dev *c2dev = c2_port->c2dev; in c2_rx_clean() local
298 pci_unmap_single(c2dev->pcidev, elem->mapaddr, in c2_rx_clean()
306 static inline int c2_tx_free(struct c2_dev *c2dev, struct c2_element *elem) in c2_tx_free() argument
312 pci_unmap_single(c2dev->pcidev, elem->mapaddr, elem->maplen, in c2_tx_free()
361 c2_tx_free(c2_port->c2dev, elem); in c2_tx_clean()
367 c2_port->c2dev->cur_tx = tx_ring->to_use - tx_ring->start; in c2_tx_clean()
382 struct c2_dev *c2dev = c2_port->c2dev; in c2_tx_interrupt() local
407 c2_tx_free(c2dev, elem); in c2_tx_interrupt()
464 struct c2_dev *c2dev = c2_port->c2dev; in c2_rx_interrupt() local
474 spin_lock_irqsave(&c2dev->lock, flags); in c2_rx_interrupt()
477 rx_ring->to_clean = rx_ring->start + c2dev->cur_rx; in c2_rx_interrupt()
508 pci_unmap_single(c2dev->pcidev, mapaddr, maplen, in c2_rx_interrupt()
538 c2dev->cur_rx = elem - rx_ring->start; in c2_rx_interrupt()
539 C2_SET_CUR_RX(c2dev, c2dev->cur_rx); in c2_rx_interrupt()
541 spin_unlock_irqrestore(&c2dev->lock, flags); in c2_rx_interrupt()
551 struct c2_dev *c2dev = (struct c2_dev *) dev_id; in c2_interrupt() local
554 netisr0 = readl(c2dev->regs + C2_NISR0); in c2_interrupt()
562 c2_rx_interrupt(c2dev->netdev); in c2_interrupt()
563 c2_tx_interrupt(c2dev->netdev); in c2_interrupt()
566 writel(netisr0, c2dev->regs + C2_NISR0); in c2_interrupt()
571 dmaisr = readl(c2dev->regs + C2_DISR); in c2_interrupt()
573 writel(dmaisr, c2dev->regs + C2_DISR); in c2_interrupt()
574 c2_rnic_interrupt(c2dev); in c2_interrupt()
588 struct c2_dev *c2dev = c2_port->c2dev; in c2_up() local
607 c2_port->mem = pci_zalloc_consistent(c2dev->pcidev, c2_port->mem_size, in c2_up()
618 c2dev->mmio_rxp_ring))) { in c2_up()
632 c2dev->mmio_txp_ring))) { in c2_up()
640 c2_port->tx_ring.start + c2dev->cur_tx; in c2_up()
662 writel(0, c2dev->regs + C2_IDIS); in c2_up()
663 netimr0 = readl(c2dev->regs + C2_NIMR0); in c2_up()
665 writel(netimr0, c2dev->regs + C2_NIMR0); in c2_up()
683 pci_free_consistent(c2dev->pcidev, c2_port->mem_size, c2_port->mem, in c2_up()
692 struct c2_dev *c2dev = c2_port->c2dev; in c2_down() local
705 writel(1, c2dev->regs + C2_IDIS); in c2_down()
706 writel(0, c2dev->regs + C2_NIMR0); in c2_down()
724 pci_free_consistent(c2dev->pcidev, c2_port->mem_size, c2_port->mem, in c2_down()
732 struct c2_dev *c2dev = c2_port->c2dev; in c2_reset() local
733 unsigned int cur_rx = c2dev->cur_rx; in c2_reset()
736 C2_SET_CUR_RX(c2dev, cur_rx | C2_PCI_HRX_QUI); in c2_reset()
744 cur_rx = C2_GET_CUR_RX(c2dev); in c2_reset()
751 c2dev->cur_rx = cur_rx; in c2_reset()
753 pr_debug("Current RX: %u\n", c2dev->cur_rx); in c2_reset()
759 struct c2_dev *c2dev = c2_port->c2dev; in c2_xmit_frame() local
780 pci_map_single(c2dev->pcidev, skb->data, maplen, PCI_DMA_TODEVICE); in c2_xmit_frame()
803 mapaddr = skb_frag_dma_map(&c2dev->pcidev->dev, frag, in c2_xmit_frame()
879 static struct net_device *c2_devinit(struct c2_dev *c2dev, in c2_devinit() argument
890 SET_NETDEV_DEV(netdev, &c2dev->pcidev->dev); in c2_devinit()
894 netdev->irq = c2dev->pcidev->irq; in c2_devinit()
898 c2_port->c2dev = c2dev; in c2_devinit()
916 c2dev->netdev = netdev; in c2_devinit()
929 struct c2_dev *c2dev = NULL; in c2_probe() local
1050 c2dev = (struct c2_dev *) ib_alloc_device(sizeof(*c2dev)); in c2_probe()
1051 if (!c2dev) { in c2_probe()
1059 memset(c2dev, 0, sizeof(*c2dev)); in c2_probe()
1060 spin_lock_init(&c2dev->lock); in c2_probe()
1061 c2dev->pcidev = pcidev; in c2_probe()
1062 c2dev->cur_tx = 0; in c2_probe()
1065 c2dev->cur_rx = in c2_probe()
1070 ret = request_irq(pcidev->irq, c2_interrupt, IRQF_SHARED, DRV_NAME, c2dev); in c2_probe()
1079 pci_set_drvdata(pcidev, c2dev); in c2_probe()
1082 if ((netdev = c2_devinit(c2dev, mmio_regs)) == NULL) { in c2_probe()
1106 c2dev->mmio_rxp_ring = ioremap_nocache(reg4_start + C2_RXP_HRXDQ_OFFSET, in c2_probe()
1108 if (!c2dev->mmio_rxp_ring) { in c2_probe()
1115 c2dev->mmio_txp_ring = ioremap_nocache(reg4_start + C2_TXP_HTXDQ_OFFSET, in c2_probe()
1117 if (!c2dev->mmio_txp_ring) { in c2_probe()
1124 C2_SET_CUR_RX(c2dev, c2dev->cur_rx); in c2_probe()
1127 c2dev->regs = ioremap_nocache(reg0_start, reg0_len); in c2_probe()
1128 if (!c2dev->regs) { in c2_probe()
1135 c2dev->pa = reg4_start + C2_PCI_REGS_OFFSET; in c2_probe()
1136 c2dev->kva = ioremap_nocache(reg4_start + C2_PCI_REGS_OFFSET, in c2_probe()
1138 if (!c2dev->kva) { in c2_probe()
1147 ret = c2_rnic_init(c2dev); in c2_probe()
1153 ret = c2_register_device(c2dev); in c2_probe()
1160 iounmap(c2dev->kva); in c2_probe()
1163 iounmap(c2dev->regs); in c2_probe()
1166 iounmap(c2dev->mmio_txp_ring); in c2_probe()
1169 iounmap(c2dev->mmio_rxp_ring); in c2_probe()
1178 free_irq(pcidev->irq, c2dev); in c2_probe()
1181 ib_dealloc_device(&c2dev->ibdev); in c2_probe()
1195 struct c2_dev *c2dev = pci_get_drvdata(pcidev); in c2_remove() local
1196 struct net_device *netdev = c2dev->netdev; in c2_remove()
1199 c2_unregister_device(c2dev); in c2_remove()
1202 c2_rnic_term(c2dev); in c2_remove()
1211 free_irq(pcidev->irq, c2dev); in c2_remove()
1216 iounmap(c2dev->kva); in c2_remove()
1217 iounmap(c2dev->regs); in c2_remove()
1218 iounmap(c2dev->mmio_txp_ring); in c2_remove()
1219 iounmap(c2dev->mmio_rxp_ring); in c2_remove()
1222 ib_dealloc_device(&c2dev->ibdev); in c2_remove()