Lines Matching refs:bp

240 	struct bmac_data *bp = (struct bmac_data *) dev->priv;  in bmac_enable_and_reset_chip()  local
241 volatile struct dbdma_regs *rd = bp->rx_dma; in bmac_enable_and_reset_chip()
242 volatile struct dbdma_regs *td = bp->tx_dma; in bmac_enable_and_reset_chip()
249 pmac_call_feature(PMAC_FTR_BMAC_ENABLE, bp->node, 0, 1); in bmac_enable_and_reset_chip()
324 struct bmac_data *bp = (struct bmac_data *) dev->priv; in bmac_init_registers() local
341 if (!bp->is_bmac_plus) { in bmac_init_registers()
383 for (i=0; i<4; i++) bp->hash_table_mask[i] = 0; in bmac_init_registers()
384 bmwrite(dev, BHASH3, bp->hash_table_mask[0]); /* bits 15 - 0 */ in bmac_init_registers()
385 bmwrite(dev, BHASH2, bp->hash_table_mask[1]); /* bits 31 - 16 */ in bmac_init_registers()
386 bmwrite(dev, BHASH1, bp->hash_table_mask[2]); /* bits 47 - 32 */ in bmac_init_registers()
387 bmwrite(dev, BHASH0, bp->hash_table_mask[3]); /* bits 63 - 48 */ in bmac_init_registers()
419 struct bmac_data *bp = (struct bmac_data *) dev->priv; in bmac_start_chip() local
420 volatile struct dbdma_regs *rd = bp->rx_dma; in bmac_start_chip()
439 struct bmac_data *bp = (struct bmac_data *) dev->priv; in bmac_init_phy() local
448 if (bp->is_bmac_plus) { in bmac_init_phy()
473 struct bmac_data *bp; in bmac_sleep_notify() local
482 bp = (struct bmac_data *) dev->priv; in bmac_sleep_notify()
493 if (bp->timeout_active) { in bmac_sleep_notify()
494 del_timer(&bp->tx_timeout); in bmac_sleep_notify()
495 bp->timeout_active = 0; in bmac_sleep_notify()
498 disable_irq(bp->tx_dma_intr); in bmac_sleep_notify()
499 disable_irq(bp->rx_dma_intr); in bmac_sleep_notify()
500 bp->sleeping = 1; in bmac_sleep_notify()
502 if (bp->opened) { in bmac_sleep_notify()
503 volatile struct dbdma_regs *rd = bp->rx_dma; in bmac_sleep_notify()
504 volatile struct dbdma_regs *td = bp->tx_dma; in bmac_sleep_notify()
516 if (bp->rx_bufs[i] != NULL) { in bmac_sleep_notify()
517 dev_kfree_skb(bp->rx_bufs[i]); in bmac_sleep_notify()
518 bp->rx_bufs[i] = NULL; in bmac_sleep_notify()
522 if (bp->tx_bufs[i] != NULL) { in bmac_sleep_notify()
523 dev_kfree_skb(bp->tx_bufs[i]); in bmac_sleep_notify()
524 bp->tx_bufs[i] = NULL; in bmac_sleep_notify()
528 pmac_call_feature(PMAC_FTR_BMAC_ENABLE, bp->node, 0, 0); in bmac_sleep_notify()
532 if (bp->opened) in bmac_sleep_notify()
535 enable_irq(bp->tx_dma_intr); in bmac_sleep_notify()
536 enable_irq(bp->rx_dma_intr); in bmac_sleep_notify()
570 struct bmac_data *bp = (struct bmac_data *) dev->priv; in bmac_set_timeout() local
575 if (bp->timeout_active) in bmac_set_timeout()
576 del_timer(&bp->tx_timeout); in bmac_set_timeout()
577 bp->tx_timeout.expires = jiffies + TX_TIMEOUT; in bmac_set_timeout()
578 bp->tx_timeout.function = bmac_tx_timeout; in bmac_set_timeout()
579 bp->tx_timeout.data = (unsigned long) dev; in bmac_set_timeout()
580 add_timer(&bp->tx_timeout); in bmac_set_timeout()
581 bp->timeout_active = 1; in bmac_set_timeout()
621 bmac_init_tx_ring(struct bmac_data *bp) in bmac_init_tx_ring() argument
623 volatile struct dbdma_regs *td = bp->tx_dma; in bmac_init_tx_ring()
625 memset((char *)bp->tx_cmds, 0, (N_TX_RING+1) * sizeof(struct dbdma_cmd)); in bmac_init_tx_ring()
627 bp->tx_empty = 0; in bmac_init_tx_ring()
628 bp->tx_fill = 0; in bmac_init_tx_ring()
629 bp->tx_fullup = 0; in bmac_init_tx_ring()
632 dbdma_setcmd(&bp->tx_cmds[N_TX_RING], in bmac_init_tx_ring()
633 (DBDMA_NOP | BR_ALWAYS), 0, 0, virt_to_bus(bp->tx_cmds)); in bmac_init_tx_ring()
638 out_le32(&td->cmdptr, virt_to_bus(bp->tx_cmds)); in bmac_init_tx_ring()
642 bmac_init_rx_ring(struct bmac_data *bp) in bmac_init_rx_ring() argument
644 volatile struct dbdma_regs *rd = bp->rx_dma; in bmac_init_rx_ring()
649 memset((char *)bp->rx_cmds, 0, in bmac_init_rx_ring()
652 if ((skb = bp->rx_bufs[i]) == NULL) { in bmac_init_rx_ring()
653 bp->rx_bufs[i] = skb = dev_alloc_skb(RX_BUFLEN+2); in bmac_init_rx_ring()
657 bmac_construct_rxbuff(skb, &bp->rx_cmds[i]); in bmac_init_rx_ring()
660 bp->rx_empty = 0; in bmac_init_rx_ring()
661 bp->rx_fill = i; in bmac_init_rx_ring()
664 dbdma_setcmd(&bp->rx_cmds[N_RX_RING], in bmac_init_rx_ring()
665 (DBDMA_NOP | BR_ALWAYS), 0, 0, virt_to_bus(bp->rx_cmds)); in bmac_init_rx_ring()
669 out_le32(&rd->cmdptr, virt_to_bus(bp->rx_cmds)); in bmac_init_rx_ring()
677 struct bmac_data *bp = (struct bmac_data *) dev->priv; in bmac_transmit_packet() local
678 volatile struct dbdma_regs *td = bp->tx_dma; in bmac_transmit_packet()
684 i = bp->tx_fill + 1; in bmac_transmit_packet()
687 if (i == bp->tx_empty) { in bmac_transmit_packet()
689 bp->tx_fullup = 1; in bmac_transmit_packet()
694 dbdma_setcmd(&bp->tx_cmds[i], DBDMA_STOP, 0, 0, 0); in bmac_transmit_packet()
696 bmac_construct_xmt(skb, &bp->tx_cmds[bp->tx_fill]); in bmac_transmit_packet()
698 bp->tx_bufs[bp->tx_fill] = skb; in bmac_transmit_packet()
699 bp->tx_fill = i; in bmac_transmit_packet()
701 bp->stats.tx_bytes += skb->len; in bmac_transmit_packet()
713 struct bmac_data *bp = (struct bmac_data *) dev->priv; in bmac_rxdma_intr() local
714 volatile struct dbdma_regs *rd = bp->rx_dma; in bmac_rxdma_intr()
729 i = bp->rx_empty; in bmac_rxdma_intr()
732 cp = &bp->rx_cmds[i]; in bmac_rxdma_intr()
740 bp->stats.rx_length_errors++; in bmac_rxdma_intr()
741 bp->stats.rx_errors++; in bmac_rxdma_intr()
743 skb = bp->rx_bufs[i]; in bmac_rxdma_intr()
744 bp->rx_bufs[i] = NULL; in bmac_rxdma_intr()
753 ++bp->stats.rx_packets; in bmac_rxdma_intr()
754 bp->stats.rx_bytes += nb; in bmac_rxdma_intr()
756 ++bp->stats.rx_dropped; in bmac_rxdma_intr()
759 if ((skb = bp->rx_bufs[i]) == NULL) { in bmac_rxdma_intr()
760 bp->rx_bufs[i] = skb = dev_alloc_skb(RX_BUFLEN+2); in bmac_rxdma_intr()
762 skb_reserve(bp->rx_bufs[i], 2); in bmac_rxdma_intr()
764 bmac_construct_rxbuff(skb, &bp->rx_cmds[i]); in bmac_rxdma_intr()
772 bp->rx_fill = last; in bmac_rxdma_intr()
773 bp->rx_empty = i; in bmac_rxdma_intr()
790 struct bmac_data *bp = (struct bmac_data *) dev->priv; in bmac_txdma_intr() local
805 cp = &bp->tx_cmds[bp->tx_empty]; in bmac_txdma_intr()
814 if (cp == bus_to_virt(in_le32(&bp->tx_dma->cmdptr))) in bmac_txdma_intr()
818 if (bp->tx_bufs[bp->tx_empty]) { in bmac_txdma_intr()
819 ++bp->stats.tx_packets; in bmac_txdma_intr()
820 dev_kfree_skb_irq(bp->tx_bufs[bp->tx_empty]); in bmac_txdma_intr()
822 bp->tx_bufs[bp->tx_empty] = NULL; in bmac_txdma_intr()
823 bp->tx_fullup = 0; in bmac_txdma_intr()
825 if (++bp->tx_empty >= N_TX_RING) in bmac_txdma_intr()
826 bp->tx_empty = 0; in bmac_txdma_intr()
827 if (bp->tx_empty == bp->tx_fill) in bmac_txdma_intr()
907 bmac_addhash(struct bmac_data *bp, unsigned char *addr) in bmac_addhash() argument
915 if (bp->hash_use_count[crc]++) return; /* This bit is already set */ in bmac_addhash()
918 bp->hash_use_count[crc/16] |= mask; in bmac_addhash()
922 bmac_removehash(struct bmac_data *bp, unsigned char *addr) in bmac_removehash() argument
930 if (bp->hash_use_count[crc] == 0) return; /* That bit wasn't in use! */ in bmac_removehash()
931 if (--bp->hash_use_count[crc]) return; /* That bit is still in use */ in bmac_removehash()
934 bp->hash_table_mask[crc/16] &= mask; in bmac_removehash()
974 bmac_update_hash_table_mask(struct net_device *dev, struct bmac_data *bp) in bmac_update_hash_table_mask() argument
976 bmwrite(dev, BHASH3, bp->hash_table_mask[0]); /* bits 15 - 0 */ in bmac_update_hash_table_mask()
977 bmwrite(dev, BHASH2, bp->hash_table_mask[1]); /* bits 31 - 16 */ in bmac_update_hash_table_mask()
978 bmwrite(dev, BHASH1, bp->hash_table_mask[2]); /* bits 47 - 32 */ in bmac_update_hash_table_mask()
979 bmwrite(dev, BHASH0, bp->hash_table_mask[3]); /* bits 63 - 48 */ in bmac_update_hash_table_mask()
985 struct bmac_data *bp, unsigned char *addr)
988 bmac_addhash(bp, addr);
990 bmac_update_hash_table_mask(dev, bp);
997 struct bmac_data *bp, unsigned char *addr)
999 bmac_removehash(bp, addr);
1001 bmac_update_hash_table_mask(dev, bp);
1015 struct bmac_data *bp = (struct bmac_data *) dev->priv; in bmac_set_multicast() local
1020 if (bp->sleeping) in bmac_set_multicast()
1026 for (i=0; i<4; i++) bp->hash_table_mask[i] = 0xffff; in bmac_set_multicast()
1027 bmac_update_hash_table_mask(dev, bp); in bmac_set_multicast()
1037 for (i=0; i<4; i++) bp->hash_table_mask[i] = 0; in bmac_set_multicast()
1038 for (i=0; i<64; i++) bp->hash_use_count[i] = 0; in bmac_set_multicast()
1044 bmac_addhash(bp, dmi->dmi_addr); in bmac_set_multicast()
1045 bmac_update_hash_table_mask(dev, bp); in bmac_set_multicast()
1106 struct bmac_data *bp = (struct bmac_data *)dev->priv; in bmac_misc_intr() local
1114 if (status & RxErrorMask) bp->stats.rx_errors++; in bmac_misc_intr()
1115 if (status & RxCRCCntExp) bp->stats.rx_crc_errors++; in bmac_misc_intr()
1116 if (status & RxLenCntExp) bp->stats.rx_length_errors++; in bmac_misc_intr()
1117 if (status & RxOverFlow) bp->stats.rx_over_errors++; in bmac_misc_intr()
1118 if (status & RxAlignCntExp) bp->stats.rx_frame_errors++; in bmac_misc_intr()
1121 if (status & TxErrorMask) bp->stats.tx_errors++; in bmac_misc_intr()
1122 if (status & TxUnderrun) bp->stats.tx_fifo_errors++; in bmac_misc_intr()
1123 if (status & TxNormalCollExp) bp->stats.collisions++; in bmac_misc_intr()
1251 struct bmac_data *bp = dev->priv; in bmac_reset_and_enable() local
1258 bmac_init_tx_ring(bp); in bmac_reset_and_enable()
1259 bmac_init_rx_ring(bp); in bmac_reset_and_enable()
1263 bp->sleeping = 0; in bmac_reset_and_enable()
1307 struct bmac_data *bp; in bmac_probe1() local
1341 bp = (struct bmac_data *) dev->priv; in bmac_probe1()
1343 bp->node = bmac; in bmac_probe1()
1366 bp->device_id = *deviceid; in bmac_probe1()
1396 bp->is_bmac_plus = is_bmac_plus; in bmac_probe1()
1397 bp->tx_dma = (volatile struct dbdma_regs *) in bmac_probe1()
1399 if (!bp->tx_dma) in bmac_probe1()
1401 bp->tx_dma_intr = bmac->intrs[1].line; in bmac_probe1()
1402 bp->rx_dma = (volatile struct dbdma_regs *) in bmac_probe1()
1404 if (!bp->rx_dma) in bmac_probe1()
1406 bp->rx_dma_intr = bmac->intrs[2].line; in bmac_probe1()
1408 bp->tx_cmds = (volatile struct dbdma_cmd *) DBDMA_ALIGN(bp + 1); in bmac_probe1()
1409 bp->rx_cmds = bp->tx_cmds + N_TX_RING + 1; in bmac_probe1()
1411 bp->queue = (struct sk_buff_head *)(bp->rx_cmds + N_RX_RING + 1); in bmac_probe1()
1412 skb_queue_head_init(bp->queue); in bmac_probe1()
1414 init_timer(&bp->tx_timeout); in bmac_probe1()
1437 pmac_call_feature(PMAC_FTR_BMAC_ENABLE, bp->node, 0, 0); in bmac_probe1()
1439 bp->next_bmac = bmac_devs; in bmac_probe1()
1448 iounmap((void *)bp->rx_dma); in bmac_probe1()
1450 iounmap((void *)bp->tx_dma); in bmac_probe1()
1454 if (bp->node) { in bmac_probe1()
1455 release_OF_resource(bp->node, 0); in bmac_probe1()
1456 release_OF_resource(bp->node, 1); in bmac_probe1()
1457 release_OF_resource(bp->node, 2); in bmac_probe1()
1458 pmac_call_feature(PMAC_FTR_BMAC_ENABLE, bp->node, 0, 0); in bmac_probe1()
1466 struct bmac_data *bp = (struct bmac_data *) dev->priv; in bmac_ethtool_ioctl() local
1477 snprintf(info.fw_version, 31, "chip id %x", bp->device_id); in bmac_ethtool_ioctl()
1516 struct bmac_data *bp = (struct bmac_data *) dev->priv; in bmac_open() local
1519 bp->opened = 1; in bmac_open()
1528 struct bmac_data *bp = (struct bmac_data *) dev->priv; in bmac_close() local
1529 volatile struct dbdma_regs *rd = bp->rx_dma; in bmac_close()
1530 volatile struct dbdma_regs *td = bp->tx_dma; in bmac_close()
1534 bp->sleeping = 1; in bmac_close()
1553 if (bp->rx_bufs[i] != NULL) { in bmac_close()
1554 dev_kfree_skb(bp->rx_bufs[i]); in bmac_close()
1555 bp->rx_bufs[i] = NULL; in bmac_close()
1560 if (bp->tx_bufs[i] != NULL) { in bmac_close()
1561 dev_kfree_skb(bp->tx_bufs[i]); in bmac_close()
1562 bp->tx_bufs[i] = NULL; in bmac_close()
1567 bp->opened = 0; in bmac_close()
1569 pmac_call_feature(PMAC_FTR_BMAC_ENABLE, bp->node, 0, 0); in bmac_close()
1577 struct bmac_data *bp = dev->priv; in bmac_start() local
1582 if (bp->sleeping) in bmac_start()
1587 i = bp->tx_fill + 1; in bmac_start()
1590 if (i == bp->tx_empty) in bmac_start()
1592 skb = skb_dequeue(bp->queue); in bmac_start()
1603 struct bmac_data *bp = dev->priv; in bmac_output() local
1604 skb_queue_tail(bp->queue, skb); in bmac_output()
1612 struct bmac_data *bp = (struct bmac_data *) dev->priv; in bmac_tx_timeout() local
1613 volatile struct dbdma_regs *td = bp->tx_dma; in bmac_tx_timeout()
1614 volatile struct dbdma_regs *rd = bp->rx_dma; in bmac_tx_timeout()
1622 bp->timeout_active = 0; in bmac_tx_timeout()
1627 cp = &bp->tx_cmds[bp->tx_empty]; in bmac_tx_timeout()
1650 bp->tx_empty, bp->tx_fill, bp->tx_fullup)); in bmac_tx_timeout()
1651 i = bp->tx_empty; in bmac_tx_timeout()
1652 ++bp->stats.tx_errors; in bmac_tx_timeout()
1653 if (i != bp->tx_fill) { in bmac_tx_timeout()
1654 dev_kfree_skb(bp->tx_bufs[i]); in bmac_tx_timeout()
1655 bp->tx_bufs[i] = NULL; in bmac_tx_timeout()
1657 bp->tx_empty = i; in bmac_tx_timeout()
1659 bp->tx_fullup = 0; in bmac_tx_timeout()
1661 if (i != bp->tx_fill) { in bmac_tx_timeout()
1662 cp = &bp->tx_cmds[i]; in bmac_tx_timeout()
1741 struct bmac_data *bp; in bmac_cleanup() local
1758 bp = (struct bmac_data *) dev->priv; in bmac_cleanup()
1759 bmac_devs = bp->next_bmac; in bmac_cleanup()
1763 release_OF_resource(bp->node, 0); in bmac_cleanup()
1764 release_OF_resource(bp->node, 1); in bmac_cleanup()
1765 release_OF_resource(bp->node, 2); in bmac_cleanup()
1767 free_irq(bp->tx_dma_intr, dev); in bmac_cleanup()
1768 free_irq(bp->rx_dma_intr, dev); in bmac_cleanup()