Lines Matching refs:sp

52 #define TX_BUFFS_AVAIL(sp) ((sp->tx_old <= sp->tx_new) ? \  argument
53 sp->tx_old + (SEEQ_TX_BUFFERS - 1) - sp->tx_new : \
54 sp->tx_old - sp->tx_new - 1)
56 #define VIRT_TO_DMA(sp, v) ((sp)->srings_dma + \ argument
58 (unsigned long)((sp)->rx_desc)))
141 static inline void seeq_go(struct sgiseeq_private *sp, in seeq_go() argument
145 sregs->rstat = sp->mode | RSTAT_GO_BITS; in seeq_go()
151 struct sgiseeq_private *sp = netdev_priv(dev); in __sgiseeq_set_mac_address() local
152 struct sgiseeq_regs *sregs = sp->sregs; in __sgiseeq_set_mac_address()
162 struct sgiseeq_private *sp = netdev_priv(dev); in sgiseeq_set_mac_address() local
167 spin_lock_irq(&sp->tx_lock); in sgiseeq_set_mac_address()
169 spin_unlock_irq(&sp->tx_lock); in sgiseeq_set_mac_address()
180 struct sgiseeq_private *sp = netdev_priv(dev); in seeq_init_ring() local
184 sp->rx_new = sp->tx_new = 0; in seeq_init_ring()
185 sp->rx_old = sp->tx_old = 0; in seeq_init_ring()
191 sp->tx_desc[i].tdma.cntinfo = TCNTINFO_INIT; in seeq_init_ring()
192 dma_sync_desc_dev(dev, &sp->tx_desc[i]); in seeq_init_ring()
197 if (!sp->rx_desc[i].skb) { in seeq_init_ring()
207 sp->rx_desc[i].skb = skb; in seeq_init_ring()
208 sp->rx_desc[i].rdma.pbuf = dma_addr; in seeq_init_ring()
210 sp->rx_desc[i].rdma.cntinfo = RCNTINFO_INIT; in seeq_init_ring()
211 dma_sync_desc_dev(dev, &sp->rx_desc[i]); in seeq_init_ring()
213 sp->rx_desc[i - 1].rdma.cntinfo |= HPCDMA_EOR; in seeq_init_ring()
214 dma_sync_desc_dev(dev, &sp->rx_desc[i - 1]); in seeq_init_ring()
220 struct sgiseeq_private *sp = netdev_priv(dev); in seeq_purge_ring() local
225 if (sp->tx_desc[i].skb) { in seeq_purge_ring()
226 dev_kfree_skb(sp->tx_desc[i].skb); in seeq_purge_ring()
227 sp->tx_desc[i].skb = NULL; in seeq_purge_ring()
233 if (sp->rx_desc[i].skb) { in seeq_purge_ring()
234 dev_kfree_skb(sp->rx_desc[i].skb); in seeq_purge_ring()
235 sp->rx_desc[i].skb = NULL; in seeq_purge_ring()
286 static int init_seeq(struct net_device *dev, struct sgiseeq_private *sp, in init_seeq() argument
289 struct hpc3_ethregs *hregs = sp->hregs; in init_seeq()
298 if (sp->is_edlc) { in init_seeq()
300 sregs->rw.wregs.control = sp->control; in init_seeq()
306 hregs->rx_ndptr = VIRT_TO_DMA(sp, sp->rx_desc); in init_seeq()
307 hregs->tx_ndptr = VIRT_TO_DMA(sp, sp->tx_desc); in init_seeq()
309 seeq_go(sp, hregs, sregs); in init_seeq()
326 static inline void rx_maybe_restart(struct sgiseeq_private *sp, in rx_maybe_restart() argument
331 hregs->rx_ndptr = VIRT_TO_DMA(sp, sp->rx_desc + sp->rx_new); in rx_maybe_restart()
332 seeq_go(sp, hregs, sregs); in rx_maybe_restart()
336 static inline void sgiseeq_rx(struct net_device *dev, struct sgiseeq_private *sp, in sgiseeq_rx() argument
345 unsigned int orig_end = PREV_RX(sp->rx_new); in sgiseeq_rx()
348 rd = &sp->rx_desc[sp->rx_new]; in sgiseeq_rx()
400 sp->rx_new = NEXT_RX(sp->rx_new); in sgiseeq_rx()
402 rd = &sp->rx_desc[sp->rx_new]; in sgiseeq_rx()
405 dma_sync_desc_cpu(dev, &sp->rx_desc[orig_end]); in sgiseeq_rx()
406 sp->rx_desc[orig_end].rdma.cntinfo &= ~(HPCDMA_EOR); in sgiseeq_rx()
407 dma_sync_desc_dev(dev, &sp->rx_desc[orig_end]); in sgiseeq_rx()
408 dma_sync_desc_cpu(dev, &sp->rx_desc[PREV_RX(sp->rx_new)]); in sgiseeq_rx()
409 sp->rx_desc[PREV_RX(sp->rx_new)].rdma.cntinfo |= HPCDMA_EOR; in sgiseeq_rx()
410 dma_sync_desc_dev(dev, &sp->rx_desc[PREV_RX(sp->rx_new)]); in sgiseeq_rx()
411 rx_maybe_restart(sp, hregs, sregs); in sgiseeq_rx()
414 static inline void tx_maybe_reset_collisions(struct sgiseeq_private *sp, in tx_maybe_reset_collisions() argument
417 if (sp->is_edlc) { in tx_maybe_reset_collisions()
418 sregs->rw.wregs.control = sp->control & ~(SEEQ_CTRL_XCNT); in tx_maybe_reset_collisions()
419 sregs->rw.wregs.control = sp->control; in tx_maybe_reset_collisions()
424 struct sgiseeq_private *sp, in kick_tx() argument
428 int i = sp->tx_old; in kick_tx()
436 td = &sp->tx_desc[i]; in kick_tx()
441 td = &sp->tx_desc[i]; in kick_tx()
445 hregs->tx_ndptr = VIRT_TO_DMA(sp, td); in kick_tx()
450 static inline void sgiseeq_tx(struct net_device *dev, struct sgiseeq_private *sp, in sgiseeq_tx() argument
458 tx_maybe_reset_collisions(sp, sregs); in sgiseeq_tx()
471 for (j = sp->tx_old; j != sp->tx_new; j = NEXT_TX(j)) { in sgiseeq_tx()
472 td = &sp->tx_desc[j]; in sgiseeq_tx()
479 hregs->tx_ndptr = VIRT_TO_DMA(sp, td); in sgiseeq_tx()
485 sp->tx_old = NEXT_TX(sp->tx_old); in sgiseeq_tx()
499 struct sgiseeq_private *sp = netdev_priv(dev); in sgiseeq_interrupt() local
500 struct hpc3_ethregs *hregs = sp->hregs; in sgiseeq_interrupt()
501 struct sgiseeq_regs *sregs = sp->sregs; in sgiseeq_interrupt()
503 spin_lock(&sp->tx_lock); in sgiseeq_interrupt()
509 sgiseeq_rx(dev, sp, hregs, sregs); in sgiseeq_interrupt()
512 if (sp->tx_old != sp->tx_new) in sgiseeq_interrupt()
513 sgiseeq_tx(dev, sp, hregs, sregs); in sgiseeq_interrupt()
515 if ((TX_BUFFS_AVAIL(sp) > 0) && netif_queue_stopped(dev)) { in sgiseeq_interrupt()
518 spin_unlock(&sp->tx_lock); in sgiseeq_interrupt()
525 struct sgiseeq_private *sp = netdev_priv(dev); in sgiseeq_open() local
526 struct sgiseeq_regs *sregs = sp->sregs; in sgiseeq_open()
535 err = init_seeq(dev, sp, sregs); in sgiseeq_open()
551 struct sgiseeq_private *sp = netdev_priv(dev); in sgiseeq_close() local
552 struct sgiseeq_regs *sregs = sp->sregs; in sgiseeq_close()
558 reset_hpc3_and_seeq(sp->hregs, sregs); in sgiseeq_close()
567 struct sgiseeq_private *sp = netdev_priv(dev); in sgiseeq_reset() local
568 struct sgiseeq_regs *sregs = sp->sregs; in sgiseeq_reset()
571 err = init_seeq(dev, sp, sregs); in sgiseeq_reset()
583 struct sgiseeq_private *sp = netdev_priv(dev); in sgiseeq_start_xmit() local
584 struct hpc3_ethregs *hregs = sp->hregs; in sgiseeq_start_xmit()
589 spin_lock_irqsave(&sp->tx_lock, flags); in sgiseeq_start_xmit()
595 spin_unlock_irqrestore(&sp->tx_lock, flags); in sgiseeq_start_xmit()
602 entry = sp->tx_new; in sgiseeq_start_xmit()
603 td = &sp->tx_desc[entry]; in sgiseeq_start_xmit()
625 if (sp->tx_old != sp->tx_new) { in sgiseeq_start_xmit()
628 backend = &sp->tx_desc[PREV_TX(sp->tx_new)]; in sgiseeq_start_xmit()
633 sp->tx_new = NEXT_TX(sp->tx_new); /* Advance. */ in sgiseeq_start_xmit()
637 kick_tx(dev, sp, hregs); in sgiseeq_start_xmit()
639 if (!TX_BUFFS_AVAIL(sp)) in sgiseeq_start_xmit()
641 spin_unlock_irqrestore(&sp->tx_lock, flags); in sgiseeq_start_xmit()
657 struct sgiseeq_private *sp = netdev_priv(dev); in sgiseeq_set_multicast() local
658 unsigned char oldmode = sp->mode; in sgiseeq_set_multicast()
661 sp->mode = SEEQ_RCMD_RANY; in sgiseeq_set_multicast()
663 sp->mode = SEEQ_RCMD_RBMCAST; in sgiseeq_set_multicast()
665 sp->mode = SEEQ_RCMD_RBCAST; in sgiseeq_set_multicast()
671 if (oldmode != sp->mode) in sgiseeq_set_multicast()
679 struct sgiseeq_private *sp = netdev_priv(dev); in setup_tx_ring() local
683 buf[i].tdma.pnext = VIRT_TO_DMA(sp, buf + i + 1); in setup_tx_ring()
688 buf[i].tdma.pnext = VIRT_TO_DMA(sp, buf); in setup_tx_ring()
696 struct sgiseeq_private *sp = netdev_priv(dev); in setup_rx_ring() local
700 buf[i].rdma.pnext = VIRT_TO_DMA(sp, buf + i + 1); in setup_rx_ring()
706 buf[i].rdma.pnext = VIRT_TO_DMA(sp, buf); in setup_rx_ring()
727 struct sgiseeq_private *sp; in sgiseeq_probe() local
738 sp = netdev_priv(dev); in sgiseeq_probe()
741 sr = dma_alloc_noncoherent(&pdev->dev, sizeof(*sp->srings), in sgiseeq_probe()
742 &sp->srings_dma, GFP_KERNEL); in sgiseeq_probe()
748 sp->srings = sr; in sgiseeq_probe()
749 sp->rx_desc = sp->srings->rxvector; in sgiseeq_probe()
750 sp->tx_desc = sp->srings->txvector; in sgiseeq_probe()
751 spin_lock_init(&sp->tx_lock); in sgiseeq_probe()
754 setup_rx_ring(dev, sp->rx_desc, SEEQ_RX_BUFFERS); in sgiseeq_probe()
755 setup_tx_ring(dev, sp->tx_desc, SEEQ_TX_BUFFERS); in sgiseeq_probe()
760 gpriv = sp; in sgiseeq_probe()
763 sp->sregs = (struct sgiseeq_regs *) &hpcregs->eth_ext[0]; in sgiseeq_probe()
764 sp->hregs = &hpcregs->ethregs; in sgiseeq_probe()
765 sp->name = sgiseeqstr; in sgiseeq_probe()
766 sp->mode = SEEQ_RCMD_RBCAST; in sgiseeq_probe()
769 sp->hregs->pconfig = 0x161; in sgiseeq_probe()
770 sp->hregs->dconfig = HPC3_EDCFG_FIRQ | HPC3_EDCFG_FEOP | in sgiseeq_probe()
774 sp->hregs->pconfig = 0x161; in sgiseeq_probe()
775 sp->hregs->dconfig = HPC3_EDCFG_FIRQ | HPC3_EDCFG_FEOP | in sgiseeq_probe()
779 hpc3_eth_reset(sp->hregs); in sgiseeq_probe()
781 sp->is_edlc = !(sp->sregs->rw.rregs.collision_tx[0] & 0xff); in sgiseeq_probe()
782 if (sp->is_edlc) in sgiseeq_probe()
783 sp->control = SEEQ_CTRL_XCNT | SEEQ_CTRL_ACCNT | in sgiseeq_probe()
803 free_page((unsigned long) sp->srings); in sgiseeq_probe()
814 struct sgiseeq_private *sp = netdev_priv(dev); in sgiseeq_remove() local
817 dma_free_noncoherent(&pdev->dev, sizeof(*sp->srings), sp->srings, in sgiseeq_remove()
818 sp->srings_dma); in sgiseeq_remove()