Lines Matching refs:d

155 #define SBDMA_NEXTBUF(d,f) ((((d)->f+1) == (d)->sbdma_dscrtable_end) ? \  argument
156 (d)->sbdma_dscrtable : (d)->f+1)
283 static void sbdma_initctx(struct sbmacdma *d, struct sbmac_softc *s, int chan,
285 static void sbdma_channel_start(struct sbmacdma *d, int rxtx);
286 static int sbdma_add_rcvbuffer(struct sbmac_softc *sc, struct sbmacdma *d,
288 static int sbdma_add_txbuffer(struct sbmacdma *d, struct sk_buff *m);
289 static void sbdma_emptyring(struct sbmacdma *d);
290 static void sbdma_fillring(struct sbmac_softc *sc, struct sbmacdma *d);
291 static int sbdma_rx_process(struct sbmac_softc *sc, struct sbmacdma *d,
293 static void sbdma_tx_process(struct sbmac_softc *sc, struct sbmacdma *d,
571 static void sbdma_initctx(struct sbmacdma *d, struct sbmac_softc *s, int chan, in sbdma_initctx() argument
582 d->sbdma_eth = s; in sbdma_initctx()
583 d->sbdma_channel = chan; in sbdma_initctx()
584 d->sbdma_txdir = txrx; in sbdma_initctx()
617 d->sbdma_config0 = in sbdma_initctx()
619 d->sbdma_config1 = in sbdma_initctx()
621 d->sbdma_dscrbase = in sbdma_initctx()
623 d->sbdma_dscrcnt = in sbdma_initctx()
625 d->sbdma_curdscr = in sbdma_initctx()
627 if (d->sbdma_txdir) in sbdma_initctx()
628 d->sbdma_oodpktlost = NULL; in sbdma_initctx()
630 d->sbdma_oodpktlost = in sbdma_initctx()
637 d->sbdma_maxdescr = maxdescr; in sbdma_initctx()
639 d->sbdma_dscrtable_unaligned = kcalloc(d->sbdma_maxdescr + 1, in sbdma_initctx()
640 sizeof(*d->sbdma_dscrtable), in sbdma_initctx()
647 d->sbdma_dscrtable = (struct sbdmadscr *) in sbdma_initctx()
648 ALIGN((unsigned long)d->sbdma_dscrtable_unaligned, in sbdma_initctx()
649 sizeof(*d->sbdma_dscrtable)); in sbdma_initctx()
651 d->sbdma_dscrtable_end = d->sbdma_dscrtable + d->sbdma_maxdescr; in sbdma_initctx()
653 d->sbdma_dscrtable_phys = virt_to_phys(d->sbdma_dscrtable); in sbdma_initctx()
659 d->sbdma_ctxtable = kcalloc(d->sbdma_maxdescr, in sbdma_initctx()
660 sizeof(*d->sbdma_ctxtable), GFP_KERNEL); in sbdma_initctx()
669 d->sbdma_int_pktcnt = int_pktcnt; in sbdma_initctx()
671 d->sbdma_int_pktcnt = 1; in sbdma_initctx()
676 d->sbdma_int_timeout = int_timeout; in sbdma_initctx()
678 d->sbdma_int_timeout = 0; in sbdma_initctx()
697 static void sbdma_channel_start(struct sbmacdma *d, int rxtx) in sbdma_channel_start() argument
704 __raw_writeq(V_DMA_INT_TIMEOUT(d->sbdma_int_timeout) | in sbdma_channel_start()
705 0, d->sbdma_config1); in sbdma_channel_start()
707 V_DMA_RINGSZ(d->sbdma_maxdescr) | in sbdma_channel_start()
708 V_DMA_INT_PKTCNT(d->sbdma_int_pktcnt) | in sbdma_channel_start()
709 0, d->sbdma_config0); in sbdma_channel_start()
711 __raw_writeq(0, d->sbdma_config1); in sbdma_channel_start()
712 __raw_writeq(V_DMA_RINGSZ(d->sbdma_maxdescr) | in sbdma_channel_start()
713 0, d->sbdma_config0); in sbdma_channel_start()
716 __raw_writeq(d->sbdma_dscrtable_phys, d->sbdma_dscrbase); in sbdma_channel_start()
722 d->sbdma_addptr = d->sbdma_dscrtable; in sbdma_channel_start()
723 d->sbdma_remptr = d->sbdma_dscrtable; in sbdma_channel_start()
738 static void sbdma_channel_stop(struct sbmacdma *d) in sbdma_channel_stop() argument
744 __raw_writeq(0, d->sbdma_config1); in sbdma_channel_stop()
746 __raw_writeq(0, d->sbdma_dscrbase); in sbdma_channel_stop()
748 __raw_writeq(0, d->sbdma_config0); in sbdma_channel_stop()
754 d->sbdma_addptr = NULL; in sbdma_channel_stop()
755 d->sbdma_remptr = NULL; in sbdma_channel_stop()
785 static int sbdma_add_rcvbuffer(struct sbmac_softc *sc, struct sbmacdma *d, in sbdma_add_rcvbuffer() argument
796 dsc = d->sbdma_addptr; in sbdma_add_rcvbuffer()
797 nextdsc = SBDMA_NEXTBUF(d,sbdma_addptr); in sbdma_add_rcvbuffer()
805 if (nextdsc == d->sbdma_remptr) { in sbdma_add_rcvbuffer()
868 d->sbdma_ctxtable[dsc-d->sbdma_dscrtable] = sb_new; in sbdma_add_rcvbuffer()
874 d->sbdma_addptr = nextdsc; in sbdma_add_rcvbuffer()
880 __raw_writeq(1, d->sbdma_dscrcnt); in sbdma_add_rcvbuffer()
901 static int sbdma_add_txbuffer(struct sbmacdma *d, struct sk_buff *sb) in sbdma_add_txbuffer() argument
911 dsc = d->sbdma_addptr; in sbdma_add_txbuffer()
912 nextdsc = SBDMA_NEXTBUF(d,sbdma_addptr); in sbdma_add_txbuffer()
920 if (nextdsc == d->sbdma_remptr) { in sbdma_add_txbuffer()
958 d->sbdma_ctxtable[dsc-d->sbdma_dscrtable] = sb; in sbdma_add_txbuffer()
964 d->sbdma_addptr = nextdsc; in sbdma_add_txbuffer()
970 __raw_writeq(1, d->sbdma_dscrcnt); in sbdma_add_txbuffer()
990 static void sbdma_emptyring(struct sbmacdma *d) in sbdma_emptyring() argument
995 for (idx = 0; idx < d->sbdma_maxdescr; idx++) { in sbdma_emptyring()
996 sb = d->sbdma_ctxtable[idx]; in sbdma_emptyring()
999 d->sbdma_ctxtable[idx] = NULL; in sbdma_emptyring()
1019 static void sbdma_fillring(struct sbmac_softc *sc, struct sbmacdma *d) in sbdma_fillring() argument
1024 if (sbdma_add_rcvbuffer(sc, d, NULL) != 0) in sbdma_fillring()
1066 static int sbdma_rx_process(struct sbmac_softc *sc, struct sbmacdma *d, in sbdma_rx_process() argument
1078 prefetch(d); in sbdma_rx_process()
1098 dsc = d->sbdma_remptr; in sbdma_rx_process()
1099 curidx = dsc - d->sbdma_dscrtable; in sbdma_rx_process()
1102 prefetch(&d->sbdma_ctxtable[curidx]); in sbdma_rx_process()
1104 hwidx = ((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) - in sbdma_rx_process()
1105 d->sbdma_dscrtable_phys) / in sbdma_rx_process()
1106 sizeof(*d->sbdma_dscrtable); in sbdma_rx_process()
1121 sb = d->sbdma_ctxtable[curidx]; in sbdma_rx_process()
1122 d->sbdma_ctxtable[curidx] = NULL; in sbdma_rx_process()
1140 if (unlikely(sbdma_add_rcvbuffer(sc, d, NULL) == in sbdma_rx_process()
1144 sbdma_add_rcvbuffer(sc, d, sb); in sbdma_rx_process()
1147 d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr); in sbdma_rx_process()
1160 sb->protocol = eth_type_trans(sb,d->sbdma_eth->sbm_dev); in sbdma_rx_process()
1180 d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr); in sbdma_rx_process()
1194 sbdma_add_rcvbuffer(sc, d, sb); in sbdma_rx_process()
1202 d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr); in sbdma_rx_process()
1231 static void sbdma_tx_process(struct sbmac_softc *sc, struct sbmacdma *d, in sbdma_tx_process() argument
1244 if (d->sbdma_remptr == d->sbdma_addptr) in sbdma_tx_process()
1247 hwidx = ((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) - in sbdma_tx_process()
1248 d->sbdma_dscrtable_phys) / sizeof(*d->sbdma_dscrtable); in sbdma_tx_process()
1262 curidx = d->sbdma_remptr - d->sbdma_dscrtable; in sbdma_tx_process()
1277 dsc = &(d->sbdma_dscrtable[curidx]); in sbdma_tx_process()
1278 sb = d->sbdma_ctxtable[curidx]; in sbdma_tx_process()
1279 d->sbdma_ctxtable[curidx] = NULL; in sbdma_tx_process()
1298 d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr); in sbdma_tx_process()
1311 netif_wake_queue(d->sbdma_eth->sbm_dev); in sbdma_tx_process()
1369 static void sbdma_uninitctx(struct sbmacdma *d) in sbdma_uninitctx() argument
1371 if (d->sbdma_dscrtable_unaligned) { in sbdma_uninitctx()
1372 kfree(d->sbdma_dscrtable_unaligned); in sbdma_uninitctx()
1373 d->sbdma_dscrtable_unaligned = d->sbdma_dscrtable = NULL; in sbdma_uninitctx()
1376 if (d->sbdma_ctxtable) { in sbdma_uninitctx()
1377 kfree(d->sbdma_ctxtable); in sbdma_uninitctx()
1378 d->sbdma_ctxtable = NULL; in sbdma_uninitctx()