Lines Matching full:ap
87 #define ACE_IS_TIGON_I(ap) 0 argument
88 #define ACE_TX_RING_ENTRIES(ap) MAX_TX_RING_ENTRIES argument
90 #define ACE_IS_TIGON_I(ap) (ap->version == 1) argument
91 #define ACE_TX_RING_ENTRIES(ap) ap->tx_ring_entries argument
458 struct ace_private *ap; in acenic_probe_one() local
467 ap = netdev_priv(dev); in acenic_probe_one()
468 ap->ndev = dev; in acenic_probe_one()
469 ap->pdev = pdev; in acenic_probe_one()
470 ap->name = pci_name(pdev); in acenic_probe_one()
496 pci_read_config_word(pdev, PCI_COMMAND, &ap->pci_command); in acenic_probe_one()
499 if (!(ap->pci_command & PCI_COMMAND_MEMORY)) { in acenic_probe_one()
502 ap->name); in acenic_probe_one()
503 ap->pci_command = ap->pci_command | PCI_COMMAND_MEMORY; in acenic_probe_one()
504 pci_write_config_word(ap->pdev, PCI_COMMAND, in acenic_probe_one()
505 ap->pci_command); in acenic_probe_one()
509 pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &ap->pci_latency); in acenic_probe_one()
510 if (ap->pci_latency <= 0x40) { in acenic_probe_one()
511 ap->pci_latency = 0x40; in acenic_probe_one()
512 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, ap->pci_latency); in acenic_probe_one()
521 ap->regs = ioremap(dev->base_addr, 0x4000); in acenic_probe_one()
522 if (!ap->regs) { in acenic_probe_one()
525 ap->name, boards_found); in acenic_probe_one()
533 ap->name); in acenic_probe_one()
536 ap->name); in acenic_probe_one()
540 printk(KERN_INFO "%s: 3Com 3C985 ", ap->name); in acenic_probe_one()
543 printk(KERN_INFO "%s: NetGear GA620 ", ap->name); in acenic_probe_one()
548 ap->name); in acenic_probe_one()
553 printk(KERN_INFO "%s: SGI AceNIC ", ap->name); in acenic_probe_one()
556 printk(KERN_INFO "%s: Unknown AceNIC ", ap->name); in acenic_probe_one()
564 if ((readl(&ap->regs->HostCtrl) >> 28) == 4) { in acenic_probe_one()
576 ap->board_idx = BOARD_IDX_OVERFLOW; in acenic_probe_one()
578 ap->board_idx = boards_found; in acenic_probe_one()
580 ap->board_idx = BOARD_IDX_STATIC; in acenic_probe_one()
590 ap->name = dev->name; in acenic_probe_one()
609 struct ace_private *ap = netdev_priv(dev); in acenic_remove_one() local
610 struct ace_regs __iomem *regs = ap->regs; in acenic_remove_one()
616 if (ap->version >= 2) in acenic_remove_one()
637 struct sk_buff *skb = ap->skb->rx_std_skbuff[i].skb; in acenic_remove_one()
643 ringp = &ap->skb->rx_std_skbuff[i]; in acenic_remove_one()
645 dma_unmap_page(&ap->pdev->dev, mapping, in acenic_remove_one()
648 ap->rx_std_ring[i].size = 0; in acenic_remove_one()
649 ap->skb->rx_std_skbuff[i].skb = NULL; in acenic_remove_one()
654 if (ap->version >= 2) { in acenic_remove_one()
656 struct sk_buff *skb = ap->skb->rx_mini_skbuff[i].skb; in acenic_remove_one()
662 ringp = &ap->skb->rx_mini_skbuff[i]; in acenic_remove_one()
664 dma_unmap_page(&ap->pdev->dev, mapping, in acenic_remove_one()
668 ap->rx_mini_ring[i].size = 0; in acenic_remove_one()
669 ap->skb->rx_mini_skbuff[i].skb = NULL; in acenic_remove_one()
676 struct sk_buff *skb = ap->skb->rx_jumbo_skbuff[i].skb; in acenic_remove_one()
681 ringp = &ap->skb->rx_jumbo_skbuff[i]; in acenic_remove_one()
683 dma_unmap_page(&ap->pdev->dev, mapping, in acenic_remove_one()
686 ap->rx_jumbo_ring[i].size = 0; in acenic_remove_one()
687 ap->skb->rx_jumbo_skbuff[i].skb = NULL; in acenic_remove_one()
705 struct ace_private *ap = netdev_priv(dev); in ace_free_descriptors() local
708 if (ap->rx_std_ring != NULL) { in ace_free_descriptors()
714 dma_free_coherent(&ap->pdev->dev, size, ap->rx_std_ring, in ace_free_descriptors()
715 ap->rx_ring_base_dma); in ace_free_descriptors()
716 ap->rx_std_ring = NULL; in ace_free_descriptors()
717 ap->rx_jumbo_ring = NULL; in ace_free_descriptors()
718 ap->rx_mini_ring = NULL; in ace_free_descriptors()
719 ap->rx_return_ring = NULL; in ace_free_descriptors()
721 if (ap->evt_ring != NULL) { in ace_free_descriptors()
723 dma_free_coherent(&ap->pdev->dev, size, ap->evt_ring, in ace_free_descriptors()
724 ap->evt_ring_dma); in ace_free_descriptors()
725 ap->evt_ring = NULL; in ace_free_descriptors()
727 if (ap->tx_ring != NULL && !ACE_IS_TIGON_I(ap)) { in ace_free_descriptors()
729 dma_free_coherent(&ap->pdev->dev, size, ap->tx_ring, in ace_free_descriptors()
730 ap->tx_ring_dma); in ace_free_descriptors()
732 ap->tx_ring = NULL; in ace_free_descriptors()
734 if (ap->evt_prd != NULL) { in ace_free_descriptors()
735 dma_free_coherent(&ap->pdev->dev, sizeof(u32), in ace_free_descriptors()
736 (void *)ap->evt_prd, ap->evt_prd_dma); in ace_free_descriptors()
737 ap->evt_prd = NULL; in ace_free_descriptors()
739 if (ap->rx_ret_prd != NULL) { in ace_free_descriptors()
740 dma_free_coherent(&ap->pdev->dev, sizeof(u32), in ace_free_descriptors()
741 (void *)ap->rx_ret_prd, ap->rx_ret_prd_dma); in ace_free_descriptors()
742 ap->rx_ret_prd = NULL; in ace_free_descriptors()
744 if (ap->tx_csm != NULL) { in ace_free_descriptors()
745 dma_free_coherent(&ap->pdev->dev, sizeof(u32), in ace_free_descriptors()
746 (void *)ap->tx_csm, ap->tx_csm_dma); in ace_free_descriptors()
747 ap->tx_csm = NULL; in ace_free_descriptors()
754 struct ace_private *ap = netdev_priv(dev); in ace_allocate_descriptors() local
763 ap->rx_std_ring = dma_alloc_coherent(&ap->pdev->dev, size, in ace_allocate_descriptors()
764 &ap->rx_ring_base_dma, GFP_KERNEL); in ace_allocate_descriptors()
765 if (ap->rx_std_ring == NULL) in ace_allocate_descriptors()
768 ap->rx_jumbo_ring = ap->rx_std_ring + RX_STD_RING_ENTRIES; in ace_allocate_descriptors()
769 ap->rx_mini_ring = ap->rx_jumbo_ring + RX_JUMBO_RING_ENTRIES; in ace_allocate_descriptors()
770 ap->rx_return_ring = ap->rx_mini_ring + RX_MINI_RING_ENTRIES; in ace_allocate_descriptors()
774 ap->evt_ring = dma_alloc_coherent(&ap->pdev->dev, size, in ace_allocate_descriptors()
775 &ap->evt_ring_dma, GFP_KERNEL); in ace_allocate_descriptors()
777 if (ap->evt_ring == NULL) in ace_allocate_descriptors()
784 if (!ACE_IS_TIGON_I(ap)) { in ace_allocate_descriptors()
787 ap->tx_ring = dma_alloc_coherent(&ap->pdev->dev, size, in ace_allocate_descriptors()
788 &ap->tx_ring_dma, GFP_KERNEL); in ace_allocate_descriptors()
790 if (ap->tx_ring == NULL) in ace_allocate_descriptors()
794 ap->evt_prd = dma_alloc_coherent(&ap->pdev->dev, sizeof(u32), in ace_allocate_descriptors()
795 &ap->evt_prd_dma, GFP_KERNEL); in ace_allocate_descriptors()
796 if (ap->evt_prd == NULL) in ace_allocate_descriptors()
799 ap->rx_ret_prd = dma_alloc_coherent(&ap->pdev->dev, sizeof(u32), in ace_allocate_descriptors()
800 &ap->rx_ret_prd_dma, GFP_KERNEL); in ace_allocate_descriptors()
801 if (ap->rx_ret_prd == NULL) in ace_allocate_descriptors()
804 ap->tx_csm = dma_alloc_coherent(&ap->pdev->dev, sizeof(u32), in ace_allocate_descriptors()
805 &ap->tx_csm_dma, GFP_KERNEL); in ace_allocate_descriptors()
806 if (ap->tx_csm == NULL) in ace_allocate_descriptors()
824 struct ace_private *ap; in ace_init_cleanup() local
826 ap = netdev_priv(dev); in ace_init_cleanup()
830 if (ap->info) in ace_init_cleanup()
831 dma_free_coherent(&ap->pdev->dev, sizeof(struct ace_info), in ace_init_cleanup()
832 ap->info, ap->info_dma); in ace_init_cleanup()
833 kfree(ap->skb); in ace_init_cleanup()
834 kfree(ap->trace_buf); in ace_init_cleanup()
839 iounmap(ap->regs); in ace_init_cleanup()
861 struct ace_private *ap; in ace_init() local
873 ap = netdev_priv(dev); in ace_init()
874 regs = ap->regs; in ace_init()
876 board_idx = ap->board_idx; in ace_init()
917 tig_ver, ap->firmware_major, ap->firmware_minor, in ace_init()
918 ap->firmware_fix); in ace_init()
920 ap->version = 1; in ace_init()
921 ap->tx_ring_entries = TIGON_I_TX_RING_ENTRIES; in ace_init()
926 tig_ver, ap->firmware_major, ap->firmware_minor, in ace_init()
927 ap->firmware_fix); in ace_init()
937 ap->version = 2; in ace_init()
938 ap->tx_ring_entries = MAX_TX_RING_ENTRIES; in ace_init()
1007 pdev = ap->pdev; in ace_init()
1027 ap->pci_latency); in ace_init()
1040 if (ap->version >= 2) { in ace_init()
1047 if (ap->pci_command & PCI_COMMAND_INVALIDATE) { in ace_init()
1048 ap->pci_command &= ~PCI_COMMAND_INVALIDATE; in ace_init()
1050 ap->pci_command); in ace_init()
1054 } else if (ap->pci_command & PCI_COMMAND_INVALIDATE) { in ace_init()
1075 ap->pci_command &= ~PCI_COMMAND_INVALIDATE; in ace_init()
1077 ap->pci_command); in ace_init()
1122 if (!(ap->pci_command & PCI_COMMAND_FAST_BACK)) { in ace_init()
1124 ap->pci_command |= PCI_COMMAND_FAST_BACK; in ace_init()
1125 pci_write_config_word(pdev, PCI_COMMAND, ap->pci_command); in ace_init()
1142 if (!(info = dma_alloc_coherent(&ap->pdev->dev, sizeof(struct ace_info), in ace_init()
1143 &ap->info_dma, GFP_KERNEL))) { in ace_init()
1147 ap->info = info; in ace_init()
1152 if (!(ap->skb = kzalloc(sizeof(struct ace_skb), GFP_KERNEL))) { in ace_init()
1167 spin_lock_init(&ap->debug_lock); in ace_init()
1168 ap->last_tx = ACE_TX_RING_ENTRIES(ap) - 1; in ace_init()
1169 ap->last_std_rx = 0; in ace_init()
1170 ap->last_mini_rx = 0; in ace_init()
1177 ap->fw_running = 0; in ace_init()
1179 tmp_ptr = ap->info_dma; in ace_init()
1183 memset(ap->evt_ring, 0, EVT_RING_ENTRIES * sizeof(struct event)); in ace_init()
1185 set_aceaddr(&info->evt_ctrl.rngptr, ap->evt_ring_dma); in ace_init()
1188 *(ap->evt_prd) = 0; in ace_init()
1190 set_aceaddr(&info->evt_prd_ptr, ap->evt_prd_dma); in ace_init()
1203 tmp_ptr = ap->info_dma; in ace_init()
1207 set_aceaddr(&info->rx_std_ctrl.rngptr, ap->rx_ring_base_dma); in ace_init()
1212 memset(ap->rx_std_ring, 0, in ace_init()
1216 ap->rx_std_ring[i].flags = BD_FLG_TCP_UDP_SUM; in ace_init()
1218 ap->rx_std_skbprd = 0; in ace_init()
1219 atomic_set(&ap->cur_rx_bufs, 0); in ace_init()
1222 (ap->rx_ring_base_dma + in ace_init()
1228 memset(ap->rx_jumbo_ring, 0, in ace_init()
1232 ap->rx_jumbo_ring[i].flags = BD_FLG_TCP_UDP_SUM | BD_FLG_JUMBO; in ace_init()
1234 ap->rx_jumbo_skbprd = 0; in ace_init()
1235 atomic_set(&ap->cur_jumbo_bufs, 0); in ace_init()
1237 memset(ap->rx_mini_ring, 0, in ace_init()
1240 if (ap->version >= 2) { in ace_init()
1242 (ap->rx_ring_base_dma + in ace_init()
1251 ap->rx_mini_ring[i].flags = in ace_init()
1259 ap->rx_mini_skbprd = 0; in ace_init()
1260 atomic_set(&ap->cur_mini_bufs, 0); in ace_init()
1263 (ap->rx_ring_base_dma + in ace_init()
1271 memset(ap->rx_return_ring, 0, in ace_init()
1274 set_aceaddr(&info->rx_ret_prd_ptr, ap->rx_ret_prd_dma); in ace_init()
1275 *(ap->rx_ret_prd) = 0; in ace_init()
1279 if (ACE_IS_TIGON_I(ap)) { in ace_init()
1280 ap->tx_ring = (__force struct tx_desc *) regs->Window; in ace_init()
1283 writel(0, (__force void __iomem *)ap->tx_ring + i * 4); in ace_init()
1287 memset(ap->tx_ring, 0, in ace_init()
1290 set_aceaddr(&info->tx_ctrl.rngptr, ap->tx_ring_dma); in ace_init()
1293 info->tx_ctrl.max_len = ACE_TX_RING_ENTRIES(ap); in ace_init()
1299 if (!ACE_IS_TIGON_I(ap)) in ace_init()
1306 set_aceaddr(&info->tx_csm_ptr, ap->tx_csm_dma); in ace_init()
1337 ap->name, ACE_MAX_MOD_PARMS); in ace_init()
1363 if(ap->version >= 2) in ace_init()
1376 ap->name); in ace_init()
1389 "forcing auto negotiation\n", ap->name); in ace_init()
1397 "negotiation\n", ap->name); in ace_init()
1400 if ((option & 0x400) && (ap->version >= 2)) { in ace_init()
1402 ap->name); in ace_init()
1407 ap->link = tmp; in ace_init()
1409 if (ap->version >= 2) in ace_init()
1412 writel(ap->firmware_start, ®s->Pc); in ace_init()
1422 ap->cur_rx = 0; in ace_init()
1423 ap->tx_prd = *(ap->tx_csm) = ap->tx_ret_csm = 0; in ace_init()
1426 ace_set_txprd(regs, ap, 0); in ace_init()
1447 while (time_before(jiffies, myjif) && !ap->fw_running) in ace_init()
1450 if (!ap->fw_running) { in ace_init()
1451 printk(KERN_ERR "%s: Firmware NOT running!\n", ap->name); in ace_init()
1453 ace_dump_trace(ap); in ace_init()
1466 if (ap->version >= 2) in ace_init()
1480 if (!test_and_set_bit(0, &ap->std_refill_busy)) in ace_init()
1484 ap->name); in ace_init()
1485 if (ap->version >= 2) { in ace_init()
1486 if (!test_and_set_bit(0, &ap->mini_refill_busy)) in ace_init()
1490 "the RX mini ring\n", ap->name); in ace_init()
1502 struct ace_private *ap = netdev_priv(dev); in ace_set_rxtx_parms() local
1503 struct ace_regs __iomem *regs = ap->regs; in ace_set_rxtx_parms()
1504 int board_idx = ap->board_idx; in ace_set_rxtx_parms()
1541 struct ace_private *ap = netdev_priv(dev); in ace_watchdog() local
1542 struct ace_regs __iomem *regs = ap->regs; in ace_watchdog()
1549 if (*ap->tx_csm != ap->tx_ret_csm) { in ace_watchdog()
1565 struct ace_private *ap = from_work(ap, work, ace_bh_work); in ace_bh_work() local
1566 struct net_device *dev = ap->ndev; in ace_bh_work()
1569 cur_size = atomic_read(&ap->cur_rx_bufs); in ace_bh_work()
1571 !test_and_set_bit(0, &ap->std_refill_busy)) { in ace_bh_work()
1578 if (ap->version >= 2) { in ace_bh_work()
1579 cur_size = atomic_read(&ap->cur_mini_bufs); in ace_bh_work()
1581 !test_and_set_bit(0, &ap->mini_refill_busy)) { in ace_bh_work()
1590 cur_size = atomic_read(&ap->cur_jumbo_bufs); in ace_bh_work()
1591 if (ap->jumbo && (cur_size < RX_LOW_JUMBO_THRES) && in ace_bh_work()
1592 !test_and_set_bit(0, &ap->jumbo_refill_busy)) { in ace_bh_work()
1598 ap->bh_work_pending = 0; in ace_bh_work()
1605 static void ace_dump_trace(struct ace_private *ap) in ace_dump_trace() argument
1608 if (!ap->trace_buf) in ace_dump_trace()
1609 if (!(ap->trace_buf = kmalloc(ACE_TRACE_SIZE, GFP_KERNEL))) in ace_dump_trace()
1624 struct ace_private *ap = netdev_priv(dev); in ace_load_std_rx_ring() local
1625 struct ace_regs __iomem *regs = ap->regs; in ace_load_std_rx_ring()
1629 prefetchw(&ap->cur_rx_bufs); in ace_load_std_rx_ring()
1631 idx = ap->rx_std_skbprd; in ace_load_std_rx_ring()
1642 mapping = dma_map_page(&ap->pdev->dev, in ace_load_std_rx_ring()
1646 ap->skb->rx_std_skbuff[idx].skb = skb; in ace_load_std_rx_ring()
1647 dma_unmap_addr_set(&ap->skb->rx_std_skbuff[idx], in ace_load_std_rx_ring()
1650 rd = &ap->rx_std_ring[idx]; in ace_load_std_rx_ring()
1660 atomic_add(i, &ap->cur_rx_bufs); in ace_load_std_rx_ring()
1661 ap->rx_std_skbprd = idx; in ace_load_std_rx_ring()
1663 if (ACE_IS_TIGON_I(ap)) { in ace_load_std_rx_ring()
1667 cmd.idx = ap->rx_std_skbprd; in ace_load_std_rx_ring()
1675 clear_bit(0, &ap->std_refill_busy); in ace_load_std_rx_ring()
1687 struct ace_private *ap = netdev_priv(dev); in ace_load_mini_rx_ring() local
1688 struct ace_regs __iomem *regs = ap->regs; in ace_load_mini_rx_ring()
1691 prefetchw(&ap->cur_mini_bufs); in ace_load_mini_rx_ring()
1693 idx = ap->rx_mini_skbprd; in ace_load_mini_rx_ring()
1703 mapping = dma_map_page(&ap->pdev->dev, in ace_load_mini_rx_ring()
1707 ap->skb->rx_mini_skbuff[idx].skb = skb; in ace_load_mini_rx_ring()
1708 dma_unmap_addr_set(&ap->skb->rx_mini_skbuff[idx], in ace_load_mini_rx_ring()
1711 rd = &ap->rx_mini_ring[idx]; in ace_load_mini_rx_ring()
1721 atomic_add(i, &ap->cur_mini_bufs); in ace_load_mini_rx_ring()
1723 ap->rx_mini_skbprd = idx; in ace_load_mini_rx_ring()
1729 clear_bit(0, &ap->mini_refill_busy); in ace_load_mini_rx_ring()
1744 struct ace_private *ap = netdev_priv(dev); in ace_load_jumbo_rx_ring() local
1745 struct ace_regs __iomem *regs = ap->regs; in ace_load_jumbo_rx_ring()
1748 idx = ap->rx_jumbo_skbprd; in ace_load_jumbo_rx_ring()
1759 mapping = dma_map_page(&ap->pdev->dev, in ace_load_jumbo_rx_ring()
1763 ap->skb->rx_jumbo_skbuff[idx].skb = skb; in ace_load_jumbo_rx_ring()
1764 dma_unmap_addr_set(&ap->skb->rx_jumbo_skbuff[idx], in ace_load_jumbo_rx_ring()
1767 rd = &ap->rx_jumbo_ring[idx]; in ace_load_jumbo_rx_ring()
1777 atomic_add(i, &ap->cur_jumbo_bufs); in ace_load_jumbo_rx_ring()
1778 ap->rx_jumbo_skbprd = idx; in ace_load_jumbo_rx_ring()
1780 if (ACE_IS_TIGON_I(ap)) { in ace_load_jumbo_rx_ring()
1784 cmd.idx = ap->rx_jumbo_skbprd; in ace_load_jumbo_rx_ring()
1792 clear_bit(0, &ap->jumbo_refill_busy); in ace_load_jumbo_rx_ring()
1809 struct ace_private *ap; in ace_handle_event() local
1811 ap = netdev_priv(dev); in ace_handle_event()
1814 switch (ap->evt_ring[evtcsm].evt) { in ace_handle_event()
1817 ap->name); in ace_handle_event()
1818 ap->fw_running = 1; in ace_handle_event()
1825 u16 code = ap->evt_ring[evtcsm].code; in ace_handle_event()
1829 u32 state = readl(&ap->regs->GigLnkState); in ace_handle_event()
1832 ap->name, in ace_handle_event()
1840 ap->name); in ace_handle_event()
1844 "UP\n", ap->name); in ace_handle_event()
1848 "state %02x\n", ap->name, code); in ace_handle_event()
1853 switch(ap->evt_ring[evtcsm].code) { in ace_handle_event()
1856 ap->name); in ace_handle_event()
1860 "error\n", ap->name); in ace_handle_event()
1864 ap->name); in ace_handle_event()
1868 ap->name, ap->evt_ring[evtcsm].code); in ace_handle_event()
1875 if (ap->skb->rx_jumbo_skbuff[i].skb) { in ace_handle_event()
1876 ap->rx_jumbo_ring[i].size = 0; in ace_handle_event()
1877 set_aceaddr(&ap->rx_jumbo_ring[i].addr, 0); in ace_handle_event()
1878 dev_kfree_skb(ap->skb->rx_jumbo_skbuff[i].skb); in ace_handle_event()
1879 ap->skb->rx_jumbo_skbuff[i].skb = NULL; in ace_handle_event()
1883 if (ACE_IS_TIGON_I(ap)) { in ace_handle_event()
1888 ace_issue_cmd(ap->regs, &cmd); in ace_handle_event()
1890 writel(0, &((ap->regs)->RxJumboPrd)); in ace_handle_event()
1894 ap->jumbo = 0; in ace_handle_event()
1895 ap->rx_jumbo_skbprd = 0; in ace_handle_event()
1897 ap->name); in ace_handle_event()
1898 clear_bit(0, &ap->jumbo_refill_busy); in ace_handle_event()
1903 ap->name, ap->evt_ring[evtcsm].evt); in ace_handle_event()
1914 struct ace_private *ap = netdev_priv(dev); in ace_rx_int() local
1920 prefetchw(&ap->cur_rx_bufs); in ace_rx_int()
1921 prefetchw(&ap->cur_mini_bufs); in ace_rx_int()
1936 retdesc = &ap->rx_return_ring[idx]; in ace_rx_int()
1950 rip = &ap->skb->rx_std_skbuff[skbidx]; in ace_rx_int()
1955 rip = &ap->skb->rx_jumbo_skbuff[skbidx]; in ace_rx_int()
1957 atomic_dec(&ap->cur_jumbo_bufs); in ace_rx_int()
1960 rip = &ap->skb->rx_mini_skbuff[skbidx]; in ace_rx_int()
1973 dma_unmap_page(&ap->pdev->dev, dma_unmap_addr(rip, mapping), in ace_rx_int()
2006 atomic_sub(std_count, &ap->cur_rx_bufs); in ace_rx_int()
2007 if (!ACE_IS_TIGON_I(ap)) in ace_rx_int()
2008 atomic_sub(mini_count, &ap->cur_mini_bufs); in ace_rx_int()
2015 if (ACE_IS_TIGON_I(ap)) { in ace_rx_int()
2016 writel(idx, &ap->regs->RxRetCsm); in ace_rx_int()
2018 ap->cur_rx = idx; in ace_rx_int()
2030 struct ace_private *ap = netdev_priv(dev); in ace_tx_int() local
2036 info = ap->skb->tx_skbuff + idx; in ace_tx_int()
2040 dma_unmap_page(&ap->pdev->dev, in ace_tx_int()
2054 idx = (idx + 1) % ACE_TX_RING_ENTRIES(ap); in ace_tx_int()
2061 ap->tx_ret_csm = txcsm; in ace_tx_int()
2096 struct ace_private *ap = netdev_priv(dev); in ace_interrupt() local
2097 struct ace_regs __iomem *regs = ap->regs; in ace_interrupt()
2112 * which happened _after_ rxretprd = *ap->rx_ret_prd; but before in ace_interrupt()
2128 rxretprd = *ap->rx_ret_prd; in ace_interrupt()
2129 rxretcsm = ap->cur_rx; in ace_interrupt()
2134 txcsm = *ap->tx_csm; in ace_interrupt()
2135 idx = ap->tx_ret_csm; in ace_interrupt()
2145 if (!tx_ring_full(ap, txcsm, ap->tx_prd)) in ace_interrupt()
2150 evtprd = *ap->evt_prd; in ace_interrupt()
2165 cur_size = atomic_read(&ap->cur_rx_bufs); in ace_interrupt()
2168 !test_and_set_bit(0, &ap->std_refill_busy)) { in ace_interrupt()
2178 if (!ACE_IS_TIGON_I(ap)) { in ace_interrupt()
2179 cur_size = atomic_read(&ap->cur_mini_bufs); in ace_interrupt()
2183 &ap->mini_refill_busy)) { in ace_interrupt()
2195 if (ap->jumbo) { in ace_interrupt()
2196 cur_size = atomic_read(&ap->cur_jumbo_bufs); in ace_interrupt()
2200 &ap->jumbo_refill_busy)){ in ace_interrupt()
2211 if (run_bh_work && !ap->bh_work_pending) { in ace_interrupt()
2212 ap->bh_work_pending = 1; in ace_interrupt()
2213 queue_work(system_bh_wq, &ap->ace_bh_work); in ace_interrupt()
2222 struct ace_private *ap = netdev_priv(dev); in ace_open() local
2223 struct ace_regs __iomem *regs = ap->regs; in ace_open()
2226 if (!(ap->fw_running)) { in ace_open()
2243 if (ap->jumbo && in ace_open()
2244 !test_and_set_bit(0, &ap->jumbo_refill_busy)) in ace_open()
2253 ap->promisc = 1; in ace_open()
2255 ap->promisc = 0; in ace_open()
2256 ap->mcast_all = 0; in ace_open()
2270 INIT_WORK(&ap->ace_bh_work, ace_bh_work); in ace_open()
2277 struct ace_private *ap = netdev_priv(dev); in ace_close() local
2278 struct ace_regs __iomem *regs = ap->regs; in ace_close()
2291 if (ap->promisc) { in ace_close()
2296 ap->promisc = 0; in ace_close()
2304 cancel_work_sync(&ap->ace_bh_work); in ace_close()
2314 for (i = 0; i < ACE_TX_RING_ENTRIES(ap); i++) { in ace_close()
2318 info = ap->skb->tx_skbuff + i; in ace_close()
2322 if (ACE_IS_TIGON_I(ap)) { in ace_close()
2325 tx = (__force struct tx_desc __iomem *) &ap->tx_ring[i]; in ace_close()
2330 memset(ap->tx_ring + i, 0, in ace_close()
2332 dma_unmap_page(&ap->pdev->dev, in ace_close()
2344 if (ap->jumbo) { in ace_close()
2359 ace_map_tx_skb(struct ace_private *ap, struct sk_buff *skb, in ace_map_tx_skb() argument
2365 mapping = dma_map_page(&ap->pdev->dev, virt_to_page(skb->data), in ace_map_tx_skb()
2369 info = ap->skb->tx_skbuff + idx; in ace_map_tx_skb()
2378 ace_load_tx_bd(struct ace_private *ap, struct tx_desc *desc, u64 addr, in ace_load_tx_bd() argument
2385 if (ACE_IS_TIGON_I(ap)) { in ace_load_tx_bd()
2403 struct ace_private *ap = netdev_priv(dev); in ace_start_xmit() local
2404 struct ace_regs __iomem *regs = ap->regs; in ace_start_xmit()
2410 idx = ap->tx_prd; in ace_start_xmit()
2412 if (tx_ring_full(ap, ap->tx_ret_csm, idx)) in ace_start_xmit()
2419 mapping = ace_map_tx_skb(ap, skb, skb, idx); in ace_start_xmit()
2427 desc = ap->tx_ring + idx; in ace_start_xmit()
2428 idx = (idx + 1) % ACE_TX_RING_ENTRIES(ap); in ace_start_xmit()
2431 if (tx_ring_full(ap, ap->tx_ret_csm, idx)) in ace_start_xmit()
2434 ace_load_tx_bd(ap, desc, mapping, flagsize, vlan_tag); in ace_start_xmit()
2440 mapping = ace_map_tx_skb(ap, skb, NULL, idx); in ace_start_xmit()
2449 ace_load_tx_bd(ap, ap->tx_ring + idx, mapping, flagsize, vlan_tag); in ace_start_xmit()
2451 idx = (idx + 1) % ACE_TX_RING_ENTRIES(ap); in ace_start_xmit()
2457 info = ap->skb->tx_skbuff + idx; in ace_start_xmit()
2458 desc = ap->tx_ring + idx; in ace_start_xmit()
2460 mapping = skb_frag_dma_map(&ap->pdev->dev, frag, 0, in ace_start_xmit()
2467 idx = (idx + 1) % ACE_TX_RING_ENTRIES(ap); in ace_start_xmit()
2471 if (tx_ring_full(ap, ap->tx_ret_csm, idx)) in ace_start_xmit()
2484 ace_load_tx_bd(ap, desc, mapping, flagsize, vlan_tag); in ace_start_xmit()
2489 ap->tx_prd = idx; in ace_start_xmit()
2490 ace_set_txprd(regs, ap, idx); in ace_start_xmit()
2501 if (!tx_ring_full(ap, ap->tx_ret_csm, idx)) in ace_start_xmit()
2538 struct ace_private *ap = netdev_priv(dev); in ace_change_mtu() local
2539 struct ace_regs __iomem *regs = ap->regs; in ace_change_mtu()
2545 if (!(ap->jumbo)) { in ace_change_mtu()
2548 ap->jumbo = 1; in ace_change_mtu()
2549 if (!test_and_set_bit(0, &ap->jumbo_refill_busy)) in ace_change_mtu()
2554 while (test_and_set_bit(0, &ap->jumbo_refill_busy)); in ace_change_mtu()
2557 if (ap->jumbo) { in ace_change_mtu()
2573 struct ace_private *ap = netdev_priv(dev); in ace_get_link_ksettings() local
2574 struct ace_regs __iomem *regs = ap->regs; in ace_get_link_ksettings()
2628 struct ace_private *ap = netdev_priv(dev); in ace_set_link_ksettings() local
2629 struct ace_regs __iomem *regs = ap->regs; in ace_set_link_ksettings()
2647 if (!ACE_IS_TIGON_I(ap)) in ace_set_link_ksettings()
2669 if (link != ap->link) { in ace_set_link_ksettings()
2674 ap->link = link; in ace_set_link_ksettings()
2676 if (!ACE_IS_TIGON_I(ap)) in ace_set_link_ksettings()
2691 struct ace_private *ap = netdev_priv(dev); in ace_get_drvinfo() local
2695 ap->firmware_major, ap->firmware_minor, ap->firmware_fix); in ace_get_drvinfo()
2697 if (ap->pdev) in ace_get_drvinfo()
2698 strscpy(info->bus_info, pci_name(ap->pdev), in ace_get_drvinfo()
2708 struct ace_private *ap = netdev_priv(dev); in ace_set_mac_addr() local
2709 struct ace_regs __iomem *regs = ap->regs; in ace_set_mac_addr()
2736 struct ace_private *ap = netdev_priv(dev); in ace_set_multicast_list() local
2737 struct ace_regs __iomem *regs = ap->regs; in ace_set_multicast_list()
2740 if ((dev->flags & IFF_ALLMULTI) && !(ap->mcast_all)) { in ace_set_multicast_list()
2745 ap->mcast_all = 1; in ace_set_multicast_list()
2746 } else if (ap->mcast_all) { in ace_set_multicast_list()
2751 ap->mcast_all = 0; in ace_set_multicast_list()
2754 if ((dev->flags & IFF_PROMISC) && !(ap->promisc)) { in ace_set_multicast_list()
2759 ap->promisc = 1; in ace_set_multicast_list()
2760 }else if (!(dev->flags & IFF_PROMISC) && (ap->promisc)) { in ace_set_multicast_list()
2765 ap->promisc = 0; in ace_set_multicast_list()
2774 if (!netdev_mc_empty(dev) && !ap->mcast_all) { in ace_set_multicast_list()
2779 }else if (!ap->mcast_all) { in ace_set_multicast_list()
2790 struct ace_private *ap = netdev_priv(dev); in ace_get_stats() local
2792 (struct ace_mac_stats __iomem *)ap->regs->Stats; in ace_get_stats()
2864 struct ace_private *ap = netdev_priv(dev); in ace_load_firmware() local
2865 struct ace_regs __iomem *regs = ap->regs; in ace_load_firmware()
2872 "CPU is running!\n", ap->name); in ace_load_firmware()
2876 if (ACE_IS_TIGON_I(ap)) in ace_load_firmware()
2879 ret = request_firmware(&fw, fw_name, &ap->pdev->dev); in ace_load_firmware()
2882 ap->name, fw_name); in ace_load_firmware()
2893 ap->firmware_major = fw->data[0]; in ace_load_firmware()
2894 ap->firmware_minor = fw->data[1]; in ace_load_firmware()
2895 ap->firmware_fix = fw->data[2]; in ace_load_firmware()
2897 ap->firmware_start = be32_to_cpu(fw_data[1]); in ace_load_firmware()
2898 if (ap->firmware_start < 0x4000 || ap->firmware_start >= 0x80000) { in ace_load_firmware()
2900 ap->name, ap->firmware_start, fw_name); in ace_load_firmware()
2908 ap->name, load_addr, fw_name); in ace_load_firmware()
3071 struct ace_private *ap = netdev_priv(dev); in read_eeprom_byte() local
3072 struct ace_regs __iomem *regs = ap->regs; in read_eeprom_byte()
3089 printk(KERN_ERR "%s: Unable to sync eeprom\n", ap->name); in read_eeprom_byte()
3098 ap->name); in read_eeprom_byte()
3107 ap->name); in read_eeprom_byte()
3117 ap->name); in read_eeprom_byte()
3174 ap->name, offset); in read_eeprom_byte()